From b7e525c22e90146fe645d5b7ea00b0e62792e7b7 Mon Sep 17 00:00:00 2001 From: Patrick Joyce Date: Sat, 26 Jun 2021 23:25:30 -0400 Subject: [PATCH] add show unpublished --- proofs.php | 63 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/proofs.php b/proofs.php index d70f77a..7e51c9e 100644 --- a/proofs.php +++ b/proofs.php @@ -5,11 +5,24 @@ $area_asc = $_GET['asc']; $area_num = $_GET['areanum']; - -$recurse = isset($_GET['recurse']) && $_GET['recurse'] === "true" ? "&recursive=1" : ""; - +$recurse = isset($_GET['recurse']) && $_GET['recurse'] == "true" ? "&recursive=1" : ""; +$show_unpublished = isset($_GET['unpublished']) && $_GET['unpublished'] == "true" ? true : false; $today=date("Y-m-d"); +$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; +$current_url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; +// Remove parameter from query string +$filtered_url =rtrim(preg_replace('~(\?|&)'.'unpublished'.'=[^&]*~', '$1', $current_url), "&"); + +if ($show_unpublished) { + $published_unpublished_query = "&advanced_published=-1"; + $published_unpublished_header = " (Unpublished Meetings Only)"; + $published_unpublished = "Show Published"; +} else { + $published_unpublished_query = "&advanced_published=1"; + $published_unpublished_header = ""; + $published_unpublished = "Show Unpublished"; +} echo " @@ -38,22 +51,29 @@ box-sizing:border-box; background:red; } + +@media print +{ + .no-print, .no-print * + { + display: none !important; + } +} - -

Meeting List Proof Report for ".$area_asc."

+". + $published_unpublished + ."

Meeting List Proof Report for ".$area_asc.$published_unpublished_header."

Printed on: " .date("l jS \of F Y h:i A") . "

Pass this proof report around at your Area Service Committee meeting so that groups can check their listing and make changes.

"; -function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) -{ - if (empty($array)) { - return; - } + +function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) { + if ( empty( $array ) ) { return; } foreach ($array as $subarray) { $keys[] = $subarray[$subkey]; } @@ -65,8 +85,8 @@ function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) sortBySubkey($formats, 'key_string'); $data_formats = ""; -$countmax = count($formats); -for ($count = 0; $count < $countmax; $count++) { +$countmax = count ( $formats ); +for ( $count = 0; $count < $countmax; $count++ ) { $data_formats .= ''; $data_formats .= ""; $data_formats .= ""; @@ -81,20 +101,26 @@ function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) //Changes printed on date and time //echo "
"; -$url = $bmlt_server. "/client_interface/xml/?switcher=GetSearchResults&get_used_formats=1&services=".$area_num."&weekdays[]=1&weekdays[]=2&weekdays[]=3&weekdays[]=4&weekdays[]=5&weekdays[]=6&weekdays[]=7&sort_keys=meeting_name" . $recurse; +$url = $bmlt_server. "/client_interface/xml/?switcher=GetSearchResults&get_used_formats=1&services=".$area_num."&weekdays[]=1&weekdays[]=2&weekdays[]=3&weekdays[]=4&weekdays[]=5&weekdays[]=6&weekdays[]=7&sort_keys=meeting_name" . $recurse . $published_unpublished_query; // get xml file contents $xml = simplexml_load_file($url); // loop begins -foreach ($xml->row as $row) { +foreach($xml->row as $row) +{ + // begin new paragraph echo "
"; // Group Name - echo "Group: ".$row->meeting_name.", "; + $unpublished = ""; + if ($row->published == 0) { + $unpublished = " (UNPUBLISHED)"; + } + echo "Group: ".$row->meeting_name.$unpublished.", "; // Day of the Week $weekday_tinyint=$row->weekday_tinyint; @@ -140,7 +166,7 @@ function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) // Published formats $formats = $row->formats; - $formats = str_replace(",", ", ", $formats); + $formats = str_replace(",",", ",$formats); echo "Published Formats: ".$formats." ]
"; //Address @@ -161,8 +187,8 @@ function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) CHANGES:



"; //echo " -//
-//
"; +//
+//
"; // End Paragraph echo "
"; @@ -172,3 +198,4 @@ function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC) echo ""; +?>
MEETING FORMATS
".$formats[$count]['key_string']."".$formats[$count]['name_string']."