site.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 site extends WebObject
00027 {
00028   function init()
00029     {
00030       $this->addSVar('id', UNDEFINED);
00031       $this->addSVar('mode', 'view');  // view | edit
00032     }
00033 
00034   function on_set_mode($event_args)
00035     {
00036       $mode = $event_args['mode'];
00037 
00038       //(double)check that only a site admin can go to edit mode
00039       $site_id = $this->getSVar('id');
00040       if ($mode=='edit' and !is_site_admin($site_id))  return; 
00041 
00042       if ($mode=='view')
00043         {
00044           WebApp::setSVar('contact_edit->mode', 'hidden');
00045           WebApp::setSVar('node_edit->mode', 'hidden');
00046           WebApp::setSVar('downtime_edit->mode', 'hidden');
00047         }
00048 
00049       $this->setSVar('mode', $mode);
00050     }
00051 
00052   function onRender()
00053     {
00054       $rs = WebApp::openRS('get_site_fields');
00055       $vars = $rs->Fields();
00056       WebApp::addVars($vars);
00057 
00058       $site_id = $vars['site_id'];
00059       $country_id = $vars['country_id'];
00060       WebApp::addVar('is_site_admin', is_site_admin($site_id));
00061       WebApp::addVar('is_country_admin', is_country_admin($country_id));
00062     }
00063 }
00064 ?>

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