From 8e4b8e45fa09cd4eac3503447e32d566b0f15b23 Mon Sep 17 00:00:00 2001 From: lemonsoftwarero Date: Fri, 26 Oct 2007 11:12:01 +0000 Subject: [PATCH] Add facilities filter in calendar view. --- interface/main/calendar/index.php | 3 +++ .../pntemplates/default/views/day/default.html | 15 +++++++++++++++ .../pntemplates/default/views/week/default.html | 15 +++++++++++++++ interface/main/calendar/modules/PostCalendar/pnuser.php | 4 ++-- .../main/calendar/modules/PostCalendar/pnuserapi.php | 9 +++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/interface/main/calendar/index.php b/interface/main/calendar/index.php index 1efd3f2b8..5a6d021f8 100644 --- a/interface/main/calendar/index.php +++ b/interface/main/calendar/index.php @@ -40,6 +40,9 @@ include 'includes/pnAPI.php'; // From Michael Brinson 2006-09-19: if ($_POST['pc_username']) $_SESSION['pc_username'] = $_POST['pc_username']; +// FACILITY FILTERING (lemonsoftware) +$_SESSION['pc_facility'] = ( $_POST['pc_facility'] ) ? $_POST['pc_facility'] : '0'; + //if (empty($_GET['no_nav'])) { // $_SESSION['last_calendar_page'] = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; //} diff --git a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/default.html b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/default.html index e6993ed4f..b459c55fa 100644 --- a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/default.html +++ b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/default.html @@ -174,6 +174,21 @@ div.tiny { width:1px; height:1px; font-size:1px; } echo ">" . $doc['fname'] . " " . $doc['lname'] . "\n"; } echo " \n"; + + // ============================== + // FACILITY FILTERING (lemonsoftware) + $facilities = getFacilities(); + echo " \n"; + // EOS FF + // ============================== + echo " \n"; // Build the date and view type selectors and the Go button and the Today button. diff --git a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/default.html b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/default.html index e6993ed4f..3bd9e81c5 100644 --- a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/default.html +++ b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/default.html @@ -174,6 +174,21 @@ div.tiny { width:1px; height:1px; font-size:1px; } echo ">" . $doc['fname'] . " " . $doc['lname'] . "\n"; } echo " \n"; + + // ============================== + // FACILITY FILTERING (lemonsoftware) + $facilities = getFacilities(); + echo " \n"; + // EOS FF + // ============================== + echo " \n"; // Build the date and view type selectors and the Go button and the Today button. diff --git a/interface/main/calendar/modules/PostCalendar/pnuser.php b/interface/main/calendar/modules/PostCalendar/pnuser.php index b6156e6b0..4907539f9 100644 --- a/interface/main/calendar/modules/PostCalendar/pnuser.php +++ b/interface/main/calendar/modules/PostCalendar/pnuser.php @@ -78,8 +78,8 @@ function postcalendar_user_view() function postcalendar_user_display($args) { list($eid, $viewtype, $tplview, - $pc_username, $Date, $print, $category, $topic) = pnVarCleanFromInput('eid', 'viewtype', 'tplview', - 'pc_username', 'Date', 'print', 'pc_category', 'pc_topic'); + $pc_username, $Date, $print, $category, $topic, $pc_facility) = pnVarCleanFromInput('eid', 'viewtype', 'tplview', + 'pc_username', 'Date', 'print', 'pc_category', 'pc_topic', 'pc_facility'); extract($args); if(empty($Date) && empty($viewtype)) { diff --git a/interface/main/calendar/modules/PostCalendar/pnuserapi.php b/interface/main/calendar/modules/PostCalendar/pnuserapi.php index 51daf244f..2aa224131 100644 --- a/interface/main/calendar/modules/PostCalendar/pnuserapi.php +++ b/interface/main/calendar/modules/PostCalendar/pnuserapi.php @@ -966,6 +966,15 @@ function &postcalendar_userapi_pcQueryEvents($args) "(a.pc_endDate = '0000-00-00' AND a.pc_eventDate >= '$start' AND " . "a.pc_eventDate <= '$end')) "; + //================================== + //FACILITY FILTERING (lemonsoftware) + if ( $pc_facility ) { + $sql .= " AND a.pc_facility = $pc_facility "; + } + //EOS FACILITY FILTERING (lemonsoftware) + //================================== + + // The above 3 lines replaced these: // AND (a.pc_endDate >= '$start' OR a.pc_endDate = '0000-00-00') // AND a.pc_eventDate <= '$end' "; -- 2.11.4.GIT