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 info extends formWebObj
00029 {
00030 function on_save($event_args)
00031 {
00032
00033 $site_id = WebApp::getSVar('site->id');
00034 if (!is_site_admin($site_id))
00035 {
00036 WebApp::message(T_("Only a site admin can do this!"));
00037 return;
00038 }
00039
00040 $site_info = $event_args;
00041 $site_info['timestamp'] = time();
00042 $this->update_record($site_info, 'sites', 'site_id');
00043 }
00044
00045 function on_change_id($event_args)
00046 {
00047
00048 $rs = WebApp::openRS('get_country_id');
00049 $country_id = $rs->Field('country_id');
00050 if (!is_country_admin($country_id))
00051 {
00052 WebApp::message(T_("Only a country admin can do this!"));
00053 return;
00054 }
00055
00056 $new_id = $event_args['site_id'];
00057
00058
00059 $rs = WebApp::openRS('get_site_id', array('site_id'=>$new_id));
00060 if (!$rs->EOF())
00061 {
00062 WebApp::message(T_("Another site with this id already exists!"));
00063 return;
00064 }
00065
00066
00067 $args = array('site_id'=>$new_id, 'timestamp'=>time());
00068 WebApp::execDBCmd('set_site_id', $args);
00069
00070
00071 $old_id = WebApp::getSVar('site->id');
00072 WebApp::setSVar('site->id', $new_id);
00073
00074
00075 $args = array('new_site_id'=>$new_id, 'old_site_id'=>$old_id);
00076 WebApp::execDBCmd('update_nodes_site_id', $args);
00077 WebApp::execDBCmd('update_contacts_site_id', $args);
00078 WebApp::execDBCmd('update_downtimes_site_id', $args);
00079 }
00080
00081 function on_set_admin($event_args)
00082 {
00083
00084 $rs = WebApp::openRS('get_country_id');
00085 $country_id = $rs->Field('country_id');
00086 if (!is_country_admin($country_id))
00087 {
00088 WebApp::message(T_("Only a country admin can do this!"));
00089 return;
00090 }
00091
00092 $event_args['timestamp'] = time();
00093 WebApp::execDBCmd('set_admin', $event_args);
00094 }
00095
00096 function onRender()
00097 {
00098 $rs = WebApp::openRS('get_site');
00099 $vars = $rs->Fields();
00100 $vars['timestamp'] = date('d/m/Y', $vars['timestamp']);
00101 WebApp::addVars($vars);
00102 }
00103 }
00104 ?>