change of the initialization of the calendar

This commit is contained in:
skeeter 2001-02-15 04:12:31 +00:00
parent 2222b135ef
commit 584c8dd637
3 changed files with 42 additions and 9 deletions

View File

@ -19,9 +19,32 @@
class calendar extends calendar_
{
function calendar($p_friendly=False)
function calendar($params=False)
{
$this->printer_friendly = $p_friendly;
global $phpgw_info;
if(gettype($params)=="array")
{
while(list($key,$value) = each($params))
{
$this->$key = $value;
}
}
else
{
$this->printer_friendly = $params;
}
if(!$this->owner)
{
$this->owner = $phpgw_info['user']['account_id'];
}
if(!isset($this->rights))
{
$this->rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
}
$this->today = $this->localdates(time());
}
}

View File

@ -18,9 +18,13 @@
{
var $stream;
var $user;
var $printer_friendly = False;
var $owner;
var $rights;
var $cal_event;
var $today = Array('raw','day','month','year','full','dow','dm','bd');
var $printer_friendly = False;
var $repeated_events;
var $checked_events;
var $re = 0;
@ -133,9 +137,7 @@
function check_perms($needed)
{
global $rights;
if($rights & $needed)
if($this->rights & $needed)
{
return True;
}

View File

@ -19,6 +19,8 @@
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
}
// This is the initialization of the ACL usage
$grants = $phpgw->acl->get_grants('calendar');
if(!isset($owner))
@ -36,16 +38,22 @@
if($grants[$owner])
{
$rights = $grants[$owner];
if (!($rights & PHPGW_ACL_READ))
if ($rights == 0)
{
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
}
}
}
/* Load calendar class */
$printer_friendly = ((isset($friendly) && ($friendly==1))?True:False);
$phpgw->calendar = CreateObject('calendar.calendar',$printer_friendly);
$parameters = Array(
'printer_friendly' => ((isset($friendly) && ($friendly==1))?True:False),
'owner' => $owner,
'rights' => $rights
);
$phpgw->calendar = CreateObject('calendar.calendar',$parameters);
if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts']))
$phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday';