Class Model

Description
  • abstract: This class manages our mysql sql query generation

Located in /model/Model.php (line 15)


	
			
Method Summary
void addCalc (string $field, [string $type = 'total'])
array addFilters ([array $filters = false], [array $allowed_filter_keys = false], [array $disabled_filters = false])
void addSelectField (string $field)
void clearQuery ()
string createHtmlTable ([array $row_names = false], [array $ignore_fields = false])
boolean delete ([string $table = false], [integer $id = false], [string $field_name = false])
boolean drop (string $table)
integer duplicate (string $table, mixed $id, [string $field_name = 'id'], [ $replace_field = false], string $select_table)
integer executeInsert ([string $table = false], [array $fields = false])
boolean executeUpdate ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = false])
void generateInsert ([string $table = false], [array $fields = false])
void generateUpdate ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = 'id'])
string getBuildQuery ()
string getLastQuery ()
mixed getPrimaryKey ()
array getSchema ()
void groupBy (string $field)
void inPastXDays (string $field, [string $day_count = 7], [string $match = 'AND'])
integer insert ([string $table = false], [array $fields = false])
integer insertForm ([string $table = false])
void leftJoin (string $table, string $key, string $foreign_key, [array $fields = false], [ $from_table = false])
void limit ([integer $start = 0], [integer $limit = 25])
void match (string $search, [array $fields = false], [string $match = 'AND'])
mixed openTable ([string $table = false])
void orderBy ([string $field = false], [string $dir = false], [string $sort_location = false])
void orderByPreference ([string $sort_location = false], [string $field = 'id'], [string $dir = 'ASC'])
void paginate (integer $current_page, [integer $per_page = 25])
object query ([string $query = false])
array quickSelectSingle ([string $table = false], [integer $id = false], [string $field = false])
string quickSelectSingleToXml ([string $table = false], [integer $id = false])
mixed quickValue ([string $sql = false], [string $return_field = 'id'])
array results ([string $key_field = false], [string $sql = false])
void select ([string $table = false], [array $fields = false], [boolean $distinct = false])
void setSecurityRule (string $field, string $key, string $value)
array showStatus (string $table)
boolean update ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = false])
integer updateForm ([string $table = false])
void where (string $field, mixed $value, [string $match = 'AND'])
void whereAfterToday (string $field, [boolean $include_today = false], [string $match = 'AND'])
void whereBeforeToday (string $field, [boolean $include_today = true], [string $match = 'AND'])
void whereBetween (string $field, mixed $start, string $end, [string $match = 'AND'])
void whereGreaterThan (string $field, mixed $value, [string $match = 'AND'])
void whereGreaterThanEqualTo (string $field, mixed $value, [string $match = 'AND'])
void whereLessThan (string $field, mixed $value, [string $match = 'AND'])
void whereLessThanEqualTo (string $field, mixed $value, [string $match = 'AND'])
void whereLike (string $field, mixed $value, [string $match = 'AND'])
void whereNot (string $field, mixed $value, [string $match = 'AND'])
Methods
Constructor __construct (line 77)
  • abstract: Contrucor, obtains an instance of the original app
  • access: public
Model __construct ()
addCalc (line 1008)
  • abstract: Adds a field calculation to db results
  • access: public
void addCalc (string $field, [string $type = 'total'])
  • string $field
  • string $type
addFilters (line 463)
  • abstract: Handles incoming filter params in url to add automated conditions to query
  • access: public
array addFilters ([array $filters = false], [array $allowed_filter_keys = false], [array $disabled_filters = false])
  • array $filters
  • array $allowed_filter_keys
  • array $disabled_filters
addSelectField (line 258)
  • abstract: Adds an additional select field
  • access: public
void addSelectField (string $field)
  • string $field
clearQuery (line 881)
  • abstract: Clears any generated queries
  • access: public
void clearQuery ()
createHtmlTable (line 1042)
  • abstract: Creates a basic table with the results
  • access: public
string createHtmlTable ([array $row_names = false], [array $ignore_fields = false])
  • array $row_names
  • array $ignore_fields
