X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FController.php;h=0e4ff0261137d08bb402fc60c3bfa3ee5fa6cd75;hb=2aa397bc9ba4608d4146278d55dedd4080c53aec;hp=e9c7b031be5463f23f1e6d7b1e2335fbc4eefd75;hpb=0ec03e9fabc23b802ac80cb68c44b5abaf7f8585;p=civicrm-core.git diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index e9c7b031be..0e4ff02611 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -1,7 +1,7 @@ _generateQFKey = FALSE; } elseif ($snippet == 5) { - // this is used for popups and inlined ajax forms - // also used for the various tabs via TabHeader + // mode deprecated in favor of json + // still used by dashlets, probably nothing else $this->_print = CRM_Core_Smarty::PRINT_NOFORM; } // Respond with JSON if in AJAX context (also support legacy value '6') @@ -253,7 +252,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } } - // if the request has a reset value, initialize the controller session + // if the request has a reset value, initialize the controller session if (!empty($_GET['reset'])) { $this->reset(); @@ -268,7 +267,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { // and created the scope etc $this->set('qfKey', $this->_key); - // also retrieve and store destination in session $this->_destination = CRM_Utils_Request::retrieve( 'civicrmDestination', @@ -280,7 +278,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { ); } - function fini() { + public function fini() { CRM_Core_BAO_Cache::storeSessionToCache(array( "_{$this->_name}_container", array('CiviCRM', $this->_scope), @@ -290,13 +288,13 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * @param $name + * @param string $name * @param bool $addSequence * @param bool $ignoreKey * * @return mixed|string */ - function key($name, $addSequence = FALSE, $ignoreKey = FALSE) { + public function key($name, $addSequence = FALSE, $ignoreKey = FALSE) { $config = CRM_Core_Config::singleton(); if ( @@ -334,8 +332,9 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * This run is basically a composition of the original run and the * jump action * + * @return mixed */ - function run() { + public function run() { // the names of the action and page should be saved // note that this is split into two, because some versions of // php 5.x core dump on the triple assignment :) @@ -359,7 +358,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * @return bool */ - function validate() { + public function validate() { $this->_actionName = $this->getActionName(); list($pageName, $action) = $this->_actionName; @@ -382,15 +381,14 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Helper function to add all the needed default actions. Note that the framework * redefines all of the default QFC actions * - * @param string directory to store all the uploaded files - * @param array names for the various upload buttons (note u can have more than 1 upload) + * @param string directory to store all the uploaded files + * @param array names for the various upload buttons (note u can have more than 1 upload) * - * @access private * * @return void * */ - function addActions($uploadDirectory = NULL, $uploadNames = NULL) { + public function addActions($uploadDirectory = NULL, $uploadNames = NULL) { $names = array( 'display' => 'CRM_Core_QuickForm_Action_Display', 'next' => 'CRM_Core_QuickForm_Action_Next', @@ -413,39 +411,36 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * getter method for stateMachine + * Getter method for stateMachine * - * @return object - * @access public + * @return CRM_Core_StateMachine */ - function getStateMachine() { + public function getStateMachine() { return $this->_stateMachine; } /** - * setter method for stateMachine + * Setter method for stateMachine * - * @param object a stateMachineObject + * @param CRM_Core_StateMachine $stateMachine * * @return void - * @access public */ - function setStateMachine($stateMachine) { + public function setStateMachine($stateMachine) { $this->_stateMachine = $stateMachine; } /** - * add pages to the controller. Note that the controller does not really care + * Add pages to the controller. Note that the controller does not really care * the order in which the pages are added * - * @param object $stateMachine the state machine object + * @param CRM_Core_StateMachine $stateMachine * @param \const|int $action the mode in which the state machine is operating * typicaly this will be add/view/edit * * @return void - * @access public */ - function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) { + public function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) { $pages = $stateMachine->getPages(); foreach ($pages as $name => $value) { $className = CRM_Utils_Array::value('className', $value, $name); @@ -461,10 +456,10 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { $ext = CRM_Extension_System::singleton()->getMapper(); if ($ext->isExtensionClass($className)) { - require_once ($ext->classToPath($className)); + require_once $ext->classToPath($className); } else { - require_once (str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'); + require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; } $$stateName = new $className($stateMachine->find($className), $action, 'post', $formName); if ($title) { @@ -492,64 +487,62 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * the other as an image, both are of type 'submit'. * * @return string the name of the button that has been pressed by the user - * @access public */ - function getButtonName() { + public function getButtonName() { $data = &$this->container(); return CRM_Utils_Array::value('_qf_button_name', $data); } /** - * function to destroy all the session state of the controller. + * Destroy all the session state of the controller. * - * @access public * * @return void */ - function reset() { + public function reset() { $this->container(TRUE); self::$_session->resetScope($this->_scope); } /** - * virtual function to do any processing of data. + * Virtual function to do any processing of data. * Sometimes it is useful for the controller to actually process data. * This is typically used when we need the controller to figure out * what pages are potentially involved in this wizard. (this is dynamic * and can change based on the arguments * * @return void - * @access public */ - function process() {} + public function process() { + } /** * Store the variable with the value in the form scope * - * @param string|array $name name of the variable or an assoc array of name/value pairs - * @param mixed $value value of the variable if string + * @param string|array $name name of the variable or an assoc array of name/value pairs + * @param mixed $value + * Value of the variable if string. * - * @access public * * @return void * */ - function set($name, $value = NULL) { + public function set($name, $value = NULL) { self::$_session->set($name, $value, $this->_scope); } /** * Get the variable from the form scope * - * @param string name : name of the variable + * @param string $name + * : name of the variable. * - * @access public * * @return mixed * */ - function get($name) { + public function get($name) { return self::$_session->get($name, $this->_scope); } @@ -557,12 +550,12 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Create the header for the wizard from the list of pages * Store the created header in smarty * - * @param string $currentPageName name of the page being displayed + * @param string $currentPageName + * Name of the page being displayed. * * @return array - * @access public */ - function wizardHeader($currentPageName) { + public function wizardHeader($currentPageName) { $wizard = array(); $wizard['steps'] = array(); $count = 0; @@ -595,13 +588,13 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * @param $wizard + * @param array $wizard */ - function addWizardStyle(&$wizard) { + public function addWizardStyle(&$wizard) { $wizard['style'] = array( 'barClass' => '', 'stepPrefixCurrent' => '»', - 'stepPrefixPast' => '√', + 'stepPrefixPast' => '✔', 'stepPrefixFuture' => ' ', 'subStepPrefixCurrent' => '  ', 'subStepPrefixPast' => '  ', @@ -611,41 +604,40 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * assign value to name in template + * Assign value to name in template * - * @param $var - * @param mixed $value value of varaible + * @param string $var + * @param mixed $value + * Value of varaible. * - * @internal param array|string $name name of variable * @return void - * @access public */ - function assign($var, $value = NULL) { + public function assign($var, $value = NULL) { self::$_template->assign($var, $value); } /** - * assign value to name in template by reference + * Assign value to name in template by reference * - * @param $var - * @param mixed $value (reference) value of varaible + * @param string $var + * @param mixed $value + * (reference) value of varaible. * - * @internal param array|string $name name of variable * @return void - * @access public */ - function assign_by_ref($var, &$value) { + public function assign_by_ref($var, &$value) { self::$_template->assign_by_ref($var, $value); } /** - * appends values to template variables + * Appends values to template variables * * @param array|string $tpl_var the template variable name(s) - * @param mixed $value the value to append + * @param mixed $value + * The value to append. * @param bool $merge */ - function append($tpl_var, $value=NULL, $merge=FALSE) { + public function append($tpl_var, $value = NULL, $merge = FALSE) { self::$_template->append($tpl_var, $value, $merge); } @@ -654,61 +646,56 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * * @param string $name * - * @internal param string $type * @return array */ - function get_template_vars($name=null) { + public function get_template_vars($name = NULL) { return self::$_template->get_template_vars($name); } /** - * setter for embedded + * Setter for embedded * - * @param boolean $embedded + * @param bool $embedded * * @return void - * @access public */ - function setEmbedded($embedded) { + public function setEmbedded($embedded) { $this->_embedded = $embedded; } /** - * getter for embedded + * Getter for embedded * * @return boolean return the embedded value - * @access public */ - function getEmbedded() { + public function getEmbedded() { return $this->_embedded; } /** - * setter for skipRedirection + * Setter for skipRedirection * - * @param boolean $skipRedirection + * @param bool $skipRedirection * * @return void - * @access public */ - function setSkipRedirection($skipRedirection) { + public function setSkipRedirection($skipRedirection) { $this->_skipRedirection = $skipRedirection; } /** - * getter for skipRedirection + * Getter for skipRedirection * * @return boolean return the skipRedirection value - * @access public */ - function getSkipRedirection() { + public function getSkipRedirection() { return $this->_skipRedirection; } /** * @param null $fileName */ - function setWord($fileName = NULL) { + public function setWord($fileName = NULL) { //Mark as a CSV file. header('Content-Type: application/vnd.ms-word'); @@ -722,7 +709,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * @param null $fileName */ - function setExcel($fileName = NULL) { + public function setExcel($fileName = NULL) { //Mark as an excel file. header('Content-Type: application/vnd.ms-excel'); @@ -735,14 +722,13 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * setter for print + * Setter for print * - * @param boolean $print + * @param bool $print * * @return void - * @access public */ - function setPrint($print) { + public function setPrint($print) { if ($print == "xls") { $this->setExcel(); } @@ -753,19 +739,18 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } /** - * getter for print + * Getter for print * * @return boolean return the print value - * @access public */ - function getPrint() { + public function getPrint() { return $this->_print; } /** * @return string */ - function getTemplateFile() { + public function getTemplateFile() { if ($this->_print) { if ($this->_print == CRM_Core_Smarty::PRINT_PAGE) { return 'CRM/common/print.tpl';