/** * 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'); // */ }
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); } }