mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 13:22:06 +02:00
fixes for the free/busy time matrix
This commit is contained in:
parent
518325dcb4
commit
41a159d0e0
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
if(extension_loaded("mcal") == False)
|
if(extension_loaded('mcal') == False)
|
||||||
{
|
{
|
||||||
define(RECUR_NONE,0);
|
define(RECUR_NONE,0);
|
||||||
define(RECUR_DAILY,1);
|
define(RECUR_DAILY,1);
|
||||||
@ -37,11 +37,12 @@ if(extension_loaded("mcal") == False)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreateObject('calendar.calendar_item');
|
CreateObject('calendar.calendar_item');
|
||||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal') == False)
|
||||||
if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded("mcal") == False)
|
|
||||||
{
|
{
|
||||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
$phpgw_info['server']['calendar_type'] = 'sql';
|
||||||
}
|
}
|
||||||
|
// The following line can be removed when vCalendar is implemented....
|
||||||
|
$phpgw_info['server']['calendar_type'] = 'sql';
|
||||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
|
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
|
||||||
|
|
||||||
class calendar extends calendar_
|
class calendar extends calendar_
|
||||||
@ -1304,13 +1305,12 @@ class calendar extends calendar_
|
|||||||
{
|
{
|
||||||
$phpgw_info['user']['preferences']['calendar']['interval'] = 15;
|
$phpgw_info['user']['preferences']['calendar']['interval'] = 15;
|
||||||
}
|
}
|
||||||
$datetime = $this->gmtdate($date['raw']);
|
|
||||||
$increment = $phpgw_info['user']['preferences']['calendar']['interval'];
|
$increment = $phpgw_info['user']['preferences']['calendar']['interval'];
|
||||||
$interval = (int)(60 / $increment);
|
$interval = (int)(60 / $increment);
|
||||||
|
|
||||||
$str = '<center>'.$phpgw->common->show_date($datetime['raw'],'l, F d, Y').'<br>';
|
$str = '<center>'.$phpgw->common->show_date($date['raw'],'l, F d, Y').'<br>';
|
||||||
$str .= '<table width="85%" border="0" cellspacing="0" cellpadding="0" cols="'.((24 * $interval) + 1).'">';
|
$str .= '<table width="85%" border="0" cellspacing="0" cellpadding="0" cols="'.((24 * $interval) + 1).'">';
|
||||||
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$phpgw_info['server']['app_images'].'/pix.gif"></td></tr>';
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
||||||
$str .= '<tr><td width="15%">Participant</td>';
|
$str .= '<tr><td width="15%">Participant</td>';
|
||||||
for($i=0;$i<24;$i++)
|
for($i=0;$i<24;$i++)
|
||||||
{
|
{
|
||||||
@ -1324,7 +1324,7 @@ class calendar extends calendar_
|
|||||||
$k = ($i<=9?'0':substr($i,0,1));
|
$k = ($i<=9?'0':substr($i,0,1));
|
||||||
}
|
}
|
||||||
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
||||||
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$datetime['year'].'&month='.$datetime['month'].'&day='.$datetime['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j<=9?'0':'').($increment * $j)."'; return true;\">";
|
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j<=9?'0':'').($increment * $j)."'; return true;\">";
|
||||||
$str .= $k.'</a></font></td>';
|
$str .= $k.'</a></font></td>';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -1333,19 +1333,19 @@ class calendar extends calendar_
|
|||||||
$k = ($i<=9?substr($i,0,1):substr($i,1,2));
|
$k = ($i<=9?substr($i,0,1):substr($i,1,2));
|
||||||
}
|
}
|
||||||
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
||||||
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$datetime['year'].'&month='.$datetime['month'].'&day='.$datetime['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
||||||
$str .= $k.'</a></font></td>';
|
$str .= $k.'</a></font></td>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$str .= '<td align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
$str .= '<td align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'">';
|
||||||
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$datetime['year'].'&month='.$datetime['month'].'&day='.$datetime['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
||||||
$str .= ' </a></font></td>';
|
$str .= ' </a></font></td>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$str .= '</tr>';
|
$str .= '</tr>';
|
||||||
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$phpgw_info['server']['app_images'].'/pix.gif"></td></tr>';
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
||||||
if(!$endtime)
|
if(!$endtime)
|
||||||
{
|
{
|
||||||
$endtime = $starttime;
|
$endtime = $starttime;
|
||||||
@ -1355,8 +1355,8 @@ class calendar extends calendar_
|
|||||||
$this->read_repeated_events($participants[$i]);
|
$this->read_repeated_events($participants[$i]);
|
||||||
$str .= '<tr>';
|
$str .= '<tr>';
|
||||||
$str .= '<td width="15%">'.$phpgw->common->grab_owner_name($participants[$i]).'</td>';
|
$str .= '<td width="15%">'.$phpgw->common->grab_owner_name($participants[$i]).'</td>';
|
||||||
$events = $this->get_sorted_by_date($datetime['raw'],$participants[$i]);
|
$events = $this->get_sorted_by_date($date['raw'],$participants[$i]);
|
||||||
if(!$this->sorted_re)
|
if($this->sorted_events_matching == False)
|
||||||
{
|
{
|
||||||
for($j=0;$j<24;$j++)
|
for($j=0;$j<24;$j++)
|
||||||
{
|
{
|
||||||
@ -1378,7 +1378,7 @@ class calendar extends calendar_
|
|||||||
$time_slice[$index]['description'] = '';
|
$time_slice[$index]['description'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($k=0;$k<$this->sorted_re;$k++)
|
for($k=0;$k<$this->sorted_events_matching;$k++)
|
||||||
{
|
{
|
||||||
$event = $events[$k];
|
$event = $events[$k];
|
||||||
$eventstart = $this->localdates($event->datetime);
|
$eventstart = $this->localdates($event->datetime);
|
||||||
@ -1433,7 +1433,7 @@ class calendar extends calendar_
|
|||||||
$index = ($hour + (($m * $increment) * 100));
|
$index = ($hour + (($m * $increment) * 100));
|
||||||
$time_slice[$index]['marker'] = '-';
|
$time_slice[$index]['marker'] = '-';
|
||||||
$time_slice[$index]['color'] = $phpgw_info['theme']['bg01'];
|
$time_slice[$index]['color'] = $phpgw_info['theme']['bg01'];
|
||||||
$time_slice[$index]['description'] = $this->is_private($event,$participants[$i]);
|
$time_slice[$index]['description'] = $this->is_private($event,$participants[$i],'title');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1449,7 +1449,7 @@ class calendar extends calendar_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$str .= '</tr>';
|
$str .= '</tr>';
|
||||||
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="#999999"><img src="'.$phpgw_info['server']['app_images'].'/pix.gif"></td></tr>';
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="#999999"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
||||||
}
|
}
|
||||||
$str .= '</table></center>';
|
$str .= '</table></center>';
|
||||||
return $str;
|
return $str;
|
||||||
|
@ -599,13 +599,17 @@ class calendar_
|
|||||||
$num_rows = $this->stream->f(0);
|
$num_rows = $this->stream->f(0);
|
||||||
if($num_rows == 0)
|
if($num_rows == 0)
|
||||||
{
|
{
|
||||||
$this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_days,cal_frequency) '
|
$this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,'
|
||||||
.'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.','.$end['raw'].",'$days',$freq)",__LINE__,__FILE__);
|
.'cal_type,cal_use_end,cal_end,cal_days,cal_frequency) '
|
||||||
|
.'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.','
|
||||||
|
.$end['raw'].",'$days',$freq)",__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->stream->query("UPDATE calendar_entry_repeats SET cal_type='".$event->rpt_type."', cal_use_end=".$use_end.', '
|
$this->stream->query('UPDATE calendar_entry_repeats '
|
||||||
."cal_end='".$end['raw']."', cal_days='".$days."', cal_frequency=".$freq.' '
|
."SET cal_type='".$event->rpt_type."', "
|
||||||
|
.'cal_use_end='.$use_end.", cal_end='".$end['raw']."', "
|
||||||
|
."cal_days='".$days."', cal_frequency=".$freq.' '
|
||||||
.'WHERE cal_id='.$event->id,__LINE__,__FILE__);
|
.'WHERE cal_id='.$event->id,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,11 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
if (floor($PHP_VERSION ) == 4)
|
||||||
|
{
|
||||||
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
|
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
|
||||||
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
|
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($filter) || !$filter)
|
if(!isset($filter) || !$filter)
|
||||||
{
|
{
|
||||||
|
@ -23,35 +23,35 @@
|
|||||||
|
|
||||||
include('../header.inc.php');
|
include('../header.inc.php');
|
||||||
|
|
||||||
$date = $thisyear;
|
// $date = $thisyear;
|
||||||
$date .= ($thismonth<=9?"0":"").$thismonth;
|
// $date .= ($thismonth<=9?"0":"").$thismonth;
|
||||||
$date .= ($thisday<=9?"0":"").$thisday;
|
// $date .= ($thisday<=9?"0":"").$thisday;
|
||||||
|
|
||||||
$parts = Array();
|
$parts = Array();
|
||||||
|
$acct = CreateObject('phpgwapi.accounts');
|
||||||
for($i=0;$i<count($participants);$i++)
|
for($i=0;$i<count($participants);$i++)
|
||||||
{
|
{
|
||||||
switch ($phpgw->accounts->get_type($participants[$i]))
|
switch ($phpgw->accounts->get_type($participants[$i]))
|
||||||
{
|
{
|
||||||
case 'g':
|
case 'g':
|
||||||
$acct = CreateObject('phpgwapi.accounts',$participants[$i]);
|
|
||||||
$members = $acct->members(intval($participants[$i]));
|
$members = $acct->members(intval($participants[$i]));
|
||||||
while($members != False && $member = each($members))
|
while($members != False && $member = each($members))
|
||||||
{
|
{
|
||||||
if(($grants[$member[1]['account_id']] & PHPGW_ACL_READ) && !isset($parts[$member[1]['account_id']]))
|
if(!!($grants[$member[1]['account_id']] & PHPGW_ACL_READ == True) && !isset($parts[$member[1]['account_id']]))
|
||||||
{
|
{
|
||||||
$parts[$member[1]['account_id']] = 1;
|
$parts[$member[1]['account_id']] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($acct);
|
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if(($grants[$participants[$i]] & PHPGW_ACL_READ) && !isset($parts[$participants[$i]]))
|
if(!!($grants[$participants[$i]] & PHPGW_ACL_READ == True) && !isset($parts[$participants[$i]]))
|
||||||
{
|
{
|
||||||
$parts[$participants[$i]] = 1;
|
$parts[$participants[$i]] = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset($acct);
|
||||||
|
|
||||||
$participants = Array();
|
$participants = Array();
|
||||||
reset($parts);
|
reset($parts);
|
||||||
@ -65,27 +65,30 @@
|
|||||||
switch($matrixtype)
|
switch($matrixtype)
|
||||||
{
|
{
|
||||||
case 'free/busy':
|
case 'free/busy':
|
||||||
echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),$phpgw->calendar->splittime('000000'),0,$participants);
|
$freetime = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday,$thisyear);
|
||||||
|
echo $phpgw->calendar->timematrix($freetime,$phpgw->calendar->splittime('000000'),0,$participants);
|
||||||
break;
|
break;
|
||||||
case 'weekly':
|
case 'weekly':
|
||||||
echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants);
|
echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
echo '<center>';
|
echo "\n".'<center>'."\n";
|
||||||
echo '<form action="'.$phpgw->link('viewmatrix.php').'" method="post" name="matrixform" target="viewmatrix">';
|
echo ' <form action="'.$phpgw->link('viewmatrix.php').'" method="post" name="matrixform" target="viewmatrix">'."\n";
|
||||||
echo '<input type="hidden" name="date" value="'.$date.'">';
|
echo ' <input type="hidden" name="year" value="'.$thisyear.'">'."\n";
|
||||||
echo '<input type="hidden" name="matrixtype" value="'.$matrixtype.'">';
|
echo ' <input type="hidden" name="month" value="'.$thismonth.'">'."\n";
|
||||||
|
echo ' <input type="hidden" name="day" value="'.$thisday.'">'."\n";
|
||||||
|
echo ' <input type="hidden" name="matrixtype" value="'.$matrixtype.'">'."\n";
|
||||||
for ($i=0;$i<count($participants);$i++)
|
for ($i=0;$i<count($participants);$i++)
|
||||||
{
|
{
|
||||||
echo '<input type="hidden" name="participants[]" value="'.$participants[$i].'">';
|
echo ' <input type="hidden" name="participants[]" value="'.$participants[$i].'">'."\n";
|
||||||
}
|
}
|
||||||
if(isset($filter) && $filter)
|
if(isset($filter) && $filter)
|
||||||
{
|
{
|
||||||
echo '<input type="hidden" name="filter" value="'.$filter.'">';
|
echo ' <input type="hidden" name="filter" value="'.$filter.'">'."\n";
|
||||||
}
|
}
|
||||||
echo '<input type="submit" value="Refresh">';
|
echo ' <input type="submit" value="Refresh">'."\n";
|
||||||
echo '</form>';
|
echo ' </form>'."\n";
|
||||||
echo '</center>';
|
echo '</center>'."\n";
|
||||||
|
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user