From 68b12e4b5e03a6675167354edadffaa096966aba Mon Sep 17 00:00:00 2001 From: skeeter Date: Fri, 24 Nov 2000 12:57:45 +0000 Subject: [PATCH] added new feature - matrix view --- calendar/edit_entry.php | 21 ++-- calendar/inc/header.inc.php | 5 + calendar/matrixselect.php | 120 ++++++++++++++++++++ calendar/templates/default/list.tpl | 4 +- calendar/templates/default/matrix_query.tpl | 20 ++++ calendar/timematrix.php | 21 ++++ 6 files changed, 179 insertions(+), 12 deletions(-) create mode 100755 calendar/matrixselect.php create mode 100755 calendar/templates/default/matrix_query.tpl diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index acbac7c51c..bf701031a0 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -192,7 +192,7 @@ $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); - $phpgw->template->set_var("field",lang("Access")); + $phpgw->template->set_var("field",lang("Groups")); $str = ""; for ($l=0;$lparticipants);$l++) $parts[$cal_info->participants[$l]] = True; - while ($phpgw->db->next_record()) { - $str .= ""; + $str .= ">".$phpgw->common->grab_owner_name($db2->f("account_id")).""; } $str .= ""; $str .= ""; @@ -273,7 +274,7 @@ $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); - $phpgw->template->set_var("field",lang("Repeat Day")."
".lang("for weekly")); + $phpgw->template->set_var("field",lang("Repeat Day")."
".lang("(for weekly)")); $str = "rpt_sun?"checked":"")."> ".lang("Sunday")." "; $str .= "rpt_mon?"checked":"")."> ".lang("Monday")." "; $str .= "rpt_tue?"checked":"")."> ".lang("Tuesday")." "; diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index 34567b917d..f16e3b3444 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -48,6 +48,11 @@ /month.gif" alt="" border="0"> + + "> + /view.gif" alt="" border="0"> + +
" method="POST"> diff --git a/calendar/matrixselect.php b/calendar/matrixselect.php new file mode 100755 index 0000000000..b47d315bbb --- /dev/null +++ b/calendar/matrixselect.php @@ -0,0 +1,120 @@ + * + * http://www.radix.net/~cknudsen * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ + + $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); + include("../header.inc.php"); + + if(isset($friendly) && $friendly) { + if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) + $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + + 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; + } + } + + $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")); + + $phpgw->template->set_block("matrix_query_begin","list","matrix_query_end","form_button"); + +// $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]); + $phpgw->template->set_var("matrix_action",lang("Daily Matrix View")); + $phpgw->template->set_var("action_url",$phpgw->link("timematrix.php")); + + $phpgw->template->parse("out","matrix_query_begin"); + + $phpgw->template->set_var("field",lang("Date")); + + $day_html = ""; + + $month_html = ""; + + $year_html = ""; + + $phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); + $phpgw->template->parse("output","list",True); + + $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"); + + $num_rows = $db2->num_rows(); + if ($num_rows > 50) + $size = 15; + elseif ($num_rows > 5) + $size = 5; + else + $size = $num_rows; + $str = ""; + $str .= ""; + $phpgw->template->set_var("data",$str); + $phpgw->template->parse("output","list",True); + + $phpgw->template->set_var("submit_button",lang("Submit")); + + $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)\""); + + $phpgw->template->parse("cancel_button","form_button"); + + $phpgw->template->pparse("out","matrix_query_end"); + + $phpgw->common->phpgw_footer(); + +?> diff --git a/calendar/templates/default/list.tpl b/calendar/templates/default/list.tpl index 2cd316afdc..f4692ac23b 100755 --- a/calendar/templates/default/list.tpl +++ b/calendar/templates/default/list.tpl @@ -1,8 +1,8 @@ - {field}: - {data} + {field}: + {data} diff --git a/calendar/templates/default/matrix_query.tpl b/calendar/templates/default/matrix_query.tpl new file mode 100755 index 0000000000..e1554269f0 --- /dev/null +++ b/calendar/templates/default/matrix_query.tpl @@ -0,0 +1,20 @@ + + +
+

{matrix_action}

+ + + + + +{output} + + +
+ + + +{cancel_button} +
+ + diff --git a/calendar/timematrix.php b/calendar/timematrix.php index 949ca1bf7b..3a58a22db2 100755 --- a/calendar/timematrix.php +++ b/calendar/timematrix.php @@ -16,6 +16,27 @@ $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); 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.$thismonth.$thisday; + echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),0,0,$participants); $phpgw->common->phpgw_footer(); ?>