egroupware_official/calendar/preferences.php

153 lines
5.7 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(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True,
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True
);
$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');
if ($mainscreen_showevents)
{
$phpgw->preferences->add('calendar','mainscreen_showevents');
}
else
{
$phpgw->preferences->delete('calendar','mainscreen_showevents');
}
$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(
'pref' => 'pref.tpl',
'pref_colspan' => 'pref_colspan.tpl',
'pref_list' => 'pref_list.tpl',
);
$p->set_file($templates);
$var = Array(
'title' => lang('Calendar preferences'),
'action_url' => $phpgw->link(''),
'bg_color' => $phpgw_info['theme']['th_bg'],
'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>';
// }
$str = '<input type="checkbox" name="mainscreen_showevents" value="Y"'.($phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == 'Y'?' checked':'').'>';
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].'>'
. $phpgw->common->formattime($i+1,'00') . '</option>';
}
$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].'>'
. $phpgw->common->formattime($i+1,'00') . '</option>';
}
$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>'
. '<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>'
. '</select>';
display_item(lang('default calendar filter'),$str);
$p->pparse('out','pref');
$phpgw->common->phpgw_footer();
?>