From bc9ae2fa70c1152b4f5aac0abe7fc57ef7630615 Mon Sep 17 00:00:00 2001 From: skeeter Date: Thu, 25 Oct 2001 23:54:21 +0000 Subject: [PATCH] A little more support for alarm management. --- calendar/inc/class.boalarm.inc.php | 6 ++ calendar/inc/class.uialarm.inc.php | 60 ++++++++++++++++-- calendar/templates/default/alarm.tpl | 37 +++++++++++ .../templates/default/images/disabled.gif | Bin 154 -> 910 bytes 4 files changed, 98 insertions(+), 5 deletions(-) create mode 100755 calendar/templates/default/alarm.tpl diff --git a/calendar/inc/class.boalarm.inc.php b/calendar/inc/class.boalarm.inc.php index db7c2d1e28..363272a218 100755 --- a/calendar/inc/class.boalarm.inc.php +++ b/calendar/inc/class.boalarm.inc.php @@ -18,6 +18,7 @@ { var $so; var $cal; + var $cal_id; var $tz_offset; @@ -29,6 +30,11 @@ function boalarm() { + $cal_id = (isset($GLOBALS['HTTP_POST_VARS']['cal_id'])?intval($GLOBALS['HTTP_POST_VARS']['cal_id']):''); + if($cal_id) + { + $this->cal_id = $cal_id; + } $this->cal = CreateObject('calendar.bocalendar',1); $this->tz_offset = $this->cal->datetime->tz_offset; diff --git a/calendar/inc/class.uialarm.inc.php b/calendar/inc/class.uialarm.inc.php index ffde49e1ec..012138b2c6 100755 --- a/calendar/inc/class.uialarm.inc.php +++ b/calendar/inc/class.uialarm.inc.php @@ -20,6 +20,7 @@ var $template_dir; var $bo; + var $event; var $debug = False; // var $debug = True; @@ -46,23 +47,21 @@ echo "BO Owner : ".$this->bo->owner."
\n"; } - $this->template = $GLOBALS['phpgw']->template; $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar'); } function prep_page() { - $cal_id = $GLOBALS['HTTP_POST_VARS']['cal_id']; - $event = $this->bo->cal->read_entry(intval($GLOBALS['HTTP_POST_VARS']['cal_id'])); + $this->event = $this->bo->cal->read_entry($this->bo->cal_id); - $can_edit = $this->bo->cal->can_user_edit($event); + $can_edit = $this->bo->cal->can_user_edit($this->event); if(!$can_edit) { Header('Location : '.$GLOBALS['phpgw']->link('/index.php', Array( 'menuaction' => 'calendar.uicalendar.view', - 'cal_id' => $GLOBALS['HTTP_POST_VARS']['cal_id'] + 'cal_id' => $this->bo->cal_id ) ) ); @@ -71,6 +70,25 @@ unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw']->common->phpgw_header(); + + $this->template = CreateObject('phpgwapi.Template',$this->template_dir); + + $this->template->set_unknowns('keep'); + $this->template->set_file( + Array( + 'alarm' => 'alarm.tpl' + ) + ); + $this->template->set_block('alarm','alarm_management','alarm_management'); + $this->template->set_block('alarm','alarm_headers','alarm_headers'); + $this->template->set_block('alarm','list','list'); + $this->template->set_block('alarm','hr','hr'); + } + + function output_template_array($row,$list,$var) + { + $this->template->set_var($var); + $this->template->parse($row,$list,True); } /* Public functions */ @@ -78,6 +96,38 @@ function manager() { $this->prep_page(); + echo ExecMethod('calendar.uicalendar.view_event',$this->event); + + $this->template->set_var('hr_text','
'.lang('Alarms').'


'); + $this->template->parse('row','hr',True); + $var = Array( + 'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uialarm.form_handler')), + 'time_lang' => lang('Time'), + 'text_lang' => lang('Text'), + 'enabled_pict' => $GLOBALS['phpgw']->common->image('calendar','enabled.gif'), + 'disabled_pict' => $GLOBALS['phpgw']->common->image('calendar','disabled.gif') + ); + + $this->output_template_array('row','alarm_headers',$var); + $this->template->set_var('hr_text','
'); + $this->template->parse('row','hr',True); + + @reset($this->event['alarm']); + while(list($key,$alarm) = each($this->event['alarm'])) + { + $var = Array( + 'edit_box' => '', + 'field' => $icon.$GLOBALS['phpgw']->common->show_date($alarm['time']), + 'data' => $alarm['text'], + 'alarm_enabled' => ($alarm['enabled']?'enabled':' '), + 'alarm_disabled' => (!$alarm['enabled']?'disabled':' ') + ); + $this->output_template_array('row','list',$var); + } + $this->template->set_var('hr_text','
'); + $this->template->parse('row','hr',True); + + echo $this->template->fp('out','alarm_management'); } function add_alarm() diff --git a/calendar/templates/default/alarm.tpl b/calendar/templates/default/alarm.tpl new file mode 100755 index 0000000000..82fab1c8b9 --- /dev/null +++ b/calendar/templates/default/alarm.tpl @@ -0,0 +1,37 @@ + + +
+
+ + + {row} +
+
+
+
+ + + +   + {time_lang} + {text_lang} + enabled + disabled + + + + + {edit_box} + {field}: + {data} + {alarm_enabled} + {alarm_disabled} + + + + + + {hr_text} + + + diff --git a/calendar/templates/default/images/disabled.gif b/calendar/templates/default/images/disabled.gif index 1b4a173927a07ef73c8d28c7b7b6d98caa4391c7..e07e274740dd8d87a60f2338448d603560ac823a 100755 GIT binary patch literal 910 zcmc(ey=s(U5QUFnl^~)7MJ#LtQHzv<8`G=`{x+fzEwV)_2duJKS%_dEM3jI;m~IO@ zQ3>9_Sfq&-=~53~fgnh#@!7cvr+dGdIdgt?Z{4{$Tv}Vug8ph&Cb<++O4V;OxhYI( zs&1RhUExYs^|XaN6rl`NFI&n}k;+sxmX*8|r7TrLn?PcfS(?0Nptf2`nh;W%xU<1ZB6u=wA6iUDd6rk(fm_&v9~gjQB%%osu!bhQAi`y!!3K9{j)n6eAJRV8I%i@PY`Jfd(5ewi&0- z2dX+VtVAJ)c~?hB{sd0KL`sH)MoPp&4j7NqSc{j~0ZW$g0|QWuL`Z`LYiPm?B3uR< zY{1xNoIW2Yes}++&K(R6N&8xyU7!6YM)Obgb!~n9^Yr_x!{cMuA8&@{24{}0Uiv+K zvvOp6c;5DQZY<7^hd(Fxe`#ax%F3ywmmhcDE{^a1xvhI2UY}ilw|cO>wY#xzr!V`% kCqFiaCtnP9Cl~joC*FT~_Waw02cI5YJ3hI(H5zI89~R-b?f?J) literal 154 zcmZ?wbhEHb6l4%&c+9}?|Ns9Ft5!V>4gGrj_^-#0FEKD&mz8~1RCLGE@^xPyP!N0Rxd!`#6fZvZTzio_Z^dTDa%TNvm5oCDEgTHi06CaO^#A|>