delete (line 934)
  • abstract: Generates and executes a select query
  • access: public
boolean delete ([string $table = false], [integer $id = false], [string $field_name = false])
  • string $table
  • integer $id
  • string $field_name
drop (line 956)
  • abstract: Drops a table completely
  • access: public
boolean drop (string $table)
  • string $table
duplicate (line 970)
  • abstract: Duplicates records using INSERT... SELECT...
  • access: public
integer duplicate (string $table, mixed $id, [string $field_name = 'id'], [ $replace_field = false], string $select_table)
  • string $table
  • mixed $id
  • string $field_name
  • string $select_table
  • $replace_field
enablePagination (line 139)
  • abstract: Sets the pagination toggle to true
  • access: public
void enablePagination ()
executeInsert (line 1091)
  • abstract: Generates an INSERT query and auto-executes it
  • access: public
integer executeInsert ([string $table = false], [array $fields = false])
  • string $table
  • array $fields
executeUpdate (line 1184)
  • abstract: Auto-generates and executes an UPDATE query
  • access: public
boolean executeUpdate ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = false])
  • string $table
  • array $fields
  • mixed $where_value
  • string $where_field
generateInsert (line 1103)
  • abstract: Generates an INSERT query
  • access: public
void generateInsert ([string $table = false], [array $fields = false])
  • string $table
  • array $fields
generateUpdate (line 1200)
  • abstract: Auto-generates an UPDATE query
  • access: public
void generateUpdate ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = 'id'])
  • string $table
  • array $fields
  • mixed $where_value
  • string $where_field
getBuildQuery (line 176)
  • abstract: Returns the query currently being built
  • access: public
string getBuildQuery ()
getLastQuery (line 166)
  • abstract: Returns the last run query
  • access: public
string getLastQuery ()
getPrimaryKey (line 120)
  • abstract: Returns the field marked as primary key for current table
  • access: public
mixed getPrimaryKey ()
getSchema (line 111)
  • abstract: Returns raw schema for the current table
  • access: public
array getSchema ()
groupBy (line 666)
  • abstract: Sets a group by
  • access: public
void groupBy (string $field)
  • string $field
inPastXDays (line 445)
  • abstract: Finds timestamps in the last $day_count days
  • access: public
void inPastXDays (string $field, [string $day_count = 7], [string $match = 'AND'])
  • string $field
  • string $day_count
  • string $match
insert (line 1079)
  • abstract: Generates an INSERT query and auto-executes it. Aliases executeInsert
  • access: public
integer insert ([string $table = false], [array $fields = false])
  • string $table
  • array $fields
insertForm (line 1134)
  • abstract: Generates an insert query using current Form class values
  • access: public
  • uses: Form
integer insertForm ([string $table = false])
  • string $table
leftJoin (line 272)
  • abstract: Generates a left join
  • access: public
void leftJoin (string $table, string $key, string $foreign_key, [array $fields = false], [ $from_table = false])
  • string $table
  • string $key
  • string $foreign_key
  • array $fields: Fields you want to return
  • $from_table
limit (line 616)
  • abstract: Limits the results returned
  • access: public
void limit ([integer $start = 0], [integer $limit = 25])
  • integer $start
  • integer $limit
match (line 629)
  • abstract: Adds a fulltext index match function
  • access: public
void match (string $search, [array $fields = false], [string $match = 'AND'])
  • string $search
  • array $fields
  • string $match
openTable (line 90)
  • abstract: Sets the current table and loads the table schema
  • access: public
mixed openTable ([string $table = false])
  • string $table
orderBy (line 549)
  • abstract: Adds a sort order, optionally pulls from saved prefs
  • access: public
void orderBy ([string $field = false], [string $dir = false], [string $sort_location = false])
  • string $field
  • string $dir
  • string $sort_location
orderByPreference (line 605)
  • abstract: Adds a sort order, optionally pulls from saved prefs DEPRACATED
  • access: public
void orderByPreference ([string $sort_location = false], [string $field = 'id'], [string $dir = 'ASC'])
  • string $sort_location
  • string $field
  • string $dir
