Page 1 of 1

add action in table_section_tabs

PostPosted: Mon Jul 07, 2008 7:41 am
by fantomasdm
is possible to add action on menu table_section!

[/img]

PostPosted: Mon Jul 07, 2008 10:12 am
by shannah
Are you talking about the tabs at the top of the page to select which table to view?

If so, then it is possible to do this, but it requires some PHP. In the application delegate class you can implement the blocks:
tables_menu_head To add tabs before the tables.
tables_menu_options To override the table tabs.
tables_menu_tail To add tabs after the tables.

Here is a snippet from the xataface.com site application delegate class that causes regular users to see the "Home", "Forum", "Documentation", and "Bug Tracker" tabs:

Code: Select all
function block__tables_menu_head(){
      $app =& Dataface_Application::getInstance();
      $query =& $app->getQuery();
      
      $options = array(
         array(
            'label'=>'Home',
            'url' => DATAFACE_SITE_HREF.'?-action=home',
            'selected'=> ( ( @$query['-action'] == 'home' ) ? ' class="selected"':'')
            ),
         array(
            'label'=>'Forum',
            'url' => DATAFACE_SITE_URL.'/forum/index.php',
            'selected'=> ((@$query['-action'] == 'a_z_index' ) ? ' class="selected"':'')
            ),
         array(
            'label'=>'Documentation',
            'url' => DATAFACE_SITE_URL.'/documentation',
            'selected'=> (preg_match('/^\/documentation/', $_SERVER['REQUEST_URI']) ? ' class="selected"':'')
            ),
         array(
            'label'=>'Bug Tracker',
            'url' => 'http://bugs.weblite.ca',
            'selected'=> false
            )
            
         );
      
      foreach ($options as $option){
         echo '<li '.$option['selected'].'><a href="'.htmlspecialchars($option['url']).'"'.$option['selected'].'>'.htmlspecialchars($option['label']).'</a></li>';
      }

      return null;
   }
   
   function block__tables_menu_options(){
      if ( isAdmin() ) return PEAR::raiseError('Admin doesnt override this', DATAFACE_E_REQUEST_NOT_HANDLED);
      echo '';
   }

PostPosted: Tue Jul 08, 2008 12:04 am
by fantomasdm
HI I add this

Code: Select all
function block__tables_menu_tail()
   {
      echo "<li><a href='http://inmilss007/GestPatologia/index.php?-action=reports'>Reports</a></li>";
   }


and now works very good!!
Thanks for all!! And sorry for my English!!