main.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003 This file  is part  of HGSM.   HGSM is a  web application  for keeping
00004 information about a hierarchical structure (in this case a grid).
00005 
00006 Copyright 2005, 2006 Dashamir Hoxha, dashohoxha@users.sourceforge.net
00007 
00008 HGSM is free software; you  can redistribute it and/or modify it under
00009 the terms of  the GNU General Public License as  published by the Free
00010 Software  Foundation; either  version 2  of the  License, or  (at your
00011 option) any later version.
00012 
00013 HGSM is  distributed in the hope  that it will be  useful, but WITHOUT
00014 ANY WARRANTY; without even  the implied warranty of MERCHANTABILITY or
00015 FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
00016 for more details.
00017 
00018 You  should have received  a copy  of the  GNU General  Public License
00019 along with HGSM; if not,  write to the Free Software Foundation, Inc.,
00020 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021 */
00022 
00026 class main extends WebObject
00027 {
00028   function init()
00029     {
00030       WebApp::addSVar('interface', 'goc');
00031       WebApp::addSVar('interface_file', 'goc/goc.html');
00032       WebApp::addSVar('language', 'sq_AL');
00033     }
00034 
00035   function on_select($event_args)
00036     {
00037       $interface = $event_args['interface'];
00038       switch ($interface)
00039         {
00040         default:
00041         case 'goc':
00042           $interface_file = 'goc/goc.html';
00043           break;
00044         case 'roc':
00045           $interface_file = 'roc/roc.html';
00046           $roc_id = $event_args['roc_id'];
00047           WebApp::setSVar('roc->id', $roc_id);
00048           WebApp::setSVar('roc->mode', 'view');
00049           break;
00050         case 'country':
00051           $interface_file = 'country/country.html';
00052           $country_id = $event_args['country_id'];
00053           WebApp::setSVar('country->id', $country_id);
00054           WebApp::setSVar('country->mode', 'view');
00055           break;
00056         case 'site':
00057           $interface_file = 'site/site.html';
00058           $site_id = $event_args['site_id'];
00059           WebApp::setSVar('site->id', $site_id);
00060           WebApp::setSVar('site->mode', 'view');
00061           break;
00062         }
00063       WebApp::setSVar('interface', $interface);
00064       WebApp::setSVar('interface_file', $interface_file);
00065     }
00066 
00067   function on_language($event_args)
00068     {
00069       $lng = $event_args['lng'];
00070       WebApp::setSVar('language', $lng);
00071     }
00072 
00073   function onParse()
00074     {
00075       $lng = WebApp::getSVar('language');
00076       global $l10n;
00077       $l10n->set_lng($lng);
00078     }
00079 
00080   function onRender()
00081     {
00082       //recordset of languages
00083       $rs_langs = new EditableRS('languages', $query);
00084       $rs_langs->addRec( array('id'=>'en', 'label'=>'English') );
00085       $rs_langs->addRec( array('id'=>'sq_AL', 'label'=>'Albanian') );
00086 
00087       //add recordsets to the web page
00088       global $webPage;
00089       $webPage->addRecordset($rs_langs);
00090     }
00091 }
00092 ?>

Generated on Fri Jan 20 10:34:52 2006 for HGSM by  doxygen 1.4.5