| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

CodexController

Page history last edited by majd87@... 12 years, 4 months ago

CodexController is what pulls together all the elements of CodeExtinguisher. It takes requests from the user, processes them, then sends the result back to the view. As of now, CodexModel is very minimal. In future versions, I hope to make the distinction between CodexController and CodexModel clearer.

 

A lot of functionality is packed into CodexController, if you want to add special behavior to your pages, then you need to overload the applicable methods in CodexController. For example, if instead of adding a new record to the database you decide to send yourself an email (such as a customer feedback form), then you would overload the execute_edit() function, writing your own. As discussed in creating your own pages, if you write a controller for your pages then you can even go as far as to define your own validation callbacks and other extra functionalities.

 

Here is a list of functions in CodexController.php and their purpose:

 

getID($offset=3) Retrieves the ID of the item of interest

 

setConfig($config) Initializes all the variables and options, assigning default values where applicable

 

index() Retrieves all the records, and sends them to defined view_mode.

 

search() Performs a simple search based on POST data and returns the results

 

getFirstItem() Retrieves the first item to be displayed in the Overview page

 

prepForDipslay($result) Prepares all the data to be displayed on the screen

 

setupPagination($max_rows) Initializes the pagination library

 

setupQuery() Sets up the query for the Overview page (useful for index() and search() )

 

add($populate_form_with = array()) Sets up the "Add New" page. If $populate_form_with is passed, it will populate the form with that data (after filtering it through prepForDisplay)

 

_edit($populate_form_with = array()) Setups up the "Edit Existing Item" page.  If $populate_form_with is passed, it will populate the form with that data (after filtering it through prepForDisplay)

 

delete($id="") Removes the specified record from the database

 

execute_add() Inserts the record to the database (calling preInsertHook, prepForDb, and postInsertHook in the process)

 

execute_edit() Updates the record to the database (calling preEditHook, prepForDb, and postEditHook in the process)

 

setValidationErrors($func) sets all the validation errors on the plugins

 

manage() Decides whether to go to _edit() or delete()

 

pluginCallback() Calls a function on a plugin using the following post data: plugin, action, and params. Parameter key/value are separated by :, and different parameters are separated by ;.  

Comments (0)

You don't have permission to comment on this page.