Source for file View.php
Documentation is available at View.php
* Presentation layer miView and miDefaultView
* @copyright Copyright (c) 2003-2007 Mirchev Ideas Ltd. All rights reserved.
* Base class for the presentation tier
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
* The controller command objects
* Reference to the controller object
* Retrieves the controller commands
* @return array the controller command objects
* Add new controller command
* @param miControllerCommand $controllerCommand
* Handles the presentation tier
* @copyright Copyright (c) 2003-2007 Mirchev Ideas Ltd. All rights reserved.
* An array of template names needed to visualize all viewes
* Object of class miSQLRecord or its subclasses
* Reference to the view mapper controller object
* Reference to the domain object
* Object of class miTable or its subclasses
* Array that describes the output and input of each database field
* Array that describes the output and input of each field of type FILE
* Stores page specific elements
* The default filter values
protected $_persistVars =
array('sortBy', 'sortDir', 'page', 'recordsPerPage');
$stateObj->setDefaultCategory(get_class($this));
// Setup the persist vars: persist the filters
foreach ($_REQUEST as $name =>
$value) {
$stateObj->restoreState();
* Creates the table pager object. Singleton pattern
$pagerObj =
new miDefaultTablePager($this->_table);
* Creates the table filter object. Singleton pattern
static $filterObj =
null;
if ($filterObj ==
null) {
$filterObj =
new miTableFilters($this->_table);
$defaultFilterValues =
$this->_defaultFilterValues;
// By default all fields that do not have explicit default
// filter value will have empty default filter value
foreach ($this->_dataFields as $dataField) {
if (!isset
($defaultFilterValues[$dataField['data']]))
$defaultFilterValues[$dataField['data']] =
'';
$filterObj->setDefaultFilterValues($defaultFilterValues);
* Adds additional table features
// Init the table pager and table filter
* Return Object of class miSqlRecord or its subclasses
* which was set by setRecord method
* @return object Object of class miSqlRecord or its subclasses
* Sets object of class miSqlRecord or its subclasses.
* miSqlRecord object is needed to handle and manage the inserting,
* updating, deleting and reading of data into the database table specified
* by the "tableName" in miSqlRecord constructor. The database table primary
* key is also needed in miSqlRecord constructor.
* $view->setRecord(new miSqlRecord('tableName', 'tablePrimaryKey'));
* @param object $u Object of class miSqlRecord or its subclasses
* Return array that describes the output and input of each database field
* @return array that describes the output and input of each database field
* Sets array that describes the output and input of each database field
* @param array $u Array that describes the output and input of each database field
* Return object of class miTable or its subclasses
* which was set by setTable method
* @return object Object of class miTable or its subclasses
* Sets Object of class miTable or its subclasses.
* miTable object is needed to manage the representation in table format of data,
* which is readed from miSqlRecordset object set in miTable constructor.
* The data is readed from table specified by the "tableName" in the miSqlRecordset
* $recordset = new miSqlRecordset('tableName');
* $view->setTable(new miTable($recordset));
* @param object $u Object of class miTable or its subclasses
* Sets main page elements
* @param array $mainPageElements array with the main page elements
* Adds main page elements
* @param array $mainPageElements array with the main page elements
* Returns the main page elements
* @param miViewPlugin $plugin the plugin to register
* Adds redirect to list controller command
* Used after dmExecCreate, dmExecEdit and dmExecDelete to prevent refreshing
* the page to cause repetition of the operation
* @param string $msg message to display on the list page
* @param int $msgType the type of the message (optional)
* Returns the redirect params
* @param string $msg message to display on the list page
* @param int $msgType the type of the message (optional)
* @return string the redirect params url string
$params .=
'&' .
$stateParams;
* Calls each of the plugins passing the $actionObj and the $actionStep
* @param miAction $actionObj action object subclassed from miAction
* @param string $actionStep the particular action step
public function callPlugin($actionObj, $actionStep)
$plugin->processActionStep($actionObj, $actionStep);
* Called before the action is executed
* Subclasses can add functionlity to be executed before the action
* @param miAction $actionObj action object, extended from miAction
$plugin->preProcessAction($actionObj);
* Called after the action is executed
* Subclasses can add functionlity to be executed after the action
* @param miAction $actionObj action object, extended from miAction
* @param boolean $actionResult the result of the action command
$plugin->postProcessAction($actionObj, $actionResult);
* Subclasses can init the table
* @param miTable $table reference to the table object
* Inits the view mapper controller
* Returns the template file for the $templateId
* @param string $templateId the id of the template
* @return string the template file name relative to the document root
* @throws miConfigurationException
$prefix =
$_SERVER['SCRIPT_NAME'];
$prefix =
substr($prefix, 1, -
9);
case self::TEMPLATE_ID_LIST:
return $prefix .
'_mgmt.tmpl';
case self::TEMPLATE_ID_VIEW:
return $prefix .
'_view.tmpl';
case self::TEMPLATE_ID_CREATE:
return $prefix .
'_create.tmpl';
case self::TEMPLATE_ID_EDIT:
return $prefix .
'_edit.tmpl';
* Returns message based on code
* @return string the message
Documentation generated on Thu, 08 May 2008 16:57:56 +0300 by phpDocumentor 1.4.1