コード例 #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
  */
 public function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $model->set('gr2o_patient_nr', 'label', $this->_('Respondent'));
     $model->set('gto_round_description', 'label', $this->_('Round / Details'));
     $model->set('gto_valid_from', 'label', $this->_('Valid from'));
     $model->set('gto_valid_until', 'label', $this->_('Valid until'));
     $model->set('gto_mail_sent_date', 'label', $this->_('Contact date'));
     $model->set('respondent_name', 'label', $this->_('Name'));
     $HTML = \MUtil_Html::create();
     $bridge->setDefaultRowClass(\MUtil_Html_TableElement::createAlternateRowClass('even', 'even', 'odd', 'odd'));
     $bridge->addColumn($this->getTokenLinks($bridge), ' ')->rowspan = 2;
     // Space needed because TableElement does not look at rowspans
     $bridge->addSortable('gto_valid_from');
     $bridge->addSortable('gto_valid_until');
     $bridge->addMultiSort('gr2o_patient_nr', $HTML->raw('; '), 'respondent_name');
     $bridge->addMultiSort('ggp_name', array($this->getActionLinks($bridge)));
     $bridge->tr();
     $bridge->addSortable('gto_mail_sent_date');
     $bridge->addSortable('gto_completion_time');
     if ($this->escort instanceof \Gems_Project_Tracks_SingleTrackInterface) {
         $bridge->addMultiSort('gto_round_description', $HTML->raw('; '), 'gsu_survey_name');
     } else {
         $model->set('gr2t_track_info', 'tableDisplay', 'smallData');
         $model->set('gto_round_description', 'tableDisplay', 'smallData');
         $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info', $bridge->gtr_track_name->if($HTML->raw(' » ')), 'gsu_survey_name', 'gto_round_description');
     }
     $bridge->addSortable('assigned_by');
 }
コード例 #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)
 {
     if ($model->has('row_class')) {
         $bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
     }
     if ($editMenuItem = $this->getEditMenuItem()) {
         $bridge->addItemLink($editMenuItem->toActionLinkLower($this->request, $bridge));
     }
     // make sure search results are highlighted
     $this->applyTextMarker();
     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);
             }
         }
     }
     if ($deleteMenuItem = $this->findMenuItem($this->request->getControllerName(), 'delete')) {
         $bridge->addItemLink($deleteMenuItem->toActionLinkLower($this->request, $bridge));
     }
 }
コード例 #3
0
 /**
  * Adds columns from the model to the bridge that creates the browse table.
  *
  * Adds a button column to the model, if such a button exists in the model.
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  * @rturn void
  */
 protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $model->setIfExists('gr2o_opened', 'tableDisplay', 'small');
     $model->setIfExists('grs_email', 'formatFunction', array('MUtil_Html_AElement', 'ifmail'));
     if ($menuItem = $this->findAllowedMenuItem('show')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
     // Newline placeholder
     $br = \MUtil_Html::create('br');
     // Display separator and phone sign only if phone exist.
     $phonesep = $bridge->itemIf($bridge->grs_phone_1, \MUtil_Html::raw('☏ '));
     $citysep = $bridge->itemIf($bridge->grs_zipcode, \MUtil_Html::raw('  '));
     if ($this->currentUser->hasPrivilege('pr.respondent.multiorg')) {
         $bridge->addMultiSort('gr2o_patient_nr', $br, 'gor_name');
         //, \MUtil_Html::raw(' '), 'gr2o_opened');
     } else {
         $bridge->addMultiSort('gr2o_patient_nr', $br, 'gr2o_opened');
     }
     $bridge->addMultiSort('name', $br, 'grs_email');
     $bridge->addMultiSort('grs_address_1', $br, 'grs_zipcode', $citysep, 'grs_city');
     $bridge->addMultiSort('grs_birthday', $br, $phonesep, 'grs_phone_1');
     if ($menuItem = $this->findAllowedMenuItem('edit')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
 }
コード例 #4
0
 /**
  * This function is called in addBrowseTableColumns() to filter the names displayed
  * by AnswerModelSnippetGeneric.
  *
  * @see \Gems_Tracker_Snippets_AnswerModelSnippetGeneric
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  * @param array $currentNames The current names in use (allows chaining)
  * @return array Of the names of labels that should be shown
  */
 public function filterAnswers(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model, array $currentNames)
 {
     $repeater = $model->loadRepeatable();
     $table = $bridge->getTable();
     $table->setRepeater($repeater);
     // Filter unless option 'fullanswers' is true, can be set as get or post var.
     $requestFullAnswers = \Zend_Controller_Front::getInstance()->getRequest()->getParam('fullanswers', false);
     if (!$repeater->__start()) {
         return $currentNames;
     }
     $keys = array();
     if ($requestFullAnswers !== false) {
         // No filtering
         return $model->getItemsOrdered();
     } else {
         foreach ($model->getItemNames() as $name) {
             $start = substr(strtolower($name), 0, $this->IncludeLength);
             if (in_array($start, $this->IncludeStarts)) {
                 $keys[$name] = $name;
             }
         }
     }
     $answers = $this->token->getRawAnswers();
     // Prevent errors when no answers present
     if (!empty($answers)) {
         $results = array_intersect($currentNames, array_keys($keys), array_keys($answers));
     } else {
         $results = array_intersect($currentNames, array_keys($keys));
     }
     $results = $this->restoreHeaderPositions($model, $results);
     if ($results) {
         return $results;
     }
     return $this->getHeaders($model, $currentNames);
 }
コード例 #5
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();
     $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);
 }
