mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:44 +01:00
Optimizations to the calendar. Also cleaned up a little of the planner code.
This commit is contained in:
parent
c9ea092eae
commit
61f8227dcc
@ -73,6 +73,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
var $debug = False;
|
var $debug = False;
|
||||||
|
// var $debug = True;
|
||||||
|
|
||||||
var $so;
|
var $so;
|
||||||
var $cached_events;
|
var $cached_events;
|
||||||
@ -105,8 +106,6 @@
|
|||||||
|
|
||||||
function bocalendar($session=0)
|
function bocalendar($session=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||||
|
|
||||||
$this->grants = $GLOBALS['phpgw']->acl->get_grants('calendar');
|
$this->grants = $GLOBALS['phpgw']->acl->get_grants('calendar');
|
||||||
@ -214,17 +213,13 @@
|
|||||||
{
|
{
|
||||||
if ($this->use_session)
|
if ($this->use_session)
|
||||||
{
|
{
|
||||||
global $phpgw;
|
|
||||||
|
|
||||||
if($this->debug) { echo '<br>Save:'; _debug_array($data); }
|
if($this->debug) { echo '<br>Save:'; _debug_array($data); }
|
||||||
$phpgw->session->appsession('session_data','calendar',$data);
|
$GLOBALS['phpgw']->session->appsession('session_data','calendar',$data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_sessiondata()
|
function read_sessiondata()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$data = $GLOBALS['phpgw']->session->appsession('session_data','calendar');
|
$data = $GLOBALS['phpgw']->session->appsession('session_data','calendar');
|
||||||
if($this->debug) { echo '<br>Read:'; _debug_array($data); }
|
if($this->debug) { echo '<br>Read:'; _debug_array($data); }
|
||||||
|
|
||||||
@ -265,8 +260,6 @@
|
|||||||
|
|
||||||
function delete_calendar($owner)
|
function delete_calendar($owner)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($GLOBALS['phpgw_info']['user']['apps']['admin'])
|
if($GLOBALS['phpgw_info']['user']['apps']['admin'])
|
||||||
{
|
{
|
||||||
$this->so->delete_calendar($owner);
|
$this->so->delete_calendar($owner);
|
||||||
@ -275,8 +268,6 @@
|
|||||||
|
|
||||||
function change_owner($account_id,$new_owner)
|
function change_owner($account_id,$new_owner)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql')
|
if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql')
|
||||||
{
|
{
|
||||||
$this->so->change_owner($account_id,$new_owner);
|
$this->so->change_owner($account_id,$new_owner);
|
||||||
@ -287,7 +278,7 @@
|
|||||||
{
|
{
|
||||||
if($this->check_perms(PHPGW_ACL_DELETE))
|
if($this->check_perms(PHPGW_ACL_DELETE))
|
||||||
{
|
{
|
||||||
reset($this->so->cal->delete_events);
|
reset($this->so->cal->deleted_events);
|
||||||
for($i=0;$i<count($this->so->cal->deleted_events);$i++)
|
for($i=0;$i<count($this->so->cal->deleted_events);$i++)
|
||||||
{
|
{
|
||||||
$event_id = $this->so->cal->deleted_events[$i];
|
$event_id = $this->so->cal->deleted_events[$i];
|
||||||
@ -305,7 +296,7 @@
|
|||||||
|
|
||||||
function update($p_cal=0,$p_participants=0,$p_start=0,$p_end=0,$p_recur_enddata=0)
|
function update($p_cal=0,$p_participants=0,$p_start=0,$p_end=0,$p_recur_enddata=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_POST_VARS, $HTTP_GET_VARS;
|
global $HTTP_POST_VARS, $HTTP_GET_VARS;
|
||||||
|
|
||||||
$l_cal = ($p_cal?$p_cal:$HTTP_POST_VARS['cal']);
|
$l_cal = ($p_cal?$p_cal:$HTTP_POST_VARS['cal']);
|
||||||
$l_participants = ($p_participants?$p_participants:$HTTP_POST_VARS['participants']);
|
$l_participants = ($p_participants?$p_participants:$HTTP_POST_VARS['participants']);
|
||||||
@ -599,8 +590,6 @@
|
|||||||
|
|
||||||
function overlap($starttime,$endtime,$participants,$owner=0,$id=0)
|
function overlap($starttime,$endtime,$participants,$owner=0,$id=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$retval = Array();
|
$retval = Array();
|
||||||
$ok = False;
|
$ok = False;
|
||||||
|
|
||||||
@ -692,8 +681,6 @@
|
|||||||
|
|
||||||
function get_fullname($accountid)
|
function get_fullname($accountid)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$account_id = get_account_id($accountid);
|
$account_id = get_account_id($accountid);
|
||||||
if($GLOBALS['phpgw']->accounts->exists($account_id) == False)
|
if($GLOBALS['phpgw']->accounts->exists($account_id) == False)
|
||||||
{
|
{
|
||||||
@ -753,8 +740,6 @@
|
|||||||
|
|
||||||
function is_private($event,$owner)
|
function is_private($event,$owner)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($owner == 0)
|
if($owner == 0)
|
||||||
{
|
{
|
||||||
$owner = $this->owner;
|
$owner = $this->owner;
|
||||||
@ -1093,6 +1078,11 @@
|
|||||||
if(!$emonth)
|
if(!$emonth)
|
||||||
{
|
{
|
||||||
$emonth = $smonth + 1;
|
$emonth = $smonth + 1;
|
||||||
|
if($emonth > 12)
|
||||||
|
{
|
||||||
|
$emonth = 1;
|
||||||
|
$eyear++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!$eday)
|
if(!$eday)
|
||||||
{
|
{
|
||||||
@ -1143,20 +1133,20 @@
|
|||||||
for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
|
for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
|
||||||
{
|
{
|
||||||
$c_evt_day = count($this->cached_events[$j]) - 1;
|
$c_evt_day = count($this->cached_events[$j]) - 1;
|
||||||
// if($c_evt_day < 0)
|
if($c_evt_day < 0)
|
||||||
// {
|
|
||||||
// $c_evt_day = 0;
|
|
||||||
// }
|
|
||||||
if($this->debug)
|
|
||||||
{
|
{
|
||||||
echo "Date: ".$j." Count : ".$c_evt_day."<br>\n";
|
$c_evt_day = 0;
|
||||||
}
|
}
|
||||||
|
// if($this->debug)
|
||||||
|
// {
|
||||||
|
// echo "Date: ".$j." Count : ".$c_evt_day."<br>\n";
|
||||||
|
// }
|
||||||
if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
|
if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
|
||||||
{
|
{
|
||||||
if($this->debug)
|
// if($this->debug)
|
||||||
{
|
// {
|
||||||
echo "Adding Event for Date: ".$j."<br>\n";
|
// echo "Adding Event for Date: ".$j."<br>\n";
|
||||||
}
|
// }
|
||||||
$this->cached_events[$j][] = $event;
|
$this->cached_events[$j][] = $event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1177,6 +1167,7 @@
|
|||||||
$this->check_repeating_events($date);
|
$this->check_repeating_events($date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$retval = Array();
|
||||||
for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
|
for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
|
||||||
{
|
{
|
||||||
$retval[$j] = $this->cached_events[$j];
|
$retval[$j] = $this->cached_events[$j];
|
||||||
@ -1188,15 +1179,12 @@
|
|||||||
/* Begin Appsession Data */
|
/* Begin Appsession Data */
|
||||||
function store_to_appsession($event)
|
function store_to_appsession($event)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
$GLOBALS['phpgw']->session->appsession('entry','calendar',$event);
|
$GLOBALS['phpgw']->session->appsession('entry','calendar',$event);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_from_appsession()
|
function restore_from_appsession()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
$this->event_init();
|
$this->event_init();
|
||||||
// $event = unserialize(str_replace('O:8:"stdClass"','O:13:"calendar_time"',serialize($GLOBALS['phpgw']->session->appsession('entry','calendar'))));
|
|
||||||
$event = $GLOBALS['phpgw']->session->appsession('entry','calendar');
|
$event = $GLOBALS['phpgw']->session->appsession('entry','calendar');
|
||||||
$this->so->cal->event = $event;
|
$this->so->cal->event = $event;
|
||||||
return $event;
|
return $event;
|
||||||
@ -1287,8 +1275,6 @@
|
|||||||
|
|
||||||
function set_week_array($startdate,$cellcolor,$weekly)
|
function set_week_array($startdate,$cellcolor,$weekly)
|
||||||
{
|
{
|
||||||
global $GLOBALS, $phpgw, $phpgw_info;
|
|
||||||
|
|
||||||
for ($j=0,$datetime=$startdate - $this->datetime->tz_offset;$j<7;$j++,$datetime += 86400)
|
for ($j=0,$datetime=$startdate - $this->datetime->tz_offset;$j<7;$j++,$datetime += 86400)
|
||||||
{
|
{
|
||||||
$date = date('Ymd',$datetime);
|
$date = date('Ymd',$datetime);
|
||||||
@ -1385,7 +1371,6 @@
|
|||||||
|
|
||||||
function prepare_matrix($interval,$increment,$part,$status,$fulldate)
|
function prepare_matrix($interval,$increment,$part,$status,$fulldate)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
for($h=0;$h<24;$h++)
|
for($h=0;$h<24;$h++)
|
||||||
{
|
{
|
||||||
for($m=0;$m<$interval;$m++)
|
for($m=0;$m<$interval;$m++)
|
||||||
@ -1483,9 +1468,6 @@
|
|||||||
|
|
||||||
function send_update($msg_type,$participants,$old_event=False,$new_event=False)
|
function send_update($msg_type,$participants,$old_event=False,$new_event=False)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$db = $GLOBALS['phpgw']->db;
|
$db = $GLOBALS['phpgw']->db;
|
||||||
$db->query("SELECT app_version FROM phpgw_applications WHERE app_name='calendar'",__LINE__,__FILE__);
|
$db->query("SELECT app_version FROM phpgw_applications WHERE app_name='calendar'",__LINE__,__FILE__);
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
@ -1710,43 +1692,65 @@
|
|||||||
|
|
||||||
function remove_doubles_in_cache($firstday,$lastday)
|
function remove_doubles_in_cache($firstday,$lastday)
|
||||||
{
|
{
|
||||||
for($v=$firstday;$v<=$lastday;$v += 1)
|
$already_moved = Array();
|
||||||
|
for($v=$firstday;$v<=$lastday;$v++)
|
||||||
{
|
{
|
||||||
$daily = $this->cached_events[$v];
|
if (!$this->cached_events[$v])
|
||||||
|
|
||||||
if($this->debug)
|
|
||||||
{
|
|
||||||
echo "<p>count(day $v)=".count($daily)."</p>\n";
|
|
||||||
}
|
|
||||||
if (!is_array($daily))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
while (list($g,$event) = each($this->cached_events[$v]))
|
||||||
@reset($daily);
|
|
||||||
while (list($g,$event) = each($daily))
|
|
||||||
{
|
{
|
||||||
|
$start = sprintf('%04d%02d%02d',$event['start']['year'],$event['start']['month'],$event['start']['mday']);
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo "<p>Event:<br>"; print_r($event); echo "</p>";
|
echo "<p>Event:<br>"; print_r($event); echo "</p>";
|
||||||
}
|
|
||||||
$start = sprintf('%04d%02d%02d',$event['start']['year'],$event['start']['month'],$event['start']['mday']);
|
|
||||||
|
|
||||||
if($this->debug)
|
|
||||||
{
|
|
||||||
echo "<p>start='$start', v='$v' ";
|
echo "<p>start='$start', v='$v' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ($start != $v && $event['recur_type'] == MCAL_RECUR_NONE) // this is an enddate-entry --> remove it
|
||||||
if ($start != $v) // this is an enddate-entry --> remove it
|
if ($start != $v) // this is an enddate-entry --> remove it
|
||||||
{
|
{
|
||||||
unset($this->cached_events[$v][$g]);
|
unset($this->cached_events[$v][$g]);
|
||||||
|
if($g != count($this->cached_events[$v]))
|
||||||
|
{
|
||||||
|
for($h=$g + 1;$h<$c_daily;$h++)
|
||||||
|
{
|
||||||
|
$this->cached_events[$v][$h - 1] = $this->cached_events[$v][$h];
|
||||||
|
}
|
||||||
|
unset($this->cached_events[$v][$h]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ($start < $firstday && $event['recur_type'] == MCAL_RECUR_NONE) // start before period --> move it to the beginning
|
||||||
if ($start < $firstday) // start before period --> move it to the beginning
|
if ($start < $firstday) // start before period --> move it to the beginning
|
||||||
|
{
|
||||||
|
if($already_moved[$event['id']] > 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$add_event = True;
|
||||||
|
$c_events = count($this->cached_events[$firstday]);
|
||||||
|
for($i=0;$i<$c_events;$i++)
|
||||||
|
{
|
||||||
|
$add_event = ($this->cached_events[$firstday][$i]['id'] == $event['id']?False:$add_event);
|
||||||
|
}
|
||||||
|
if($add_event)
|
||||||
{
|
{
|
||||||
$this->cached_events[$firstday][] = $event;
|
$this->cached_events[$firstday][] = $event;
|
||||||
|
$already_moved[$event['id']] = 1;
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo "moved</p>\n";
|
echo "moved</p>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$already_moved[$event['id']] = 2;
|
||||||
|
if($this->debug)
|
||||||
|
{
|
||||||
|
echo "removed (not moved)</p>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif($this->debug)
|
elseif($this->debug)
|
||||||
{
|
{
|
||||||
@ -1758,6 +1762,7 @@
|
|||||||
echo "ok</p>\n";
|
echo "ok</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,21 +46,19 @@
|
|||||||
|
|
||||||
function boholiday()
|
function boholiday()
|
||||||
{
|
{
|
||||||
global $phpgw_info, $locale, $start, $query, $sort, $order, $id;
|
|
||||||
|
|
||||||
$this->so = CreateObject('calendar.soholiday');
|
$this->so = CreateObject('calendar.soholiday');
|
||||||
|
|
||||||
if(isset($locale)) { $this->locales[] = $locale; }
|
if(isset($GLOBALS['locale'])) { $this->locales[] = $GLOBALS['locale']; }
|
||||||
|
|
||||||
if(isset($start)) { $this->start = $start; } else { $this->start = 0; }
|
if(isset($GLOBALS['start'])) { $this->start = $GLOBALS['start']; } else { $this->start = 0; }
|
||||||
|
|
||||||
if(isset($query)) { $this->query = $query; }
|
if(isset($GLOBALS['query'])) { $this->query = $GLOBALS['query']; }
|
||||||
|
|
||||||
if(isset($sort)) { $this->sort = $sort; }
|
if(isset($GLOBALS['sort'])) { $this->sort = $GLOBALS['sort']; }
|
||||||
|
|
||||||
if(isset($order)) { $this->order = $order; }
|
if(isset($GLOBALS['order'])) { $this->order = $GLOBALS['order']; }
|
||||||
|
|
||||||
if(isset($id)) { $this->id = $id; }
|
if(isset($GLOBALS['id'])) { $this->id = $GLOBALS['id']; }
|
||||||
|
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
@ -73,7 +71,6 @@
|
|||||||
/* Begin Calendar functions */
|
/* Begin Calendar functions */
|
||||||
function read_entry($id=0)
|
function read_entry($id=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo "BO : Reading Holiday ID : ".$id."<br>\n";
|
echo "BO : Reading Holiday ID : ".$id."<br>\n";
|
||||||
@ -136,8 +133,7 @@
|
|||||||
|
|
||||||
function accept_holiday()
|
function accept_holiday()
|
||||||
{
|
{
|
||||||
global $HTTP_REFERER;
|
global $HTTP_POST_VARS, $HTTP_REFERER;
|
||||||
global $name, $day, $month, $occurence, $dow, $observance;
|
|
||||||
|
|
||||||
$send_back_to = str_replace('submitlocale','holiday_admin',$HTTP_REFERER);
|
$send_back_to = str_replace('submitlocale','holiday_admin',$HTTP_REFERER);
|
||||||
if(!@$this->locales[0])
|
if(!@$this->locales[0])
|
||||||
@ -147,13 +143,13 @@
|
|||||||
|
|
||||||
$send_back_to = str_replace('&locale='.$this->locales[0],'',$send_back_to);
|
$send_back_to = str_replace('&locale='.$this->locales[0],'',$send_back_to);
|
||||||
$file = './holidays.'.$this->locales[0];
|
$file = './holidays.'.$this->locales[0];
|
||||||
if(!file_exists($file) && count($name))
|
if(!file_exists($file) && count($HTTP_POST_VARS['name']))
|
||||||
{
|
{
|
||||||
$c_holidays = count($name);
|
$c_holidays = count($HTTP_POST_VARS['name']);
|
||||||
$fp = fopen($file,'w');
|
$fp = fopen($file,'w');
|
||||||
for($i=0;$i<$c_holidays;$i++)
|
for($i=0;$i<$c_holidays;$i++)
|
||||||
{
|
{
|
||||||
fwrite($fp,$this->locales[0]."\t".$name[$i]."\t".$day[$i]."\t".$month[$i]."\t".$occurence[$i]."\t".$dow[$i]."\t".$observance[$i]."\n");
|
fwrite($fp,$this->locales[0]."\t".$HTTP_POST_VARS['name'][$i]."\t".$HTTP_POST_VARS['day'][$i]."\t".$HTTP_POST_VARS['month'][$i]."\t".$HTTP_POST_VARS['occurence'][$i]."\t".$HTTP_POST_VARS['dow'][$i]."\t".$HTTP_POST_VARS['observance'][$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@ -162,85 +158,40 @@
|
|||||||
|
|
||||||
function get_holiday_list($locale='', $sort='', $order='', $query='', $total='')
|
function get_holiday_list($locale='', $sort='', $order='', $query='', $total='')
|
||||||
{
|
{
|
||||||
if(!$locale)
|
$locale = ($locale?$locale:$this->locales[0]);
|
||||||
{
|
$sort = ($sort?$sort:$this->sort);
|
||||||
$locale = $this->locales[0];
|
$order = ($order?$order:$this->order);
|
||||||
}
|
$query = ($query?$query:$this->query);
|
||||||
|
|
||||||
if(!$sort)
|
|
||||||
{
|
|
||||||
$sort = $this->sort;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$order)
|
|
||||||
{
|
|
||||||
$order = $this->order;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$query)
|
|
||||||
{
|
|
||||||
$query = $this->query;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->so->read_holidays($locale,$query,$order);
|
return $this->so->read_holidays($locale,$query,$order);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_locale_list($sort='', $order='', $query='')
|
function get_locale_list($sort='', $order='', $query='')
|
||||||
{
|
{
|
||||||
if(!$sort)
|
$sort = ($sort?$sort:$this->sort);
|
||||||
{
|
$order = ($order?$order:$this->order);
|
||||||
$sort = $this->sort;
|
$query = ($query?$query:$$this->query);
|
||||||
}
|
|
||||||
|
|
||||||
if(!$order)
|
|
||||||
{
|
|
||||||
$order = $this->order;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$query)
|
|
||||||
{
|
|
||||||
$query = $this->query;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->so->get_locale_list($sort,$order,$query);
|
return $this->so->get_locale_list($sort,$order,$query);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_read_holidays($year=0,$owner=0)
|
function prepare_read_holidays($year=0,$owner=0)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
$this->year = ($year?$year:$GLOBALS['phpgw']->common->show_date(time(),'Y'));
|
||||||
|
$this->owner = ($owner?$owner:$GLOBALS['phpgw_info']['user']['account_id']);
|
||||||
|
|
||||||
if($year==0)
|
if(@$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
|
||||||
{
|
{
|
||||||
$this->year = date('Y');
|
$this->locales[] = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
|
||||||
}
|
}
|
||||||
else
|
elseif(@$GLOBALS['phpgw_info']['user']['preferences']['calendar']['locale'])
|
||||||
{
|
{
|
||||||
$this->year = $year;
|
$this->locales[] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']['locale'];
|
||||||
}
|
|
||||||
|
|
||||||
if($owner == 0)
|
|
||||||
{
|
|
||||||
$this->owner = $phpgw_info['user']['account_id'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->owner = $owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(@$phpgw_info['user']['preferences']['common']['country'])
|
|
||||||
{
|
|
||||||
$this->locales[] = $phpgw_info['user']['preferences']['common']['country'];
|
|
||||||
}
|
|
||||||
elseif(@$phpgw_info['user']['preferences']['calendar']['locale'])
|
|
||||||
{
|
|
||||||
$this->locales[] = $phpgw_info['user']['preferences']['calendar']['locale'];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->locales[] = 'US';
|
$this->locales[] = 'US';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->owner != $phpgw_info['user']['account_id'])
|
if($this->owner != $GLOBALS['phpgw_info']['user']['account_id'])
|
||||||
{
|
{
|
||||||
$owner_pref = CreateObject('phpgwapi.preferences',$owner);
|
$owner_pref = CreateObject('phpgwapi.preferences',$owner);
|
||||||
$owner_prefs = $owner_pref->read_repository();
|
$owner_prefs = $owner_pref->read_repository();
|
||||||
@ -256,7 +207,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@reset($this->locales);
|
@reset($this->locales);
|
||||||
if($phpgw_info['server']['auto_load_holidays'] == True)
|
if($GLOBALS['phpgw_info']['server']['auto_load_holidays'] == True)
|
||||||
{
|
{
|
||||||
while(list($key,$value) = each($this->locales))
|
while(list($key,$value) = each($this->locales))
|
||||||
{
|
{
|
||||||
@ -269,20 +220,20 @@
|
|||||||
{
|
{
|
||||||
if($this->so->holiday_total($locale) == 0)
|
if($this->so->holiday_total($locale) == 0)
|
||||||
{
|
{
|
||||||
global $phpgw_info, $HTTP_HOST, $SERVER_PORT;
|
global $HTTP_HOST, $SERVER_PORT;
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
|
|
||||||
/* get the file that contains the calendar events for your locale */
|
/* get the file that contains the calendar events for your locale */
|
||||||
/* "http://www.phpgroupware.org/cal/holidays.US"; */
|
/* "http://www.phpgroupware.org/cal/holidays.US"; */
|
||||||
$network = CreateObject('phpgwapi.network');
|
$network = CreateObject('phpgwapi.network');
|
||||||
if(isset($phpgw_info['server']['holidays_url_path']) && $phpgw_info['server']['holidays_url_path'] != 'localhost')
|
if(isset($GLOBALS['phpgw_info']['server']['holidays_url_path']) && $GLOBALS['phpgw_info']['server']['holidays_url_path'] != 'localhost')
|
||||||
{
|
{
|
||||||
$load_from = $phpgw_info['server']['holidays_url_path'];
|
$load_from = $GLOBALS['phpgw_info']['server']['holidays_url_path'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pos = strpos(' '.$phpgw_info['server']['webserver_url'],$HTTP_HOST);
|
$pos = strpos(' '.$GLOBALS['phpgw_info']['server']['webserver_url'],$HTTP_HOST);
|
||||||
if($pos == 0)
|
if($pos == 0)
|
||||||
{
|
{
|
||||||
switch($SERVER_PORT)
|
switch($SERVER_PORT)
|
||||||
@ -294,11 +245,11 @@
|
|||||||
$http_protocol = 'https://';
|
$http_protocol = 'https://';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$server_host = $http_protocol.$HTTP_HOST.$phpgw_info['server']['webserver_url'];
|
$server_host = $http_protocol.$HTTP_HOST.$GLOBALS['phpgw_info']['server']['webserver_url'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$server_host = $phpgw_info['server']['webserver_url'];
|
$server_host = $GLOBALS['phpgw_info']['server']['webserver_url'];
|
||||||
}
|
}
|
||||||
$load_from = $server_host.'/calendar/setup';
|
$load_from = $server_host.'/calendar/setup';
|
||||||
}
|
}
|
||||||
@ -336,25 +287,25 @@
|
|||||||
|
|
||||||
function add()
|
function add()
|
||||||
{
|
{
|
||||||
global $phpgw, $submit, $holiday, $locale;
|
global $HTTP_POST_VARS;
|
||||||
|
|
||||||
if(@$submit)
|
if(@$HTTP_POST_VARS['submit'])
|
||||||
{
|
{
|
||||||
if(empty($holiday['mday']))
|
if(empty($HTTP_POST_VARS['holiday']['mday']))
|
||||||
{
|
{
|
||||||
$holiday['mday'] = 0;
|
$HTTP_POST_VARS['holiday']['mday'] = 0;
|
||||||
}
|
}
|
||||||
if(!isset($this->bo->locales[0]) || $this->bo->locales[0]=='')
|
if(!isset($this->bo->locales[0]) || $this->bo->locales[0]=='')
|
||||||
{
|
{
|
||||||
$this->bo->locales[0] = $holiday['locale'];
|
$this->bo->locales[0] = $HTTP_POST_VARS['holiday']['locale'];
|
||||||
}
|
}
|
||||||
elseif(!isset($holiday['locale']) || $holiday['locale']=='')
|
elseif(!isset($HTTP_POST_VARS['holiday']['locale']) || $HTTP_POST_VARS['holiday']['locale']=='')
|
||||||
{
|
{
|
||||||
$holiday['locale'] = $this->bo->locales[0];
|
$HTTP_POST_VARS['holiday']['locale'] = $this->bo->locales[0];
|
||||||
}
|
}
|
||||||
if(!isset($holiday['hol_id']))
|
if(!isset($HTTP_POST_VARS['holiday']['hol_id']))
|
||||||
{
|
{
|
||||||
$holiday['hol_id'] = $this->bo->id;
|
$HTTP_POST_VARS['holiday']['hol_id'] = $this->bo->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still need to put some validation in here.....
|
// Still need to put some validation in here.....
|
||||||
@ -362,11 +313,11 @@
|
|||||||
$this->ui = CreateObject('calendar.uiholiday');
|
$this->ui = CreateObject('calendar.uiholiday');
|
||||||
if (is_array($errors))
|
if (is_array($errors))
|
||||||
{
|
{
|
||||||
$this->ui->add($errors,$holiday);
|
$this->ui->add($errors,$HTTP_POST_VARS['holiday']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->so->save_holiday($holiday);
|
$this->so->save_holiday($HTTP_POST_VARS['holiday']);
|
||||||
$this->ui->edit_locale();
|
$this->ui->edit_locale();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,14 +366,12 @@
|
|||||||
return $holidays;
|
return $holidays;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $phpgw_info;
|
$temp_locale = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
|
||||||
|
|
||||||
$temp_locale = $phpgw_info['user']['preferences']['common']['country'];
|
|
||||||
$datetime = CreateObject('phpgwapi.datetime');
|
$datetime = CreateObject('phpgwapi.datetime');
|
||||||
for($i=0;$i<count($holidays);$i++)
|
for($i=0;$i<count($holidays);$i++)
|
||||||
{
|
{
|
||||||
$c = $i;
|
$c = $i;
|
||||||
$phpgw_info['user']['preferences']['common']['country'] = $holidays[$i]['locale'];
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $holidays[$i]['locale'];
|
||||||
$holidaycalc = CreateObject('calendar.holidaycalc');
|
$holidaycalc = CreateObject('calendar.holidaycalc');
|
||||||
$holidays[$i]['date'] = $holidaycalc->calculate_date($holidays[$i], $holidays, $this->year, $datetime, $c);
|
$holidays[$i]['date'] = $holidaycalc->calculate_date($holidays[$i], $holidays, $this->year, $datetime, $c);
|
||||||
unset($holidaycalc);
|
unset($holidaycalc);
|
||||||
@ -434,24 +383,16 @@
|
|||||||
unset($datetime);
|
unset($datetime);
|
||||||
$this->holidays = $this->sort_holidays_by_date($holidays);
|
$this->holidays = $this->sort_holidays_by_date($holidays);
|
||||||
$this->cached_holidays = $this->set_holidays_to_date($this->holidays);
|
$this->cached_holidays = $this->set_holidays_to_date($this->holidays);
|
||||||
$phpgw_info['user']['preferences']['common']['country'] = $temp_locale;
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $temp_locale;
|
||||||
return $this->cached_holidays;
|
return $this->cached_holidays;
|
||||||
}
|
}
|
||||||
/* End Calendar functions */
|
/* End Calendar functions */
|
||||||
|
|
||||||
function check_admin()
|
function check_admin()
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
if(!@$GLOBALS['phpgw_info']['user']['apps']['admin'])
|
||||||
|
|
||||||
$admin = False;
|
|
||||||
if(@$phpgw_info['user']['apps']['admin'])
|
|
||||||
{
|
{
|
||||||
$admin = True;
|
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php'));
|
||||||
}
|
|
||||||
|
|
||||||
if(!$admin)
|
|
||||||
{
|
|
||||||
Header('Location: ' . $phpgw->link('/index.php'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,30 +26,12 @@
|
|||||||
|
|
||||||
function socalendar($param)
|
function socalendar($param)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
$this->db = $GLOBALS['phpgw']->db;
|
||||||
|
|
||||||
$this->db = $phpgw->db;
|
|
||||||
$this->datetime = CreateObject('phpgwapi.datetime');
|
$this->datetime = CreateObject('phpgwapi.datetime');
|
||||||
|
|
||||||
if(!isset($param['owner']) || $param['owner'] == 0)
|
$this->owner = (!isset($param['owner']) || $param['owner'] == 0?$GLOBALS['phpgw_info']['user']['account_id']:$param['owner']);
|
||||||
{
|
$this->filter = (isset($param['filter']) && $param['filter'] != ''?$param['filter']:$this->filter);
|
||||||
$this->owner = $phpgw_info['user']['account_id'];
|
$this->cat_id = (isset($param['category']) && $param['category'] != ''?$param['category']:$this->cat_id);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->owner = $param['owner'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($param['filter']) && $param['filter'] != '')
|
|
||||||
{
|
|
||||||
$this->filter = $param['filter'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($param['category']) && $param['category'] != '')
|
|
||||||
{
|
|
||||||
$this->cat_id = $param['category'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo 'SO Filter : '.$this->filter."<br>\n";
|
echo 'SO Filter : '.$this->filter."<br>\n";
|
||||||
@ -76,25 +58,15 @@
|
|||||||
function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0)
|
function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
$this->makeobj();
|
||||||
|
|
||||||
$extra = '';
|
$extra = '';
|
||||||
if(strpos($this->filter,'private'))
|
$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
|
||||||
{
|
$extra .= ($this->cat_id?'AND phpgw_cal.category = '.$this->cat_id.' ':'');
|
||||||
$extra .= 'AND phpgw_cal.is_public=0 ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->cat_id)
|
|
||||||
{
|
|
||||||
$extra .= 'AND phpgw_cal.category = '.$this->cat_id.' ';
|
|
||||||
}
|
|
||||||
return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$this->datetime->tz_offset);
|
return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$this->datetime->tz_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday)
|
function list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
if($GLOBALS['phpgw_info']['server']['calendar_type'] != 'sql')
|
||||||
|
|
||||||
if($phpgw_info['server']['calendar_type'] != 'sql')
|
|
||||||
{
|
{
|
||||||
return Array();
|
return Array();
|
||||||
}
|
}
|
||||||
@ -109,15 +81,9 @@
|
|||||||
// . 'AND (phpgw_cal.datetime <= '.$starttime.') '
|
// . 'AND (phpgw_cal.datetime <= '.$starttime.') '
|
||||||
. 'AND (((phpgw_cal_repeats.recur_enddate >= '.$starttime.') AND (phpgw_cal_repeats.recur_enddate <= '.$endtime.')) OR (phpgw_cal_repeats.recur_enddate=0))) ';
|
. 'AND (((phpgw_cal_repeats.recur_enddate >= '.$starttime.') AND (phpgw_cal_repeats.recur_enddate <= '.$endtime.')) OR (phpgw_cal_repeats.recur_enddate=0))) ';
|
||||||
|
|
||||||
if(strpos($this->filter,'private'))
|
$sql .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
|
||||||
{
|
|
||||||
$sql .= 'AND phpgw_cal.is_public=0 ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->cat_id)
|
$sql .= ($this->cat_id?'AND phpgw_cal.category = '.$this->cat_id.' ':'');
|
||||||
{
|
|
||||||
$sql .= 'AND phpgw_cal.category = '.$this->cat_id.' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
$sql .= 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
||||||
|
|
||||||
@ -138,33 +104,15 @@
|
|||||||
$words = split(' ',$keywords);
|
$words = split(' ',$keywords);
|
||||||
for ($i=0;$i<count($words);$i++)
|
for ($i=0;$i<count($words);$i++)
|
||||||
{
|
{
|
||||||
if($i==0)
|
$sql .= ($i==0?' AND (':'');
|
||||||
{
|
$sql .= ($i>0?' OR ':'');
|
||||||
$sql .= ' AND (';
|
|
||||||
}
|
|
||||||
if($i>0)
|
|
||||||
{
|
|
||||||
$sql .= ' OR ';
|
|
||||||
}
|
|
||||||
$sql .= "(UPPER(phpgw_cal.title) LIKE UPPER('%".$words[$i]."%') OR "
|
$sql .= "(UPPER(phpgw_cal.title) LIKE UPPER('%".$words[$i]."%') OR "
|
||||||
. "UPPER(phpgw_cal.description) LIKE UPPER('%".$words[$i]."%'))";
|
. "UPPER(phpgw_cal.description) LIKE UPPER('%".$words[$i]."%'))";
|
||||||
|
$sql .= ($i==count($words) - 1?') ':'');
|
||||||
if($i==count($words) - 1)
|
|
||||||
{
|
|
||||||
$sql .= ') ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strpos($this->filter,'private'))
|
|
||||||
{
|
|
||||||
$sql .= 'AND phpgw_cal.is_public=0 ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->cat_id)
|
|
||||||
{
|
|
||||||
$sql .= 'AND phpgw_cal.category = '.$this->cat_id.' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
|
||||||
|
$sql .= ($this->cat_id?'AND phpgw_cal.category = '.$this->cat_id.' ':'');
|
||||||
$sql .= 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
$sql .= 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
||||||
return $this->get_event_ids(False,$sql);
|
return $this->get_event_ids(False,$sql);
|
||||||
}
|
}
|
||||||
@ -212,8 +160,7 @@
|
|||||||
|
|
||||||
function change_owner($account_id,$new_owner)
|
function change_owner($account_id,$new_owner)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql')
|
||||||
if($phpgw_info['server']['calendar_type'] == 'sql')
|
|
||||||
{
|
{
|
||||||
$this->so->cal->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
|
$this->so->cal->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
|
||||||
$this->so->cal->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_login='.$account_id);
|
$this->so->cal->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_login='.$account_id);
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
if(@$phpgw_info['server']['calendar_type'] == 'mcal' &&
|
if(@$GLOBALS['phpgw_info']['server']['calendar_type'] == 'mcal' &&
|
||||||
extension_loaded('mcal') == False)
|
extension_loaded('mcal') == False)
|
||||||
{
|
{
|
||||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
$GLOBALS['phpgw_info']['server']['calendar_type'] = 'sql';
|
||||||
}
|
}
|
||||||
// This will be elminated when ical is fully implemented
|
// This will be elminated when ical is fully implemented
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
$GLOBALS['phpgw_info']['server']['calendar_type'] = 'sql';
|
||||||
}
|
}
|
||||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar__.inc.php');
|
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar__.inc.php');
|
||||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
|
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar_'.$GLOBALS['phpgw_info']['server']['calendar_type'].'.inc.php');
|
||||||
?>
|
?>
|
||||||
|
@ -21,7 +21,7 @@ if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'])
|
|||||||
|
|
||||||
$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'] = True;
|
$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'] = True;
|
||||||
|
|
||||||
include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php');
|
/* include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php'); */
|
||||||
|
|
||||||
if(extension_loaded('mcal') == False)
|
if(extension_loaded('mcal') == False)
|
||||||
{
|
{
|
||||||
|
@ -30,8 +30,6 @@ class socalendar_ extends socalendar__
|
|||||||
|
|
||||||
function open($calendar='',$user='',$passwd='',$options='')
|
function open($calendar='',$user='',$passwd='',$options='')
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($user=='')
|
if($user=='')
|
||||||
{
|
{
|
||||||
settype($user,'integer');
|
settype($user,'integer');
|
||||||
@ -95,8 +93,6 @@ class socalendar_ extends socalendar__
|
|||||||
|
|
||||||
function fetch_event($event_id,$options='')
|
function fetch_event($event_id,$options='')
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!isset($this->stream))
|
if(!isset($this->stream))
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
@ -193,10 +189,7 @@ class socalendar_ extends socalendar__
|
|||||||
{
|
{
|
||||||
$this->add_attribute('users_status',$this->stream->f('cal_status'));
|
$this->add_attribute('users_status',$this->stream->f('cal_status'));
|
||||||
}
|
}
|
||||||
// $this->event->participants[$this->stream->f('cal_login')] = $this->stream->f('cal_status');
|
|
||||||
$this->add_attribute('participants',$this->stream->f('cal_status'),intval($this->stream->f('cal_login')));
|
$this->add_attribute('participants',$this->stream->f('cal_status'),intval($this->stream->f('cal_login')));
|
||||||
// $this->add_attribute('participants',array(intval($this->stream->f('cal_login'))=>$this->stream->f('cal_status')));
|
|
||||||
// $this->add_attribute('participants['.intval($this->stream->f('cal_login')).']',$this->stream->f('cal_status'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,8 +353,6 @@ class socalendar_ extends socalendar__
|
|||||||
|
|
||||||
function save_event(&$event)
|
function save_event(&$event)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$locks = Array(
|
$locks = Array(
|
||||||
'phpgw_cal',
|
'phpgw_cal',
|
||||||
'phpgw_cal_user',
|
'phpgw_cal_user',
|
||||||
@ -478,8 +469,6 @@ class socalendar_ extends socalendar__
|
|||||||
|
|
||||||
function group_search($owner=0)
|
function group_search($owner=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$owner = ($owner==$GLOBALS['phpgw_info']['user']['account_id']?0:$owner);
|
$owner = ($owner==$GLOBALS['phpgw_info']['user']['account_id']?0:$owner);
|
||||||
$groups = substr($GLOBALS['phpgw']->common->sql_search('phpgw_cal.groups',intval($owner)),4);
|
$groups = substr($GLOBALS['phpgw']->common->sql_search('phpgw_cal.groups',intval($owner)),4);
|
||||||
if (!$groups)
|
if (!$groups)
|
||||||
|
@ -56,8 +56,6 @@
|
|||||||
|
|
||||||
function uicalendar()
|
function uicalendar()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$GLOBALS['phpgw']->browser = CreateObject('phpgwapi.browser');
|
$GLOBALS['phpgw']->browser = CreateObject('phpgwapi.browser');
|
||||||
$this->theme = $GLOBALS['phpgw_info']['theme'];
|
$this->theme = $GLOBALS['phpgw_info']['theme'];
|
||||||
|
|
||||||
@ -92,8 +90,6 @@
|
|||||||
|
|
||||||
function mini_calendar($params)
|
function mini_calendar($params)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!is_array($params))
|
if(!is_array($params))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -242,16 +238,12 @@
|
|||||||
|
|
||||||
function index($params='')
|
function index($params='')
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
Header('Location: '. $this->page('',$params));
|
Header('Location: '. $this->page('',$params));
|
||||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function month()
|
function month()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$this->bo->read_holidays();
|
$this->bo->read_holidays();
|
||||||
|
|
||||||
$m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
|
$m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
|
||||||
@ -323,9 +315,6 @@
|
|||||||
|
|
||||||
function week()
|
function week()
|
||||||
{
|
{
|
||||||
|
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$this->bo->read_holidays();
|
$this->bo->read_holidays();
|
||||||
|
|
||||||
$next = $this->bo->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year);
|
$next = $this->bo->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year);
|
||||||
@ -422,8 +411,6 @@
|
|||||||
|
|
||||||
function year()
|
function year()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!$this->bo->printer_friendly)
|
if(!$this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
@ -490,7 +477,7 @@
|
|||||||
|
|
||||||
function view($vcal_id=0)
|
function view($vcal_id=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_GET_VARS;
|
global $HTTP_GET_VARS;
|
||||||
|
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||||
@ -653,7 +640,7 @@
|
|||||||
|
|
||||||
function delete()
|
function delete()
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_GET_VARS;
|
global $HTTP_GET_VARS;
|
||||||
|
|
||||||
if(!isset($HTTP_GET_VARS['cal_id']))
|
if(!isset($HTTP_GET_VARS['cal_id']))
|
||||||
{
|
{
|
||||||
@ -680,8 +667,6 @@
|
|||||||
|
|
||||||
function day()
|
function day()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$this->bo->read_holidays();
|
$this->bo->read_holidays();
|
||||||
|
|
||||||
if (!$this->bo->printer_firendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals']))
|
if (!$this->bo->printer_firendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals']))
|
||||||
@ -749,7 +734,7 @@
|
|||||||
|
|
||||||
function edit_status()
|
function edit_status()
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_GET_VARS;
|
global $HTTP_GET_VARS;
|
||||||
|
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||||
@ -805,8 +790,6 @@
|
|||||||
|
|
||||||
function planner()
|
function planner()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||||
$GLOBALS['phpgw']->common->phpgw_header();
|
$GLOBALS['phpgw']->common->phpgw_header();
|
||||||
@ -852,18 +835,18 @@
|
|||||||
'syear' => $this->bo->year,
|
'syear' => $this->bo->year,
|
||||||
'smonth' => $this->bo->month,
|
'smonth' => $this->bo->month,
|
||||||
'sday' => 1,
|
'sday' => 1,
|
||||||
'eyear' => 0,
|
'eyear' => $this->bo->year,
|
||||||
'emonth' => 0,
|
'emonth' => $this->bo->month,
|
||||||
'eday' => 1
|
'eday' => $days
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$firstday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
|
$firstday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
|
||||||
$lastday = intval(date('Ymd',mktime(0,0,0,$this->bo->month + 1,0,$this->bo->year)));
|
$lastday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,$days,$this->bo->year)));
|
||||||
|
|
||||||
$this->bo->remove_doubles_in_cache($firstday,$lastday);
|
$this->bo->remove_doubles_in_cache($firstday,$lastday);
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
for($v=$firstday;$v<=$lastday;$v += 1)
|
for($v=$firstday;$v<=$lastday;$v++)
|
||||||
{
|
{
|
||||||
$daily = $this->bo->cached_events[$v];
|
$daily = $this->bo->cached_events[$v];
|
||||||
@reset($daily);
|
@reset($daily);
|
||||||
@ -987,8 +970,6 @@
|
|||||||
|
|
||||||
function matrixselect()
|
function matrixselect()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset;
|
$datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset;
|
||||||
|
|
||||||
$sb = CreateObject('phpgwapi.sbox');
|
$sb = CreateObject('phpgwapi.sbox');
|
||||||
@ -1106,7 +1087,7 @@
|
|||||||
|
|
||||||
function viewmatrix()
|
function viewmatrix()
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_POST_VARS;
|
global $HTTP_POST_VARS;
|
||||||
|
|
||||||
$participants = $HTTP_POST_VARS['participants'];
|
$participants = $HTTP_POST_VARS['participants'];
|
||||||
$parts = Array();
|
$parts = Array();
|
||||||
@ -1190,7 +1171,7 @@
|
|||||||
|
|
||||||
function search()
|
function search()
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_POST_VARS;
|
global $HTTP_POST_VARS;
|
||||||
|
|
||||||
if (!$HTTP_POST_VARS['keywords'])
|
if (!$HTTP_POST_VARS['keywords'])
|
||||||
{
|
{
|
||||||
@ -1328,8 +1309,6 @@
|
|||||||
|
|
||||||
function page($page='',$params='')
|
function page($page='',$params='')
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($page == '')
|
if($page == '')
|
||||||
{
|
{
|
||||||
$page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']);
|
$page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']);
|
||||||
@ -1354,7 +1333,7 @@
|
|||||||
|
|
||||||
function header()
|
function header()
|
||||||
{
|
{
|
||||||
global $GLOBALS, $HTTP_POST_VARS, $HTTP_GET_VARS;
|
global $HTTP_POST_VARS, $HTTP_GET_VARS;
|
||||||
|
|
||||||
$cols = 8;
|
$cols = 8;
|
||||||
if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
|
if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
|
||||||
@ -1373,8 +1352,6 @@
|
|||||||
|
|
||||||
function footer()
|
function footer()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
list(,,$method) = explode('.',$GLOBALS['menuaction']);
|
list(,,$method) = explode('.',$GLOBALS['menuaction']);
|
||||||
|
|
||||||
if (@$this->bo->printer_friendly)
|
if (@$this->bo->printer_friendly)
|
||||||
@ -1475,8 +1452,6 @@
|
|||||||
|
|
||||||
function no_edit()
|
function no_edit()
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!$isset($GLOBALS['phpgw_info']['flags']['noheader']))
|
if(!$isset($GLOBALS['phpgw_info']['flags']['noheader']))
|
||||||
{
|
{
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
@ -1491,8 +1466,6 @@
|
|||||||
|
|
||||||
function link_to_entry($event,$month,$day,$year)
|
function link_to_entry($event,$month,$day,$year)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
$is_private = $this->bo->is_private($event,$this->bo->owner);
|
$is_private = $this->bo->is_private($event,$this->bo->owner);
|
||||||
$editable = ((!$this->bo->printer_friendly) && (($is_private && $this->bo->check_perms(PHPGW_ACL_PRIVATE)) || !$is_private));
|
$editable = ((!$this->bo->printer_friendly) && (($is_private && $this->bo->check_perms(PHPGW_ACL_PRIVATE)) || !$is_private));
|
||||||
@ -1632,8 +1605,6 @@
|
|||||||
|
|
||||||
function overlap($overlapping_events,$event)
|
function overlap($overlapping_events,$event)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$month = $event['start']['month'];
|
$month = $event['start']['month'];
|
||||||
$mday = $event['start']['mday'];
|
$mday = $event['start']['mday'];
|
||||||
$year = $event['start']['year'];
|
$year = $event['start']['year'];
|
||||||
@ -1689,8 +1660,7 @@
|
|||||||
|
|
||||||
function planner_participants($parts)
|
function planner_participants($parts)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
static $id2lid;
|
||||||
static $id2lid = array();
|
|
||||||
|
|
||||||
$names = '';
|
$names = '';
|
||||||
while (list($id,$status) = each($parts))
|
while (list($id,$status) = each($parts))
|
||||||
@ -1714,7 +1684,7 @@
|
|||||||
|
|
||||||
function planner_category($id)
|
function planner_category($id)
|
||||||
{
|
{
|
||||||
static $cats = array();
|
static $cats;
|
||||||
|
|
||||||
if (!isset($cats[$id]))
|
if (!isset($cats[$id]))
|
||||||
{
|
{
|
||||||
@ -1727,8 +1697,6 @@
|
|||||||
|
|
||||||
function week_header($month,$year,$display_name = False)
|
function week_header($month,$year,$display_name = False)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$this->weekstarttime = $this->bo->datetime->get_weekday_start($year,$month,1);
|
$this->weekstarttime = $this->bo->datetime->get_weekday_start($year,$month,1);
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
@ -1772,8 +1740,6 @@
|
|||||||
|
|
||||||
function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0)
|
function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if($owner == 0) { $owner = $GLOBALS['phpgw_info']['user']['account_id']; }
|
if($owner == 0) { $owner = $GLOBALS['phpgw_info']['user']['account_id']; }
|
||||||
|
|
||||||
$temp_owner = $this->bo->owner;
|
$temp_owner = $this->bo->owner;
|
||||||
@ -1892,8 +1858,6 @@
|
|||||||
|
|
||||||
function display_month($month,$year,$showyear,$owner=0)
|
function display_month($month,$year,$showyear,$owner=0)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$this->bo->store_to_cache(
|
$this->bo->store_to_cache(
|
||||||
Array(
|
Array(
|
||||||
'syear' => $year,
|
'syear' => $year,
|
||||||
@ -1940,8 +1904,6 @@
|
|||||||
|
|
||||||
function display_weekly($params)
|
function display_weekly($params)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!is_array($params))
|
if(!is_array($params))
|
||||||
{
|
{
|
||||||
$this->index();
|
$this->index();
|
||||||
@ -2020,8 +1982,6 @@
|
|||||||
|
|
||||||
function view_event($event)
|
function view_event($event)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!$event['participants'][$this->bo->owner])
|
if(!$event['participants'][$this->bo->owner])
|
||||||
{
|
{
|
||||||
return '<center>'.lang('You do not have permission to read this record!').'</center>';
|
return '<center>'.lang('You do not have permission to read this record!').'</center>';
|
||||||
@ -2226,8 +2186,6 @@
|
|||||||
|
|
||||||
function print_day($params)
|
function print_day($params)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!is_array($params))
|
if(!is_array($params))
|
||||||
{
|
{
|
||||||
$this->index();
|
$this->index();
|
||||||
@ -2533,8 +2491,6 @@
|
|||||||
|
|
||||||
function timematrix($param)
|
function timematrix($param)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!is_array($param))
|
if(!is_array($param))
|
||||||
{
|
{
|
||||||
$this->index();
|
$this->index();
|
||||||
@ -2666,8 +2622,6 @@
|
|||||||
|
|
||||||
function get_response($cal_id)
|
function get_response($cal_id)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
$p->set_file(
|
$p->set_file(
|
||||||
Array(
|
Array(
|
||||||
@ -2698,8 +2652,6 @@
|
|||||||
|
|
||||||
function edit_form($param)
|
function edit_form($param)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
|
|
||||||
if(!is_array($param))
|
if(!is_array($param))
|
||||||
{
|
{
|
||||||
$this-index();
|
$this-index();
|
||||||
@ -2952,7 +2904,6 @@
|
|||||||
|
|
||||||
function build_part_list(&$users,$accounts,$owner)
|
function build_part_list(&$users,$accounts,$owner)
|
||||||
{
|
{
|
||||||
global $GLOBALS;
|
|
||||||
if($accounts == False)
|
if($accounts == False)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user