00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 include_once FORM_PATH.'formWebObj.php';
00024
00028 class downtime_edit extends formWebObj
00029 {
00030 var $downtime_record = array(
00031 'start' => '',
00032 'endtime' => '',
00033 'description' => ''
00034 );
00035
00036 function init()
00037 {
00038 $this->addSVar('mode', 'hidden');
00039 $this->addSVar('downtime_id', UNDEFINED);
00040 }
00041
00042 function on_save($event_args)
00043 {
00044
00045 $site_id = WebApp::getSVar('site->id');
00046 if (!is_site_admin($site_id))
00047 {
00048 WebApp::message(T_("Only a site admin can do this!"));
00049 return;
00050 }
00051
00052 $mode = $this->getSVar('mode');
00053
00054 if ($mode=='add')
00055 {
00056
00057 WebApp::execDBCmd('add_downtime', $event_args);
00058
00059
00060 $this->setSVar('downtime_id', $event_args['downtime_id']);
00061 }
00062 elseif ($mode=='edit')
00063 {
00064 WebApp::execDBCmd('update_downtime', $event_args);
00065 }
00066
00067
00068 $this->setSVar('mode', 'hidden');
00069 }
00070
00071 function onRender()
00072 {
00073 $mode = $this->getSVar('mode');
00074 if ($mode=='add')
00075 {
00076 WebApp::addVars($this->downtime_record);
00077 }
00078 elseif ($mode=='edit')
00079 {
00080 $rs = WebApp::openRS('get_downtime');
00081 WebApp::addVars($rs->Fields());
00082 }
00083 }
00084 }
00085 ?>