/** * 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) { $bridge->tr()->class = $bridge->row_class; if ($showMenuItem = $this->getShowMenuItem()) { $bridge->addItemLink($showMenuItem->toActionLinkLower($this->request, $bridge)); } // make sure search results are highlighted $this->applyTextMarker(); $br = \MUtil_Html::create()->br(); $orgName[] = \MUtil_Lazy::iff($bridge->gor_url, \MUtil_Html_AElement::a($bridge->gor_name, array('href' => $bridge->gor_url, 'target' => '_blank', 'class' => 'globe')), $bridge->gor_name); $orgName[] = $bridge->createSortLink('gor_name'); $mailName[] = \MUtil_Lazy::iff($bridge->gor_contact_email, \MUtil_Html_AElement::email(\MUtil_Lazy::first($bridge->gor_contact_name, $bridge->gor_contact_email), array('href' => array('mailto:', $bridge->gor_contact_email))), $bridge->gor_contact_name); $mailName[] = $bridge->createSortLink('gor_contact_name'); $bridge->addMultiSort($orgName, $br, 'gor_task', $br, 'gor_location'); $bridge->addMultiSort($mailName, $br, 'gor_active', $br, 'gor_has_login'); $bridge->addMultiSort('gor_add_respondents', $br, 'gor_has_respondents', $br, 'gor_respondent_group'); $bridge->add('gor_accessible_by'); if ($editMenuItem = $this->getEditMenuItem()) { $bridge->addItemLink($editMenuItem->toActionLinkLower($this->request, $bridge)); } }
/** * 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); }