forked from extern/egroupware
fixes for the free/busy time matrix
This commit is contained in:
parent
518325dcb4
commit
41a159d0e0
@ -14,7 +14,7 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if(extension_loaded("mcal") == False)
|
||||
if(extension_loaded('mcal') == False)
|
||||
{
|
||||
define(RECUR_NONE,0);
|
||||
define(RECUR_DAILY,1);
|
||||
@ -37,11 +37,12 @@ if(extension_loaded("mcal") == False)
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
// 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');
|
||||
|
||||
class calendar extends calendar_
|
||||
@ -1304,13 +1305,12 @@ class calendar extends calendar_
|
||||
{
|
||||
$phpgw_info['user']['preferences']['calendar']['interval'] = 15;
|
||||
}
|
||||
$datetime = $this->gmtdate($date['raw']);
|
||||
$increment = $phpgw_info['user']['preferences']['calendar']['interval'];
|
||||
$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 .= '<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>';
|
||||
for($i=0;$i<24;$i++)
|
||||
{
|
||||
@ -1324,7 +1324,7 @@ class calendar extends calendar_
|
||||
$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 .= '<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>';
|
||||
break;
|
||||
case 1:
|
||||
@ -1333,19 +1333,19 @@ class calendar extends calendar_
|
||||
$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 .= '<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>';
|
||||
break;
|
||||
default:
|
||||
$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>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$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)
|
||||
{
|
||||
$endtime = $starttime;
|
||||
@ -1355,8 +1355,8 @@ class calendar extends calendar_
|
||||
$this->read_repeated_events($participants[$i]);
|
||||
$str .= '<tr>';
|
||||
$str .= '<td width="15%">'.$phpgw->common->grab_owner_name($participants[$i]).'</td>';
|
||||
$events = $this->get_sorted_by_date($datetime['raw'],$participants[$i]);
|
||||
if(!$this->sorted_re)
|
||||
$events = $this->get_sorted_by_date($date['raw'],$participants[$i]);
|
||||
if($this->sorted_events_matching == False)
|
||||
{
|
||||
for($j=0;$j<24;$j++)
|
||||
{
|
||||
@ -1378,7 +1378,7 @@ class calendar extends calendar_
|
||||
$time_slice[$index]['description'] = '';
|
||||
}
|
||||
}
|
||||
for($k=0;$k<$this->sorted_re;$k++)
|
||||
for($k=0;$k<$this->sorted_events_matching;$k++)
|
||||
{
|
||||
$event = $events[$k];
|
||||
$eventstart = $this->localdates($event->datetime);
|
||||
@ -1433,7 +1433,7 @@ class calendar extends calendar_
|
||||
$index = ($hour + (($m * $increment) * 100));
|
||||
$time_slice[$index]['marker'] = '-';
|
||||
$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><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>';
|
||||
return $str;
|
||||
|
@ -599,13 +599,17 @@ class calendar_
|
||||
$num_rows = $this->stream->f(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) '
|
||||
.'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.','.$end['raw'].",'$days',$freq)",__LINE__,__FILE__);
|
||||
$this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,'
|
||||
.'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
|
||||
{
|
||||
$this->stream->query("UPDATE calendar_entry_repeats SET cal_type='".$event->rpt_type."', cal_use_end=".$use_end.', '
|
||||
."cal_end='".$end['raw']."', cal_days='".$days."', cal_frequency=".$freq.' '
|
||||
$this->stream->query('UPDATE calendar_entry_repeats '
|
||||
."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__);
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,11 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
|
||||
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
|
||||
if (floor($PHP_VERSION ) == 4)
|
||||
{
|
||||
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
|
||||
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
|
||||
}
|
||||
|
||||
if(!isset($filter) || !$filter)
|
||||
{
|
||||
|
@ -23,35 +23,35 @@
|
||||
|
||||
include('../header.inc.php');
|
||||
|
||||
$date = $thisyear;
|
||||
$date .= ($thismonth<=9?"0":"").$thismonth;
|
||||
$date .= ($thisday<=9?"0":"").$thisday;
|
||||
// $date = $thisyear;
|
||||
// $date .= ($thismonth<=9?"0":"").$thismonth;
|
||||
// $date .= ($thisday<=9?"0":"").$thisday;
|
||||
|
||||
$parts = Array();
|
||||
$acct = CreateObject('phpgwapi.accounts');
|
||||
for($i=0;$i<count($participants);$i++)
|
||||
{
|
||||
switch ($phpgw->accounts->get_type($participants[$i]))
|
||||
{
|
||||
case 'g':
|
||||
$acct = CreateObject('phpgwapi.accounts',$participants[$i]);
|
||||
$members = $acct->members(intval($participants[$i]));
|
||||
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;
|
||||
}
|
||||
}
|
||||
unset($acct);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($acct);
|
||||
|
||||
$participants = Array();
|
||||
reset($parts);
|
||||
@ -65,27 +65,30 @@
|
||||
switch($matrixtype)
|
||||
{
|
||||
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;
|
||||
case 'weekly':
|
||||
echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants);
|
||||
break;
|
||||
}
|
||||
echo '<center>';
|
||||
echo '<form action="'.$phpgw->link('viewmatrix.php').'" method="post" name="matrixform" target="viewmatrix">';
|
||||
echo '<input type="hidden" name="date" value="'.$date.'">';
|
||||
echo '<input type="hidden" name="matrixtype" value="'.$matrixtype.'">';
|
||||
echo "\n".'<center>'."\n";
|
||||
echo ' <form action="'.$phpgw->link('viewmatrix.php').'" method="post" name="matrixform" target="viewmatrix">'."\n";
|
||||
echo ' <input type="hidden" name="year" value="'.$thisyear.'">'."\n";
|
||||
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++)
|
||||
{
|
||||
echo '<input type="hidden" name="participants[]" value="'.$participants[$i].'">';
|
||||
echo ' <input type="hidden" name="participants[]" value="'.$participants[$i].'">'."\n";
|
||||
}
|
||||
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 '</form>';
|
||||
echo '</center>';
|
||||
echo ' <input type="submit" value="Refresh">'."\n";
|
||||
echo ' </form>'."\n";
|
||||
echo '</center>'."\n";
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user