コード例 #6
0
 /**
  * This function is called in addBrowseTableColumns() to filter the names displayed
  * by AnswerModelSnippetGeneric.
  *
  * @see \Gems_Tracker_Snippets_AnswerModelSnippetGeneric
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  * @param array $currentNames The current names in use (allows chaining)
  * @return array Of the names of labels that should be shown
  */
 public function filterAnswers(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model, array $currentNames)
 {
     $rows = $bridge->getRows();
     if (!$rows) {
         return $currentNames;
     }
     $keys = array();
     foreach ($rows as $row) {
         // Add the keys that contain values.
         $keys += $this->array_filter($row, $model);
     }
     $results = array_intersect($currentNames, array_keys($keys), array_keys($this->token->getRawAnswers()));
     // \MUtil_Echo::track($results);
     $results = $this->restoreHeaderPositions($model, $results);
     if ($results) {
         return $results;
     }
     return $this->getHeaders($model, $currentNames);
 }
コード例 #7
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->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));
     }
 }
コード例 #8
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)
 {
     // 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);
     }
 }
コード例 #9
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)
 {
     if ($model->has('row_class')) {
         $bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
     }
     if ($this->showMenu) {
         $showMenuItems = $this->getShowMenuItems();
         foreach ($showMenuItems as $menuItem) {
             $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge));
         }
     }
     // Newline placeholder
     $br = \MUtil_Html::create('br');
     $by = \MUtil_Html::raw($this->_(' / '));
     $sp = \MUtil_Html::raw(' ');
     // make sure search results are highlighted
     $this->applyTextMarker();
     $bridge->addMultiSort('grco_created', $br, 'gr2o_patient_nr', $sp, 'respondent_name', $br, 'grco_address', $br, 'gtr_track_name');
     $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender', $br, 'gsu_survey_name');
     $bridge->addMultiSort('status', $by, 'filler', $br, 'grco_topic');
     if ($this->showMenu) {
         $items = $this->findMenuItems('track', 'show');
         $links = array();
         $params = array('gto_id_token' => $bridge->gto_id_token, \Gems_Model::ID_TYPE => 'token');
         $title = \MUtil_Html::create('strong', $this->_('+'));
         foreach ($items as $item) {
             if ($item instanceof \Gems_Menu_SubMenuItem) {
                 $bridge->addItemLink($item->toActionLinkLower($this->request, $params, $title));
             }
         }
     }
     $bridge->getTable()->appendAttrib('class', 'compliance');
     $tbody = $bridge->tbody();
     $td = $tbody[0][0];
     $td->appendAttrib('class', \MUtil_Lazy::method($this->util->getTokenData(), 'getStatusClass', $bridge->getLazy('status')));
 }
