コード例 #1
0
ファイル: StationJob.php プロジェクト: ConSked/scheduler
 public static function selectExpo($expoId)
 {
     $stations = Station::selectExpo($expoId);
     $stationjobs = array();
     foreach ($stations as $station) {
         $stationJob = new StationJob();
         $stationJob->setStation($station);
         $jobs = Job::selectStation($station->expoid, $station->stationid);
         $stationJob->setJob($jobs[0]);
         $stationjobs[] = $stationJob;
     }
     return $stationjobs;
 }
コード例 #2
0
function createStationLockHTMLMatrix($expoid, $workerid)
{
    $station = StationJob::selectExpo($expoid);
    // make titles
    $htitle = array();
    $vtitle = array();
    foreach ($station as $s) {
        $htitle[] = $s->location . " (" . $s->title . ")";
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $vtitle[] = $stationDateTime[0] . " (" . $stationDateTime[1] . ")";
    }
    $htitle = array_values(array_unique($htitle));
    $vtitle = array_values(array_unique($vtitle));
    // initialize matrix
    for ($h = 0; $h <= count($htitle); $h++) {
        for ($v = 0; $v <= count($vtitle); $v++) {
            $matrix[$h][$v] = '<td align="center"></td>';
        }
    }
    //add horizontal titles to matrix
    for ($h = 0; $h < count($htitle); $h++) {
        $matrix[$h + 1][0] = '<td class="rowTitle">' . $htitle[$h] . '</td>';
    }
    //add vertical titles
    for ($v = 0; $v < count($vtitle); $v++) {
        $matrix[0][$v + 1] = '<td class="rowTitle">' . $vtitle[$v] . '</td>';
    }
    // fill assignment data to matrix
    foreach ($station as $s) {
        $hvalue = $s->location . " (" . $s->title . ")";
        $hpos = array_search($hvalue, $htitle);
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $vvalue = $stationDateTime[0] . " (" . $stationDateTime[1] . ")";
        $vpos = array_search($vvalue, $vtitle);
        if (ShiftAssignmentView::isWorkerAssignedStation($workerid, $expoid, $s->stationid)) {
            $matrix[$hpos + 1][$vpos + 1] = '<td align="center">X</td>';
        } else {
            $matrix[$hpos + 1][$vpos + 1] = '<td align="center">-</td>';
        }
    }
    // make table
    echo '<table>';
    for ($v = 0; $v <= count($vtitle); $v++) {
        echo '<tr>';
        for ($h = 0; $h <= count($htitle); $h++) {
            echo $matrix[$h][$v];
        }
        echo '</tr>';
    }
    echo '</table>';
    echo '<p />';
}
コード例 #3
0
ファイル: NewPreferences.php プロジェクト: ConSked/scheduler
function timePreferences($step, $author, $expo)
{
    echo "<div class=\"center\"><b>" . $step . "</b>. Click on the grid below to select your time preferences.</div>\n";
    echo "<div class=\"center\">(&#x2713; = available, &#x2715; = not available)</div>\n";
    echo "<br>\n";
    $stations = StationJob::selectExpo($expo->expoid);
    $ctitles = array('12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11');
    $startTime = $expo->startTime;
    $stopTime = $expo->stopTime;
    $interval = $startTime->diff($stopTime)->d;
    $day = clone $startTime;
    for ($i = 0; $i <= $interval; $i++) {
        if ($i != 0) {
            $day = $day->add(new DateInterval('P1D'));
        }
        $days[$i] = clone $day;
    }
    $rtitles = array();
    $colorArray = array();
    for ($i = 0; $i < count($days); $i++) {
        $tp_old = NewTimePreference::selectID($author->workerid, $expo->expoid, swwat_format_isodate($days[$i]));
        echo "<input type=\"hidden\" name=\"" . PARAM_DAY . $i . "\" value=\"" . swwat_format_isodate($days[$i]) . "\">\n";
        $rtitles[$i] = swwat_format_preferencesdate($days[$i]);
        $hourMin = stationStartHourMin($stations, $days[$i]);
        $hourMax = stationStopHourMax($stations, $days[$i]);
        for ($j = 0; $j < count($ctitles); $j++) {
            if ($j >= $hourMin && $j < $hourMax) {
                $colorArray[$i][$j] = 'green';
                if (count($tp_old) != 0) {
                    $field = 'hour' . ($j + 1);
                    $tpref_old = $tp_old[0]->{$field};
                    if ($tpref_old == 0) {
                        $colorArray[$i][$j] = 'red';
                    }
                }
            } else {
                $colorArray[$i][$j] = 'gray';
            }
        }
    }
    include 'PrefTable.php';
    echo "<br><br>\n";
    $step++;
    return $step;
}
コード例 #4
0
function makeCheckInWorkerDashboardListHTMLRows2(Worker $w, $expoid)
{
    echo "<tr>\n";
    echo "<td class=\"fieldValueFirst\">" . htmlspecialchars($w->nameString()) . "</td>\n";
    echo "<td class=\"fieldValue\">" . htmlspecialchars($w->email) . "</td>\n";
    echo "<td class=\"fieldValue\">" . swwat_format_phone($w->phone) . "</td>\n";
    $ss = ShiftStatus::mostRecentStatusWorker($w->workerid, $expoid);
    echo "<td class=\"fieldValue\">";
    if (!is_null($ss)) {
        $s = StationJob::selectID($ss->stationid);
        echo $s->location . " (" . $s->title . ")";
    } else {
        echo "-";
    }
    echo "</td>\n";
    echo "<td class=\"fieldValue\">";
    if (!is_null($ss)) {
        if ($ss->statusType == "CHECK_IN") {
            echo "<div style=\"color: red\">Checked In</div>";
        } else {
            if ($ss->statusType == "CHECK_OUT") {
                echo "<div style=\"color: green\">Checked Out</div>";
            }
        }
    } else {
        echo "Never checked in";
    }
    echo "</td>\n";
    echo "<td class=\"fieldValue\">";
    if (!is_null($ss)) {
        $hours = ShiftStatus::WorkerHours($w->workerid, $expoid);
        if (is_int($hours)) {
            echo $hours;
        } else {
            echo sprintf('%.2f', $hours);
        }
    } else {
        echo "-";
    }
    echo "</td>\n";
    echo "</tr>\n";
}
コード例 #5
0
function createWorkerScheduleHTMLList(Expo $expo, Worker $worker)
{
    // set up links properly
    $shiftList = ShiftAssignmentView::selectWorker($expo->expoid, $worker->workerid);
    usort($shiftList, "ShiftAssignmentCompare");
    if (0 == count($shiftList)) {
        echo '<tr><td class="fieldError" colspan="5">You are not currently assigned to any stations.</td></tr>';
        return;
    }
    $stationList = array();
    $position = 0;
    foreach ($shiftList as $shift) {
        $station = StationJob::selectID($shift->stationid);
        $stationList[] = $station;
        $shift->url = $station->URL;
        // todo - put this into ShiftAssignmentView as part of the shiftassignmentview
        $shift->instruction = $station->instruction;
        // todo - put this into ShiftAssignmentView as part of the shiftassignmentview
        makeWorkerScheduleListHTMLRows($shift, $position);
        $position += 1;
    }
    // $shift
    $_SESSION[PARAM_LIST2] = $stationList;
}
コード例 #6
0
echo PARAM_LIST_INDEX;
?>
"+"=W:"+workerid;
			document.ShiftCheckIn_form.submit();
			return;
		}
	</script>
