_name = $name; $this->_type = $type; $this->_back = $back; $this->_next = $next; $this->_stateMachine = &$stateMachine; } function debugPrint() { CRM_Core_Error::debug("{$this->_name}, {$this->_type}", "{$this->_back}, {$this->_next}"); } /** * Given an CRM Form, jump to the previous page * * @param object the CRM_Core_Form element under consideration * * @return mixed does a jump to the back state * @access public */ function handleBackState(&$page) { if ($this->_type & self::START) { $page->handle('display'); } else { $back = &$page->controller->getPage($this->_back); return $back->handle('jump'); } } /** * Given an CRM Form, jump to the next page * * @param object the CRM_Core_Form element under consideration * * @return mixed does a jump to the nextstate * @access public */ function handleNextState(&$page) { if ($this->_type & self::FINISH) { $page->handle('process'); } else { $next = &$page->controller->getPage($this->_next); return $next->handle('jump'); } } /** * Determine the name of the next state. This is useful when we want * to display the navigation labels or potential path * * @return string * @access public */ function getNextState() { if ($this->_type & self::FINISH) { return NULL; } else { $next = &$page->controller->getPage($this->_next); return $next; } } /** * Mark this page as valid for the QFC framework. This is needed as * we build more advanced functionality into the StateMachine * * @param object the QFC data container * * @return void * @access public */ function validate(&$data) { $data['valid'][$this->_name] = TRUE; } /** * Mark this page as invalid for the QFC framework. This is needed as * we build more advanced functionality into the StateMachine * * @param object the QFC data container * * @return void * @access public */ function invalidate(&$data) { $data['valid'][$this->_name] = NULL; } /** * Getter for name * * @return string * @access public */ function getName() { return $this->_name; } /** * Setter for name * * @param string * * @return void * @access public */ function setName($name) { $this->_name = $name; } /** * Getter for type * * @return int * @access public */ function getType() { return $this->_type; } }