Controller Class Reference

Public Member Functions | |
| _afterScaffoldSave ($method) | |
| _afterScaffoldSaveError ($method) | |
| _beforeScaffold ($method) | |
| _initComponents () | |
| _scaffoldError ($method) | |
| afterFilter () | |
| beforeFilter () | |
| beforeRender () | |
| constructClasses () | |
| disableCache () | |
| flash ($message, $url, $pause=1) | |
| header ($status) | |
| isAuthorized () | |
| loadModel ($modelClass=null, $id=null) | |
| paginate ($object=null, $scope=array(), $whitelist=array()) | |
| postConditions ($data=array(), $op=null, $bool= 'AND', $exclusive=false) | |
| redirect ($url, $status=null, $exit=true) | |
| referer ($default=null, $local=false) | |
| render ($action=null, $layout=null, $file=null) | |
| set ($one, $two=null) | |
| setAction ($action) | |
| validate () | |
| validateErrors () | |
Public Attributes | |
| $action = null | |
| $autoLayout = true | |
| $autoRender = true | |
| $base = null | |
| $cacheAction = false | |
| $Component = null | |
| $components = array() | |
| $data = array() | |
| $ext = '.ctp' | |
| $helpers = array('Html', 'Form') | |
| $here = null | |
| $layout = 'default' | |
| $layoutPath = null | |
| $modelNames = array() | |
| $name = null | |
| $output = null | |
| $pageTitle = false | |
| $paginate = array('limit' => 20, 'page' => 1) | |
| $params = array() | |
| $passedArgs = array() | |
| $persistModel = false | |
| $plugin = null | |
| $uses = false | |
| $view = 'View' | |
| $viewPath = null | |
| $viewVars = array() | |
| $webroot = null | |
Detailed Description
Definition at line 43 of file controller.php.
Member Function Documentation
| Controller::_afterScaffoldSave | ( | $ | method | ) |
This method should be overridden in child classes.
- Parameters:
-
string $method name of method called either edit or update.
- Returns:
- boolean Success protected
Definition at line 1054 of file controller.php.
| Controller::_afterScaffoldSaveError | ( | $ | method | ) |
This method should be overridden in child classes.
- Parameters:
-
string $method name of method called either edit or update.
- Returns:
- boolean Success protected
Definition at line 1064 of file controller.php.
| Controller::_beforeScaffold | ( | $ | method | ) |
This method should be overridden in child classes.
- Parameters:
-
string $method name of method called example index, edit, etc.
- Returns:
- boolean Success protected
Definition at line 1044 of file controller.php.
| Controller::_initComponents | ( | ) |
Starts the components linked to this controller.
- Deprecated:
- 1.2.0.7070
- See also:
- Component::init()
Definition at line 300 of file controller.php.
| Controller::_scaffoldError | ( | $ | method | ) |
This method should be overridden in child classes. If not it will render a scaffold error. Method MUST return true in child classes
- Parameters:
-
string $method name of method called example index, edit, etc.
- Returns:
- boolean Success protected
Definition at line 1076 of file controller.php.
| Controller::afterFilter | ( | ) |
Called after the controller action is run and rendered. Overridden in subclasses.
public
Definition at line 1035 of file controller.php.
| Controller::beforeFilter | ( | ) |
Called before the controller action. Overridden in subclasses.
public
Definition at line 1021 of file controller.php.
| Controller::beforeRender | ( | ) |
Called after the controller action is run, but before the view is rendered. Overridden in subclasses.
public
Definition at line 1028 of file controller.php.
Referenced by render().
| Controller::constructClasses | ( | ) |
Loads Model classes based on the the uses property see Controller::loadModel(); for more info Loads Components and prepares them for initailization
- Returns:
- mixed true if models found and instance created, or cakeError if models not found. public
- See also:
- Controller::loadModel()
Definition at line 385 of file controller.php.
References $uses, loadModel(), and uses().
| Controller::disableCache | ( | ) |
Tells the browser not to cache the results of the current request by sending headers
public
Definition at line 771 of file controller.php.
References header().
| Controller::flash | ( | $ | message, | |
| $ | url, | |||
| $ | pause = 1 | |||
| ) |
Shows a message to the user $time seconds, then redirects to $url Uses flash.thtml as a layout for the messages
- Parameters:
-
string $message Message to display to the user string $url Relative URL to redirect to after the time expires integer $time Time to show the message public
Definition at line 787 of file controller.php.
References $url, render(), and Router::url().
| Controller::header | ( | $ | status | ) |
undocumented function
- Parameters:
-
string $status
- Returns:
- void public
Definition at line 576 of file controller.php.
Referenced by disableCache(), and redirect().
| Controller::isAuthorized | ( | ) |
Controller callback to tie into Auth component.
- Returns:
- bool true if authorized, false otherwise public
Definition at line 636 of file controller.php.
| Controller::loadModel | ( | $ | modelClass = null, |
|
| $ | id = null | |||
| ) |
Loads and instantiates models required by this controller. If Controller::persistModel; is true, controller will create cached model instances on first request, additional request will used cached models
- Parameters:
-
string $modelClass Name of model class to load mixed $id Initial ID the instanced model class should have
- Returns:
- mixed true when single model found and instance created error returned if models not found. public
Definition at line 418 of file controller.php.
References $plugin, Object::_persist(), Object::cakeError(), ClassRegistry::getInstance(), ClassRegistry::init(), and uses().
Referenced by constructClasses().
| Controller::paginate | ( | $ | object = null, |
|
| $ | scope = array(), |
|||
| $ | whitelist = array() | |||
| ) |
Handles automatic pagination of model records.
- Parameters:
-
mixed $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel') mixed $scope Conditions to use while paginating array $whitelist List of allowed options for paging
- Returns:
- array Model query results public
Definition at line 858 of file controller.php.
| Controller::postConditions | ( | $ | data = array(), |
|
| $ | op = null, |
|||
| $ | bool = 'AND', |
|||
| $ | exclusive = false | |||
| ) |
Converts POST'ed model data to a model conditions array, suitable for a find or findAll Model query
- Parameters:
-
array $data POST'ed data organized by model and field mixed $op A string containing an SQL comparison operator, or an array matching operators to fields string $bool SQL boolean operator: AND, OR, XOR, etc. boolean $exclusive If true, and $op is an array, fields not included in $op will not be included in the returned conditions
- Returns:
- array An array of model conditions public
Definition at line 806 of file controller.php.
References $data.
| Controller::redirect | ( | $ | url, | |
| $ | status = null, |
|||
| $ | exit = true | |||
| ) |
Redirects to given $url, after turning off $this->autoRender. Please notice that the script execution is not stopped after the redirect.
- Parameters:
-
mixed $url A string or array-based URL pointing to another location within the app, or an absolute URL integer $status Optional HTTP status code (eg: 404) boolean $exit If true, exit() will be called after the redirect public
Definition at line 474 of file controller.php.
References $url, Object::_stop(), header(), ife(), and Router::url().
Referenced by PagesController::display().
| Controller::referer | ( | $ | default = null, |
|
| $ | local = false | |||
| ) |
Gets the referring URL of this request
- Parameters:
-
string $default Default URL to use if HTTP_REFERER cannot be read from headers boolean $local If true, restrict referring URLs to local server
- Returns:
- string Referring URL public
Definition at line 745 of file controller.php.
| Controller::render | ( | $ | action = null, |
|
| $ | layout = null, |
|||
| $ | file = null | |||
| ) |
Gets an instance of the view object & prepares it for rendering the output, then asks the view to actually do the job.
- Parameters:
-
string $action Action name to render string $layout Layout to use string $file File to use for rendering
- Returns:
- string Full output string of view contents public
Definition at line 689 of file controller.php.
References $action, $file, $layout, $plugin, beforeRender(), Inflector::camelize(), ClassRegistry::getObject(), App::import(), ClassRegistry::isKeySet(), ClassRegistry::keys(), params(), Configure::read(), and Inflector::underscore().
Referenced by PagesController::display(), and flash().
| Controller::set | ( | $ | one, | |
| $ | two = null | |||
| ) |
Saves a variable to use inside a template.
- Parameters:
-
mixed $one A string or an array of data. mixed $two Value in case $one is a string (which then works as the key). Unused if $one is an associative array, otherwise serves as the values to $one's keys. public
Definition at line 587 of file controller.php.
References $data, $name, and Inflector::variable().
| Controller::setAction | ( | $ | action | ) |
Internally redirects one action to another. Examples:
setAction('another_action'); setAction('action_with_parameters', $parameter1);
- Parameters:
-
string $action The new action to be redirected to mixed Any other parameters passed to this method will be passed as parameters to the new action.
- Returns:
- mixed Returns the return value of the called action public
Definition at line 624 of file controller.php.
References $action.
| Controller::validate | ( | ) |
Returns number of errors in a submitted FORM.
- Returns:
- integer Number of errors public
Definition at line 646 of file controller.php.
References validateErrors().
| Controller::validateErrors | ( | ) |
Validates models passed by parameters. Example:
$errors = $this->validateErrors($this->Article, $this->User);
- Parameters:
-
mixed A list of models as a variable argument
- Returns:
- array Validation errors, or false if none public
Definition at line 664 of file controller.php.
Referenced by validate().
Member Data Documentation
| Controller::$action = null |
| Controller::$autoLayout = true |
Definition at line 192 of file controller.php.
| Controller::$autoRender = true |
Definition at line 185 of file controller.php.
| Controller::$base = null |
| Controller::$cacheAction = false |
Definition at line 256 of file controller.php.
| Controller::$Component = null |
Definition at line 199 of file controller.php.
| Controller::$components = array() |
| Controller::$data = array() |
| Controller::$ext = '.ctp' |
Definition at line 223 of file controller.php.
| Controller::$helpers = array('Html', 'Form') |
| Controller::$here = null |
Definition at line 57 of file controller.php.
| Controller::$layout = 'default' |
| Controller::$layoutPath = null |
Definition at line 139 of file controller.php.
| Controller::$modelNames = array() |
Definition at line 161 of file controller.php.
| Controller::$name = null |
Reimplemented in PagesController, and CakeErrorController.
Definition at line 50 of file controller.php.
Referenced by set().
| Controller::$output = null |
Definition at line 232 of file controller.php.
| Controller::$pageTitle = false |
Definition at line 154 of file controller.php.
| Controller::$paginate = array('limit' => 20, 'page' => 1) |
Definition at line 125 of file controller.php.
| Controller::$params = array() |
Definition at line 98 of file controller.php.
| Controller::$passedArgs = array() |
Definition at line 272 of file controller.php.
| Controller::$persistModel = false |
Definition at line 265 of file controller.php.
| Controller::$plugin = null |
| Controller::$uses = false |
Reimplemented in PagesController, and CakeErrorController.
Definition at line 80 of file controller.php.
Referenced by constructClasses().
| Controller::$view = 'View' |
Definition at line 216 of file controller.php.
| Controller::$viewPath = null |
Definition at line 132 of file controller.php.
| Controller::$viewVars = array() |
Definition at line 146 of file controller.php.
| Controller::$webroot = null |
Definition at line 64 of file controller.php.
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/controller/controller.php