forked from extern/egroupware
matrix's fixed to handle new api structure
This commit is contained in:
parent
5ba2a1cdde
commit
8b5f954c1c
@ -14,11 +14,11 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
$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_
|
||||||
{
|
{
|
||||||
function calendar($params=False)
|
function calendar($params=False)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
@ -47,5 +47,165 @@
|
|||||||
|
|
||||||
$this->today = $this->localdates(time());
|
$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 .= ' </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"> </td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for($h=0;$h<24;$h++)
|
||||||
|
{
|
||||||
|
for($m=0;$m<$interval;$m++)
|
||||||
|
{
|
||||||
|
$index = (($h * 10000) + (($m * $increment) * 100));
|
||||||
|
$time_slice[$index]['marker'] = ' ';
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -430,166 +430,6 @@ class calendar_
|
|||||||
return $str;
|
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 .= ' </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"> </td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for($h=0;$h<24;$h++)
|
|
||||||
{
|
|
||||||
for($m=0;$m<$interval;$m++)
|
|
||||||
{
|
|
||||||
$index = (($h * 10000) + (($m * $increment) * 100));
|
|
||||||
$time_slice[$index]['marker'] = ' ';
|
|
||||||
$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)
|
function read_repeated_events($owner=0)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
@ -12,127 +12,150 @@
|
|||||||
* option) any later version. *
|
* 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) {
|
include('../header.inc.php');
|
||||||
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]))
|
|
||||||
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
|
|
||||||
|
|
||||||
if (isset($date) && strlen($date) > 0) {
|
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$phpgw->template->set_file(array("matrix_query_begin" => "matrix_query.tpl",
|
$templates = Array(
|
||||||
"list" => "list.tpl",
|
'matrix_query_begin' => 'matrix_query.tpl',
|
||||||
"matrix_query_end" => "matrix_query.tpl",
|
'list' => 'list.tpl',
|
||||||
"form_button" => "form_button_script.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"));
|
$var = Array(
|
||||||
$phpgw->template->set_var("action_url",$phpgw->link("viewmatrix.php"));
|
'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\">";
|
$month_html = '<select name="month">';
|
||||||
for($i=1;$i<=31;$i++)
|
for($i=1;$i<=12;$i++)
|
||||||
$day_html .= "<option value=\"$i\"".($i==$thisday?" selected":"").">$i</option>\n";
|
{
|
||||||
$day_html .= "</select>";
|
$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\">";
|
$year_html = '<select name="year">';
|
||||||
for($i=1;$i<=12;$i++) {
|
for($i=($thisyear - 1);$i<($thisyear + 5);$i++)
|
||||||
$m = lang(date("F", mktime(0,0,0,$i,1,$thisyear)));
|
{
|
||||||
$month_html .= "<option value=\"$i\"".($i==$thismonth?" selected":"").">$m</option>\n";
|
$year_html .= '<option value="'.$i.'"'.($i==$thisyear?' selected':'').'>'.$i.'</option>'."\n";
|
||||||
}
|
}
|
||||||
$month_html .= "</select>";
|
$year_html .= '</select>';
|
||||||
|
|
||||||
$year_html = "<select name=\"year\">";
|
$var = Array(
|
||||||
for($i=($thisyear - 1);$i<($thisyear + 5);$i++) {
|
'field' => lang('Date'),
|
||||||
$year_html .= "<option value=\"$i\"".($i==$thisyear?" selected":"").">$i</option>\n";
|
'data' => $phpgw->common->dateformatorder($year_html,$month_html,$day_html)
|
||||||
}
|
);
|
||||||
$year_html .= "</select>";
|
|
||||||
|
|
||||||
$phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
|
$p->set_var($var);
|
||||||
$phpgw->template->parse("output","list",True);
|
$p->parse('output','list',True);
|
||||||
|
|
||||||
// View type
|
// View type
|
||||||
$phpgw->template->set_var("field",lang("View"));
|
$str = '<select name="matrixtype">';
|
||||||
$str = "<select name=\"matrixtype\">";
|
$str .= '<option value="free/busy" selected>'.lang('free/busy').'</option>'."\n";
|
||||||
$str .= "<option value=\"free/busy\" selected>".lang("free/busy")."</option>\n";
|
$str .= '<option value="weekly">'.lang('Weekly').'</option>'."\n";
|
||||||
$str .= "<option value=\"weekly\">".lang("Weekly")."</option>\n";
|
$str .= '</select>'."\n";
|
||||||
$str .= "</select>\n";
|
|
||||||
$phpgw->template->set_var("data",$str);
|
$var = Array(
|
||||||
$phpgw->template->parse("output","list",True);
|
'field' => lang('View'),
|
||||||
|
'data' => $str
|
||||||
|
);
|
||||||
|
|
||||||
|
$p->set_var($var);
|
||||||
|
$p->parse('output','list',True);
|
||||||
|
|
||||||
// Participants
|
// Participants
|
||||||
$phpgw->template->set_var("field",lang("Participants"));
|
$accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar');
|
||||||
$db2 = $phpgw->db;
|
$users = Array();
|
||||||
$db2->query("select account_id,account_lastname,account_firstname "
|
for($i=0;$i<count($accounts);$i++)
|
||||||
. "from accounts where account_status !='L' and "
|
{
|
||||||
. "account_id != ".$phpgw_info["user"]["account_id"]." "
|
$user = $accounts[$i];
|
||||||
. "and account_permissions like '%:calendar:%' "
|
if(!isset($users[$user]))
|
||||||
. "order by account_lastname,account_firstname");
|
{
|
||||||
|
$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_users > 50)
|
||||||
if ($num_rows > 50)
|
{
|
||||||
$size = 15;
|
$size = 15;
|
||||||
elseif ($num_rows > 5)
|
}
|
||||||
$size = 5;
|
elseif ($num_users > 5)
|
||||||
else
|
{
|
||||||
$size = $num_rows;
|
$size = 5;
|
||||||
$str = "<select name=\"participants[]\" multiple size=\"$size\">";
|
}
|
||||||
|
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()) {
|
$var = Array(
|
||||||
$id = $db2->f("account_id");
|
'field' => lang('Participants'),
|
||||||
$str .= "<option value=\"".$id."\">".$phpgw->common->grab_owner_name($id)."</option>\n";
|
'data' => $str
|
||||||
}
|
);
|
||||||
$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);
|
|
||||||
|
|
||||||
// Groups
|
$p->set_var($var);
|
||||||
$phpgw->template->set_var("field",lang("Groups"));
|
$p->parse('output','list',True);
|
||||||
$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);
|
|
||||||
|
|
||||||
$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","");
|
$p->set_var($var);
|
||||||
$phpgw->template->set_var("action_text_button",lang("Cancel"));
|
$p->parse('cancel_button','form_button');
|
||||||
$phpgw->template->set_var("action_confirm_button","onClick=\"history.back(-1)\"");
|
|
||||||
|
|
||||||
$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();
|
|
||||||
?>
|
?>
|
||||||
|
@ -12,76 +12,80 @@
|
|||||||
* option) any later version. *
|
* 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) {
|
$date = $thisyear;
|
||||||
$thisyear = substr($date, 0, 4);
|
$date .= ($thismonth<=9?"0":"").$thismonth;
|
||||||
$thismonth = substr($date, 4, 2);
|
$date .= ($thisday<=9?"0":"").$thisday;
|
||||||
$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;
|
|
||||||
|
|
||||||
}
|
$parts = Array();
|
||||||
|
for($i=0;$i<count($participants);$i++)
|
||||||
// $date = $thisyear.$thismonth.$thisday;
|
{
|
||||||
|
switch ($phpgw->accounts->get_type($participants[$i]))
|
||||||
if(isset($groups) && $groups) {
|
{
|
||||||
for($i=0;$i<count($groups);$i++) {
|
case 'g':
|
||||||
$phpgw->db->query("SELECT account_id FROM accounts WHERE account_groups LIKE '%,".$groups[$i].":%'");
|
$acct = CreateObject('phpgwapi.accounts',$participants[$i]);
|
||||||
while($phpgw->db->next_record()) {
|
$members = $acct->members(intval($participants[$i]));
|
||||||
$participating = False;
|
while($members != False && $member = each($members))
|
||||||
for($j=0;$j<count($participants);$j++) {
|
{
|
||||||
if($participants[$j] == $phpgw->db->f("account_id")) {
|
if(($grants[$member[1]['account_id']] & PHPGW_ACL_READ) && !isset($parts[$member[1]['account_id']]))
|
||||||
$participating = True;
|
{
|
||||||
}
|
$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) {
|
reset($participants);
|
||||||
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>";
|
|
||||||
|
|
||||||
$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();
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user