/** * 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) { $tUtil = $this->util->getTokenData(); $repeater = new \MUtil_Lazy_RepeatableByKeyValue($tUtil->getEveryStatus()); $table = new \MUtil_Html_TableElement(); $table->class = 'compliance timeTable rightFloat table table-condensed'; $table->setRepeater($repeater); $table->throw($this->_('Legend')); $table->td($repeater->key)->class = array('round', \MUtil_Lazy::method($tUtil, 'getStatusClass', $repeater->key)); $table->td($repeater->value); return $table; }
/** * * @param boolean $detailed True when the current action is not in $summarizedActions. */ public function applySetting($detailed = true) { if ($detailed) { $this->addLeftTable('gems__comm_templates', array('grco_id_message' => 'gct_id_template')); } $this->resetOrder(); $this->set('grco_created', 'label', $this->_('Date sent')); if ($detailed) { $this->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate); } $this->set('gr2o_patient_nr', 'label', $this->_('Respondent nr')); $this->set('respondent_name', 'label', $this->_('Receiver')); $this->set('grco_address', 'label', $this->_('To address'), 'itemDisplay', array('MUtil_Html_AElement', 'ifmail')); $this->set('assigned_by', 'label', $this->_('Sender')); $this->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', array('MUtil_Html_AElement', 'ifmail')); $this->set('grco_id_token', 'label', $this->_('Token'), 'itemDisplay', array($this, 'displayToken')); $this->set('grco_topic', 'label', $this->_('Subject')); $this->set('gtr_track_name', 'label', $this->_('Track')); $this->set('gsu_survey_name', 'label', $this->_('Survey')); $this->set('filler', 'label', $this->_('Fill out by')); $this->set('status', 'label', $this->_('Status'), 'formatFunction', array($this->util->getTokenData(), 'getStatusDescription')); if ($detailed) { $this->set('gct_name', 'label', $this->_('Template')); } }
/** * 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 ($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)); } } // Newline placeholder $br = \MUtil_Html::create('br'); $by = \MUtil_Html::raw($this->_(' / ')); $sp = \MUtil_Html::raw(' '); // make sure search results are highlighted $this->applyTextMarker(); $bridge->addMultiSort('grco_created', $br, 'gr2o_patient_nr', $sp, 'respondent_name', $br, 'grco_address', $br, 'gtr_track_name'); $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender', $br, 'gsu_survey_name'); $bridge->addMultiSort('status', $by, 'filler', $br, 'grco_topic'); if ($this->showMenu) { $items = $this->findMenuItems('track', 'show'); $links = array(); $params = array('gto_id_token' => $bridge->gto_id_token, \Gems_Model::ID_TYPE => 'token'); $title = \MUtil_Html::create('strong', $this->_('+')); foreach ($items as $item) { if ($item instanceof \Gems_Menu_SubMenuItem) { $bridge->addItemLink($item->toActionLinkLower($this->request, $params, $title)); } } } $bridge->getTable()->appendAttrib('class', 'compliance'); $tbody = $bridge->tbody(); $td = $tbody[0][0]; $td->appendAttrib('class', \MUtil_Lazy::method($this->util->getTokenData(), 'getStatusClass', $bridge->getLazy('status'))); }
/** * 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) { $tUtil = $this->util->getTokenData(); $table = $bridge->getTable(); $table->appendAttrib('class', 'compliance'); $thead = $table->thead(); $th_row = $thead->tr(array('class' => 'rounds')); $th = $th_row->td(); $span = 1; $cRound = null; $cDesc = null; $thead->tr(); if ($showMenuItem = $this->getShowMenuItem()) { $bridge->addItemLink($showMenuItem->toActionLinkLower($this->request, $bridge)); } // Initialize alter $alternateClass = new \MUtil_Lazy_Alternate(array('odd', 'even')); foreach ($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { $round = $model->get($name, 'round'); if ($round == $cRound) { $span++; $class = null; } else { // If the round has an icon, show the icon else just 'R' since // complete round description messes up the display $th->append($cDesc); $th->title = $cRound; $th->colspan = $span; $span = 1; $cRound = $round; if ($cIcon = $model->get($name, 'roundIcon')) { $cDesc = \MUtil_Html_ImgElement::imgFile($cIcon, array('alt' => $cRound, 'title' => $cRound)); } else { if (substr($name, 0, 5) == 'stat_') { $cDesc = 'R'; } else { $cDesc = null; } } $class = 'newRound'; $thClass = $class . ' ' . $alternateClass; // Add alternate class only for th $th = $th_row->td(array('class' => $thClass)); } if ($model->get($name, 'noSort')) { $title = array(\MUtil_Lazy::method($tUtil, 'getStatusDescription', $bridge->{$name}), "\n" . $model->get($name, 'description')); $token = 'tok_' . substr($name, 5); $href = new \MUtil_Html_HrefArrayAttribute(array($this->request->getControllerKey() => 'track', $this->request->getActionKey() => 'show', \MUtil_Model::REQUEST_ID => $bridge->{$token})); $href->setRouteReset(); $onclick = new \MUtil_Html_OnClickArrayAttribute(); $onclick->addUrl($href)->addCancelBubble(); $tds = $bridge->addColumn(array(\MUtil_Html_AElement::iflink($bridge->{$token}, array($href, 'onclick' => 'event.cancelBubble = true;', 'title' => $title, $bridge->{$name}), $bridge->{$name}), 'class' => array('round', \MUtil_Lazy::method($tUtil, 'getStatusClass', $bridge->{$name})), 'title' => $title, 'onclick' => \MUtil_Lazy::iff($bridge->{$token}, $onclick)), array($label, 'title' => $model->get($name, 'description'), 'class' => 'round')); } else { $tds = $bridge->addSortable($name, $label); } if ($class) { $tds->appendAttrib('class', $class); } } } $th->append($cRound); $th->colspan = $span; }