egroupware/calendar/inc/class.bopreferences.inc.php

108 lines
3.1 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
* http://www.radix.net/~cknudsen *
* Modified by Mark Peters <skeeter@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. *
\**************************************************************************/
/* $Id$ */
class bopreferences
{
var $public_functions = Array(
'preferences' => True
);
var $prefs;
var $debug = False;
function bopreferences()
{
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->prefs['calendar'] = $GLOBALS['phpgw_info']['user']['preferences']['calendar'];
}
function preferences()
{
2002-09-20 01:45:19 +02:00
if (get_var('submit',Array('POST')))
{
2002-09-20 01:45:19 +02:00
$prefs = get_var('prefs',Array('POST'));
$GLOBALS['phpgw']->preferences->read_repository();
2002-04-18 01:43:29 +02:00
$pref_list = Array(
'weekdaystarts',
'workdaystarts',
'workdayends',
'defaultcalendar',
'defaultfilter',
2002-09-17 04:25:40 +02:00
'interval',
2002-09-20 01:45:19 +02:00
'planner_intervals_per_day',
'planner_start_with_group'
2002-04-18 01:43:29 +02:00
);
2002-04-18 01:43:29 +02:00
for($i=0;$i<count($pref_list);$i++)
{
2002-09-20 01:45:19 +02:00
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$prefs[$pref_list[$i]]);
}
2002-04-18 01:43:29 +02:00
$pref_list = Array(
'send_updates',
2002-09-21 23:50:30 +02:00
'send_extra'
);
if($prefs[$pref_list[1]] == True)
2002-09-21 23:50:30 +02:00
{
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[1],$prefs[$pref_list[1]]);
if($prefs[$pref_list[2]] == True)
2002-09-21 23:50:30 +02:00
{
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[2],$prefs[$pref_list[2]]);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[2]);
}
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[1]);
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[2]);
}
$pref_list = Array(
'mainscreen_showevents',
2002-04-18 01:43:29 +02:00
'display_status',
'default_private',
'display_minicals',
'print_black_white',
'weekdays_only'
);
2002-04-18 01:43:29 +02:00
for($i=0;$i<count($pref_list);$i++)
{
2002-09-20 01:45:19 +02:00
if ($prefs[$pref_list[$i]] == True)
2002-04-18 01:43:29 +02:00
{
2002-09-20 01:45:19 +02:00
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$prefs[$pref_list[$i]]);
2002-04-18 01:43:29 +02:00
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[$i]);
}
}
$GLOBALS['phpgw']->preferences->save_repository(True);
Header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php'));
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
exit;
}
}
}
2002-09-20 01:45:19 +02:00
?>