add action in table_section_tabs

A place for users and developers of the Xataface to discuss and receive support.

add action in table_section_tabs

Postby fantomasdm » Mon Jul 07, 2008 7:41 am

is possible to add action on menu table_section!

[/img]
fantomasdm
 
Posts: 114
Joined: Thu Mar 13, 2008 2:35 pm

Postby shannah » Mon Jul 07, 2008 10:12 am

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 '';
   }
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby fantomasdm » Tue Jul 08, 2008 12:04 am

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!!
fantomasdm
 
Posts: 114
Joined: Thu Mar 13, 2008 2:35 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 32 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved