/** * 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) { $model->set('gto_id_token', 'formatFunction', 'strtoupper'); $bridge->setDefaultRowClass(\MUtil_Html_TableElement::createAlternateRowClass('even', 'even', 'odd', 'odd')); $tr1 = $bridge->tr(); $tr1->appendAttrib('class', $bridge->row_class); $tr1->appendAttrib('title', $bridge->gto_comment); $bridge->addColumn($this->createShowTokenButton($bridge), ' ')->rowspan = 2; // Space needed because TableElement does not look at rowspans $bridge->addSortable('gto_valid_from'); $bridge->addSortable('gto_valid_until'); $bridge->addSortable('gto_id_token'); // $bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments'))->rowspan = 2; $this->addRespondentCell($bridge, $model); $bridge->addMultiSort('ggp_name', array($this->createActionButtons($bridge))); $tr2 = $bridge->tr(); $tr2->appendAttrib('class', $bridge->row_class); $tr2->appendAttrib('title', $bridge->gto_comment); $bridge->addSortable('gto_mail_sent_date'); $bridge->addSortable('gto_completion_time'); $bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments')); if ($this->multiTracks) { $model->set('gr2t_track_info', 'tableDisplay', 'smallData'); $model->set('gto_round_description', 'tableDisplay', 'smallData'); $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info', array($bridge->gtr_track_name->if(\MUtil_Html::raw(' » ')), ' '), 'gsu_survey_name', 'gto_round_description'); } else { $bridge->addMultiSort('gto_round_description', \MUtil_Html::raw('; '), 'gsu_survey_name'); } $bridge->addSortable('assigned_by'); }
/** * 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) { // Signal the bridge that we need these values $bridge->gr2t_id_respondent_track; $bridge->gr2o_patient_nr; $bridge->tr()->appendAttrib('class', \MUtil_Lazy::iif($bridge->gro_id_round, $bridge->row_class, array($bridge->row_class, ' inserted'))); $title = \MUtil_Html::create()->strong($this->_('+')); $showLinks[] = $this->createMenuLink($bridge, 'track', 'show', $title); // Remove nulls $showLinks = array_filter($showLinks); // Columns $bridge->addSortable('gsu_survey_name')->append(\MUtil_Lazy::iif($bridge->gro_icon_file, \MUtil_Lazy::iif($bridge->gto_icon_file, \MUtil_Html::create('img', array('src' => $bridge->gto_icon_file, 'class' => 'icon')), \MUtil_Lazy::iif($bridge->gro_icon_file, \MUtil_Html::create('img', array('src' => $bridge->gro_icon_file, 'class' => 'icon')))))); $bridge->addSortable('gto_round_description'); $bridge->addSortable('ggp_name'); $bridge->addSortable('gto_valid_from', null, 'date'); $bridge->addSortable('gto_completion_time', null, 'date'); $bridge->addSortable('gto_valid_until', null, 'date'); if ($this->loader->getCurrentUser()->hasPrivilege('pr.respondent.result')) { $bridge->addSortable('gto_result', $this->_('Score'), 'date'); } $actionLinks[] = $this->createMenuLink($bridge, 'track', 'answer'); $actionLinks[] = array($bridge->ggp_staff_members->if($this->createMenuLink($bridge, 'ask', 'take'), $bridge->can_be_taken->if($bridge->calc_id_token->strtoupper())), 'class' => $bridge->ggp_staff_members->if(null, $bridge->calc_id_token->if('token'))); // Remove nulls $actionLinks = array_filter($actionLinks); if ($actionLinks) { $bridge->addItemLink($actionLinks); } if ($showLinks) { foreach ($showLinks as $showLink) { if ($showLink) { $showLink->title = array($this->_('Token'), $bridge->gto_id_token->strtoupper()); } } $bridge->addItemLink($showLinks); } }
protected function setTableBody(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Lazy_RepeatableInterface $repeater, $columnClass) { $baseurl = $bridge->getBaseUrl(); $onEmpty = $this->_('-'); foreach ($this->getFields() as $name => $field) { $bridge->tr(array('class' => $this->dateGroup == $name ? 'selectedRow' : null)); // Left cell $td = $bridge->td($field->getLabel()); $td->class = $field->getLabelClass(); // Repeating column $href = $field->getHRef($repeater, $baseurl); $td = $bridge->td(); $td->a($href, $repeater->{$name}); $td->class = array($this->dataCellClass, $field->getClass(), $columnClass); $td->onclick = array('location.href=\'', $href, '\';'); $td->setOnEmpty($onEmpty); $td->setRepeater($repeater); $td->setRepeatTags(true); } }