Beispiel #1
0
 /**
  * Loads the current questionnaire model if said model exists, otherwise redirects to the
  * dashboard
  *
  * @param  boolean (optional) redirect to the dashboard if no instance is set
  * @return InstanceModel
  */
 protected function loadInstance($redirect = true)
 {
     $session = new Zend_Session_Namespace('login');
     // if we are in redirect mode && no instanceID is set
     if (!isset($session->instanceID)) {
         if ($redirect) {
             $this->_redirector->gotoRouteAndExit(array('controller' => 'dashboard'), null, true);
         }
     } else {
         // set up current questionnaire/instance stuff for the view/controller
         $this->_instance = new InstanceModel(array('instanceID' => $session->instanceID, 'depth' => 'page'));
         $this->view->currentInstance = $this->_instance;
         $this->view->numQuestionsDisabled = $this->_instance->getNumQuestionsDisabled();
         $this->view->instanceInfo = array('questionnaire' => $this->_instance->questionnaireName, 'questionnaireVersion' => $this->_instance->questionnaireVersion, 'instance' => $this->_instance->instanceName);
         $this->view->changeInstancePath = $this->view->url(array('controller' => 'dashboard'), null, true);
     }
 }