/**
  * Returns the rendered values of th earray elements
  *
  * @return array
  */
 protected function _getArrayRendered()
 {
     $results = parent::_getArrayRendered();
     if (isset($results[\MUtil_Model::REQUEST_ID1], $results[\MUtil_Model::REQUEST_ID2]) && $results[\MUtil_Model::REQUEST_ID2] == $this->_hiddenOrgId) {
         $results[\MUtil_Model::REQUEST_ID] = $results[\MUtil_Model::REQUEST_ID1];
         unset($results[\MUtil_Model::REQUEST_ID1], $results[\MUtil_Model::REQUEST_ID2]);
     }
     return $results;
 }
 /**
  * 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;
 }
 /**
  * Generate a hrf attribute using these sources
  *
  * @param \Gems_Menu_ParameterCollector $source A parameter source collection
  * @param boolean $condition When true the system may create a Lazy condition for the url
  * @return \MUtil_Html_HrefArrayAttribute
  */
 private function _toHRef(\Gems_Menu_ParameterCollector $source, &$condition)
 {
     if ($this->get('allowed')) {
         $parameters = array();
         if ($condition = $this->_applyParameterSources($source, $parameters, !$condition)) {
             if ($this->_hiddenOrgId) {
                 $url = new \Gems_Menu_HiddenOrganizationHrefAttribute($parameters);
                 $url->setHiddenOrgId($this->_hiddenOrgId);
             } else {
                 $url = new \MUtil_Html_HrefArrayAttribute($parameters);
             }
             $url->setRouteReset($this->get('reset_param', true));
             foreach (array('module', 'controller', 'action', 'route') as $name) {
                 if ($this->has($name)) {
                     $url->add($name, $this->get($name));
                     // \MUtil_Echo::r($name . '-' . $this->get($name));
                     // } else {
                     // \MUtil_Echo::r($name);
                 }
             }
             return $url;
         }
     }
 }