Beispiel #1
0
function wizardPageContent($author, $expo)
{
    $dateSpanList = GrossPreference::selectDateSpan($expo->expoid);
    $locationList = GrossPreference::selectLocation($expo->expoid);
    $_SESSION[PARAM_DATETIME] = $dateSpanList;
    $_SESSION[PARAM_LOCATION] = $locationList;
    echo "<form method=\"POST\" name=\"preferencewizard_form\" action=\"PreferenceWizardAction.php\">\n";
    echo "<div id=\"content\" style=\"clear:both\">\n";
    echo "<table>\n";
    echo "   <tr>\n";
    echo "      <td>\n";
    echo "         <br><b>For the following dropdown menus:</b><br>\n";
    echo "         <i>\n";
    echo "            0 = I absolutely cannot work at this station and/or time.<br>\n";
    echo "            1 = I'll do it if absolutely necessary.<br>\n";
    echo "            5 or 6 ish = Yes, sounds like fun, I'm available.<br>\n";
    echo "            10 = I'd absolutely love to work this one!<br>\n";
    echo "            So consider 0, 1, and 10 as extremes (pay attention to \"absolutely\").<br><br>\n";
    echo "            <b>Note: We'll do our best to schedule everyone to their top choices, but you'll be schedule between your preferences and our need!</b>\n";
    echo "         </i>\n";
    echo "      </td>\n";
    echo "   </tr>\n";
    echo "</table>\n";
    echo "<p />\n";
    echo "<div id=\"shiftpreferencepage_data\">\n";
    echo "<table width=\"100%\">\n";
    echo "   <tr>\n";
    echo "      <td valign=\"top\">\n";
    echo "         <table>\n";
    echo "            <tr><th class=\"rowTitle2\" colspan=\"5\">Shift</th></tr>\n";
    $tp = TimePreference::selectID($author->workerid, $expo->expoid);
    for ($k = 0; $k < count($dateSpanList); $k++) {
        $dateSpanFormatted = format_shift($dateSpanList[$k]);
        if (!is_null($tp)) {
            $arg = 'shift' . ($k + 1);
            $default = $tp->{$arg};
        } else {
            $default = 50;
        }
        createPreferenceHTMLRows(12, $dateSpanFormatted, $default, PARAM_DATETIME . $k, TRUE);
    }
    echo "         </table>\n";
    echo "      </td>\n";
    echo "      <td valign=\"top\">\n";
    echo "         <table>\n";
    echo "            <tr><th class=\"rowTitle2\" colspan=\"5\">Job</th></tr>\n";
    $jp = JobPreference::selectID($author->workerid, $expo->expoid);
    for ($k = 0; $k < count($locationList); $k++) {
        if (!is_null($jp)) {
            $arg = 'job' . ($k + 1);
            $default = $jp->{$arg};
        } else {
            $default = 50;
        }
        createPreferenceHTMLRows(12, $locationList[$k], $default, PARAM_LOCATION . $k, FALSE);
    }
    echo "         </table>\n";
    echo "      </td>\n";
    echo "   </tr>\n";
    echo "</table>\n";
    echo "<p />\n";
    echo "<table>\n";
    echo "   <tr>\n";
    echo "      <td class=\"fieldTitle\"><h2>How many hours can you work:&nbsp;</h2></td>\n";
    echo "      <td>\n";
    $maxhours = $_POST[PARAM_MAXHOURS] = $author->selectMaxHours($expo->expoid);
    $optionArray = array();
    for ($k = 0; $k < $maxhours; $k++) {
        $optionArray[$k] = array($maxhours - $k, "&nbsp;" . ($maxhours - $k) . "&nbsp;");
    }
    swwat_createSelect(6, PARAM_MAXHOURS, $optionArray, $maxhours);
    echo "      </td>\n";
    echo "   </tr>\n";
    echo "</table>\n";
    echo "</div><!-- shiftpreferencepage_data -->\n";
    echo "</div><!-- content -->\n";
}
Beispiel #2
0
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;
}