function locationPreferences($step, $author, $expo) { $locationList = GrossPreference::selectLocation($expo->expoid); if (count($locationList) > 1) { echo "<div class=\"center\"><b>" . $step . "</b>. Select your location preferences.</div>\n"; echo "<div class=\"center\">(0 = absolutely not, 10 = absolutely yes)</div>\n"; echo "<br>\n"; $jp_old = JobPreference::selectID($author->workerid, $expo->expoid); $default = array(); for ($i = 0; $i < count($locationList); $i++) { echo "<input type=\"hidden\" name=\"" . PARAM_LOCATION . $i . "\" value=\"" . $locationList[$i] . "\">\n"; if (count($jp_old) != 0) { $arg = 'job' . ($i + 1); $default[$i] = $jp_old->{$arg} / 10; } else { $default[$i] = 5; } } echo "<table class=\"prefs\">\n"; swwat_spaces(2); echo "<tbody>\n"; for ($i = 0; $i < count($locationList); $i++) { swwat_spaces(4); echo "<tr>\n"; swwat_spaces(6); echo "<th class=\"blue\">" . $locationList[$i] . "</th>\n"; swwat_spaces(6); echo "<td>\n"; swwat_spaces(8); echo "<select name=\"" . PARAM_LPREFS . $i . "\">\n"; for ($j = 0; $j < 11; $j++) { $checked = $default[$i] == $j ? ' selected' : ''; swwat_spaces(10); echo "<option value=\"" . $j . "\"" . $checked . ">" . $j . "</option>\n"; } swwat_spaces(8); echo "</select>\n"; swwat_spaces(6); echo "</td>\n"; swwat_spaces(4); echo "</tr>\n"; } swwat_spaces(2); echo "</tbody>\n"; echo "</table>\n"; echo "<br><br>\n"; $step++; } else { if (count($locationList) == 1) { $i = 0; echo "<input type=\"hidden\" name=\"" . PARAM_LOCATION . $i . "\" value=\"" . $locationList[$i] . "\">\n"; echo "<input type=\"hidden\" name=\"" . PARAM_LPREFS . $i . "\" value=\"10\">\n"; } } return $step; }
function createPreferenceHTMLRows($spaces, $label, $value, $paramPrefix, $unavailable = FALSE) { swwat_spaces($spaces); echo "<tr>\n"; swwat_spaces($spaces + 3); echo "<th class=\"rowTitle\">", $label, "</th>\n"; swwat_spaces($spaces + 3); echo "<td>\n"; swwat_spaces($spaces + 6); echo "<select name=\"", $paramPrefix, "\">\n"; for ($selectIndex = 0; $selectIndex < 11; $selectIndex++) { $checked = $value == $selectIndex * 10 ? ' selected' : ''; swwat_spaces($spaces + 9); echo "<option value=\"", $selectIndex * 10, "\"", $checked, ">", $selectIndex, "</option>", "\n"; } swwat_spaces($spaces + 6); echo "</select>\n"; swwat_spaces($spaces + 3); echo "</td>\n"; swwat_spaces($spaces); echo "</tr>\n"; }
function swwat_createSelect($spaces, $param, $optionArray, $defaultOption, $isDisabledFlag = FALSE) { $selected = $defaultOption; if (isset($_POST[$param])) { $selected = $_POST[$param]; } swwat_spaces($spaces + 3); echo "<select id=\"", $param, "\" name=\"", $param, "\""; if ($isDisabledFlag) { echo " disabled=\"disabled\""; } echo ">\n"; for ($j = 0; $j < count($optionArray); $j++) { $option = $optionArray[$j]; swwat_createOption($spaces + 6, $option, 0 == strcmp($selected, $option[0])); } // $j swwat_spaces($spaces + 3); echo "</select>\n"; }