コード例 #10
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)
 {
     if ($model->has('row_class')) {
         $bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
     }
     if ($this->showMenu) {
         $showMenuItems = $this->getShowMenuItems();
         foreach ($showMenuItems as $menuItem) {
             $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge));
         }
     }
     // make sure search results are highlighted
     $this->applyTextMarker();
     parent::addBrowseTableColumns($bridge, $model);
     if ($this->showMenu) {
         $editMenuItems = $this->getEditMenuItems();
         foreach ($editMenuItems as $menuItem) {
             $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge));
         }
     }
 }
コード例 #11
0
 /**
  * Add first columns (group) from the model to the bridge that creates the browse table.
  *
  * You can actually add more than one column in this function, but just call all four functions
  * with the default columns in each
  *
  * 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 addBrowseColumn4(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $br = \MUtil_Html::create('br');
     // Display separator and phone sign only if phone exist.
     $phonesep = \MUtil_Html::raw('☏ ');
     // $bridge->itemIf($bridge->grs_phone_1, \MUtil_Html::raw('☏ '));
     $bridge->addMultiSort('grs_birthday', $br, $phonesep, 'grs_phone_1');
 }
コード例 #12
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)
 {
     $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);
 }
コード例 #13
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)
 {
     $tUtil = $this->util->getTokenData();
     $table = $bridge->getTable();
     $table->appendAttrib('class', 'compliance');
     $thead = $table->thead();
     $th_row = $thead->tr(array('class' => 'rounds'));
     $th = $th_row->td();
     $span = 1;
     $cRound = null;
     $cDesc = null;
     $thead->tr();
     if ($showMenuItem = $this->getShowMenuItem()) {
         $bridge->addItemLink($showMenuItem->toActionLinkLower($this->request, $bridge));
     }
     // Initialize alter
     $alternateClass = new \MUtil_Lazy_Alternate(array('odd', 'even'));
     foreach ($model->getItemsOrdered() as $name) {
         if ($label = $model->get($name, 'label')) {
             $round = $model->get($name, 'round');
             if ($round == $cRound) {
                 $span++;
                 $class = null;
             } else {
                 // If the round has an icon, show the icon else just 'R' since
                 // complete round description messes up the display
                 $th->append($cDesc);
                 $th->title = $cRound;
                 $th->colspan = $span;
                 $span = 1;
                 $cRound = $round;
                 if ($cIcon = $model->get($name, 'roundIcon')) {
                     $cDesc = \MUtil_Html_ImgElement::imgFile($cIcon, array('alt' => $cRound, 'title' => $cRound));
                 } else {
                     if (substr($name, 0, 5) == 'stat_') {
                         $cDesc = 'R';
                     } else {
                         $cDesc = null;
                     }
                 }
                 $class = 'newRound';
                 $thClass = $class . ' ' . $alternateClass;
                 // Add alternate class only for th
                 $th = $th_row->td(array('class' => $thClass));
             }
             if ($model->get($name, 'noSort')) {
                 $title = array(\MUtil_Lazy::method($tUtil, 'getStatusDescription', $bridge->{$name}), "\n" . $model->get($name, 'description'));
                 $token = 'tok_' . substr($name, 5);
                 $href = new \MUtil_Html_HrefArrayAttribute(array($this->request->getControllerKey() => 'track', $this->request->getActionKey() => 'show', \MUtil_Model::REQUEST_ID => $bridge->{$token}));
                 $href->setRouteReset();
                 $onclick = new \MUtil_Html_OnClickArrayAttribute();
                 $onclick->addUrl($href)->addCancelBubble();
                 $tds = $bridge->addColumn(array(\MUtil_Html_AElement::iflink($bridge->{$token}, array($href, 'onclick' => 'event.cancelBubble = true;', 'title' => $title, $bridge->{$name}), $bridge->{$name}), 'class' => array('round', \MUtil_Lazy::method($tUtil, 'getStatusClass', $bridge->{$name})), 'title' => $title, 'onclick' => \MUtil_Lazy::iff($bridge->{$token}, $onclick)), array($label, 'title' => $model->get($name, 'description'), 'class' => 'round'));
             } else {
                 $tds = $bridge->addSortable($name, $label);
             }
             if ($class) {
                 $tds->appendAttrib('class', $class);
             }
         }
     }
     $th->append($cRound);
     $th->colspan = $span;
 }
コード例 #14
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)
 {
     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);
             }
         }
     }
 }
コード例 #15
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');
              // */
 }
