/** * 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) { if (!$this->columns) { $br = \MUtil_Html::create('br'); $this->columns[10] = array('gla_created', $br, 'gls_name'); $this->columns[20] = array('gla_message'); $this->columns[30] = array('staff_name', $br, 'gla_role'); $this->columns[40] = array('respondent_name', $br, 'gla_organization'); } parent::addBrowseTableColumns($bridge, $model); }
/** * Called after the check that all required registry values * have been set correctly has run. * * @return void */ public function afterRegistry() { parent::afterRegistry(); $orgId = $this->respondent->getOrganizationId(); // These values are set for the generic table snippet and // should be reset for this snippet $this->browse = false; $this->extraFilter = array("gtr_organizations LIKE '%|{$orgId}|%'"); $this->menuEditActions = 'view'; $this->menuShowActions = 'create'; }
/** * 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; }
/** * Called after the check that all required registry values * have been set correctly has run. * * @return void */ public function afterRegistry() { parent::afterRegistry(); $this->onEmpty = $this->_('No appointments found.'); }
/** * 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) { $table = parent::getHtmlOutput($view); $table->getOnEmpty()->class = 'centerAlign'; if (($this->containingId || $this->keyboard) && !self::$keyboardUsed) { // Assign keyboard tracking only once self::$keyboardUsed = true; $this->applyHtmlAttributes($table); // If we are already in a containing div it is simple if ($this->containingId) { return array($table, new \Gems_JQuery_TableRowKeySelector($this->containingId)); } // Create a new containing div $div = \MUtil_Html::create()->div(array('id' => 'keys_target', 'class' => 'table-container'), $table); return array($div, new \Gems_JQuery_TableRowKeySelector($div)); } else { return $table; } }
/** * 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) { if ($this->columns) { parent::addBrowseTableColumns($bridge, $model); return; } if ($model->has('row_class')) { $bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class); } if ($this->showMenu) { $showMenuItems = $this->getShowMenuItems(); foreach ($showMenuItems as $menuItem) { $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge)); } } // make sure search results are highlighted $this->applyTextMarker(); $this->addBrowseColumn1($bridge, $model); $this->addBrowseColumn2($bridge, $model); $this->addBrowseColumn3($bridge, $model); $this->addBrowseColumn4($bridge, $model); if ($this->showMenu) { $editMenuItems = $this->getEditMenuItems(); foreach ($editMenuItems as $menuItem) { $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge)); } } }
/** * Called after the check that all required registry values * have been set correctly has run. * * @return void */ public function afterRegistry() { parent::afterRegistry(); $model = $this->getModel(); $br = \MUtil_Html::create('br'); $sp = \MUtil_Html::raw(' '); $this->columns[10] = array('gro_id_order'); $this->columns[20] = array('gro_id_survey'); $this->columns[30] = array('gro_round_description'); $this->columns[40] = array('gro_icon_file'); $this->columns[45] = array('ggp_name'); $this->columns[50] = array('gro_valid_after_field', $sp, 'gro_valid_after_source', $sp, 'gro_valid_after_id'); $this->columns[60] = array('gro_valid_for_field', $sp, 'gro_valid_for_source', $sp, 'gro_valid_for_id'); $this->columns[70] = array('gro_active'); if ($label = $model->get('gro_changed_event', 'label')) { $this->columns[80] = array('gro_changed_event'); } if ($label = $model->get('gro_changed_event', 'label')) { $this->columns[90] = array('gro_display_event'); } $this->columns[100] = array('gro_code'); $this->columns[110] = array('organizations'); }
/** * Returns an edit menu item, if access is allowed by privileges * * @return \Gems_Menu_SubMenuItem */ protected function getEditMenuItems() { $resets = $this->findMenuItems($this->menuActionController, 'reset'); foreach ($resets as $resetPw) { if ($resetPw instanceof \Gems_Menu_SubMenuItem) { $resetPw->set('label', $this->_('password')); } } return array_merge(parent::getEditMenuItems(), $resets, $this->findMenuItems($this->menuActionController, 'mail')); }
/** * The place to check if the data set in the snippet is valid * to generate the snippet. * * When invalid data should result in an error, you can throw it * here but you can also perform the check in the * checkRegistryRequestsAnswers() function from the * {@see \MUtil_Registry_TargetInterface}. * * @return boolean */ public function hasHtmlOutput() { if (!$this->multiTracks) { return false; } $this->tracker = $this->loader->getTracker(); if (!$this->respondentTrackId) { $this->respondentTrackId = $this->request->getParam(\Gems_Model::RESPONDENT_TRACK); } if ($this->respondentTrackId) { if (!$this->respondentTrack instanceof \Gems_Tracker_RespondentTrack) { $this->respondentTrack = $this->tracker->getRespondentTrack($this->respondentTrackId); } } if ($this->respondentTrack instanceof \Gems_Tracker_RespondentTrack) { if (!$this->respondentTrackId) { $this->respondentTrackId = $this->respondentTrack->getRespondentTrackId(); } $this->trackId = $this->respondentTrack->getTrackId(); if (!$this->respondentId) { $this->respondentId = $this->respondentTrack->getRespondentId(); } if (!$this->organizationId) { $this->organizationId = $this->respondentTrack->getOrganizationId(); } $this->caption = $this->_('Other assignments of this track to this respondent.'); $this->onEmpty = $this->_('This track is assigned only once to this respondent.'); } else { if ($this->respondent instanceof \Gems_Tracker_Respondent) { if (!$this->respondentId) { $this->respondentId = $this->respondent->getId(); } if (!$this->organizationId) { $this->organizationId = $this->respondent->getOrganizationId(); } } $this->caption = $this->_('Existing assignments of this track to this respondent.'); $this->onEmpty = $this->_('This track is not assigned to this respondent.'); } if (!$this->trackId) { $this->trackId = $this->request->getParam(\Gems_Model::TRACK_ID); } if (!$this->trackId && $this->trackEngine instanceof \Gems_Tracker_Engine_TrackEngineInterface) { $this->trackId = $this->trackEngine->getTrackId(); } return $this->trackId && $this->respondentId && $this->organizationId && parent::hasHtmlOutput(); }
/** * The place to check if the data set in the snippet is valid * to generate the snippet. * * When invalid data should result in an error, you can throw it * here but you can also perform the check in the * checkRegistryRequestsAnswers() function from the * {@see \MUtil_Registry_TargetInterface}. * * @return boolean */ public function hasHtmlOutput() { // Try to set $this->respondentTrackId, it can be ok when not set if (!$this->respondentTrackId) { if ($this->respondentTrack) { $this->respondentTrackId = $this->respondentTrack->getRespondentTrackId(); } else { $this->respondentTrackId = $this->request->getParam(\Gems_Model::RESPONDENT_TRACK); } } // First attempt at trackId if (!$this->trackId && $this->trackEngine) { $this->trackId = $this->trackEngine->getTrackId(); } // Check if a sufficient set of data is there if (!($this->trackId || $this->patientId || $this->organizationId)) { // Now we really need $this->respondentTrack if (!$this->respondentTrack) { if ($this->respondentTrackId) { $this->respondentTrack = $this->loader->getTracker()->getRespondentTrack($this->respondentTrackId); } else { // Parameters not valid return false; } } } if (!$this->trackId) { $this->trackId = $this->respondentTrack->getTrackId(); } if (!$this->patientId) { $this->patientId = $this->respondentTrack->getPatientNumber(); } if (!$this->organizationId) { $this->organizationId = $this->respondentTrack->getOrganizationId(); } // \MUtil_Echo::track($this->trackId, $this->patientId, $this->organizationId, $this->respondentTrackId); return $this->getModel()->loadFirst() && parent::hasHtmlOutput(); }