$currentSubdirSize = "XXX"; } $subdirssizelist[$file] = $currentSubdirSize; } else { $filelist[] = $file; $datelist[$file] = $currentFileTime; $sizelist[$file] = $currentFileSize; } } } closedir($dirlink); } $filenum = sizeof($filelist) + sizeof($subdirs); buildMenu($self, $uplink, $reloadlink, $helplink); if (count($filelist) != 0 || is_array($subdirs)) { printTableHeader(); if ($_SESSION["sort"] == "date") { $filelist = array(); arsort($datelist); foreach ($datelist as $file => $currentFileTime) { $filelist[] = $file; } if (is_array($subdirs)) { asort($subdirsdatelist); foreach ($subdirsdatelist as $currentSubdir => $currentFileTime) { array_unshift($filelist, $currentSubdir); } } } elseif ($_SESSION["sort"] == "size") { $filelist = array(); asort($sizelist);
/** * Perform search and print out results * This function will perform the search for given * criteria and print out formatted results. * @param string $type output type * @global $_POST['memberid'] array array of memberid's * @global $_POST['piid'] array array of piID's * @global $_POST['machid'] array array of machID's * @global $_POST['startYear'] int starting year * @global $_POST['startMonth'] int starting month * @global $_POST['startDay'] int starting day * @global $_POST['endYear'] int ending year * @global $_POST['endMonth'] int ending month * @global $_POST['endDay'] int ending day * @global $_POST['starttime'] double starting time * @global $_POST['endtime'] double ending time */ function search($type, $searchtype) { global $db; global $link; $html = $type == 'html'; // Store form vars for easy access $scheduleids = $_POST['scheduleid']; // Array of scheduleids $memberids = $_POST['memberid']; // Array of memberID's $machids = $_POST['machid']; // Array of machID's $startDateMin = mktime(0, 0, 0, intval($_POST['startMonthMin']), intval($_POST['startDayMin']), intval($_POST['startYearMin'])); $startDateMax = mktime(0, 0, 0, intval($_POST['startMonthMax']), intval($_POST['startDayMax']), intval($_POST['startYearMax'])); $endDateMin = mktime(0, 0, 0, intval($_POST['endMonthMin']), intval($_POST['endDayMin']), intval($_POST['endYearMin'])); $endDateMax = mktime(0, 0, 0, intval($_POST['endMonthMax']), intval($_POST['endDayMax']), intval($_POST['endYearMax'])); $starttimeMin = intval($_POST['starttimeMin']); $starttimeMax = intval($_POST['starttimeMax']); $endtimeMin = intval($_POST['endtimeMin']); $endtimeMax = intval($_POST['endtimeMax']); $percent = 0; $summarysearch = $_POST['summarysearch']; $summarytype = $_POST['summarytype']; //die($startDateMin . ' ' . $startDateMax . ' ' . $endDateMin . ' ' . $endDateMax); $res = $db->get_reservations($scheduleids, $memberids, $machids, $startDateMin, $startDateMax, $endDateMin, $endDateMax, $starttimeMin, $starttimeMax, $endtimeMin, $endtimeMax, $summarysearch, $summarytype); $rs_hours = $db->get_resource_times($machids); // Number of records returned $recs = count($res); // Print number of results found and a link to the text version echo '<h3 align="center">' . translate('Search Results found', array($recs)) . "</h3>\n" . '<h5 align="center">' . $link->getLink($_SERVER['PHP_SELF'], translate('Try a different search')) . "</h5>\n"; print_change_output($_POST); echo "<hr noshade size=\"1\">\n"; // If there were no results found, exit if ($recs <= 0) { return; } // Set up initial booleans $newUser = false; $newMach = false; $totalHours = 0; $resNo = 1; // Get first row $rs = $res[0]; // Set up initial previous user/machine variables $prevUser = $rs['memberid']; $prevMach = $rs['machid']; /* Text file variables */ // Create text output // Make global to share with other functions if ($type == 'text') { $GLOBALS['dblStr'] = str_repeat('=', 50) . "\n"; $GLOBALS['sglStr'] = str_repeat('-', 50) . "\n"; } if ($type != 'html') { // Plain-text view echo '<pre>'; echo translate('Search Run On') . ' ' . date('M jS, Y - h:i:s a') . "\r\n\r\n"; } // Print out first table with this information printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type); printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']); if ($type == 'csv') { // Print record id line for csv output print_csv_header(); } // Repeat for each record for ($i = 0; $i < count($res); $i++) { $rs = $res[$i]; // Current reservation // If we are at a new user, set them to prevUser if ($prevUser != $rs['memberid']) { $prevUser = $rs['memberid']; $newUser = true; } // If we are at a new resource, set it to prevMach if ($prevMach != $rs['machid']) { $prevMach = $rs['machid']; $newMach = true; } // If we are making a new table (by advancing to new user or resource) if ($newUser || $newMach) { // Write total hours row and close table // Write out total hours for this machine printTableFooter($totalHours, $type, $percent); $totalHours = 0; // Reset total hours $resNo = 1; // Reset total reservations // If it is a new user, write a comment, a extra break, and the user info if ($newUser) { // Write extra break to text output if ($type == 'text') { echo "\r\n\r\n"; } if ($html) { echo '<p> </p>'; } printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type); } // Set both newUser and newResource to false $newUser = false; $newMach = false; // Write next table header printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']); } // Keep running total of hours on this machine $totalHours = $totalHours + ($rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime'])); // Calculate what percentage that is of total machine time $percent = sprintf('%.02f', $totalHours / $rs_hours[$rs['machid']] * 100); // Store variables $start_date = Time::formatDate($rs['start_date'], null, false); $end_date = Time::formatDate($rs['end_date'], null, false); $created = Time::formatDateTime($rs['created'], null, false); $modified = !empty($rs['modified']) ? Time::formatDateTime($rs['modified'], null, false) : translate('N/A'); $starttime = Time::formatTime($rs['starttime'], false); $endtime = Time::formatTime($rs['endtime'], false); $totTime = $rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime']); print_reservation_data($type, $link, $resNo++, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $rs['resid'], $rs['fname'], $rs['lname'], $rs['name'], $rs['memberid'], $rs['scheduletitle']); } unset($rs); // On last record, print out total hours // Write out total hours for this machine printTableFooter($totalHours, $type, $percent); if (!$html) { echo '</pre>'; } }
function createMeetingList($array) { // footable script initialization echo "<script type=\"text/javascript\">"; echo '$(function () {$(\'.footable\').footable({addRowToggle: false}); }); </script>' . "\n\n"; // table heading echo "<div id=\"sml_maindiv\">\n"; echo "<h2 id=\"titlepar\"><span id=\"titdes\">All Meetings</span> <span id=\"mtgnum\"></span></h2>"; echo "<p id=\"subtitlepar\"><span id=\"subtitdes\"></span></p>"; echo "<h3 id=\"printlink\"><a href=\"javascript:window.print()\">Print This Meeting List</a></h3>"; echo "<p class=\"codekey\">O = Open Meeting, C = Closed Meeting, M = Men's Meeting, W = Women's Meeting, S = Spanish Speaking, G = LGBTQI, H = Handicap Accessible, KF = Kid Friendly, SI = Sign Language Interpreter, VSI = Volunteer SI (To Arrange Call CSO Accessibilities at 253-474-8897), @ = Alanon Meeting Runs Concurrently</p>"; echo "<p class=\"clickmsg\"><strong><span style=\"color:red\">Note: </span></strong> Click On A Row To Display Additional Meeting Info</p>"; // variables for keeping track of number of days and meetings $daycount = 0; $meetingcount = 0; // visible table for browser screens echo "<div id=\"visibletable\">"; // checks to see if there is any meetings for each day before printing subheading and then rows of meetings if (count($array[0]) != 0) { $daycount++; echo "<h3>Sunday:</h3>\n"; printTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Sun") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[1]) != 0) { $daycount++; echo "<h3>Monday:</h3>\n"; printTableHeader(); foreach ($array[1] as $value) { echo $value->toTableRow("Mon") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[2]) != 0) { $daycount++; echo "<h3>Tuesday:</h3>\n"; printTableHeader(); // table rows foreach ($array[2] as $value) { echo $value->toTableRow("Tue") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[3]) != 0) { $daycount++; echo "<h3>Wednesday:</h3>\n"; printTableHeader(); // table rows foreach ($array[3] as $value) { echo $value->toTableRow("Wed") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[4]) != 0) { $daycount++; echo "<h3>Thursday:</h3>\n"; printTableHeader(); // table rows foreach ($array[4] as $value) { echo $value->toTableRow("Thu") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[5]) != 0) { $daycount++; echo "<h3>Friday:</h3>\n"; printTableHeader(); // table rows foreach ($array[5] as $value) { echo $value->toTableRow("Fri") . "\n"; $meetingcount++; } printTableFooter(); } if (count($array[6]) != 0) { $daycount++; echo "<h3>Saturday:</h3>\n"; printTableHeader(); // table rows foreach ($array[6] as $value) { echo $value->toTableRow("Sat") . "\n"; $meetingcount++; } printTableFooter(); } echo "</div>"; // invisible table just for printing echo "<div id=\"invisibletable\">"; if (count($array[0]) != 0) { echo "<h3>Sunday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Sun") . "\n"; } printTableFooter(); } if (count($array[1]) != 0) { echo "<h3>Monday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Mon") . "\n"; } printTableFooter(); } if (count($array[2]) != 0) { echo "<h3>Tuesday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Tue") . "\n"; } printTableFooter(); } if (count($array[3]) != 0) { echo "<h3>Wednesday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Wed") . "\n"; } printTableFooter(); } if (count($array[4]) != 0) { echo "<h3>Thursday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Thu") . "\n"; } printTableFooter(); } if (count($array[5]) != 0) { echo "<h3>Friday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Fri") . "\n"; } printTableFooter(); } if (count($array[6]) != 0) { echo "<h3>Saturday:</h3>\n"; printPrintTableHeader(); // table rows foreach ($array[0] as $value) { echo $value->toTableRow("Sat") . "\n"; } printTableFooter(); } echo "</div>"; // message in case there are no meetings matching the search parameters if ($daycount == 0) { echo "<p id=\"nomeetingmsg\"><em>No meetings found matching your search parameters. <a href=\"" . home_url('meeting-search') . "\">Try a different search.</a></em></p>"; } echo "</div>\n\n"; // JavaScript to append the number of meetings found next to the title description echo "<script>\n"; echo "var data = " . $meetingcount . ";"; echo '$( "#mtgnum" ).append( "[' . $meetingcount . ' Found]" );'; echo "</script>\n"; // calls a function to change the title description based on the search parameters printTitleDescription(); }