<?php

// $Id: ShiftPreferenceExplicitAction.php 1800 2012-09-07 04:23:26Z preston $ Copyright (c) ConSked, LLC. All Rights Reserved.
include 'util/authenticate.php';
require_once 'db/ShiftPreference.php';
require_once 'db/StationJob.php';
require_once 'db/Worker.php';
require_once 'properties/constants.php';
require_once 'swwat/gizmos/parse.php';
require_once 'util/log.php';
require_once 'util/session.php';
/**
 * This Controller is used by the StationViewPage's submit button
 */
$author = getWorkerAuthenticated();
$job = getStationCurrent();
// note only works for CIW when station:job = 1:1
$preference = ShiftPreference::selectID($author->workerid, $job->jobid);
try {
    $desire = swwat_parse_integer(html_entity_decode($_POST[PARAM_DESIRE]), 3, FALSE);
    $preference->setDesire($desire);
    $preference->update();
} catch (ParseSWWATException $ex) {
    // ignore, but do nothing!
}
header('Location: StationViewPage.php');
include 'StationViewPage.php';
Exemplo n.º 2
0
require_once 'util/session.php';
require_once 'swwat/gizmos/parse.php';
$station = getStationCurrent();
if (isset($_REQUEST['copy'])) {
    $station->stationid = NULL;
}
if (isset($_POST[PARAM_SAVE])) {
    $titleEnums = JobTitle::titleEnums($station->expoid);
    try {
        $station->startTime = swwat_parse_date(html_entity_decode($_POST[PARAM_DATE] . " " . $_POST[PARAM_STARTHOUR]), true);
        $station->stopTime = swwat_parse_date(html_entity_decode($_POST[PARAM_DATE] . " " . $_POST[PARAM_STOPHOUR]), true);
        $station->jobTitle = swwat_parse_enum($_POST[PARAM_JOB], $titleEnums, false);
        $station->maxCrew = swwat_parse_integer(html_entity_decode($_POST[PARAM_MAXCREW]), 11, true);
        $station->minCrew = swwat_parse_integer(html_entity_decode($_POST[PARAM_MINCREW]), 11, true);
        $station->maxSupervisor = swwat_parse_integer(html_entity_decode($_POST[PARAM_MAXSUPERVISOR]), 11, true);
        $station->minSupervisor = swwat_parse_integer(html_entity_decode($_POST[PARAM_MINSUPERVISOR]), 11, true);
        $station->description = swwat_parse_string(html_entity_decode($_POST[PARAM_DESCRIPTION]), true);
        $station->title = swwat_parse_string(html_entity_decode($_POST[PARAM_TITLE]), true);
        $station->location = swwat_parse_string(html_entity_decode($_POST[PARAM_LOCATION]), true);
        $station->instruction = swwat_parse_string(html_entity_decode($_POST[PARAM_INSTRUCTION]), true);
    } catch (Exception $ex) {
        header('Location: WorkerLoginPage.php');
        include 'WorkerLoginPage.php';
        return;
    }
    $station = is_null($station->stationid) ? $station->insert() : $station->update();
    setStationCurrent($station);
    // if saved
    header('Location: StationViewPage.php');
    include 'StationViewPage.php';
    return;
Exemplo n.º 3
0
 $c = count($_POST[PARAM_STATUSID]);
 for ($k = 0; $k < $c; $k++) {
     $shiftstatus_new[$k] = new ShiftStatus();
     if ($_POST[PARAM_STATUSDATE][$k] != "" && $_POST[PARAM_STATUSHOUR][$k] != "") {
         $shiftstatus_new[$k]->shiftstatusid = swwat_parse_integer(html_entity_decode($_POST[PARAM_STATUSID][$k]), 11, true);
         $shiftstatus_new[$k]->workerid = swwat_parse_integer(html_entity_decode($worker->workerid), 11, true);
         $shiftstatus_new[$k]->stationid = swwat_parse_integer(html_entity_decode($station->stationid), 11, true);
         $shiftstatus_new[$k]->expoid = swwat_parse_integer(html_entity_decode($expo->expoid), 11, true);
         $shiftstatus_new[$k]->statusType = swwat_parse_string(html_entity_decode($_POST[PARAM_STATUSTYPE][$k]), true);
         $shiftstatus_new[$k]->statusTime = swwat_parse_date(html_entity_decode($_POST[PARAM_STATUSDATE][$k] . " " . $_POST[PARAM_STATUSHOUR][$k]), true);
     } else {
         if ($_POST[PARAM_STATUSDATE][$k] == "" && $_POST[PARAM_STATUSHOUR][$k] != "") {
             $shiftstatus_new[$k]->shiftstatusid = swwat_parse_integer(html_entity_decode($_POST[PARAM_STATUSID][$k]), 11, true);
             $shiftstatus_new[$k]->workerid = swwat_parse_integer(html_entity_decode($worker->workerid), 11, true);
             $shiftstatus_new[$k]->stationid = swwat_parse_integer(html_entity_decode($station->stationid), 11, true);
             $shiftstatus_new[$k]->expoid = swwat_parse_integer(html_entity_decode($expo->expoid), 11, true);
             $shiftstatus_new[$k]->statusType = swwat_parse_string(html_entity_decode($_POST[PARAM_STATUSTYPE][$k]), true);
             if ($_POST[PARAM_STATUSTYPE][$k] == "CHECK_IN") {
                 $shiftstatus_new[$k]->statusTime = swwat_parse_date(html_entity_decode($_POST[PARAM_STATUSDATE][$k + 1] . " " . $_POST[PARAM_STATUSHOUR][$k]), true);
             } else {
                 if ($_POST[PARAM_STATUSTYPE][$k] == "CHECK_OUT") {
                     $shiftstatus_new[$k]->statusTime = swwat_parse_date(html_entity_decode($_POST[PARAM_STATUSDATE][$k - 1] . " " . $_POST[PARAM_STATUSHOUR][$k]), true);
                 }
             }
         } else {
             $shiftstatus_new[$k]->shiftstatusid = NULL;
             $shiftstatus_new[$k]->workerid = NULL;
             $shiftstatus_new[$k]->stationid = NULL;
             $shiftstatus_new[$k]->expoid = NULL;
             $shiftstatus_new[$k]->statusType = NULL;
             $shiftstatus_new[$k]->statusTime = NULL;