Ejemplo n.º 1
0
function createShiftCheckInHTMLList($expoid, $stationid)
{
    echo "<div id=\"workerlist_table\">\n";
    echo "<form method=\"POST\" name=\"ShiftCheckIn_form\" action=\"ShiftCheckInAction.php?" . PARAM_LIST_INDEX . "=" . $stationid . "\">\n";
    echo "<table>\n";
    $shiftAssignmentList = ShiftAssignmentView::selectStation($expoid, $stationid);
    $c = count($shiftAssignmentList);
    $workerList = array();
    for ($k = 0; $k < $c; $k++) {
        $workerList[$k] = Worker::selectID($shiftAssignmentList[$k]->workerid);
    }
    usort($workerList, "WorkerCompare");
    echo "<tr><td class=\"rowTitle\" colspan=\"4\">Supervisors</td></tr>\n";
    $supervisors = 0;
    for ($k = 0; $k < $c; $k++) {
        if ($workerList[$k]->isSupervisor() && !$workerList[$k]->isDisabled) {
            $ss = ShiftStatus::mostRecentStatus($workerList[$k]->workerid, $stationid, $expoid);
            if (count($ss) > 0) {
                $statusType = $ss->statusType;
            } else {
                $statusType = NULL;
            }
            makeShiftCheckInListHTMLRows($workerList[$k], $statusType);
            $supervisors++;
        }
    }
    if ($supervisors == 0) {
        echo "<tr><td class=\"fieldError\" colspan=\"4\">There are currently no Supervisors assigned to this station.</td></tr>\n";
    }
    echo "<tr><td class=\"rowTitle\" colspan=\"4\">Crew</td></tr>\n";
    $crew = 0;
    for ($k = 0; $k < $c; $k++) {
        if ($workerList[$k]->isCrewMember() && !$workerList[$k]->isDisabled) {
            $ss = ShiftStatus::mostRecentStatus($workerList[$k]->workerid, $stationid, $expoid);
            if (count($ss) > 0) {
                $statusType = $ss->statusType;
            } else {
                $statusType = NULL;
            }
            makeShiftCheckInListHTMLRows($workerList[$k], $statusType);
            $crew++;
        }
    }
    // $k
    if ($crew == 0) {
        echo "<tr><td class=\"fieldError\" colspan=\"4\">There are currently no Crew assigned to this station.</td></tr>\n";
    }
    echo "</table></form></div><!-- workerlist_table -->\n";
}
function makeCheckInStationDashboardStationListHTMLRows(Job $job, $k, $expoid, $max_name_size, $max_email_size)
{
    $stationDateTime = swwat_format_shift($job->startTime, $job->stopTime);
    list($stationDate, $stationTime, $start) = explode(';', $stationDateTime);
    $dclass = preg_replace('/\\s/', '_', $stationDate);
    echo "<tr class=\"mainTitle All " . $dclass . "\">\n";
    echo "<td class=\"fieldValue\"><a href=\"StationViewPage.php?";
    echo PARAM_LIST2_INDEX, "=", $k, "\">";
    echo htmlspecialchars($job->stationTitle);
    echo "</a></td>\n";
    echo "<td class=\"fieldValue\">" . htmlspecialchars($job->jobTitle) . "</td>\n";
    echo "<td class=\"fieldValue\">" . htmlspecialchars($job->location) . "</td>\n";
    echo "<td class=\"fieldValue\">" . htmlspecialchars($stationDate) . "</td>\n";
    echo "<td class=\"fieldValue\">" . htmlspecialchars($stationTime) . "</td>\n";
    echo "</tr>\n";
    echo "<tr class=\"All " . $dclass . "\">\n";
    echo "<td colspan=\"5\" style='padding-left: 15px'>\n";
    echo "<table class=\"research\" width=\"100%\">\n";
    $assignedWorkerList = ShiftAssignmentView::selectStation($expoid, $job->stationid);
    $c = count($assignedWorkerList);
    $nsupervisor = 0;
    $ncrew = 0;
    if ($c > 0) {
        for ($k = 0; $k < $c; $k++) {
            $w = Worker::selectID($assignedWorkerList[$k]->workerid);
            if ($w->isSupervisor()) {
                $nsupervisor++;
            }
            if ($w->isCrewMember()) {
                $ncrew++;
            }
        }
    }
    $supervisor = 'Supervisors: ' . $nsupervisor . ' (' . $job->minSupervisor . ' - ' . $job->maxSupervisor . ')';
    echo "<tr class=\"accordion Supervisors sectionTitle\">\n";
    echo "<td colspan=\"5\" class=\"fieldValue\">\n";
    echo "<div style=\"float:left\">" . htmlspecialchars($supervisor) . "</div>\n";
    echo "<div style=\"float:right\"><img id=\"icon\" src=\"" . PARAM_EXPAND_ICON . "\"/></div>\n";
    echo "</td>\n";
    echo "<tr>\n";
    if ($nsupervisor > 0) {
        for ($k = 0; $k < $c; $k++) {
            $w = Worker::selectID($assignedWorkerList[$k]->workerid);
            if ($w->isSupervisor()) {
                $ss = ShiftStatus::mostRecentStatus($assignedWorkerList[$k]->workerid, $job->stationid, $expoid);
                makeCheckInStationDashboardWorkerListHTMLRows($w, $ss, $max_name_size, $max_email_size);
            }
        }
    } else {
        echo "<tr><td class=\"fieldError\" colspan=\"5\">There are currently no supervisors assigned to this station.</td></tr>\n";
    }
    echo "</table>\n";
    echo "<table class=\"research\" width=\"100%\">\n";
    $crew = 'Crew: ' . $ncrew . ' (' . $job->minCrew . ' - ' . $job->maxCrew . ')';
    echo "<tr class=\"accordion Crew sectionTitle\">\n";
    echo "<td colspan=\"5\" class=\"fieldValue\">\n";
    echo "<div style=\"float:left\">" . $crew . "</div>\n";
    echo "<div style=\"float:right\"><img id=\"icon\" src=\"" . PARAM_EXPAND_ICON . "\"/></div>\n";
    echo "</td>\n";
    echo "<tr>\n";
    if ($ncrew > 0) {
        for ($k = 0; $k < $c; $k++) {
            $w = Worker::selectID($assignedWorkerList[$k]->workerid);
            if ($w->isCrewMember()) {
                $ss = ShiftStatus::mostRecentStatus($assignedWorkerList[$k]->workerid, $job->stationid, $expoid);
                makeCheckInStationDashboardWorkerListHTMLRows($w, $ss, $max_name_size, $max_email_size);
            }
        }
    } else {
        echo "<tr><td class=\"fieldError\" colspan=\"5\">There are currently no crew assigned to this station.</td></tr>\n";
    }
    echo "</table>";
    echo "</td>\n</tr>\n";
}