00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 class roc extends WebObject
00027 {
00028 function init()
00029 {
00030 $this->addSVar('id', 'SEE-GRID');
00031 $this->addSVar('mode', 'view');
00032 }
00033
00034 function on_set_mode($event_args)
00035 {
00036 $mode = $event_args['mode'];
00037
00038
00039 $roc_id = $this->getSVar('id');
00040 if ($mode=='edit' and !is_roc_admin($roc_id)) return;
00041
00042 if ($mode=='view')
00043 {
00044 WebApp::setSVar('country_edit->mode', 'hidden');
00045 }
00046
00047 $this->setSVar('mode', $mode);
00048 }
00049
00050 function on_save($event_args)
00051 {
00052
00053 $roc_id = $this->getSVar('id');
00054 if (!is_roc_admin($roc_id)) return;
00055
00056 $event_args['timestamp'] = time();
00057 WebApp::execDBCmd('save_roc', $event_args);
00058 }
00059
00060 function on_change_id($event_args)
00061 {
00062
00063 if (!is_goc_admin()) return;
00064
00065 $new_id = $event_args['ROC_id'];
00066
00067
00068 $rs = WebApp::openRS('get_roc_id', array('roc_id'=>$new_id));
00069 if (!$rs->EOF())
00070 {
00071 WebApp::message(T_("Another ROC with this id already exists!"));
00072 return;
00073 }
00074
00075
00076 $args = array('ROC_id'=>$new_id, 'timestamp'=>time());
00077 WebApp::execDBCmd('set_roc_id', $args);
00078
00079
00080 $old_id = $this->getSVar('id');
00081 $this->setSVar('id', $new_id);
00082
00083
00084 $args = array('new_roc_id'=>$new_id, 'old_roc_id'=>$old_id);
00085 WebApp::execDBCmd('update_roc_id', $args);
00086 }
00087
00088 function on_set_admin($event_args)
00089 {
00090
00091 if (!is_goc_admin())
00092 {
00093 WebApp::message(T_("Only a GOC admin can do this!"));
00094 return;
00095 }
00096
00097 $event_args['timestamp'] = time();
00098 WebApp::execDBCmd('set_admin', $event_args);
00099 }
00100
00101 function onRender()
00102 {
00103 $rs = WebApp::openRS('roc');
00104 $vars = $rs->Fields();
00105 $vars['timestamp'] = date('d/m/Y', $vars['timestamp']);
00106 WebApp::addVars($vars);
00107
00108 $roc_id = $this->getSVar('id');
00109 WebApp::addVar('is_roc_admin', is_roc_admin($roc_id));
00110 }
00111 }
00112 ?>