egroupware/calendar/preferences.php

192 lines
7.4 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
2001-02-25 17:08:31 +01:00
/* $Id$ */
$phpgw_flags = Array(
2001-03-31 02:57:47 +02:00
'currentapp' => 'calendar',
2001-02-25 17:08:31 +01:00
'enable_nextmatchs_class' => True,
2001-03-31 02:57:47 +02:00
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True
2001-02-25 17:08:31 +01:00
);
$phpgw_info['flags'] = $phpgw_flags;
include('../header.inc.php');
if ($submit)
{
$phpgw->preferences->read_repository();
$phpgw->preferences->add('calendar','weekdaystarts');
$phpgw->preferences->add('calendar','workdaystarts');
$phpgw->preferences->add('calendar','workdayends');
$phpgw->preferences->add('calendar','defaultcalendar');
$phpgw->preferences->add('calendar','defaultfilter');
$phpgw->preferences->add('calendar','locale');
2001-03-17 20:37:52 +01:00
if ($mainscreen_showevents == True)
2001-02-25 17:08:31 +01:00
{
$phpgw->preferences->add('calendar','mainscreen_showevents');
}
else
{
$phpgw->preferences->delete('calendar','mainscreen_showevents');
}
2001-03-17 20:37:52 +01:00
if ($send_updates == True)
{
$phpgw->preferences->add('calendar','send_updates');
}
else
{
$phpgw->preferences->delete('calendar','send_updates');
}
2001-03-17 20:37:52 +01:00
if ($display_status == True)
{
$phpgw->preferences->add('calendar','display_status');
}
else
{
$phpgw->preferences->delete('calendar','display_status');
}
if ($default_private == True)
{
$phpgw->preferences->add('calendar','default_private');
}
else
{
$phpgw->preferences->delete('calendar','default_private');
}
2001-02-25 17:08:31 +01:00
$phpgw->preferences->save_repository(True);
2001-02-25 17:08:31 +01:00
Header('Location: '.$phpgw->link('/preferences/index.php'));
$phpgw->common->phpgw_exit();
}
2001-02-25 17:08:31 +01:00
function display_item($field,$data)
{
global $phpgw, $p, $tr_color;
2001-02-25 17:08:31 +01:00
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$var = Array(
'bg_color' => $tr_color,
'field' => $field,
'data' => $data
);
$p->set_var($var);
$p->parse('row','pref_list',True);
}
2001-02-25 17:08:31 +01:00
$phpgw->common->phpgw_header();
echo parse_navbar();
2000-11-11 19:51:14 +01:00
2001-02-25 17:08:31 +01:00
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$templates = Array(
2001-03-31 02:57:47 +02:00
'pref' => 'pref.tpl',
'pref_colspan' => 'pref_colspan.tpl',
'pref_list' => 'pref_list.tpl',
2001-02-25 17:08:31 +01:00
);
$p->set_file($templates);
$var = Array(
2001-03-31 02:57:47 +02:00
'title' => lang('Calendar preferences'),
2001-03-10 05:52:12 +01:00
'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/preferences.php'),
2001-03-31 02:57:47 +02:00
'bg_color' => $phpgw_info['theme']['th_bg'],
2001-02-25 17:08:31 +01:00
'submit_lang' => lang('submit')
);
$p->set_var($var);
$p->set_var('text','&nbsp;');
$p->parse('row','pref_colspan',True);
// if ($totalerrors)
// {
// echo '<p><center>' . $phpgw->common->error_list($errors) . '</center>';
// }
2001-03-17 20:37:52 +01:00
$str = '<input type="checkbox" name="mainscreen_showevents" value="True"'.($phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == True?' checked':'').'>';
2001-02-25 17:08:31 +01:00
display_item(lang('show day view on main screen'),$str);
$t_weekday[$phpgw_info['user']['preferences']['calendar']['weekdaystarts']] = ' selected';
$str = '<select name="weekdaystarts">'
. '<option value="Monday"'.$t_weekday['Monday'].'>'.lang('Monday').'</option>'
. '<option value="Sunday"'.$t_weekday['Sunday'].'>'.lang('Sunday').'</option>'
. '</select>';
display_item(lang('weekday starts on'),$str);
$t_workdaystarts[$phpgw_info['user']['preferences']['calendar']['workdaystarts']] = ' selected';
$str = '<select name="workdaystarts">';
for ($i=0; $i<24; $i++)
{
$str .= '<option value="'.$i.'"'.$t_workdaystarts[$i].'>'
2001-04-19 19:38:42 +02:00
. $phpgw->common->formattime($i,'00') . '</option>';
2001-02-25 17:08:31 +01:00
}
$str .= '</select>';
display_item(lang('work day starts on'),$str);
$t_workdayends[$phpgw_info['user']['preferences']['calendar']['workdayends']] = ' selected';
$str = '<select name="workdayends">';
for ($i=0; $i<24; $i++)
{
$str .= '<option value="'.$i.'"'.$t_workdayends[$i].'>'
2001-04-19 19:38:42 +02:00
. $phpgw->common->formattime($i,'00') . '</option>';
2001-02-25 17:08:31 +01:00
}
$str .= '</select>';
display_item(lang('work day ends on'),$str);
$selected[$phpgw_info['user']['preferences']['calendar']['defaultcalendar']] = ' selected';
if (!isset($phpgw_info['user']['preferences']['calendar']['defaultcalendar']))
{
$selected['month.php'] = ' selected';
}
$str = '<select name="defaultcalendar">'
. '<option value="year.php"'.$selected['year.php'].'>'.lang('Yearly').'</option>'
. '<option value="month.php"'.$selected['month.php'].'>'.lang('Monthly').'</option>'
. '<option value="week.php"'.$selected['week.php'].'>'.lang('Weekly').'</option>'
. '<option value="day.php"'.$selected['day.php'].'>'.lang('Daily').'</option>'
. '</select>';
display_item(lang('default calendar view'),$str);
$selected = array();
$selected[$phpgw_info['user']['preferences']['calendar']['defaultfilter']] = ' selected';
if (! isset($phpgw_info['user']['preferences']['calendar']['defaultfilter']) || $phpgw_info['user']['preferences']['calendar']['defaultfilter'] == 'private')
{
$selected['private'] = ' selected';
}
$str = '<select name="defaultfilter">'
. '<option value="all"'.$selected['all'].'>'.lang('all').'</option>'
. '<option value="private"'.$selected['private'].'>'.lang('private only').'</option>'
2001-03-17 20:37:52 +01:00
// . '<option value="public"'.$selected['public'].'>'.lang('global public only').'</option>'
// . '<option value="group"'.$selected['group'].'>'.lang('group public only').'</option>'
// . '<option value="private+public"'.$selected['private+public'].'>'.lang('private and global public').'</option>'
// . '<option value="private+group"'.$selected['private+group'].'>'.lang('private and group public').'</option>'
// . '<option value="public+group"'.$selected['public+group'].'>'.lang('global public and group public').'</option>'
2001-02-25 17:08:31 +01:00
. '</select>';
display_item(lang('default calendar filter'),$str);
2001-03-17 20:37:52 +01:00
$str = '<input type="checkbox" name="send_updates" value="True"'.($phpgw_info['user']['preferences']['calendar']['send_updates'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['send_updates'] == True?' checked':'').'>';
display_item(lang('send updates via email'),$str);
2001-03-17 20:37:52 +01:00
$str = '<input type="checkbox" name="display_status" value="True"'.($phpgw_info['user']['preferences']['calendar']['display_status'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' checked':'').'>';
display_item(lang('display status of events'),$str);
$str = '<input type="checkbox" name="default_private" value="True"'.($phpgw_info['user']['preferences']['calendar']['default_private'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['default_private'] == True?' checked':'').'>';
display_item(lang('when creating new events default set to private'),$str);
$country = CreateObject('phpgwapi.country');
display_item(lang('Select country for including holidays'),$country->form_select($phpgw_info['user']['preferences']['calendar']['locale'],'locale'));
2001-02-25 17:08:31 +01:00
$p->pparse('out','pref');
$phpgw->common->phpgw_footer();
?>