/** * 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; }
/** * 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; }
/** * * @param \MUtil_Lazy_LazyInterface $part * @param \MUtil_Lazy_LazyInterface $total * @return \MUtil_Lazy_Call */ public function percentageLazy($part, $total) { return \MUtil_Lazy::method($this, 'showPercentage', $part, $total); }
public function setOnEmpty($content, $colcount = null) { if ($content instanceof \MUtil_Html_ElementInterface && $content->getTagName() == $this->_defaultChildTag) { $this->_onEmptyContent = $content; if (isset($this->_onEmptyContent[0])) { $this->_onEmptyLocal = $this->_onEmptyContent[0]; } else { $this->_onEmptyLocal = $this->_onEmptyContent->td(); } } else { $this->_onEmptyContent = \MUtil_Html::create($this->_defaultChildTag); $this->_onEmptyLocal = $this->_onEmptyContent->td($content); } // Collcount tells us to span the empty content cell if ($colcount) { if ($colcount instanceof \MUtil_Html_ColumnInterface) { // Lazy calculation of number of columns when this is a ColumnInterface $this->_onEmptyLocal->colspan = \MUtil_Lazy::method($colcount, 'getColumnCount'); } else { // Passed fixed number of columns, just set $this->_onEmptyLocal->colspan = $colcount; } } else { // Pass the row instead of the cell. Without a colspan // the programmer should add extra cells to it. $this->_onEmptyLocal = $this->_onEmptyContent; } return $this->_onEmptyLocal; }