/** * 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) { // \MUtil_Model::$verbose = true; // // Initiate data retrieval for stuff needed by links $bridge->gr2o_patient_nr; $bridge->gr2o_id_organization; $bridge->gr2t_id_respondent_track; $HTML = \MUtil_Html::create(); $roundIcon[] = \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->addMultiSort('gsu_survey_name', $roundIcon); $bridge->addSortable('ggp_name'); $bridge->addSortable('calc_used_date', null, $HTML->if($bridge->is_completed, 'disabled date', 'enabled date')); $bridge->addSortable('gto_changed'); $bridge->addSortable('assigned_by', $this->_('Assigned by')); // If we are allowed to see the result of the survey, show them $user = $this->loader->getCurrentUser(); if ($user->hasPrivilege('pr.respondent.result')) { $bridge->addSortable('gto_result', $this->_('Score'), 'date'); } $bridge->useRowHref = false; $actionLinks[] = $this->createMenuLink($bridge, 'track', 'answer'); $actionLinks[] = array($bridge->ggp_staff_members->if($this->createMenuLink($bridge, 'ask', 'take'), $bridge->calc_id_token->strtoupper()), 'class' => $bridge->ggp_staff_members->if(null, $bridge->calc_id_token->if('token'))); // calc_id_token is empty when the survey has been completed // Remove nulls $actionLinks = array_filter($actionLinks); if ($actionLinks) { $bridge->addItemLink($actionLinks); } $this->addTokenLinks($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) { // $bridge->getTable()->setAlternateRowClass('odd', 'odd', 'even', 'even'); // \MUtil_Model::$verbose = true; $bridge->add('gro_round_description', $bridge->createSortLink('gro_id_order', $model->get('gro_round_description', 'label'))); $bridge->addSortable('gsu_survey_name'); $bridge->th(array($bridge->createSortLink('answered'), 'colspan' => 2))->class = 'centerAlign'; $bridge->td($bridge->answered)->class = 'centerAlign'; $bridge->td($this->percentageLazy($bridge->answered, $bridge->total))->class = 'rightAlign'; $bridge->th(array($bridge->createSortLink('missed'), 'colspan' => 2))->class = 'centerAlign'; $bridge->td($bridge->missed)->class = 'centerAlign'; $bridge->td($this->percentageLazy($bridge->missed, $bridge->total))->class = 'rightAlign'; $bridge->th(array($bridge->createSortLink('open'), 'colspan' => 2))->class = 'centerAlign'; $bridge->td($bridge->open)->class = 'centerAlign'; $bridge->td($this->percentageLazy($bridge->open, $bridge->total))->class = 'rightAlign'; // $bridge->addSortable('answered'); // $bridge->addSortable('missed'); // $bridge->addSortable('open'); // $bridge->add('future'); // $bridge->add('unknown'); $bridge->addColumn(array('=', 'class' => 'centerAlign')); $bridge->addSortable('total'); $bridge->addSortable('gsu_id_primary_group'); // $bridge->tr(); // $bridge->add('gsu_survey_name')->colspan = 4; // $bridge->add('gsu_id_primary_group')->colspan = 2; // $bridge->addColumn(); /* $bridge->addColumn( array( $bridge->gsu_survey_name, \MUtil_Html::create('em', ' - ', $bridge->gsu_id_primary_group) ), array( $model->get('gsu_survey_name', 'label'), \MUtil_Html::create('em', ' - ', $model->get('gsu_id_primary_group', 'label')) ) )->colspan = 7; $bridge->add('removed'); // */ }
/** * 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) { foreach ($this->columns as $column) { call_user_func_array(array($bridge, 'addMultiSort'), $column); } } elseif ($this->sortableLinks) { foreach ($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { $bridge->addSortable($name, $label); } } } else { foreach ($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { $bridge->add($name, $label); } } } }
/** * 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) { foreach ($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { $bridge->addSortable($name, $label); } } }