require_once 'HTML/QuickForm/Controller.php';
require_once 'HTML/QuickForm/Action/Direct.php';
+/**
+ * Class CRM_Core_Controller
+ */
class CRM_Core_Controller extends HTML_QuickForm_Controller {
/**
- * the title associated with this controller
+ * The title associated with this controller
*
* @var string
*/
public $_key;
/**
- * the name of the session scope where values are stored
+ * The name of the session scope where values are stored
*
* @var object
*/
protected $_scope;
/**
- * the state machine associated with this controller
+ * The state machine associated with this controller
*
* @var object
*/
public $_QFResponseType = 'html';
/**
- * cache the smarty template for efficiency reasons
+ * Cache the smarty template for efficiency reasons
*
* @var CRM_Core_Smarty
*/
static protected $_template;
/**
- * cache the session for efficiency reasons
+ * Cache the session for efficiency reasons
*
* @var CRM_Core_Session
*/
/**
* All CRM single or multi page pages should inherit from this class.
*
- * @param string title descriptive title of the controller
- * @param boolean whether controller is modal
- * @param string scope name of session if we want unique scope, used only by Controller_Simple
- * @param boolean addSequence should we add a unique sequence number to the end of the key
- * @param boolean ignoreKey should we not set a qfKey for this controller (for standalone forms)
+ * @param string $title descriptive title of the controller
+ * @param bool $modal whether controller is modal
+ * @param null $mode
+ * @param string $scope name of session if we want unique scope, used only by Controller_Simple
+ * @param bool $addSequence should we add a unique sequence number to the end of the key
+ * @param bool $ignoreKey should we not set a qfKey for this controller (for standalone forms)
*
* @access public
*
- * @return void
- *
+ * @return CRM_Core_Controller
*/
function __construct(
$title = NULL,
$this->_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')
);
}
+ /**
+ * @param string $name
+ * @param bool $addSequence
+ * @param bool $ignoreKey
+ *
+ * @return mixed|string
+ */
function key($name, $addSequence = FALSE, $ignoreKey = FALSE) {
$config = CRM_Core_Config::singleton();
return $this->_pages[$pageName]->handle($action);
}
+ /**
+ * @return bool
+ */
function validate() {
$this->_actionName = $this->getActionName();
list($pageName, $action) = $this->_actionName;
}
/**
- * getter method for stateMachine
+ * Getter method for stateMachine
*
- * @return object
+ * @return CRM_Core_StateMachine
* @access public
*/
function getStateMachine() {
}
/**
- * setter method for stateMachine
+ * Setter method for stateMachine
*
- * @param object a stateMachineObject
+ * @param CRM_Core_StateMachine $stateMachine
*
* @return void
* @access public
}
/**
- * 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 int $action the mode in which the state machine is operating
+ * @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) {
$pages = $stateMachine->getPages();
}
/**
- * function to destroy all the session state of the controller.
+ * Destroy all the session state of the controller.
*
* @access public
*
}
/**
- * 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
/**
* Get the variable from the form scope
*
- * @param string name : name of the variable
+ * @param string $name : name of the variable
*
* @access public
return $wizard;
}
+ /**
+ * @param array $wizard
+ */
function addWizardStyle(&$wizard) {
$wizard['style'] = array(
'barClass' => '',
}
/**
- * assign value to name in template
+ * Assign value to name in template
*
- * @param array|string $name name of variable
+ * @param string $var
* @param mixed $value value of varaible
*
* @return void
}
/**
- * assign value to name in template by reference
+ * Assign value to name in template by reference
*
- * @param array|string $name name of variable
+ * @param string $var
* @param mixed $value (reference) value of varaible
*
* @return void
}
/**
- * 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
* Returns an array containing template variables
*
* @param string $name
- * @param string $type
+ *
* @return array
*/
function get_template_vars($name=null) {
}
/**
- * setter for embedded
+ * Setter for embedded
*
* @param boolean $embedded
*
}
/**
- * getter for embedded
+ * Getter for embedded
*
* @return boolean return the embedded value
* @access public
}
/**
- * setter for skipRedirection
+ * Setter for skipRedirection
*
* @param boolean $skipRedirection
*
}
/**
- * getter for skipRedirection
+ * Getter for skipRedirection
*
* @return boolean return the skipRedirection value
* @access public
return $this->_skipRedirection;
}
+ /**
+ * @param null $fileName
+ */
function setWord($fileName = NULL) {
//Mark as a CSV file.
header('Content-Type: application/vnd.ms-word');
header("Content-Disposition: attachment; filename=Contacts_$fileName");
}
+ /**
+ * @param null $fileName
+ */
function setExcel($fileName = NULL) {
//Mark as an excel file.
header('Content-Type: application/vnd.ms-excel');
}
/**
- * setter for print
+ * Setter for print
*
* @param boolean $print
*
}
/**
- * getter for print
+ * Getter for print
*
* @return boolean return the print value
* @access public
return $this->_print;
}
+ /**
+ * @return string
+ */
function getTemplateFile() {
if ($this->_print) {
if ($this->_print == CRM_Core_Smarty::PRINT_PAGE) {
}
}
+ /**
+ * @param $uploadDir
+ * @param $uploadNames
+ */
public function addUploadAction($uploadDir, $uploadNames) {
if (empty($uploadDir)) {
$config = CRM_Core_Config::singleton();
$this->addAction('upload', $action);
}
+ /**
+ * @param $parent
+ */
public function setParent($parent) {
$this->_parent = $parent;
}
+ /**
+ * @return object
+ */
public function getParent() {
return $this->_parent;
}
+ /**
+ * @return string
+ */
public function getDestination() {
return $this->_destination;
}
+ /**
+ * @param null $url
+ * @param bool $setToReferer
+ */
public function setDestination($url = NULL, $setToReferer = FALSE) {
if (empty($url)) {
if ($setToReferer) {
$this->set('civicrmDestination', $this->_destination);
}
+ /**
+ * @return mixed
+ */
public function cancelAction() {
$actionName = $this->getActionName();
list($pageName, $action) = $actionName;