function createStationPreferenceHTMLList($workerid, $jobid) { $preference = ShiftPreference::selectID($workerid, $jobid); $_POST[PARAM_DESIRE] = $preference->desirePercent; echo '<form method="POST" name="stationviewpage_stationsetpreference_form" action="ShiftPreferenceExplicitAction.php">'; swwat_createInputValidateInteger(PARAM_DESIRE, "stationviewpage_stationsetpreference_form", 3, FALSE); echo ' <input class="fieldValue" type="Submit" value="Save Preference"/><p/>'; echo '</form>'; }
function reviewPageContent() { echo "<form method=\"POST\" name=\"preferencereview_form\" action=\"PreferenceReviewAction.php\">\n"; echo "\n"; echo "<div id=\"content\" style=\"clear:both\">\n"; echo "Below are all the sessions you've shown interest in. You're welcome to trim down the list. You MUST set a maximum number of hours at the bottom of the page (it is defaulted to 20), and we'll schedule you for where we need you the most!\n"; echo "<p />\n"; echo "Note: Our system won't allow us to double book you, so if you have two sessions at the same time, you'll only be scheduled for one. Also know that if you requested more shifts than the maximum amount of hours you can commit, you will not be booked to all of the events you selected.\n"; echo "<p />\n"; echo "Click next at the bottom of the page once you are comfortable with your selections.\n"; echo "<p />\n"; $jobIncludeList = array(); $jobIncludeList[] = "Volunteer"; $jobList = Job::selectExpo($expo->expoid); usort($jobList, "JobCompare"); $date = array(); $max_job_size = 0; $max_time_size = 0; $max_location_size = 0; $max_title_size = 0; foreach ($jobList as $j) { $stationDateTime = swwat_format_shift($j->startTime, $j->stopTime); list($stationDate, $stationTime, $start) = explode(';', $stationDateTime); $date[] = $stationDate; $job = $j->jobTitle; if (strlen($job) > $max_job_size) { $max_job_size = strlen($job); } if (strlen($stationTime) > $max_time_size) { $max_time_size = strlen($stationTime); } $location = $j->location; if (strlen($location) > $max_location_size) { $max_location_size = strlen($location); } $title = $j->stationTitle; if (strlen($title) > $max_title_size) { $max_title_size = strlen($title); } } $date = array_values(array_unique($date)); $max_radio_size = "10%"; $max_percent_size = "5%"; //$max_job_size = 12*($max_job_size); $max_time_size = "12%"; $max_hours_size = "5%"; $max_location_size = "15%"; $max_title_size = "53%"; $table_size = "95%"; $numColumns = 6; echo "<table width=\"" . $table_size . "\" align=\"center\" class=\"research\">\n"; echo "<tr class=\"accordion\">\n"; echo "<th width=\"120\" class=\"rowTitle\"></th>"; echo "<th width=\"" . $max_percent_size . "\" class=\"rowTitle\">Percent Filled</th>"; //echo "<th width=\"".$max_job_size."\" class=\"rowTitle\">Job</th>"; echo "<th width=\"" . $max_time_size . "\" class=\"rowTitle\">Time</th>"; echo "<th width=\"" . $max_hours_size . "\" class=\"rowTitle\">Hours</th>"; echo "<th width=\"" . $max_location_size . "\" class=\"rowTitle\">Location</th>"; echo "<th width=\"" . $max_title_size . "\" class=\"rowTitle\">Title</th>"; echo "</tr>\n"; // kludge to remove empty dates for ($k = 0; $k < count($date); $k++) { $count[$k] = 0; for ($l = 0; $l < count($jobList); $l++) { $sp = ShiftPreference::selectID($author->workerid, $jobList[$l]->jobid); if (!is_null($sp)) { $desire = $sp->desirePercent; } else { $desire = 0; } $stationDateTime = swwat_format_shift($jobList[$l]->startTime, $jobList[$l]->stopTime); list($stationDate, $stationTime, $start) = explode(';', $stationDateTime); if (!strcmp($date[$k], $stationDate) && in_array($jobList[$l]->jobTitle, $jobIncludeList) && $desire != 0) { $count[$k]++; } } } for ($k = 0; $k < count($date); $k++) { $dow = date('l', strtotime($date[$k])); if ($count[$k] != 0) { echo "<tr class=\"accordion\">\n"; echo "<th colspan=\"" . $numColumns . "\" class=\"rowTitle\">"; echo "<div style=\"float:left\">" . htmlspecialchars($date[$k] . ", " . $dow) . "</div>\n"; echo "<div style=\"float:right\"><img id=\"icon1\" src=\"" . PARAM_COLLAPSE_ICON . "\"/></div>\n"; echo "</th>\n"; echo "</tr>\n"; } for ($l = 0; $l < count($jobList); $l++) { //$optionArray = array(array($jobList[$l]->jobid.":0", "No"), array($jobList[$l]->jobid.":1", "Yes")); $param_station = PARAM_TITLE . $l; if (!isset($_POST[$param_station])) { $_POST[$param_station] = NULL; } $sp = ShiftPreference::selectID($author->workerid, $jobList[$l]->jobid); if (!is_null($sp)) { $desire = $sp->desirePercent; } else { $desire = 0; } $stationDateTime = swwat_format_shift($jobList[$l]->startTime, $jobList[$l]->stopTime); list($stationDate, $stationTime, $start) = explode(';', $stationDateTime); $start = $jobList[$l]->startTime; $stop = $jobList[$l]->stopTime; $diff = $start->diff($stop); $hours = $diff->d * 24 + $diff->h + $diff->i / 60 + $diff->s / 360; if ($jobList[$l]->minCrew != 0) { $percent = intval(100 * ($jobList[$l]->assignedCrew / $jobList[$l]->minCrew)) . "%"; } else { $percent = "-"; } $s = Station::selectID($jobList[$l]->stationid); $dclass = preg_replace('/\\s/', '_', $date[$k]); if (!strcmp($date[$k], $stationDate) && in_array($jobList[$l]->jobTitle, $jobIncludeList) && $desire != 0) { echo "<tr class=\"" . $dclass . "\">\n"; echo "<td class=\"fieldValue\">"; //swwat_createRadioSelect($param_station, $optionArray, "radio", $jobList[$l]->jobid.":".$desire); echo "<input id=\"" . $param_station . "n\" name=\"" . $param_station . "\" type=\"radio\" value=\"" . $jobList[$l]->jobid . ":0" . "\" "; if ($desire == 0) { echo "checked=\"checked\" "; } echo "/>"; echo "<label for=\"" . $param_station . "n\">No </label>\n"; echo "<input id=\"" . $param_station . "y\" name=\"" . $param_station . "\" type=\"radio\" value=\"" . $jobList[$l]->jobid . ":100" . "\" "; if ($desire != 0) { echo "checked=\"checked\" "; } echo "/>"; echo "<label for=\"" . $param_station . "y\">Yes</label>\n"; echo "</td>\n"; echo "<td class=\"fieldValue\">" . htmlspecialchars($percent) . "</td>\n"; //echo "<td class=\"fieldValue\">".htmlspecialchars($jobList[$l]->jobTitle)."</td>\n"; echo "<td class=\"fieldValue\">" . htmlspecialchars($stationTime) . "</td>\n"; echo "<td class=\"fieldValue\">" . htmlspecialchars($hours) . "</td>\n"; echo "<td class=\"fieldValue\">" . htmlspecialchars($jobList[$l]->location) . "</td>\n"; echo "<td class=\"fieldValue\">"; echo "<div style=\"float:left\">" . htmlspecialchars($jobList[$l]->stationTitle) . "</div>\n"; echo "<div style=\"float:right\"><img id=\"icon2\" src=\"" . PARAM_EXPAND_ICON . "\"/></div>\n"; echo "</td>\n"; echo "</tr>\n"; echo "<tr class=\"description " . $param_station . " " . $dclass . "\">\n"; echo "<td class=\"fieldValue\" style=\"text-align: center\" colspan=\"" . $numColumns . "\">"; echo htmlspecialchars($s->description) . "<br><a href=\"" . htmlspecialchars($s->URL) . "\">" . htmlspecialchars($s->URL) . "</a></td>\n"; echo "</td>\n"; echo "</tr>\n"; } } } echo "</table>\n"; echo "<p />"; $_POST[PARAM_MAXHOURS] = $author->selectMaxHours($expo->expoid); echo "The MAXIMUM number of hours I am available to work is "; swwat_createInputValidateInteger(PARAM_MAXHOURS, "content", 2); echo "<p />"; echo "</div><!-- content -->\n"; }