original_string: public function showAction()
      {
          $this->html->h2($this->getTopicTitle());
  
          $context = $this->_getParam('id', 'gems');
          $this->_upgrades->setContext($context);
          if ($info = $this->_upgrades->getUpgradesInfo($context)) {
              $this->html->table(array('class'=>'browser'))->tr()
                  ->th($this->_('Context'))->td($info['context'])
                  ->tr()
                  ->th($this->_('Level'))->td($info['level']);
              $data = $this->_upgrades->getUpgrades();
              foreach($data as $level => $row) {
                  foreach($this->menu->getCurrent()->getChildren() as $menuItem) {
                      if ($menuItem->is('allowed', true)) {
                          $show = true;
                          if ($level <= $info['level'] && $menuItem->is('action','execute-to')) {
                              //When this level is < current level don't allow to execute from current level to this one
                              $show = false;
                          }
                          if ($level <= $info['level'] && $menuItem->is('action','execute-from')) {
                              //When this level is < current level don't allow to execute from current level to this one
                              $show = false;
                          }
                          if ($show) {
                              $row['action'][] = $menuItem->toActionLinkLower($this->getRequest(), $row, array('from'=>$level, 'to'=>$level));
                          }
                      }
                  }
                  $row['level'] = $level;
                  $data[$level] = $row;
              }
              $displayColumns = array('level' => $this->_('Level'),
                                      'info'   => $this->_('Description'),
                                      'action' => $this->_('Action'));
              $this->addSnippet('SelectiveTableSnippet', 'data', $data, 'class', 'browser', 'columns', $displayColumns);
          } else {
              $this->html[] = sprintf($this->_('Context %s not found!'), $context);
          }
  
          if ($parentItem = $this->menu->getCurrent()->getParent()) {
              $this->html[] = $parentItem->toActionLink($this->getRequest(), $this->_('Cancel'));
          }
      }
code: public function showAction()
      {
          $this->html->h2($this->getTopicTitle());
  
          $context = $this->_getParam('id', 'gems');
          $this->_upgrades->setContext($context);
          if ($info = $this->_upgrades->getUpgradesInfo($context)) {
              $this->html->table(array('class'=>'browser'))->tr()
                  ->th($this->_('Context'))->td($info['context'])
                  ->tr()
                  ->th($this->_('Level'))->td($info['level']);
              $data = $this->_upgrades->getUpgrades();
              foreach($data as $level => $row) {
                  foreach($this->menu->getCurrent()->getChildren() as $menuItem) {
                      if ($menuItem->is('allowed', true)) {
                          $show = true;
                          if ($level <= $info['level'] && $menuItem->is('action','execute-to')) {
                              //When this level is < current level don't allow to execute from current level to this one
                              $show = false;
                          }
                          if ($level <= $info['level'] && $menuItem->is('action','execute-from')) {
                              //When this level is < current level don't allow to execute from current level to this one
                              $show = false;
                          }
                          if ($show) {
                              $row['action'][] = $menuItem->toActionLinkLower($this->getRequest(), $row, array('from'=>$level, 'to'=>$level));
                          }
                      }
                  }
                  $row['level'] = $level;
                  $data[$level] = $row;
              }
              $displayColumns = array('level' => $this->_('Level'),
                                      'info'   => $this->_('Description'),
                                      'action' => $this->_('Action'));
              $this->addSnippet('SelectiveTableSnippet', 'data', $data, 'class', 'browser', 'columns', $displayColumns);
          } else {
              $this->html[] = sprintf($this->_('Context %s not found!'), $context);
          }
  
          if ($parentItem = $this->menu->getCurrent()->getParent()) {
              $this->html[] = $parentItem->toActionLink($this->getRequest(), $this->_('Cancel'));
          }
      }
code_tokens: public function showAction ( ) { $ this -> html -> h2 ( $ this -> getTopicTitle ( ) ) ; $ context = $ this -> _getParam ( 'id' , 'gems' ) ; $ this -> _upgrades -> setContext ( $ context ) ; if ( $ info = $ this -> _upgrades -> getUpgradesInfo ( $ context ) ) { $ this -> html -> table ( array ( 'class' => 'browser' ) ) -> tr ( ) -> th ( $ this -> _ ( 'Context' ) ) -> td ( $ info [ 'context' ] ) -> tr ( ) -> th ( $ this -> _ ( 'Level' ) ) -> td ( $ info [ 'level' ] ) ; $ data = $ this -> _upgrades -> getUpgrades ( ) ; foreach ( $ data as $ level => $ row ) { foreach ( $ this -> menu -> getCurrent ( ) -> getChildren ( ) as $ menuItem ) { if ( $ menuItem -> is ( 'allowed' , true ) ) { $ show = true ; if ( $ level <= $ info [ 'level' ] && $ menuItem -> is ( 'action' , 'execute-to' ) ) { //When this level is < current level don't allow to execute from current level to this one $ show = false ; } if ( $ level <= $ info [ 'level' ] && $ menuItem -> is ( 'action' , 'execute-from' ) ) { //When this level is < current level don't allow to execute from current level to this one $ show = false ; } if ( $ show ) { $ row [ 'action' ] [ ] = $ menuItem -> toActionLinkLower ( $ this -> getRequest ( ) , $ row , array ( 'from' => $ level , 'to' => $ level ) ) ; } } } $ row [ 'level' ] = $ level ; $ data [ $ level ] = $ row ; } $ displayColumns = array ( 'level' => $ this -> _ ( 'Level' ) , 'info' => $ this -> _ ( 'Description' ) , 'action' => $ this -> _ ( 'Action' ) ) ; $ this -> addSnippet ( 'SelectiveTableSnippet' , 'data' , $ data , 'class' , 'browser' , 'columns' , $ displayColumns ) ; } else { $ this -> html [ ] = sprintf ( $ this -> _ ( 'Context %s not found!' ) , $ context ) ; } if ( $ parentItem = $ this -> menu -> getCurrent ( ) -> getParent ( ) ) { $ this -> html [ ] = $ parentItem -> toActionLink ( $ this -> getRequest ( ) , $ this -> _ ( 'Cancel' ) ) ; } }
docstring: Show the upgrades and level for a certain context
  
  Usage: show/context/<context>
docstring_tokens: Show the upgrades and level for a certain context