</head>

<body>
<div id="container">

<?php 
$expo = getExpoCurrent();
if (isset($_REQUEST[PARAM_LIST_INDEX])) {
    $station = StationJob::selectID($_REQUEST[PARAM_LIST_INDEX]);
    setStationCurrent($station);
} else {
    $station = getStationCurrent();
}
// ok, start the html
include 'section/header.php';
?>

<div id="main">
    <?php 
include 'section/LinkStation.php';
?>

    <div id="checkinclient_workerlist">
    	<?php 
コード例 #7
0
function createCheckInStationDashboardHTMLList($expoid)
{
    $stationList = StationJob::selectExpo($expoid);
    $dates = array();
    foreach ($stationList as $s) {
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $dates[] = $stationDateTime[0];
    }
    $dates = array_values(array_unique($dates));
    echo "Select Date: <select id=\"" . PARAM_DATE . "\" name=\"" . PARAM_DATE . "\" onchange=\"hideRows()\">\n";
    for ($k = 0; $k < count($dates); $k++) {
        echo "<option value=\"" . $dates[$k] . "\">&nbsp;" . $dates[$k] . "&nbsp;</option>\n";
    }
    echo "<option value=\"All\">&nbsp;All Dates&nbsp;</option>\n";
    echo "</select>\n";
    echo "<p />\n";
    echo "<input type=\"radio\" name=\"role\" value=\"Supervisors\" onclick=\"hideRoles()\" /> Supervisors";
    echo "&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"role\" value=\"Crew\" onclick=\"hideRoles()\" /> Crew";
    echo "&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"role\" value=\"Both\" checked=\"checked\" onclick=\"hideRoles()\" /> Both\n";
    echo "<p />\n";
    $assignedWorkerList = ShiftAssignmentView::selectExpo($expoid);
    $c = count($assignedWorkerList);
    $max_name_size = 0;
    $max_email_size = 0;
    for ($k = 0; $k < $c; $k++) {
        $worker = Worker::selectID($assignedWorkerList[$k]->workerid);
        $name = $worker->nameString();
        if (strlen($name) > $max_name_size) {
            $max_name_size = strlen($name);
        }
        $email = $worker->email;
        if (strlen($email) > $max_email_size) {
            $max_email_size = strlen($email);
        }
    }
    $max_name_size = 10 * $max_name_size;
    $max_email_size = 10 * $max_email_size;
    $table_size = "75%";
    echo "<div id=\"checkinlist_table\">\n";
    echo "<table width=\"" . $table_size . "\">\n";
    echo "<tr class=\"mainTitle\">\n";
    echo "<td class=\"fieldValue\" colspan=\"5\" onclick=\"ExpandCollapseAll()\">\n";
    echo "<div style=\"float:right\"><div class=\"alldiv\" style=\"display:inline\">Expand All</div>&nbsp;&nbsp;&nbsp;<img id=\"allicon\" src=\"" . PARAM_EXPAND_ICON . "\"/></div>\n";
    echo "</td>\n</tr>\n";
    $jobList = Job::selectExpo($expoid);
    usort($jobList, "JobCompare");
    $_SESSION[PARAM_LIST2] = $jobList;
    $c = count($jobList);
    if ($c > 0) {
        for ($k = 0; $k < $c; $k++) {
            $job = $jobList[$k];
            makeCheckInStationDashboardStationListHTMLRows($job, $k, $expoid, $max_name_size, $max_email_size);
        }
    } else {
        echo "<tr><td class=\"fieldError\" colspan=\"5\">There are currently no stations assigned to this expo.</td></tr>\n";
    }
    echo "</table>\n</div>\n";
}
コード例 #8
0
function createShiftCheckInHTMLMatrix($expoid)
{
    $station = StationJob::selectExpo($expoid);
    // make titles
    $htitle = array();
    $date = array();
    $vtitle = array();
    $dates = array();
    foreach ($station as $s) {
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $htitle[] = $stationDateTime[0] . " (" . $stationDateTime[1] . ")";
        $date[] = $stationDateTime[0];
        $vtitle[] = $s->location . " (" . $s->title . ")";
    }
    $htitle = array_values(array_unique($htitle));
    $vtitle = array_values(array_unique($vtitle));
    $dates = array_values(array_unique($date));
    echo "Select Date: <select id=\"" . PARAM_DATE . "\" name=\"" . PARAM_DATE . "\" onchange=\"hideColumns()\">\n";
    for ($k = 0; $k < count($dates); $k++) {
        echo "<option value=\"" . $dates[$k] . "\">&nbsp;" . $dates[$k] . "&nbsp;</option>\n";
    }
    echo "<option value=\"All\">&nbsp;All Dates&nbsp;</option>\n";
    echo "</select>\n";
    echo "<p />";
    // get class names
    $hdate = array();
    for ($h = 0; $h < count($htitle); $h++) {
        for ($d = 0; $d < count($dates); $d++) {
            if (preg_match("/" . $dates[$d] . "/", $htitle[$h])) {
                $hdate[$h] = preg_replace('/\\s/', '_', $dates[$d]);
            }
        }
    }
    // initialize matrix
    for ($h = 0; $h <= count($htitle); $h++) {
        for ($v = 0; $v <= count($vtitle); $v++) {
            if ($h == 0 && $v == 0) {
                $matrix[$h][$v] = "<td align=\"center\"></td>\n";
            } else {
                if ($h == 0) {
                    $matrix[$h][$v] = "<td align=\"center\">-</td>\n";
                } else {
                    $matrix[$h][$v] = "<td align=\"center\" class=\"" . $hdate[$h - 1] . "\">-</td>\n";
                }
            }
        }
    }
    //add horizontal titles to matrix
    for ($h = 0; $h < count($htitle); $h++) {
        $matrix[$h + 1][0] = "<td class=\"rowTitle " . $hdate[$h] . "\">" . $htitle[$h] . "</td>\n";
    }
    //add vertical titles
    for ($v = 0; $v < count($vtitle); $v++) {
        $matrix[0][$v + 1] = "<td class=\"rowTitle\">" . $vtitle[$v] . "</td>\n";
    }
    // fill assignment data to matrix
    foreach ($station as $s) {
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $hvalue = $stationDateTime[0] . " (" . $stationDateTime[1] . ")";
        $hpos = array_search($hvalue, $htitle);
        $vvalue = $s->location . " (" . $s->title . ")";
        $vpos = array_search($vvalue, $vtitle);
        $matrix[$hpos + 1][$vpos + 1] = "<td align=\"center\" class=\"" . $hdate[$hpos] . "\">";
        $matrix[$hpos + 1][$vpos + 1] .= "<a href=\"ShiftCheckInPage.php?" . PARAM_LIST_INDEX . "=" . $s->stationid . "\">";
        $matrix[$hpos + 1][$vpos + 1] .= "Super: " . $s->assignedSupervisor . "; Crew: " . $s->assignedCrew . "</a></td>\n";
    }
    // determine pattern array
    for ($d = 0; $d < count($dates); $d++) {
        $darray[$d] = array();
        for ($h = 1; $h <= count($htitle); $h++) {
            if (!strpos($matrix[$h][0], $dates[$d])) {
                $darray[$d][] = $h;
            }
        }
    }
    // find row class
    for ($v = 0; $v <= count($vtitle); $v++) {
        $vdate[$v] = NULL;
        for ($d = 0; $d < count($dates); $d++) {
            $flag = true;
            foreach ($darray[$d] as $dvalue) {
                if (!strpos($matrix[$dvalue][$v], '>-<')) {
                    $flag = false;
                }
            }
            if ($flag) {
                $vdate[$v] = preg_replace('/\\s/', '_', $dates[$d]);
            }
        }
    }
    echo "<table>\n";
    for ($v = 0; $v <= count($vtitle); $v++) {
        if (!is_null($vdate[$v])) {
            echo "<tr class=\"" . $vdate[$v] . "\">\n";
        } else {
            echo "<tr>\n";
        }
        for ($h = 0; $h <= count($htitle); $h++) {
            echo $matrix[$h][$v];
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<p />\n";
}
コード例 #9
0
ファイル: ExpoViewPage.php プロジェクト: ConSked/scheduler
    $expo = getParamItem(PARAM_LIST, PARAM_LIST_INDEX);
    setExpoCurrent($expo);
    // paranoia about some included section
}
$_SESSION[PARAM_LIST] = NULL;
unset($_SESSION[PARAM_MESSAGE]);
//setStationCurrent(NULL);
// now go get the workers
$workerList = Worker::selectExpo($expo->expoid);
// should be in order for display
usort($workerList, "WorkerCompare");
$_SESSION[PARAM_LIST] = $workerList;
setWorkerCurrent(NULL);
// set null wherever param_list set to workers
$_REQUEST[PARAM_LIST_INDEX] = NULL;
$stationList = StationJob::selectExpo($expo->expoid);
$_SESSION[PARAM_LIST2] = $stationList;
$_REQUEST[PARAM_LIST2_INDEX] = NULL;
// ok, start the html
include 'section/header.php';
?>

<div id="main">

    <div id="expoviewpage_expodata">
        <?php 
createExpoDataHTMLRows($expo, "", TRUE);
if ($author->isOrganizer() && !$expo->isPast()) {
    // you can edit yourself
    echo '<form method="GET" name="expoviewpage_expodata_form" action="ExpoEditPage.php">';
    echo '<input class="fieldValue" type="Submit" value="Edit"/></form>';
コード例 #10
0
<?php 
$type = NULL;
$index = NULL;
if (isset($_REQUEST[PARAM_LIST_INDEX])) {
    list($type, $index) = explode(':', $_REQUEST[PARAM_LIST_INDEX]);
}
if ($type == 'W') {
    $expo = getExpoCurrent();
    $station = getStationCurrent();
    $worker = Worker::selectID($index);
    setWorkerCurrent($worker);
} else {
    if ($type == 'S') {
        $expo = getExpoCurrent();
        $worker = getWorkerCurrent();
        $station = StationJob::selectID($index);
        setStationCurrent($station);
    }
}
// ok, start the html
include 'section/header.php';
?>

<div id="main">
    <?php 
include 'section/LinkStationWorker.php';
?>

<div id="shiftstatusdata_table">
	<form method="POST" id="shiftstatuseditpage_shiftstatusdata"
	      action="ShiftStatusEditPage.php?<?php 
コード例 #11
0
ファイル: StationViewPage.php プロジェクト: ConSked/scheduler
<body>
<div id="container">

<?php 
$expo = getExpoCurrent();
// use REQUEST as may be a GET
if (isset($_REQUEST[PARAM_LIST2_INDEX])) {
    $station = getParamItem(PARAM_LIST2, PARAM_LIST2_INDEX);
    if (isset($station)) {
        if (!$station instanceof StationJob) {
            // used in the reports, etc
            if ($station instanceof Job || $station instanceof ShiftAssignment) {
                $station = StationJob::selectID($station->stationid);
            } else {
                $station = StationJob::selectID($station->stationid);
            }
        }
        setStationCurrent($station);
    }
}
$_SESSION[PARAM_LIST2] = NULL;
$station = getStationCurrent();
$workerList = Worker::selectStation($station->stationid);
$_SESSION[PARAM_LIST] = $workerList;
$_REQUEST[PARAM_LIST2_INDEX] = NULL;
// ok, start the html
include 'section/header.php';
?>

<div id="main">
コード例 #12
0
function createSchedulingReportHTMLList($expoid)
{
    $stationList = StationJob::selectExpo($expoid);
    $dates = array();
    foreach ($stationList as $s) {
        $stationDateTime = explode(';', swwat_format_shift($s->startTime, $s->stopTime));
        $dates[] = $stationDateTime[0];
    }
    $dates = array_values(array_unique($dates));
    echo "Select Date: <select id='" . PARAM_DATE . "' name='" . PARAM_DATE . "' onchange='hideRows()'>\n";
    for ($k = 0; $k < count($dates); $k++) {
        echo "<option value='" . $dates[$k] . "'>&nbsp;" . $dates[$k] . "&nbsp;</option>\n";
    }
    echo "<option value='All'>&nbsp;All Dates&nbsp;</option>\n";
    echo "</select>\n";
    echo "<p />\n";
    echo "<input type='radio' name='role' value='Supervisors' onclick='hideRoles()' /> Supervisors";
    echo "&nbsp;&nbsp;&nbsp;<input type='radio' name='role' value='Crew' onclick='hideRoles()' /> Crew";
    echo "&nbsp;&nbsp;&nbsp;<input type='radio' name='role' value='Both' checked='checked' onclick='hideRoles()' /> Both\n";
    echo "<p />\n";
    $workerList = Worker::selectExpo($expoid);
    $_SESSION[PARAM_LIST] = $workerList;
    $max_name_size = 0;
    $max_email_size = 0;
    foreach ($workerList as $worker) {
        $name = $worker->nameString();
        if (strlen($name) > $max_name_size) {
            $max_name_size = strlen($name);
        }
        $email = $worker->email;
        if (strlen($email) > $max_email_size) {
            $max_email_size = strlen($email);
        }
    }
    $max_name_size = 10 * $max_name_size;
    $max_email_size = 10 * $max_email_size;
    $table_size = "75%";
    echo "<div id='stationlist_table'>\n";
    echo "<table width='" . $table_size . "'>\n";
    echo "<tr class='mainTitle'>\n";
    echo "<td class='fieldValue' colspan='5' onclick='ExpandCollapseAll()'>\n";
    echo "<div style='float:right'><div class='alldiv' style='display:inline'>Expand All</div>&nbsp;&nbsp;&nbsp;<img id='allicon' src='" . PARAM_EXPAND_ICON . "'/></div>\n";
    echo "</td>\n</tr>\n";
    $jobList = Job::selectExpo($expoid);
    usort($jobList, "JobCompare");
    $_SESSION[PARAM_LIST2] = $jobList;
    $c = count($jobList);
    if ($c > 0) {
        for ($k = 0; $k < $c; $k++) {
            $job = $jobList[$k];
            makeSchedulingReportStationListHTMLRows($job, $workerList, $k, $max_name_size, $max_email_size);
        }
    } else {
        echo "<tr><td class='fieldError' colspan='5'>There are currently no stations assigned to this expo.</td></tr>";
    }
    echo "</table>\n</div>\n";
}