matrix's fixed to handle new api structure

This commit is contained in:
skeeter 2001-02-20 03:48:39 +00:00
parent 5ba2a1cdde
commit 8b5f954c1c
4 changed files with 356 additions and 329 deletions

View File

@ -14,11 +14,11 @@
/* $Id$ */
$phpgw_info['server']['calendar_type'] = 'sql';
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
$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_
{
class calendar extends calendar_
{
function calendar($params=False)
{
global $phpgw_info;
@ -47,5 +47,165 @@
$this->today = $this->localdates(time());
}
}
function timematrix($date,$starttime,$endtime,$participants)
{
global $phpgw, $phpgw_info;
if(!isset($phpgw_info['user']['preferences']['calendar']['interval']) ||
!$phpgw_info['user']['preferences']['calendar']['interval'])
{
$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 .= '<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 width="15%">Participant</td>';
for($i=0;$i<24;$i++)
{
for($j=0;$j<$interval;$j++)
{
switch($j)
{
case 0:
if($interval == 4)
{
$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 .= $k.'</a></font></td>';
break;
case 1:
if($interval == 4)
{
$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 .= $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 .= '&nbsp</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>';
if(!$endtime)
{
$endtime = $starttime;
}
for($i=0;$i<count($participants);$i++)
{
$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)
{
for($j=0;$j<24;$j++)
{
for($k=0;$k<$interval;$k++)
{
$str .= '<td height="1" align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'" color="#999999">&nbsp;</td>';
}
}
}
else
{
for($h=0;$h<24;$h++)
{
for($m=0;$m<$interval;$m++)
{
$index = (($h * 10000) + (($m * $increment) * 100));
$time_slice[$index]['marker'] = '&nbsp';
$time_slice[$index]['color'] = $phpgw_info['theme']['bg_color'];
$time_slice[$index]['description'] = '';
}
}
for($k=0;$k<$this->sorted_re;$k++)
{
$event = $events[$k];
$eventstart = $this->localdates($event->datetime);
$eventend = $this->localdates($event->edatetime);
$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
$starttemp = $this->splittime("$start");
$subminute = 0;
for($m=0;$m<$interval;$m++)
{
$minutes = $increment * $m;
if(intval($starttemp['minute']) > $minutes && intval($starttemp['minute']) < ($minutes + $increment))
{
$subminute = ($starttemp['minute'] - $minutes) * 100;
}
}
$start -= $subminute;
$end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
$endtemp = $this->splittime("$end");
$addminute = 0;
for($m=0;$m<$interval;$m++)
{
$minutes = ($increment * $m);
if($endtemp['minute'] < ($minutes + $increment) && $endtemp['minute'] > $minutes)
{
$addminute = ($minutes + $increment - $endtemp['minute']) * 100;
}
}
$end += $addminute;
$starttemp = $this->splittime("$start");
$endtemp = $this->splittime("$end");
// Do not display All-Day events in this free/busy time
if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59)))
{
}
else
{
for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
{
$startminute = 0;
$endminute = $interval;
$hour = $h * 10000;
if($h == intval($starttemp['hour']))
{
$startminute = ($starttemp['minute'] / $increment);
}
if($h == intval($endtemp['hour']))
{
$endminute = ($endtemp['minute'] / $increment);
}
for($m=$startminute;$m<=$endminute;$m++)
{
$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]);
}
}
}
}
for($h=0;$h<24;$h++)
{
$hour = $h * 10000;
for($m=0;$m<$interval;$m++)
{
$index = ($hour + (($m * $increment) * 100));
$str .= '<td height="1" align="left" bgcolor="'.$time_slice[$index]['color']."\" color=\"#999999\" onMouseOver=\"window.status='".$time_slice[$index]['description']."'; return true;\">".$time_slice[$index]['marker'].'</td>';
}
}
}
$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 .= '</table></center>';
return $str;
}
}
?>

View File

@ -430,166 +430,6 @@ class calendar_
return $str;
}
function timematrix($date,$starttime,$endtime,$participants)
{
global $phpgw, $phpgw_info;
if(!isset($phpgw_info['user']['preferences']['calendar']['interval']) ||
!$phpgw_info['user']['preferences']['calendar']['interval'])
{
$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 .= '<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 width="15%">Participant</td>';
for($i=0;$i<24;$i++)
{
for($j=0;$j<$interval;$j++)
{
switch($j)
{
case 0:
if($interval == 4)
{
$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 .= $k.'</a></font></td>';
break;
case 1:
if($interval == 4)
{
$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 .= $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 .= '&nbsp</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>';
if(!$endtime)
{
$endtime = $starttime;
}
for($i=0;$i<count($participants);$i++)
{
$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)
{
for($j=0;$j<24;$j++)
{
for($k=0;$k<$interval;$k++)
{
$str .= '<td height="1" align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'" color="#999999">&nbsp;</td>';
}
}
}
else
{
for($h=0;$h<24;$h++)
{
for($m=0;$m<$interval;$m++)
{
$index = (($h * 10000) + (($m * $increment) * 100));
$time_slice[$index]['marker'] = '&nbsp';
$time_slice[$index]['color'] = $phpgw_info['theme']['bg_color'];
$time_slice[$index]['description'] = '';
}
}
for($k=0;$k<$this->sorted_re;$k++)
{
$event = $events[$k];
$eventstart = $this->localdates($event->datetime);
$eventend = $this->localdates($event->edatetime);
$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
$starttemp = $this->splittime("$start");
$subminute = 0;
for($m=0;$m<$interval;$m++)
{
$minutes = $increment * $m;
if(intval($starttemp['minute']) > $minutes && intval($starttemp['minute']) < ($minutes + $increment))
{
$subminute = ($starttemp['minute'] - $minutes) * 100;
}
}
$start -= $subminute;
$end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
$endtemp = $this->splittime("$end");
$addminute = 0;
for($m=0;$m<$interval;$m++)
{
$minutes = ($increment * $m);
if($endtemp['minute'] < ($minutes + $increment) && $endtemp['minute'] > $minutes)
{
$addminute = ($minutes + $increment - $endtemp['minute']) * 100;
}
}
$end += $addminute;
$starttemp = $this->splittime("$start");
$endtemp = $this->splittime("$end");
// Do not display All-Day events in this free/busy time
if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59)))
{
}
else
{
for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
{
$startminute = 0;
$endminute = $interval;
$hour = $h * 10000;
if($h == intval($starttemp['hour']))
{
$startminute = ($starttemp['minute'] / $increment);
}
if($h == intval($endtemp['hour']))
{
$endminute = ($endtemp['minute'] / $increment);
}
for($m=$startminute;$m<=$endminute;$m++)
{
$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]);
}
}
}
}
for($h=0;$h<24;$h++)
{
$hour = $h * 10000;
for($m=0;$m<$interval;$m++)
{
$index = ($hour + (($m * $increment) * 100));
$str .= '<td height="1" align="left" bgcolor="'.$time_slice[$index]['color']."\" color=\"#999999\" onMouseOver=\"window.status='".$time_slice[$index]['description']."'; return true;\">".$time_slice[$index]['marker'].'</td>';
}
}
}
$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 .= '</table></center>';
return $str;
}
function read_repeated_events($owner=0)
{
global $phpgw, $phpgw_info;

View File

@ -12,127 +12,150 @@
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True, "parent_page" => "index.php");
$phpgw_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True,
);
include("../header.inc.php");
$phpgw_info['flags'] = $phpgw_flags;
if(isset($friendly) && $friendly) {
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]))
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
include('../header.inc.php');
if (isset($date) && strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);
$thisday = substr($date, 6, 2);
} else {
if (!isset($day) || !$day)
$thisday = $phpgw->calendar->today["day"];
else
$thisday = $day;
if (!isset($month) || !$month)
$thismonth = $phpgw->calendar->today["month"];
else
$thismonth = $month;
if (!isset($year) || !$year)
$thisyear = $phpgw->calendar->today["year"];
else
$thisyear = $year;
}
}
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$phpgw->template->set_file(array("matrix_query_begin" => "matrix_query.tpl",
"list" => "list.tpl",
"matrix_query_end" => "matrix_query.tpl",
"form_button" => "form_button_script.tpl"));
$templates = Array(
'matrix_query_begin' => 'matrix_query.tpl',
'list' => 'list.tpl',
'matrix_query_end' => 'matrix_query.tpl',
'form_button' => 'form_button_script.tpl'
);
$phpgw->template->set_block("matrix_query_begin","list","matrix_query_end","form_button");
$p->set_file($templates);
$phpgw->template->set_var("matrix_action",lang("Daily Matrix View"));
$phpgw->template->set_var("action_url",$phpgw->link("viewmatrix.php"));
$var = Array(
'matrix_action' => lang('Daily Matrix View'),
'action_url' => $phpgw->link('viewmatrix.php')
);
$phpgw->template->parse("out","matrix_query_begin");
$p->set_var($var);
$p->parse('out','matrix_query_begin');
$phpgw->template->set_var("field",lang("Date"));
// Date
$day_html = '<select name="day">';
for($i=1;$i<=31;$i++)
{
$day_html .= '<option value="'.$i.'"'.($i==$thisday?' selected':'').'>'.$i.'</option>'."\n";
}
$day_html .= '</select>';
$day_html = "<select name=\"day\">";
for($i=1;$i<=31;$i++)
$day_html .= "<option value=\"$i\"".($i==$thisday?" selected":"").">$i</option>\n";
$day_html .= "</select>";
$month_html = '<select name="month">';
for($i=1;$i<=12;$i++)
{
$m = lang(date('F', mktime(0,0,0,$i,1,$thisyear)));
$month_html .= '<option value="'.$i.'"'.($i==$thismonth?' selected':'').'>'.$m.'</option>'."\n";
}
$month_html .= '</select>';
$month_html = "<select name=\"month\">";
for($i=1;$i<=12;$i++) {
$m = lang(date("F", mktime(0,0,0,$i,1,$thisyear)));
$month_html .= "<option value=\"$i\"".($i==$thismonth?" selected":"").">$m</option>\n";
}
$month_html .= "</select>";
$year_html = "<select name=\"year\">";
for($i=($thisyear - 1);$i<($thisyear + 5);$i++) {
$year_html .= "<option value=\"$i\"".($i==$thisyear?" selected":"").">$i</option>\n";
}
$year_html .= "</select>";
$phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
$phpgw->template->parse("output","list",True);
$year_html = '<select name="year">';
for($i=($thisyear - 1);$i<($thisyear + 5);$i++)
{
$year_html .= '<option value="'.$i.'"'.($i==$thisyear?' selected':'').'>'.$i.'</option>'."\n";
}
$year_html .= '</select>';
$var = Array(
'field' => lang('Date'),
'data' => $phpgw->common->dateformatorder($year_html,$month_html,$day_html)
);
$p->set_var($var);
$p->parse('output','list',True);
// View type
$phpgw->template->set_var("field",lang("View"));
$str = "<select name=\"matrixtype\">";
$str .= "<option value=\"free/busy\" selected>".lang("free/busy")."</option>\n";
$str .= "<option value=\"weekly\">".lang("Weekly")."</option>\n";
$str .= "</select>\n";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
$str = '<select name="matrixtype">';
$str .= '<option value="free/busy" selected>'.lang('free/busy').'</option>'."\n";
$str .= '<option value="weekly">'.lang('Weekly').'</option>'."\n";
$str .= '</select>'."\n";
$var = Array(
'field' => lang('View'),
'data' => $str
);
$p->set_var($var);
$p->parse('output','list',True);
// Participants
$phpgw->template->set_var("field",lang("Participants"));
$db2 = $phpgw->db;
$db2->query("select account_id,account_lastname,account_firstname "
. "from accounts where account_status !='L' and "
. "account_id != ".$phpgw_info["user"]["account_id"]." "
. "and account_permissions like '%:calendar:%' "
. "order by account_lastname,account_firstname");
$accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar');
$users = Array();
for($i=0;$i<count($accounts);$i++)
{
$user = $accounts[$i];
if(!isset($users[$user]))
{
$users[$user] = $phpgw->common->grab_owner_name($user);
if($phpgw->accounts->get_type($user) == 'g')
{
$group_members = $phpgw->acl->get_ids_for_location($user,1,'phpgw_group');
if($group_members != False)
{
for($j=0;$j<count($group_members);$j++)
{
if(!isset($users[$group_members[$j]]))
{
$users[$group_members[$j]] = $phpgw->common->grab_owner_name($group_members[$j]);
}
}
}
}
}
}
$num_rows = $db2->num_rows();
if ($num_rows > 50)
$size = 15;
elseif ($num_rows > 5)
$size = 5;
else
$size = $num_rows;
$str = "<select name=\"participants[]\" multiple size=\"$size\">";
if ($num_users > 50)
{
$size = 15;
}
elseif ($num_users > 5)
{
$size = 5;
}
else
{
$size = $num_users;
}
$str = "\n".' <select name="participants[]" multiple size="'.$size.'">'."\n";
@asort($users);
@reset($users);
while ($user = each($users))
{
if((($phpgw->accounts->exists($user[0]) == True) && ($grants[$user[0]] && PHPGW_ACL_READ)) || ($user[0] == $owner) || $phpgw->accounts->get_type($user[0]) == 'g')
{
$str .= ' <option value="' . $user[0] . '">('.$phpgw->accounts->get_type($user[0]).') '.$user[1].'</option>'."\n";
}
}
$str .= ' </select>';
while($db2->next_record()) {
$id = $db2->f("account_id");
$str .= "<option value=\"".$id."\">".$phpgw->common->grab_owner_name($id)."</option>\n";
}
$str .= "</select>";
$str .= "<input type=\"hidden\" name=\"participants[]\" value=\"".$phpgw_info["user"]["account_id"]."\">";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
$var = Array(
'field' => lang('Participants'),
'data' => $str
);
// Groups
$phpgw->template->set_var("field",lang("Groups"));
$str = "<select name=\"groups[]\" multiple size=\"5\">";
$user_groups = $phpgw->accounts->read_group_names();
for ($i=0;$i<count($user_groups);$i++) {
$str .= "<option value=\"" . $user_groups[$i][0] . "\">" . $user_groups[$i][1] . "</option>\n";
}
$str .= "</select>";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
$p->set_var($var);
$p->parse('output','list',True);
$phpgw->template->set_var("submit_button",lang("Submit"));
$var = Array(
'submit_button' => lang('Submit'),
'action_url_button' => '',
'action_text_button' => lang('Cancel'),
'action_confirm_button' => 'onClick="history.back(-1)"'
);
$phpgw->template->set_var("action_url_button","");
$phpgw->template->set_var("action_text_button",lang("Cancel"));
$phpgw->template->set_var("action_confirm_button","onClick=\"history.back(-1)\"");
$p->set_var($var);
$p->parse('cancel_button','form_button');
$phpgw->template->parse("cancel_button","form_button");
$p->pparse('out','matrix_query_end');
$phpgw->template->pparse("out","matrix_query_end");
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_footer();
?>

