Esempio n. 1
0
function createStationDataHTMLRows(StationJob $station, Expo $expo, $formName, $isDisabledFlag = TRUE)
{
    if (is_null($station) || is_null($expo)) {
        return;
    }
    if (!is_null($station->startTime)) {
        $_POST[PARAM_DATE] = htmlspecialchars(swwat_format_isodate($station->startTime));
        $_POST[PARAM_STARTHOUR] = htmlspecialchars(swwat_format_isotime($station->startTime));
        $_POST[PARAM_STARTTIME] = htmlspecialchars(swwat_format_isodatetime($station->startTime));
    } else {
        $_POST[PARAM_DATE] = htmlspecialchars($station->startTime);
        $_POST[PARAM_STARTHOUR] = htmlspecialchars($station->startTime);
        $_POST[PARAM_STARTTIME] = htmlspecialchars($station->startTime);
    }
    if (!is_null($station->stopTime)) {
        $_POST[PARAM_STOPHOUR] = htmlspecialchars(swwat_format_isotime($station->stopTime));
        $_POST[PARAM_STOPTIME] = htmlspecialchars(swwat_format_isodatetime($station->stopTime));
    } else {
        $_POST[PARAM_STOPHOUR] = htmlspecialchars($station->stopTime);
        $_POST[PARAM_STOPTIME] = htmlspecialchars($station->stopTime);
    }
    $_POST[PARAM_LOCATION] = htmlspecialchars($station->location);
    $_POST[PARAM_INSTRUCTION] = htmlspecialchars($station->instruction);
    $_POST[PARAM_DESCRIPTION] = htmlspecialchars($station->description);
    $_POST[PARAM_TITLE] = htmlspecialchars($station->title);
    $_POST[PARAM_EXPOSTART] = htmlspecialchars(date_format($expo->startTime, 'l j, F Y'));
    $_POST[PARAM_EXPOSTOP] = htmlspecialchars(date_format($expo->stopTime, 'l j, F Y'));
    echo '<tr style="display:none"><td><input type="hidden" id="' . PARAM_EXPOSTART . '" name="' . PARAM_EXPOSTART . '" value="', $_POST[PARAM_EXPOSTART], '"/></td></tr>' . "\n";
    echo '<tr style="display:none"><td><input type="hidden" id="' . PARAM_EXPOSTOP . '" name="' . PARAM_EXPOSTOP . '" value="', $_POST[PARAM_EXPOSTOP], '"/></td></tr>' . "\n";
    echo "  <tr><td class='fieldTitle'>Title:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_TITLE, $formName, 'titleCheck', 255, $isDisabledFlag);
    echo "</td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Description:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_DESCRIPTION, $formName, 'descriptionCheck', 2048, $isDisabledFlag);
    echo "</td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Location:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_LOCATION, $formName, 'locationCheck', 255, $isDisabledFlag);
    echo "</td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Instruction:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_INSTRUCTION, $formName, 'instructionCheck', 255, $isDisabledFlag);
    echo "</td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Date:</td>\n<td>";
    echo '  <input type="text" id="', PARAM_DATE, '" name="', PARAM_DATE, '" value="', $_POST[PARAM_DATE], '" size="25" ';
    if ($isDisabledFlag) {
        echo ' disabled="disabled" ';
    }
    echo "/></td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Start Time:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_STARTHOUR, $formName, 'starthourCheck', 11, $isDisabledFlag);
    echo "</td></tr>\n";
    echo "  <tr><td class='fieldTitle'>Stop Time:</td>\n<td>";
    swwat_createInputValidateLength(PARAM_STOPHOUR, $formName, 'stophourCheck', 11, $isDisabledFlag);
    echo "</td></tr>\n";
}
Esempio n. 2
0
function makeShiftStatusDataHTMLRows($sm, $k, $l, $formName, $isDisabledFlag)
{
    if (!is_null($sm)) {
        $_POST[PARAM_STATUSID] = htmlspecialchars($sm->shiftstatusid);
        $_POST[PARAM_STATUSDATE] = htmlspecialchars(swwat_format_isodate($sm->statusTime));
        $_POST[PARAM_STATUSHOUR] = htmlspecialchars(swwat_format_isotime($sm->statusTime));
        $_POST[PARAM_STATUSTYPE] = htmlspecialchars($sm->statusType);
    } else {
        $_POST[PARAM_STATUSID] = NULL;
        $_POST[PARAM_STATUSDATE] = NULL;
        $_POST[PARAM_STATUSHOUR] = NULL;
        if ($l == 0) {
            $_POST[PARAM_STATUSTYPE] = "CHECK_IN";
        } else {
            if ($l == 1) {
                $_POST[PARAM_STATUSTYPE] = "CHECK_OUT";
            }
        }
    }
    if ($l == 0) {
        echo "<tr>\n";
    }
    echo "<td>\n";
    if ($isDisabledFlag) {
        $disabled = "disabled=\"disabled\" ";
    } else {
        $disabled = "";
    }
    echo "<input type=\"hidden\" name=\"" . PARAM_STATUSID . "[]\" value=\"" . $_POST[PARAM_STATUSID] . "\" " . $disabled . "/>\n";
    echo "<input type=\"hidden\" name=\"" . PARAM_STATUSDATE . "[]\" value=\"" . $_POST[PARAM_STATUSDATE] . "\" " . $disabled . "/>\n";
    echo "<input type=\"text\" name=\"" . PARAM_STATUSHOUR . "[]\" value=\"" . $_POST[PARAM_STATUSHOUR] . "\" " . $disabled . "/>\n";
    echo "<input type=\"hidden\" name=\"" . PARAM_STATUSTYPE . "[]\" value=\"" . $_POST[PARAM_STATUSTYPE] . "\" " . $disabled . "/>\n";
    echo "</td>\n";
    if ($l == 1) {
        echo "</tr>\n";
    }
}
Esempio n. 3
0
 /**
  * This method updates a calculated desire;
  * use updateRaw for raw desires.
  *
  * @param $dbh is the PDOConnection this transaction is a part of
  * @throws PDOException
  */
 public static function updateCalculated(PDO $dbh, $desirePercent, $expoId, $workerId, $location, DateTime $stationDate, DateTime $startTime, DateTime $stopTime)
 {
     // validation check
     if (!is_null($desirePercent)) {
         if ($desirePercent > 100.0) {
             $desirePercent = 100.0;
         }
         if ($desirePercent < 0.0) {
             $desirePercent = 0.0;
         }
         $desirePercent = round($desirePercent);
     }
     $sql = GROSSPREF_UPDATE_STATION;
     $params = array($desirePercent, $expoId, $workerId, $location, swwat_format_isodate($stationDate), swwat_format_isotime($startTime), swwat_format_isotime($stopTime));
     // now onto the update
     $stmt = $dbh->prepare($sql);
     return $stmt->execute($params);
 }