paginate (line 655)
  • abstract: Sets the limit for pagination page numbers
  • access: public
void paginate (integer $current_page, [integer $per_page = 25])
  • integer $current_page
  • integer $per_page
query (line 738)
  • abstract: A wrapper for running a query directly to the db, and provided the results directly to the caller
  • access: public
object query ([string $query = false])
  • string $query
quickSelectSingle (line 899)
  • abstract: Generates a quick select statement for a single record
  • access: public
array quickSelectSingle ([string $table = false], [integer $id = false], [string $field = false])
  • string $table
  • integer $id
  • string $field
quickSelectSingleToXml (line 921)
  • abstract: Generates a quick select statement for a single record and returns the result as xml
  • access: public
string quickSelectSingleToXml ([string $table = false], [integer $id = false])
  • string $table
  • integer $id
quickValue (line 865)
  • abstract: Returns a single field, single-record value from a query
  • access: public
mixed quickValue ([string $sql = false], [string $return_field = 'id'])
  • string $sql
  • string $return_field
results (line 775)
  • abstract: Runs the generated query and appends any additional info we've selected
  • access: public
array results ([string $key_field = false], [string $sql = false])
  • string $key_field: Field value to use for array element key values
  • string $sql: Optional sql query replacing any generated
select (line 229)
  • abstract: Adds a new select statement to our query
  • access: public
void select ([string $table = false], [array $fields = false], [boolean $distinct = false])
  • string $table
  • array $fields
  • boolean $distinct
setSecurityRule (line 194)
  • abstract: Sets a security rule for data coming into a specific field
  • access: public
void setSecurityRule (string $field, string $key, string $value)
  • string $field
  • string $key
  • string $value
showStatus (line 149)
  • abstract: Returns the table status info
  • access: public
array showStatus (string $table)
  • string $table
update (line 1170)
  • abstract: Auto-generates and executes an UPDATE query. Aliases executeUpdate
  • access: public
boolean update ([string $table = false], [array $fields = false], mixed $where_value, [string $where_field = false])
  • string $table
  • array $fields
  • mixed $where_value
  • string $where_field
updateForm (line 1230)
  • abstract: Updates a database record from Form class values
  • access: public
  • uses: Form
integer updateForm ([string $table = false])
  • string $table
where (line 317)
  • abstract: Adds a standard where condition
  • access: public
void where (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereAfterToday (line 433)
  • abstract: Finds timestamps after today
  • access: public
void whereAfterToday (string $field, [boolean $include_today = false], [string $match = 'AND'])
  • string $field
  • boolean $include_today
  • string $match
whereBeforeToday (line 421)
  • abstract: Finds timestamps prior to today
  • access: public
void whereBeforeToday (string $field, [boolean $include_today = true], [string $match = 'AND'])
  • string $field
  • boolean $include_today
  • string $match
whereBetween (line 357)
  • abstract: Searches for values between $start and $end
  • access: public
void whereBetween (string $field, mixed $start, string $end, [string $match = 'AND'])
  • string $field
  • mixed $start
  • string $end
  • string $match
whereGreaterThan (line 369)
  • abstract: Adds a standard where greater than condition
  • access: public
void whereGreaterThan (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereGreaterThanEqualTo (line 382)
  • abstract: Adds a standard where greater than or is equal to condition
  • access: public
void whereGreaterThanEqualTo (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereLessThan (line 395)
  • abstract: Adds a standard where less than condition
  • access: public
void whereLessThan (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereLessThanEqualTo (line 408)
  • abstract: Adds a standard where less than or is equal to condition
  • access: public
void whereLessThanEqualTo (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereLike (line 343)
  • abstract: Adds a standard where like %% condition
  • access: public
void whereLike (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match
whereNot (line 330)
  • abstract: Adds a standard where not condition
  • access: public
void whereNot (string $field, mixed $value, [string $match = 'AND'])
  • string $field
  • mixed $value
  • string $match

Documentation generated on Wed, 15 Apr 2009 17:03:40 -0700 by phpDocumentor 1.4.1