View File

@ -12,76 +12,80 @@
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id$ */
$matrix = $matrixtype;
$phpgw_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True,
);
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True, "parent_page" => "matrixselect.php");
$phpgw_info['flags'] = $phpgw_flags;
include("../header.inc.php");
include('../header.inc.php');
if (isset($date) && strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);
$thisday = substr($date, 6, 2);
} else {
if (!isset($day) || !$day)
$thisday = $phpgw->calendar->today["day"];
else
$thisday = $day;
if (!isset($month) || !$month)
$thismonth = $phpgw->calendar->today["month"];
else
$thismonth = $month;
if (!isset($year) || !$year)
$thisyear = $phpgw->calendar->today["year"];
else
$thisyear = $year;
$date = $thisyear;
$date .= ($thismonth<=9?"0":"").$thismonth;
$date .= ($thisday<=9?"0":"").$thisday;
$date = $thisyear;
$date .= ($thismonth<=9?"0":"").$thismonth;
$date .= ($thisday<=9?"0":"").$thisday;
}
// $date = $thisyear.$thismonth.$thisday;
if(isset($groups) && $groups) {
for($i=0;$i<count($groups);$i++) {
$phpgw->db->query("SELECT account_id FROM accounts WHERE account_groups LIKE '%,".$groups[$i].":%'");
while($phpgw->db->next_record()) {
$participating = False;
for($j=0;$j<count($participants);$j++) {
if($participants[$j] == $phpgw->db->f("account_id")) {
$participating = True;
}
$parts = Array();
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']]))
{
$parts[$member[1]['account_id']] = 1;
}
}
unset($acct);
break;
case 'u':
if(($grants[$participants[$i]] & PHPGW_ACL_READ) && !isset($parts[$participants[$i]]))
{
$parts[$participants[$i]] = 1;
}
break;
}
}
if(!$participating) $participants[] = $phpgw->db->f("account_id");
}
}
}
reset($participants);
$participants = Array();
reset($parts);
while($part = each($parts))
{
$participants[] = $part[0];
}
switch($matrixtype) {
case "free/busy" :
echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),$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=\"".$matrix."\">";
for ($i=0;$i<count($participants);$i++)
echo "<input type=\"hidden\" name=\"participants[]\" value=\"".$participants[$i]."\">";
if(isset($filter) && $filter) {
echo "<input type=\"hidden\" name=\"filter\" value=\"".$filter."\">";
}
echo "<input type=\"submit\" value=\"Refresh\">";
echo "</form>";
echo "</center>";
reset($participants);
$phpgw->common->phpgw_footer();
switch($matrixtype)
{
case 'free/busy':
echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),$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.'">';
for ($i=0;$i<count($participants);$i++)
{
echo '<input type="hidden" name="participants[]" value="'.$participants[$i].'">';
}
if(isset($filter) && $filter)
{
echo '<input type="hidden" name="filter" value="'.$filter.'">';
}
echo '<input type="submit" value="Refresh">';
echo '</form>';
echo '</center>';
$phpgw->common->phpgw_footer();
?>