function viewmatrix() { if (phpgw::get_var('cancel', 'bool', 'POST')) { $this->index(); } $participants = phpgw::get_var('participants', 'string', 'POST'); $parts = array(); $acct = CreateObject('phpgwapi.accounts', $this->bo->owner); if (is_array($participants)) { foreach ($participants as $participant) { switch (substr($participant, 0, 2)) { case 'g_': if ($members = $acct->member((int) substr($participant, 2))) { foreach ($members as $member) { $person_id = $this->bo->contacts->is_contact($member['account_id']); if ($this->bo->check_perms(PHPGW_ACL_READ, 0, $person_id)) { $parts[$person_id] = True; } } } break; default: if ($this->bo->check_perms(PHPGW_ACL_READ, 0, $this->bo->contacts->is_contact($participant))) { $parts[$participant] = True; } break; } } } unset($acct); $participants = array_keys($parts); // get id's as values and a numeric index $date_select = phpgw::get_var('date_select', 'string', 'POST'); if ($date_select) { $jscal = CreateObject('phpgwapi.jscalendar', false); $date_selected = $jscal->input2date($date_select); $this->bo->year = $date_selected['year']; $this->bo->month = $date_selected['month']; $this->bo->day = $date_selected['day']; } unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); if ($this->always_app_header) { $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'] . ' - ' . lang('Matrixview'); } //$GLOBALS['phpgw']->common->phpgw_header(); $this->header(); //_debug_array($_POST); $matrixtype = phpgw::get_var('matrixtype', 'string', 'POST'); switch ($matrixtype) { case 'free/busy': echo '<br />' . $this->timematrix(array('date' => phpgwapi_datetime::gmtdate(mktime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year)), 'starttime' => $this->bo->splittime('000000', False), 'endtime' => 0, 'participants' => $parts)); $prev_next_shift = 1; break; case 'weekly': echo "<br />\n<span style=\"font-size: larger; color:#000000;\"><strong>" . $this->bo->get_week_label() . "</strong></span><br />\n" . $this->display_weekly(array('date' => sprintf("%04d%02d%02d", $this->bo->year, $this->bo->month, $this->bo->day), 'showyear' => true, 'owners' => $participants)); $prev_next_shift = 7; break; } //_debug_array($date_selected); $next_day = phpgwapi_datetime::makegmttime(0, 0, 0, $this->bo->month, $this->bo->day + $prev_next_shift, $this->bo->year); $prev_day = phpgwapi_datetime::makegmttime(0, 0, 0, $this->bo->month, $this->bo->day - $prev_next_shift, $this->bo->year); #echo '<br>prev: '.var_dump($prev_day); #echo '<br>next: '.var_dump($next_day); $form_action = $this->page('viewmatrix'); $part_inputs = ''; foreach (phpgw::get_var('participants', 'int', 'POST') as $part) { $part_inputs .= <<<HTML \t\t\t\t<input type="hidden" name="participants[]" value="{$part}"> HTML; } $other_type = $matrixtype == 'weekly' ? 'free/busy' : 'weekly'; $lang_othertype = lang($other_type); $lang_change_to = lang('change view to'); $lang_cancel = lang('cancel'); $lang_refresh = lang('refresh'); // Prev echo <<<HTML <table cellpadding="5" width="100%"> \t<tr> \t\t<td> \t\t\t<br> \t\t\t<form action="{$form_action}" method="post" name="matrixform"> \t\t\t\t<input type="hidden" name="year" value="{$prev_day['year']}"> \t\t\t\t<input type="hidden" name="month" value="{$prev_day['month']}"> \t\t\t\t<input type="hidden" name="day" value="{$prev_day['day']}"> \t\t\t\t<input type="hidden" name="matrixtype" value="{$matrixtype}"> \t\t\t\t{$part_inputs} \t\t\t\t<input type="submit" name="prev" value="<<"> \t\t\t</form> \t\t</td> \t\t<td align="right"> \t\t\t<br> \t\t\t<form action="{$form_action}" method="post" name="matrixform"> \t\t\t\t<input type="hidden" name="year" value="{$next_day['year']}"> \t\t\t\t<input type="hidden" name="month" value="{$next_day['month']}"> \t\t\t\t<input type="hidden" name="day" value="{$next_day['day']}"> \t\t\t\t<input type="hidden" name="matrixtype" value="{$matrixtype}"> \t\t\t\t{$part_inputs} \t\t\t\t<input type="submit" name="prev" value=">>"> \t\t\t</form>' \t\t</td> \t</tr> </table> <table cellpadding="5"> \t<tr> \t\t<td valign="bottom"> \t\t\t<form action="{$form_action}" method="post" name="matrixform"> \t\t\t\t<input type="hidden" name="year" value="{$this->bo->year}"> \t\t\t\t<input type="hidden" name="month" value="{$this->bo->month}">'." "; \t\t\t\t<input type="hidden" name="day" value="{$this->bo->day}"> \t\t\t\t<input type="hidden" name="matrixtype" value="{$_POST['matrixtype']}"> \t\t\t\t{$part_inputs}; \t\t\t\t<input type="submit" name="refresh" value="{$lang_refresh}"> \t\t\t\t<input type="submit" name="cancel" value="{$lang_cancel}"> \t\t\t</form> \t\t</td> \t\t<td> </td> \t\t<td align="right" valign="bottom"> \t\t\t<br> \t\t\t<form action="{$form_action}" method="post" name="matrixform"> \t\t\t\t<input type="hidden" name="year" value="{$this->bo->year}"> \t\t\t\t<input type="hidden" name="month" value="{$this->bo->month}"> \t\t\t\t<input type="hidden" name="day" value="{$this->bo->day}"> \t\t\t\t<input type="hidden" name="matrixtype" value="{$other_type}"> \t\t\t\t{$part_inputs} \t\t\t\t{$lang_change_to}: <input type="submit" name="change_view" value="{$lang_other_type}"> \t\t\t</form> \t\t</td> \t</tr> </table> HTML; }