egroupware_official/calendar/inc/functions.inc.php

104 lines
2.6 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
/**************************************************************************\
2000-12-26 21:13:34 +01:00
* phpGroupWare *
2000-08-18 05:24:22 +02:00
* 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. *
\**************************************************************************/
/* $Id$ */
2001-02-20 04:48:00 +01:00
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if(!isset($filter) || !$filter)
{
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
// This is the initialization of the ACL usage
2001-02-20 04:48:00 +01:00
$grants = $phpgw->acl->get_grants('calendar');
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if(!isset($owner))
{
$owner = 0;
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if(!isset($owner) || !$owner)
{
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
}
else
{
if($grants[$owner])
{
$rights = $grants[$owner];
if ($rights == 0)
{
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
}
}
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
/* Load calendar class */
$parameters = Array(
'printer_friendly'=> ((isset($friendly) && ($friendly==1))?True:False),
'owner' => $owner,
'rights' => $rights
);
2001-02-20 04:48:00 +01:00
$phpgw->calendar = CreateObject('calendar.calendar',$parameters);
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts']))
{
$phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday';
}
if (isset($date) && strlen($date) > 0)
{
$thisyear = intval(substr($date, 0, 4));
$thismonth = intval(substr($date, 4, 2));
$thisday = intval(substr($date, 6, 2));
}
else
{
if (!isset($day) || !$day)
{
$thisday = $phpgw->calendar->today['day'];
}
else
{
$thisday = $day;
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if (!isset($month) || !$month)
{
$thismonth = $phpgw->calendar->today['month'];
}
else
{
$thismonth = $month;
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
if (!isset($year) || !$year)
{
$thisyear = $phpgw->calendar->today['year'];
}
else
{
$thisyear = $year;
}
2001-02-14 03:58:46 +01:00
2001-02-20 04:48:00 +01:00
}
2001-02-14 03:58:46 +01:00
$phpgw->calendar->tempyear = $thisyear;
$phpgw->calendar->tempmonth = $thismonth;
$phpgw->calendar->tempday = $thisday;
?>