コード例 #1
0
 /**
  * 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');
              // */
 }
コード例 #2
0
 /**
  * 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();
     $roundDescription[] = $HTML->if($bridge->gto_round_description, $HTML->small(' [', $bridge->gto_round_description, ']'));
     $roundDescription[] = $HTML->small(' [', $bridge->createSortLink('gto_round_description'), ']');
     $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'))));
     if ($menuItem = $this->findMenuItem('track', 'show-track')) {
         $href = $menuItem->toHRefAttribute($this->request, $bridge);
         $track1 = $HTML->if($bridge->gtr_track_name, $HTML->a($href, $bridge->gtr_track_name));
     } else {
         $track1 = $bridge->gtr_track_name;
     }
     $track[] = array($track1, $HTML->if($bridge->gr2t_track_info, $HTML->small(' [', $bridge->gr2t_track_info, ']')));
     $track[] = array($bridge->createSortLink('gtr_track_name'), $HTML->small(' [', $bridge->createSortLink('gr2t_track_info'), ']'));
     $bridge->addMultiSort($track);
     $bridge->addMultiSort('gsu_survey_name', $roundDescription, $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'));
     $project = \GemsEscort::getInstance()->project;
     // 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);
 }