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