/** * Should be called after answering the request to allow the Target * to check if all required registry values have been set correctly. * * @return boolean False if required are missing. */ public function checkRegistryRequestsAnswers() { if ($this->token instanceof \Gems_Tracker_Token) { $this->wasAnswered = $this->token->isCompleted(); return $this->request instanceof \Zend_Controller_Request_Abstract && $this->view instanceof \Zend_View && parent::checkRegistryRequestsAnswers(); } else { return false; } }
/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { $model = $this->token->getModel(); if ($this->useFakeForm && $this->token->hasSuccesCode() && !$this->token->isCompleted()) { $model->set('gto_id_token', 'formatFunction', array(__CLASS__, 'makeFakeForm')); } else { $model->set('gto_id_token', 'formatFunction', 'strtoupper'); } $model->setBridgeFor('itemTable', 'ThreeColumnTableBridge'); return $model; }
/** * Called after loadFormData() and isUndeleting() but before the form is created * * @return array */ public function getReceptionCodes() { $rcLib = $this->util->getReceptionCodeLibrary(); if ($this->unDelete) { return $rcLib->getTokenRestoreCodes(); } if ($this->token->isCompleted()) { return $rcLib->getCompletedTokenDeletionCodes(); } return $rcLib->getUnansweredTokenDeletionCodes(); }
/** * Process the data and return the answers that should be filled in beforehand. * * Storing the changed values is handled by the calling function. * * @param \Gems_Tracker_Token $token Gems token object * @return array Containing the changed values */ public function processTokenInsertion(\Gems_Tracker_Token $token) { if ($token->hasSuccesCode() && !$token->isCompleted()) { // Preparation for a more general object class $surveyId = $token->getSurveyId(); $prev = $token; while ($prev = $prev->getPreviousToken()) { if ($prev->hasSuccesCode() && $prev->isCompleted()) { // Check first on survey id and when that does not work by name. if ($prev->getSurveyId() == $surveyId) { return $prev->getRawAnswers(); } } } } }
/** * An array of snippet names for displaying a token * * @param \Gems_Tracker_Token $token Allows token status dependent show snippets * @return array of string snippet names */ public function getTokenShowSnippetNames(\Gems_Tracker_Token $token) { $output[] = 'Token\\ShowTrackTokenSnippet'; if ($token->isCompleted()) { $output[] = 'Tracker_Answers_SingleTokenAnswerModelSnippet'; } else { $output[] = 'Survey\\SurveyQuestionsSnippet'; } return $output; }
/** * Returns true when this token should be displayed * * @param \Gems_Tracker_Token $token * @return boolean */ public function _displayToken($token) { if ($token->isCompleted()) { return true; } return false; }