function createStationLockHTMLMatrix($expoid, $workerid) { $station = StationJob::selectExpo($expoid); // make titles $htitle = array(); $vtitle = array(); foreach ($station as $s) { $htitle[] = $s->location . " (" . $s->title . ")"; $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $vtitle[] = $stationDateTime[0] . " (" . $stationDateTime[1] . ")"; } $htitle = array_values(array_unique($htitle)); $vtitle = array_values(array_unique($vtitle)); // initialize matrix for ($h = 0; $h <= count($htitle); $h++) { for ($v = 0; $v <= count($vtitle); $v++) { $matrix[$h][$v] = '<td align="center"></td>'; } } //add horizontal titles to matrix for ($h = 0; $h < count($htitle); $h++) { $matrix[$h + 1][0] = '<td class="rowTitle">' . $htitle[$h] . '</td>'; } //add vertical titles for ($v = 0; $v < count($vtitle); $v++) { $matrix[0][$v + 1] = '<td class="rowTitle">' . $vtitle[$v] . '</td>'; } // fill assignment data to matrix foreach ($station as $s) { $hvalue = $s->location . " (" . $s->title . ")"; $hpos = array_search($hvalue, $htitle); $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $vvalue = $stationDateTime[0] . " (" . $stationDateTime[1] . ")"; $vpos = array_search($vvalue, $vtitle); if (ShiftAssignmentView::isWorkerAssignedStation($workerid, $expoid, $s->stationid)) { $matrix[$hpos + 1][$vpos + 1] = '<td align="center">X</td>'; } else { $matrix[$hpos + 1][$vpos + 1] = '<td align="center">-</td>'; } } // make table echo '<table>'; for ($v = 0; $v <= count($vtitle); $v++) { echo '<tr>'; for ($h = 0; $h <= count($htitle); $h++) { echo $matrix[$h][$v]; } echo '</tr>'; } echo '</table>'; echo '<p />'; }
function timePreferences($step, $author, $expo) { echo "<div class=\"center\"><b>" . $step . "</b>. Click on the grid below to select your time preferences.</div>\n"; echo "<div class=\"center\">(✓ = available, ✕ = not available)</div>\n"; echo "<br>\n"; $stations = StationJob::selectExpo($expo->expoid); $ctitles = array('12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'); $startTime = $expo->startTime; $stopTime = $expo->stopTime; $interval = $startTime->diff($stopTime)->d; $day = clone $startTime; for ($i = 0; $i <= $interval; $i++) { if ($i != 0) { $day = $day->add(new DateInterval('P1D')); } $days[$i] = clone $day; } $rtitles = array(); $colorArray = array(); for ($i = 0; $i < count($days); $i++) { $tp_old = NewTimePreference::selectID($author->workerid, $expo->expoid, swwat_format_isodate($days[$i])); echo "<input type=\"hidden\" name=\"" . PARAM_DAY . $i . "\" value=\"" . swwat_format_isodate($days[$i]) . "\">\n"; $rtitles[$i] = swwat_format_preferencesdate($days[$i]); $hourMin = stationStartHourMin($stations, $days[$i]); $hourMax = stationStopHourMax($stations, $days[$i]); for ($j = 0; $j < count($ctitles); $j++) { if ($j >= $hourMin && $j < $hourMax) { $colorArray[$i][$j] = 'green'; if (count($tp_old) != 0) { $field = 'hour' . ($j + 1); $tpref_old = $tp_old[0]->{$field}; if ($tpref_old == 0) { $colorArray[$i][$j] = 'red'; } } } else { $colorArray[$i][$j] = 'gray'; } } } include 'PrefTable.php'; echo "<br><br>\n"; $step++; return $step; }
function createCheckInStationDashboardHTMLList($expoid) { $stationList = StationJob::selectExpo($expoid); $dates = array(); foreach ($stationList as $s) { $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $dates[] = $stationDateTime[0]; } $dates = array_values(array_unique($dates)); echo "Select Date: <select id=\"" . PARAM_DATE . "\" name=\"" . PARAM_DATE . "\" onchange=\"hideRows()\">\n"; for ($k = 0; $k < count($dates); $k++) { echo "<option value=\"" . $dates[$k] . "\"> " . $dates[$k] . " </option>\n"; } echo "<option value=\"All\"> All Dates </option>\n"; echo "</select>\n"; echo "<p />\n"; echo "<input type=\"radio\" name=\"role\" value=\"Supervisors\" onclick=\"hideRoles()\" /> Supervisors"; echo " <input type=\"radio\" name=\"role\" value=\"Crew\" onclick=\"hideRoles()\" /> Crew"; echo " <input type=\"radio\" name=\"role\" value=\"Both\" checked=\"checked\" onclick=\"hideRoles()\" /> Both\n"; echo "<p />\n"; $assignedWorkerList = ShiftAssignmentView::selectExpo($expoid); $c = count($assignedWorkerList); $max_name_size = 0; $max_email_size = 0; for ($k = 0; $k < $c; $k++) { $worker = Worker::selectID($assignedWorkerList[$k]->workerid); $name = $worker->nameString(); if (strlen($name) > $max_name_size) { $max_name_size = strlen($name); } $email = $worker->email; if (strlen($email) > $max_email_size) { $max_email_size = strlen($email); } } $max_name_size = 10 * $max_name_size; $max_email_size = 10 * $max_email_size; $table_size = "75%"; echo "<div id=\"checkinlist_table\">\n"; echo "<table width=\"" . $table_size . "\">\n"; echo "<tr class=\"mainTitle\">\n"; echo "<td class=\"fieldValue\" colspan=\"5\" onclick=\"ExpandCollapseAll()\">\n"; echo "<div style=\"float:right\"><div class=\"alldiv\" style=\"display:inline\">Expand All</div> <img id=\"allicon\" src=\"" . PARAM_EXPAND_ICON . "\"/></div>\n"; echo "</td>\n</tr>\n"; $jobList = Job::selectExpo($expoid); usort($jobList, "JobCompare"); $_SESSION[PARAM_LIST2] = $jobList; $c = count($jobList); if ($c > 0) { for ($k = 0; $k < $c; $k++) { $job = $jobList[$k]; makeCheckInStationDashboardStationListHTMLRows($job, $k, $expoid, $max_name_size, $max_email_size); } } else { echo "<tr><td class=\"fieldError\" colspan=\"5\">There are currently no stations assigned to this expo.</td></tr>\n"; } echo "</table>\n</div>\n"; }
function createShiftCheckInHTMLMatrix($expoid) { $station = StationJob::selectExpo($expoid); // make titles $htitle = array(); $date = array(); $vtitle = array(); $dates = array(); foreach ($station as $s) { $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $htitle[] = $stationDateTime[0] . " (" . $stationDateTime[1] . ")"; $date[] = $stationDateTime[0]; $vtitle[] = $s->location . " (" . $s->title . ")"; } $htitle = array_values(array_unique($htitle)); $vtitle = array_values(array_unique($vtitle)); $dates = array_values(array_unique($date)); echo "Select Date: <select id=\"" . PARAM_DATE . "\" name=\"" . PARAM_DATE . "\" onchange=\"hideColumns()\">\n"; for ($k = 0; $k < count($dates); $k++) { echo "<option value=\"" . $dates[$k] . "\"> " . $dates[$k] . " </option>\n"; } echo "<option value=\"All\"> All Dates </option>\n"; echo "</select>\n"; echo "<p />"; // get class names $hdate = array(); for ($h = 0; $h < count($htitle); $h++) { for ($d = 0; $d < count($dates); $d++) { if (preg_match("/" . $dates[$d] . "/", $htitle[$h])) { $hdate[$h] = preg_replace('/\\s/', '_', $dates[$d]); } } } // initialize matrix for ($h = 0; $h <= count($htitle); $h++) { for ($v = 0; $v <= count($vtitle); $v++) { if ($h == 0 && $v == 0) { $matrix[$h][$v] = "<td align=\"center\"></td>\n"; } else { if ($h == 0) { $matrix[$h][$v] = "<td align=\"center\">-</td>\n"; } else { $matrix[$h][$v] = "<td align=\"center\" class=\"" . $hdate[$h - 1] . "\">-</td>\n"; } } } } //add horizontal titles to matrix for ($h = 0; $h < count($htitle); $h++) { $matrix[$h + 1][0] = "<td class=\"rowTitle " . $hdate[$h] . "\">" . $htitle[$h] . "</td>\n"; } //add vertical titles for ($v = 0; $v < count($vtitle); $v++) { $matrix[0][$v + 1] = "<td class=\"rowTitle\">" . $vtitle[$v] . "</td>\n"; } // fill assignment data to matrix foreach ($station as $s) { $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $hvalue = $stationDateTime[0] . " (" . $stationDateTime[1] . ")"; $hpos = array_search($hvalue, $htitle); $vvalue = $s->location . " (" . $s->title . ")"; $vpos = array_search($vvalue, $vtitle); $matrix[$hpos + 1][$vpos + 1] = "<td align=\"center\" class=\"" . $hdate[$hpos] . "\">"; $matrix[$hpos + 1][$vpos + 1] .= "<a href=\"ShiftCheckInPage.php?" . PARAM_LIST_INDEX . "=" . $s->stationid . "\">"; $matrix[$hpos + 1][$vpos + 1] .= "Super: " . $s->assignedSupervisor . "; Crew: " . $s->assignedCrew . "</a></td>\n"; } // determine pattern array for ($d = 0; $d < count($dates); $d++) { $darray[$d] = array(); for ($h = 1; $h <= count($htitle); $h++) { if (!strpos($matrix[$h][0], $dates[$d])) { $darray[$d][] = $h; } } } // find row class for ($v = 0; $v <= count($vtitle); $v++) { $vdate[$v] = NULL; for ($d = 0; $d < count($dates); $d++) { $flag = true; foreach ($darray[$d] as $dvalue) { if (!strpos($matrix[$dvalue][$v], '>-<')) { $flag = false; } } if ($flag) { $vdate[$v] = preg_replace('/\\s/', '_', $dates[$d]); } } } echo "<table>\n"; for ($v = 0; $v <= count($vtitle); $v++) { if (!is_null($vdate[$v])) { echo "<tr class=\"" . $vdate[$v] . "\">\n"; } else { echo "<tr>\n"; } for ($h = 0; $h <= count($htitle); $h++) { echo $matrix[$h][$v]; } echo "</tr>\n"; } echo "</table>\n"; echo "<p />\n"; }
$expo = getParamItem(PARAM_LIST, PARAM_LIST_INDEX); setExpoCurrent($expo); // paranoia about some included section } $_SESSION[PARAM_LIST] = NULL; unset($_SESSION[PARAM_MESSAGE]); //setStationCurrent(NULL); // now go get the workers $workerList = Worker::selectExpo($expo->expoid); // should be in order for display usort($workerList, "WorkerCompare"); $_SESSION[PARAM_LIST] = $workerList; setWorkerCurrent(NULL); // set null wherever param_list set to workers $_REQUEST[PARAM_LIST_INDEX] = NULL; $stationList = StationJob::selectExpo($expo->expoid); $_SESSION[PARAM_LIST2] = $stationList; $_REQUEST[PARAM_LIST2_INDEX] = NULL; // ok, start the html include 'section/header.php'; ?> <div id="main"> <div id="expoviewpage_expodata"> <?php createExpoDataHTMLRows($expo, "", TRUE); if ($author->isOrganizer() && !$expo->isPast()) { // you can edit yourself echo '<form method="GET" name="expoviewpage_expodata_form" action="ExpoEditPage.php">'; echo '<input class="fieldValue" type="Submit" value="Edit"/></form>';
function createSchedulingReportHTMLList($expoid) { $stationList = StationJob::selectExpo($expoid); $dates = array(); foreach ($stationList as $s) { $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime)); $dates[] = $stationDateTime[0]; } $dates = array_values(array_unique($dates)); echo "Select Date: <select id='" . PARAM_DATE . "' name='" . PARAM_DATE . "' onchange='hideRows()'>\n"; for ($k = 0; $k < count($dates); $k++) { echo "<option value='" . $dates[$k] . "'> " . $dates[$k] . " </option>\n"; } echo "<option value='All'> All Dates </option>\n"; echo "</select>\n"; echo "<p />\n"; echo "<input type='radio' name='role' value='Supervisors' onclick='hideRoles()' /> Supervisors"; echo " <input type='radio' name='role' value='Crew' onclick='hideRoles()' /> Crew"; echo " <input type='radio' name='role' value='Both' checked='checked' onclick='hideRoles()' /> Both\n"; echo "<p />\n"; $workerList = Worker::selectExpo($expoid); $_SESSION[PARAM_LIST] = $workerList; $max_name_size = 0; $max_email_size = 0; foreach ($workerList as $worker) { $name = $worker->nameString(); if (strlen($name) > $max_name_size) { $max_name_size = strlen($name); } $email = $worker->email; if (strlen($email) > $max_email_size) { $max_email_size = strlen($email); } } $max_name_size = 10 * $max_name_size; $max_email_size = 10 * $max_email_size; $table_size = "75%"; echo "<div id='stationlist_table'>\n"; echo "<table width='" . $table_size . "'>\n"; echo "<tr class='mainTitle'>\n"; echo "<td class='fieldValue' colspan='5' onclick='ExpandCollapseAll()'>\n"; echo "<div style='float:right'><div class='alldiv' style='display:inline'>Expand All</div> <img id='allicon' src='" . PARAM_EXPAND_ICON . "'/></div>\n"; echo "</td>\n</tr>\n"; $jobList = Job::selectExpo($expoid); usort($jobList, "JobCompare"); $_SESSION[PARAM_LIST2] = $jobList; $c = count($jobList); if ($c > 0) { for ($k = 0; $k < $c; $k++) { $job = $jobList[$k]; makeSchedulingReportStationListHTMLRows($job, $workerList, $k, $max_name_size, $max_email_size); } } else { echo "<tr><td class='fieldError' colspan='5'>There are currently no stations assigned to this expo.</td></tr>"; } echo "</table>\n</div>\n"; }