Cleanup for php3 support.

This commit is contained in:
skeeter 2001-06-01 03:55:05 +00:00
parent 22e3591f14
commit d17e4d5648
4 changed files with 44 additions and 18 deletions

View File

@ -38,7 +38,7 @@ class calendar extends calendar_
var $image_dir;
var $filter;
var $repeating_events;
var $repeating_events = Array();
var $repeated_events = Array();
var $repeating_event_matches = 0;
var $sorted_events_matching = 0;
@ -426,11 +426,16 @@ class calendar extends calendar_
}
else
{
$repetitive_events = Array();
$this->repeated_events = $events;
$c_events = count($events);
for($i=0;$i<$c_events;$i++)
if($c_events > 0)
{
$this->repeating_events[] = $this->fetch_event($events[$i]);
for($i=0;$i<$c_events;$i++)
{
$repititive_events[] = $this->fetch_event($events[$i]);
}
$this->repeating_events = $repititive_events;
}
}
}
@ -453,6 +458,7 @@ class calendar extends calendar_
$search_date_day = date('d',$datetime);
$search_date_dow = date('w',$datetime);
$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
@reset($this->repeated_events);
$r_events = count($this->repeated_events);
for ($i=0;$i<$r_events;$i++)
{
@ -586,7 +592,7 @@ class calendar extends calendar_
$this->sorted_events_matching = 0;
$this->set_filter();
$owner = !$owner?$phpgw_info['user']['account_id']:$owner;
$repeating_events_matched = $this->check_repeating_entries($datetime - $this->tz_offset);
$repeating_events_matched = $this->check_repeating_entries($datetime - $this->datetime->tz_offset);
$eod = $datetime + 86399;
$sql = "AND (phpgw_cal.cal_type != 'M') "
. 'AND ((phpgw_cal.datetime >= '.$datetime.' AND phpgw_cal.datetime <= '.$eod.') '
@ -602,6 +608,8 @@ class calendar extends calendar_
$sql .= ') ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
$event = Array();
$event = $this->get_event_ids(False,$sql);
if($this->repeating_event_matches == False && $event == False)
@ -609,12 +617,15 @@ class calendar extends calendar_
return False;
}
if($this->repeating_event_matches != False)
if($this->repeating_event_matches != 0)
{
reset($repeating_events_matched);
while(list($key,$value) = each($repeating_events_matched))
if(count($repeating_events_matched))
{
$event[] = $value;
while(list($key,$value) = each($repeating_events_matched))
{
$event[] = intval($value);
}
}
}
@ -628,7 +639,7 @@ class calendar extends calendar_
{
for($i=0;$i<$this->sorted_events_matching;$i++)
{
$events[] = $this->fetch_event($event[$i]);
$events[] = $this->fetch_event(intval($event[$i]));
}
if($this->sorted_events_matching == 1)
@ -1104,7 +1115,9 @@ class calendar extends calendar_
'events' => ''
);
$p->set_var($var);
for ($k=0;$k<$this->sorted_events_matching;$k++)
$c_rep_events = count($rep_events);
for ($k=0;$k<$c_rep_events;$k++)
// for ($k=0;$k<$this->sorted_events_matching;$k++)
{
$lr_events = $rep_events[$k];

View File

@ -19,7 +19,7 @@ class calendar_holiday
var $tz_offset;
var $holidays = Array();
var $index = Array();
var $users;
var $users = Array();
var $datetime;
function calendar_holiday($owner='')
@ -28,13 +28,19 @@ class calendar_holiday
$this->datetime = CreateObject('phpgwapi.datetime');
$this->db = $phpgw->db;
$this->users['user'] = $phpgw_info['user']['preferences']['calendar']['locale'];
if(isset($phpgw_info['user']['preferences']['calendar']['locale']) && $phpgw_info['user']['preferences']['calendar']['locale'])
{
$this->users['user'] = $phpgw_info['user']['preferences']['calendar']['locale'];
}
$owner_id = get_account_id($owner);
if($owner_id != $phpgw_info['user']['account_id'])
{
$owner_pref = CreateObject('phpgwapi.preferences',$owner_id);
$owner_prefs = $owner_pref->read_repository();
$this->users['owner'] = $owner_prefs['calendar']['locale'];
if(isset($owner_prefs['calendar']['locale']) && $owner_prefs['calendar']['locale'])
{
$this->users['owner'] = $owner_prefs['calendar']['locale'];
}
}
if($phpgw_info['server']['auto_load_holidays'] == True)
{
@ -101,7 +107,7 @@ class calendar_holiday
else
{
$pos = strpos(' '.$phpgw_info['server']['webserver_url'],$HTTP_HOST);
if($pos === False)
if($pos == False)
{
switch($SERVER_PORT)
{
@ -209,6 +215,9 @@ class calendar_holiday
$this->year = intval($phpgw->calendar->tempyear);
$sql = $this->build_holiday_query();
if($sql == False)
{ return False;
}
$this->holidays = Null;
$this->db->query($sql,__LINE__,__FILE__);
@ -272,6 +281,10 @@ class calendar_holiday
function build_holiday_query()
{
if(!isset($this->users) || count($this->users) == 0)
{
return False;
}
$sql = 'SELECT * FROM phpgw_cal_holidays WHERE locale in (';
$find_it = '';
reset($this->users);

View File

@ -32,7 +32,6 @@ class calendar_ extends calendar__
{
global $phpgw, $phpgw_info;
$this->stream = $phpgw->db;
if($user=='')
{
settype($user,'integer');
@ -47,6 +46,7 @@ class calendar_ extends calendar__
$this->user = $phpgw->accounts->name2id($user);
}
$this->stream = $phpgw->db;
return $this->stream;
}

View File

@ -15,7 +15,7 @@
/* $Id$ */
$phpgw_flags = array(
'currentapp' => 'calendar',
'currentapp' => 'calendar'
);
$phpgw_info['flags'] = $phpgw_flags;
@ -36,11 +36,11 @@
}
$phpgw->calendar->open('INBOX',$owner,'');
$event = $phpgw->calendar->fetch_event($id);
$event = $phpgw->calendar->fetch_event(intval($id));
echo '<center>';
if($event != False)
if(isset($event->id))
{
echo $phpgw->calendar->view_event($event);