コード例 #16
0
 /**
  * Adds columns from the model to the bridge that creates the browse table.
  *
  * Adds a button column to the model, if such a button exists in the model.
  *
  * @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 ($model->has('row_class')) {
         $bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
     }
     // Add edit button if allowed, otherwise show, again if allowed
     if ($menuItem = $this->findAllowedMenuItem('show')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
     parent::addBrowseTableColumns($bridge, $model);
     // Add edit button if allowed, otherwise show, again if allowed
     if ($menuItem = $this->findAllowedMenuItem('edit')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
 }
コード例 #17
0
 /**
  * As this is a common cell setting, this function allows you to overrule it.
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function addRespondentCell(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $bridge->addMultiSort('gr2o_patient_nr', \MUtil_Html::raw('; '), 'respondent_name');
 }
コード例 #18
0
 protected function setTableHeader(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Lazy_RepeatableInterface $repeater, $columnClass)
 {
     $baseurl = $bridge->getBaseUrl();
     // Left cell with period types
     $th = $bridge->th($this->_('Period'), ' ');
     $th->class = 'middleAlign';
     $thdiv = $th->span()->spaced();
     // array('class' => 'rightFloat'));
     $contents = $this->getDateLabels();
     foreach ($this->getDateDescriptions() as $letter => $title) {
         if (isset($contents[$letter])) {
             $content = $contents[$letter];
         } else {
             $content = strtolower($this->_($letter));
         }
         if ($letter == $this->dateType) {
             $thdiv->span($content, array('class' => 'browselink btn btn-primary btn-xs disabled'));
         } else {
             $thdiv->a(array(self::DATE_TYPE => $letter, self::DATE_FACTOR => $this->dateFactorChanges[$letter]) + $baseurl, $content, array('class' => 'browselink btn btn-default btn-xs', 'title' => $title));
         }
     }
     // Repeating column
     switch ($this->dateType) {
         case 'D':
             // $header = $repeater->period_1;
             $header = $repeater->period_1->call($this->util->getTranslated()->formatDate);
             break;
         case 'W':
             $header = array($repeater->period_1, \MUtil_Html::create()->br(), \MUtil_Lazy::call('sprintf', $this->_('week %s'), $repeater->period_2));
             break;
         case 'M':
             $header = array($repeater->period_1, \MUtil_Html::create()->br(), $repeater->period_2->call($this->util->getLocalized()->getMonthName));
             break;
         case 'Y':
             $header = $repeater->period_1;
             break;
         default:
             throw new \Gems_Exception_Coding('Incorrect date_type value: ' . $this->dateType);
             //  $this->_getParam('date_type', 'W'));
     }
     $th = $bridge->th();
     $th->class = array($this->dataCellClass, $columnClass);
     $th->a(array(self::DATE_FACTOR => $repeater->date_factor, \MUtil_Model::AUTOSEARCH_RESET => null) + $baseurl, $header);
     $th->setRepeater($repeater);
     $th->setRepeatTags(true);
     $baseurl[\Gems_Selector_DateSelectorAbstract::DATE_FACTOR] = $repeater->date_factor;
     $baseurl[\Gems_Selector_DateSelectorAbstract::DATE_GROUP] = null;
     $th->onclick = array('location.href=\'', new \MUtil_Html_HrefArrayAttribute($baseurl), '\';');
 }
コード例 #19
0
 protected function setTableBody(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Lazy_RepeatableInterface $repeater, $columnClass)
 {
     $bridge->setAlternateRowClass('even', 'odd', 'odd');
     parent::setTableBody($bridge, $repeater, $columnClass);
 }
コード例 #20
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)
 {
     foreach ($model->getItemsOrdered() as $name) {
         if ($label = $model->get($name, 'label')) {
             $bridge->addSortable($name, $label);
         }
     }
 }