/**
  * Set menu parameters from the organization
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_Token (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->offsetSet('can_add_respondents', $this->canCreateRespondents());
 }
 /**
  * Adds columns from the model to the bridge that creates the browse table.
  *
  * Overrule this function to add different columns to the browse table, without
  * having to recode the core table building code.
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  * @return void
  */
 protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $br = \MUtil_Html::create('br');
     if ($this->showSelected) {
         $selectedClass = \MUtil_Lazy::iff(\MUtil_Lazy::comp($bridge->gto_id_token, '==', $this->tokenId), 'selectedColumn', null);
     } else {
         $selectedClass = null;
     }
     $bridge->th($this->_('Status'));
     $td = $bridge->tdh(\MUtil_Lazy::first($bridge->grc_description, $this->_('OK')));
     $td->appendAttrib('class', $selectedClass);
     $bridge->th($this->_('Question'));
     if ($model->has('grr_name') && $model->has('gtf_field_name')) {
         $td = $bridge->tdh(\MUtil_Lazy::iif($bridge->grr_name, array($bridge->grr_name, $br)), \MUtil_Lazy::iif($bridge->gtf_field_name, array($bridge->gtf_field_name, $br)), $bridge->gto_round_description, \MUtil_Lazy::iif($bridge->gto_round_description, $br), \MUtil_Lazy::iif($bridge->gto_completion_time, $bridge->gto_completion_time, $bridge->gto_valid_from));
     } else {
         $td = $bridge->tdh($bridge->gto_round_description, \MUtil_Lazy::iif($bridge->gto_round_description, $br), \MUtil_Lazy::iif($bridge->gto_completion_time, $bridge->gto_completion_time, $bridge->gto_valid_from));
     }
     $td->appendAttrib('class', $selectedClass);
     $td->appendAttrib('class', $bridge->row_class);
     // Apply filter on the answers displayed
     $answerNames = $model->getItemsOrdered();
     if ($this->answerFilter instanceof \Gems_Tracker_Snippets_AnswerNameFilterInterface) {
         $answerNames = $this->answerFilter->filterAnswers($bridge, $model, $answerNames);
     }
     foreach ($answerNames as $name) {
         $label = $model->get($name, 'label');
         if (null !== $label) {
             // Was strlen($label), but this ruled out empty sub-questions
             $bridge->thd($label, array('class' => $model->get($name, 'thClass')));
             $td = $bridge->td($bridge->{$name});
             $td->appendAttrib('class', 'answer');
             $td->appendAttrib('class', $selectedClass);
             $td->appendAttrib('class', $bridge->row_class);
         }
     }
     $bridge->th($this->_('Token'));
     $tokenUpper = $bridge->gto_id_token->strtoupper();
     if ($this->showTakeButton && ($menuItem = $this->menu->find(array('controller' => 'ask', 'action' => 'take', 'allowed' => true)))) {
         $source = new \Gems_Menu_ParameterSource();
         $source->setTokenId($bridge->gto_id_token);
         $source->offsetSet('can_be_taken', $bridge->can_be_taken);
         $link = $menuItem->toActionLink($source);
         if ($link) {
             $link->title = array($this->_('Token'), $tokenUpper);
         }
         $td = $bridge->tdh($bridge->can_be_taken->if($link, $tokenUpper));
     } else {
         $td = $bridge->tdh($tokenUpper);
     }
     $td->appendAttrib('class', $selectedClass);
     $td->appendAttrib('class', $bridge->row_class);
 }
Esempio n. 3
0
 /**
  * Set menu parameters from this user
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_User_User
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->offsetSet('gsf_id_organization', $this->getBaseOrganizationId());
     $source->offsetSet('gsf_active', $this->isActive() ? 1 : 0);
     $source->offsetSet('accessible_role', $this->hasAllowedRole() ? 1 : 0);
     $source->offsetSet('can_mail', $this->hasEmailAddress() ? 1 : 0);
 }
 /**
  * Set menu parameters from this track engine
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_Engine_TrackEngineInterface (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->setTrackId($this->_trackId);
     $source->offsetSet('gtr_active', isset($this->_trackData['gtr_active']) ? $this->_trackData['gtr_active'] : 0);
     return $this;
 }
 /**
  * Set menu parameters from this track engine
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_Engine_TrackEngineInterface (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->setTrackId($this->_trackId);
     return $this;
 }
 /**
  * Set menu parameters from this token
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_RespondentTrack (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->setPatient($this->getPatientNumber(), $this->getOrganizationId());
     $source->offsetSet('resp_deleted', $this->getReceptionCode()->isSuccess() ? 0 : 1);
     return $this;
 }
 /**
  * Set menu parameters from this token
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_RespondentTrack (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->setRespondentTrackId($this->_respTrackId);
     $source->offsetSet('can_edit', $this->hasSuccesCode() ? 1 : 0);
     $source->offsetSet('track_can_be_created', 0);
     $this->getRespondent()->applyToMenuSource($source);
     $this->getTrackEngine()->applyToMenuSource($source);
     return $this;
 }
Esempio n. 8
0
 /**
  * Set menu parameters from this token
  *
  * @param \Gems_Menu_ParameterSource $source
  * @return \Gems_Tracker_Token (continuation pattern)
  */
 public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
 {
     $source->setTokenId($this->_tokenId);
     if ($this->exists) {
         if (!isset($this->_gemsData['gr2o_patient_nr'])) {
             $this->_ensureRespondentData();
         }
         $source->setTokenId($this->_tokenId);
         $this->getRespondentTrack()->applyToMenuSource($source);
         $source->offsetSet('gsu_id_survey', $this->_gemsData['gto_id_survey']);
         $source->offsetSet('grc_success', $this->getReceptionCode()->isSuccess() ? 1 : 0);
         $source->offsetSet('is_completed', $this->_gemsData['gto_completion_time'] ? 1 : 0);
         $source->offsetSet('show_answers', $this->_gemsData['gto_completion_time'] ? 1 : 0);
         if ($this->getReceptionCode()->isSuccess() && !$this->_gemsData['gto_completion_time'] && ($validFrom = $this->getValidFrom())) {
             $validUntil = $this->getValidUntil();
             $today = new \MUtil_Date();
             $can_be_taken = $validFrom->isEarlier($today) && ($validUntil ? $validUntil->isLater($today) : true);
         } else {
             $can_be_taken = false;
         }
         $source->offsetSet('can_be_taken', $can_be_taken);
     }
     return $this;
 }