mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
A little more support for alarm management.
This commit is contained in:
parent
551bfb8dbb
commit
bc9ae2fa70
@ -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;
|
||||
|
||||
|
@ -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."<br>\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','<center><b>'.lang('Alarms').'</b></center></br><hr>');
|
||||
$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','<hr>');
|
||||
$this->template->parse('row','hr',True);
|
||||
|
||||
@reset($this->event['alarm']);
|
||||
while(list($key,$alarm) = each($this->event['alarm']))
|
||||
{
|
||||
$var = Array(
|
||||
'edit_box' => '<input type="checkbox" name="alarm[id]" value="'.$alarm['id'].'">',
|
||||
'field' => $icon.$GLOBALS['phpgw']->common->show_date($alarm['time']),
|
||||
'data' => $alarm['text'],
|
||||
'alarm_enabled' => ($alarm['enabled']?'<img src="'.$GLOBALS['phpgw']->common->image('calendar','enabled.gif').'" width="13" height="13" alt="enabled">':' '),
|
||||
'alarm_disabled' => (!$alarm['enabled']?'<img src="'.$GLOBALS['phpgw']->common->image('calendar','disabled.gif').'" width="13" height="13" alt="disabled">':' ')
|
||||
);
|
||||
$this->output_template_array('row','list',$var);
|
||||
}
|
||||
$this->template->set_var('hr_text','<hr>');
|
||||
$this->template->parse('row','hr',True);
|
||||
|
||||
echo $this->template->fp('out','alarm_management');
|
||||
}
|
||||
|
||||
function add_alarm()
|
||||
|
37
calendar/templates/default/alarm.tpl
Executable file
37
calendar/templates/default/alarm.tpl
Executable file
@ -0,0 +1,37 @@
|
||||
<!-- $Id$ -->
|
||||
<!-- BEGIN alarm_management -->
|
||||
<form action="{action_url}" method="post" name="alarmform">
|
||||
<center>
|
||||
<font color="{bg_text}">
|
||||
<table border="0" width="75%">
|
||||
{row}
|
||||
</table>
|
||||
</font>
|
||||
</center>
|
||||
</form>
|
||||
<!-- END alarm_management -->
|
||||
<!-- BEGIN alarm_headers -->
|
||||
<tr>
|
||||
<th valign="top" align="left" width="4%"> </b></th>
|
||||
<th valign="top" align="left" width="30%"><b>{time_lang}</b></th>
|
||||
<th valign="top" align="left" width="54%">{text_lang}</th>
|
||||
<th valign="top" align="left" width="6%"><img src="{enabled_pict}" width="13" height="13" alt="enabled"></th>
|
||||
<th valign="top" align="left" width="6%"><img src="{disabled_pict}" width="13" height="13" alt="disabled"></th>
|
||||
</tr>
|
||||
<!-- END alarm_headers -->
|
||||
<!-- BEGIN list -->
|
||||
<tr>
|
||||
<td valign="top" align="left" width="4%">{edit_box}</td>
|
||||
<td valign="top" align="left" width="30%"><b>{field}:</b></td>
|
||||
<td valign="top" align="left" width="54%">{data}</td>
|
||||
<td valign="top" align="left" width="6%">{alarm_enabled}</td>
|
||||
<td valign="top" align="left" width="6%">{alarm_disabled}</td>
|
||||
</tr>
|
||||
<!-- END list -->
|
||||
<!-- BEGIN hr -->
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
{hr_text}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END hr -->
|
Binary file not shown.
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 910 B |
Loading…
Reference in New Issue
Block a user