コード例 #1
0
 /**
  * The action where survey sources should return to after survey completion
  */
 public function returnAction()
 {
     if (!$this->_initToken()) {
         // In all other cases: the action that generates meaningfull warnings and is reachable for everyone
         $this->_forward('forward');
         return;
     }
     if ($url = $this->token->getReturnUrl()) {
         // Check for completed tokens
         $this->tracker->processCompletedTokens($this->token->getRespondentId(), $this->token->getChangedBy(), $this->token->getOrganizationId());
         // Redirect at once, might be another site url
         header('Location: ' . $url);
         exit;
     }
     // No return? Check for old style user based return
     if (!$this->currentUser->isActive()) {
         $this->_forward('forward');
         return;
     }
     // Check for completed tokens
     $this->tracker->processCompletedTokens($this->token->getRespondentId(), $this->currentUser->getUserId());
     // Get return route parameters
     $parameters = $this->currentUser->getSurveyReturn();
     if (!$parameters) {
         // Default fallback for the fallback
         $request = $this->getRequest();
         $parameters[$request->getControllerKey()] = 'respondent';
         $parameters[$request->getActionKey()] = 'show';
         $parameters[\MUtil_Model::REQUEST_ID] = $this->token->getPatientNumber();
     }
     $this->_reroute($parameters, true);
 }
コード例 #2
0
 public function afterRegistry()
 {
     if ($this->tokenIdentifier) {
         $this->token = $this->loader->getTracker()->getToken($this->tokenIdentifier);
         if ($this->token->exists) {
             $this->patientId = $this->token->getPatientNumber();
             $this->organizationId = $this->token->getOrganizationId();
         }
     } else {
         $this->loadDefault();
     }
     parent::afterRegistry();
     if ($this->token && $this->token->hasRelation()) {
         // If we have a token with a relation, remove the respondent and use relation in to field
         array_pop($this->to);
     }
 }
コード例 #3
0
 protected function loadExport()
 {
     $this->export = $this->loader->getRespondentExport();
     if ($this->token instanceof \Gems_Tracker_Token) {
         $this->addRespondent($this->token->getPatientNumber(), $this->token->getOrganizationId());
         $this->export->addRespondentTrackFilter($this->token->getRespondentTrackId());
         $this->export->addTokenFilter($this->token->getTokenId());
     } elseif ($this->respondentTrack instanceof \Gems_Tracker_RespondentTrack) {
         $this->addRespondent($this->respondentTrack->getPatientNumber(), $this->respondentTrack->getOrganizationId());
         $this->export->addRespondentTrackFilter($this->respondentTrack->getRespondentTrackId());
     } elseif ($this->respondent instanceof \Gems_Tracker_Respondent) {
         $this->addRespondent($this->respondent->getPatientNumber(), $this->respondent->getOrganizationId());
     }
 }
コード例 #4
0
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @param \Zend_View_Abstract $view Just in case it is needed here
  * @return \MUtil_Html_HtmlInterface Something that can be rendered
  */
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $htmlDiv = \MUtil_Html::create()->div(array('class' => 'answer-container'));
     if ($this->tokenId) {
         if ($this->token->exists) {
             if ($this->showHeaders) {
                 $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber()));
                 $htmlDiv->pInfo(sprintf($this->_('Answers for token %s, patient number %s: %s.'), strtoupper($this->tokenId), $this->token->getPatientNumber(), $this->token->getRespondentName()))->appendAttrib('class', 'noprint');
             }
             $table = parent::getHtmlOutput($view);
             $table->setPivot(true, 2, 1);
             $this->applyHtmlAttributes($table);
             $this->class = false;
             $htmlDiv[] = $table;
         } else {
             $htmlDiv->ul(sprintf($this->_('Token %s not found.'), $this->tokenId), array('class' => 'errors'));
         }
     } else {
         $htmlDiv->ul($this->_('No token specified.'), array('class' => 'errors'));
     }
     if ($this->showButtons) {
         $buttonDiv = $htmlDiv->buttonDiv();
         $buttonDiv->actionLink(array(), $this->_('Close'), array('onclick' => 'window.close();'));
         $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
     }
     return $htmlDiv;
 }
コード例 #5
0
 /**
  * Copied from parent, but insert chart instead of table after commented out part
  *
  * @param \Zend_View_Abstract $view
  * @return type
  */
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     //$view->headLink()->prependStylesheet($view->serverUrl() . \GemsEscort::getInstance()->basepath->getBasePath() . '/gems/css/barchart.less', 'screen,print');
     $htmlDiv = \MUtil_Html::create()->div(' ', array('class' => 'barchartcontainer'));
     if ($this->showHeaders) {
         if (isset($this->token)) {
             $htmlDiv->h3(sprintf($this->_('Overview for patient number %s'), $this->token->getPatientNumber()));
             $htmlDiv->pInfo(sprintf($this->_('Overview for patient number %s: %s.'), $this->token->getPatientNumber(), $this->token->getRespondentName()))->appendAttrib('class', 'noprint');
         } else {
             $htmlDiv->pInfo($this->_('No data present'));
         }
     }
     if (!empty($this->data)) {
         $htmlDiv->append($this->getChart());
         // Insert the chart here
     }
     if ($this->showButtons) {
         $buttonDiv = $htmlDiv->buttonDiv();
         $buttonDiv->actionLink(array(), $this->_('Back'), array('onclick' => 'window.history.go(-1); return false;'));
         $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
     }
     // Make vertically resizable
     $view = \Zend_Layout::getMvcInstance()->getView();
     /*$jquery = $view->jQuery();
       $jquery->enable();*/
     \MUtil_JQuery::enableView($view);
     // We need width 100% otherwise it will look strange in print output
     $view->jQuery()->addOnLoad("\$('.barchart').resizable({\r\n            handles: 's',\r\n            resize: function( event, ui ) { ui.element.css({ width: '100%'}); },\r\n            minHeight: 150\r\n            });");
     return $htmlDiv;
 }