tabs1.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    This file is part of DocBookWiki.  DocBookWiki is a web application
00004    that displays and edits DocBook documents.
00005 
00006    Copyright (C) 2004, 2005, 2006, 2007
00007    Dashamir Hoxha, dashohoxha@users.sourceforge.net
00008 
00009    DocBookWiki is free software; you can redistribute it and/or modify
00010    it under the  terms of the GNU General  Public License as published
00011    by the Free  Software Foundation; either version 2  of the License,
00012    or (at your option) any later version.
00013 
00014    DocBookWiki is distributed in the  hope that it will be useful, but
00015    WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
00016    MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
00017    General Public License for more details.
00018 
00019    You should have  received a copy of the  GNU General Public License
00020    along  with  DocBookWiki;  if  not,  write  to  the  Free  Software
00021    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022    USA
00023   */
00024 
00029 class tabs1 extends WebObject
00030 {
00031   function init()
00032   {
00033     $items_file = $this->params["items"];
00034     $items_file = WebApp::replaceVars($items_file);
00035     $this->addSVar("items_file", $items_file);
00036 
00037     //set the first menu item as the selected item
00038     include $items_file; //read the menu items
00039     $first_item = key($menu_items);
00040     $this->addSVar("selected_item", $first_item); 
00041   }
00042 
00043   function on_select($event_args)
00044   {
00045     $item = $event_args["item"];
00046     $this->setSVar("selected_item", $item);
00047   } 
00048 
00049   function onRender()
00050   {
00051     $this->add_items_list();
00052   }
00053 
00054   function add_items_list()
00055   {
00056     $obj_vars = $this->getObjVars();
00057     $obj_name = $obj_vars["obj_name"];
00058     $obj_count = $obj_vars["obj_count"];
00059     $rs = new EditableRS($obj_name."_items");
00060 
00061     //read the menu items
00062     $items_file = $this->getSVar("items_file");
00063     include $items_file;
00064 
00065     //fill the recordset
00066     $selected = $this->getSVar("selected_item");
00067     while ( list($item, $label) = each($menu_items) )
00068       {
00069         $css_class = ($item==$selected ? "tabs1-item-selected" : "tabs1-item");
00070         $rec = array(
00071                      "item"  => $item, 
00072                      "label" => $label,
00073                      "class" => $css_class
00074                      );
00075         $rs->addRec($rec);
00076       }
00077 
00078     //set the recordset to the page
00079     global $webPage;
00080     $webPage->addRecordset($rs);
00081   }
00082 }
00083 ?>

Generated on Wed Jan 9 08:27:32 2008 for DokBookWiki by  doxygen 1.5.2