Exemplo n.º 1
0
function mailSchedule(Expo $expo, Worker $worker)
{
    $savList = ShiftAssignmentView::selectWorker($expo->expoid, $worker->workerid);
    $paramNames = array("FIRSTNAME", "EXPONAME");
    $params = array("FIRSTNAME" => $worker->firstName, "EXPONAME" => $expo->title);
    $body = "Hello FIRSTNAME,\n\nYour schedule for EXPONAME is:\n";
    $body .= sprintfSchedule($savList);
    $body .= "\n\nSincerely,\nThe " . SITE_NAME . " Team";
    $form = new FormMail($expo->title . " Schedule", $paramNames, $body);
    $form->sendForm($worker->email, $params);
}
Exemplo n.º 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 />';
}
Exemplo n.º 3
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";
}
Exemplo n.º 4
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;
}
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";
}
Exemplo n.º 6
0
require_once 'util/log.php';
require_once 'util/mail.php';
$date = new DateTime();
$targtag = $date->modify('+' . PARAM_ANTEREMINDER_TIME . ' day');
$messagedata = array();
// will become array of array
$email_array = array();
logMessage("SendMessagesCron", "called.");
if (ReminderSent::selectDate(swwat_format_isodate($targtag))) {
    logMessage("SendMessagesCron", "emails for " . swwat_format_isodate($targtag) . " already sent out.");
    exit;
}
$expoList = Expo::selectMultiple();
foreach ($expoList as $expo) {
    if (!$expo->isPast() && $expo->scheduleVisible) {
        $shiftassignments = ShiftAssignmentView::selectDate($expo->expoid, $targtag);
        foreach ($shiftassignments as $shift) {
            if (strcmp(substr(strtolower($shift->stationTitle), 0, 5), "can't")) {
                $message = new MessageData();
                $message->fillData($shift);
                $email = $message->workerEmail;
                // just a convenience
                if (is_null($email)) {
                    logMessage("SendMessagesCron", "Worker has null email:" . var_export($worker, true));
                    continue;
                }
                if (!in_array($email, $email_array)) {
                    $email_array[] = $email;
                    $messagedata[$email] = array();
                    // first time
                }
Exemplo n.º 7
0
    </div><!-- shiftassignpage -->

    <div id="shiftassignpage_confirm">
        <?php 
// display the 'current' assignments always
$workerList = Worker::selectStation($job->stationid);
if (count($workerList) > 0) {
    ?>
			<p />
            <table class="fieldValue">
            <tr class="rowTitle">
                <th>Name</th><th>Role</th><th>Station</th><th>Job</th><th>Start</th><th>Stop</th><th>Supers</th><th>Crew</th>
            </tr>
            <?php 
    foreach ($workerList as $worker) {
        $assnArray = ShiftAssignmentView::selectWorker($expo->expoid, $worker->workerid);
        createWorkerStationHTMLRows($worker, $assnArray, TRUE, FALSE);
    }
    // $worker
    ?>
            </table>
        <?php 
}
?>
		<p />
    </div><!-- shiftassignpage_confirm -->

</div><!-- main -->

<?php 
$menuItemArray = array();
<div id="main">
    <div id="workerdisableconfirmpage_workerdata">
        <?php 
createWorkerDataHTMLRows($worker, "", TRUE);
?>
		<br />
    </div><!-- workerdisableconfirmpage_workerdata -->

    <div id="workerdisableconfirmpage_confirm">
            <table class="fieldValue">
            <tr class="rowTitle">
                <th>Expo</th><th>Station</th><th>Job</th><th>Start</th><th>Stop</th><th>Supers</th><th>Crew</th>
            </tr>
            <?php 
$assnArray = ShiftAssignmentView::selectWorker(NULL, $worker->workerid);
createWorkerStationHTMLRows($worker, $assnArray, FALSE, TRUE);
?>
            </table>
            <form method="POST" name="workerdisableconfirmpage_disable_form" action="WorkerDisableAction.php">
            <?php 
// maintain compatibility with WorkerViewPage
swwat_createInputSubmit(PARAM_DISABLED, "Confirm Disable Login");
?>
            </form>
    </div><!-- workerdisableconfirmpage_confirm -->

</div><!-- main -->

<?php 
$menuItemArray = array();
Exemplo n.º 9
0
require_once 'db/Expo.php';
require_once 'db/Worker.php';
require_once 'util/log.php';
require_once 'util/mail.php';
require_once 'util/mailSchedule.php';
require_once 'util/session.php';
require_once 'swwat/gizmos/format.php';
require_once 'swwat/gizmos/parse.php';
$author = getWorkerAuthenticated();
$expo = Expo::selectActive($author->workerid);
$subject = swwat_parse_string(html_entity_decode($_POST[PARAM_SUBJECT_MESSAGE]));
$message = swwat_parse_string(html_entity_decode($_POST[PARAM_MESSAGE]));
$to = "*****@*****.**";
$message .= "\n\n\n...............................\nStandard Data Included\n...............................";
$message .= "\nfrom: {$author->lastName}, {$author->firstName}";
$message .= "\nrole: " . RoleEnum::getString($author->authrole);
$message .= "\nemail: {$author->email}";
$message .= "\nphone: " . swwat_format_phone($author->phone);
$message .= "\nstatus: " . ($author->isDisabled ? "disabled" : "enabled");
if (!is_null($expo)) {
    $message .= "\ncurrent expo: " . $expo->titleString();
    $message .= "\nschedule:\n";
    $savList = ShiftAssignmentView::selectWorker($expo->expoid, $author->workerid);
    $message .= sprintfSchedule($savList);
} else {
    $message .= "no current expo";
}
$message .= "\n\n";
FormMail::send($to, $subject, $message);
header('Location: WorkerViewPage.php');
include 'WorkerViewPage.php';
Exemplo n.º 10
0
// gather data
$expoId = 2;
$jobList = Job::selectExpo($expoId);
usort($jobList, "JobCompare");
$j = 0;
// Todo: Make shift/job name span the relevant fields.
foreach ($jobList as $job) {
    $matrix[$j][0] = 'Date';
    $matrix[$j][1] = 'Day of Week';
    $matrix[$j][2] = 'Shift Time';
    $matrix[$j][3] = 'Volunteer Role';
    $matrix[$j][4] = 'Volunteer Name';
    $matrix[$j][5] = 'Shift Name';
    $matrix[$j][6] = true;
    $j++;
    $assignedWorkerList = ShiftAssignmentView::selectJob($expoId, $job->jobid);
    foreach ($assignedWorkerList as $aw) {
        $date = date_format($aw->startTime, 'd-M');
        $weekDay = date_format($aw->startTime, 'l');
        $awDateTime = swwat_format_shift($aw->startTime, $aw->stopTime);
        list($awDate, $shiftTime, $start) = explode(';', $awDateTime);
        $shiftName = $aw->stationTitle . ' - ' . $aw->location;
        $worker = Worker::selectID($aw->workerid);
        $matrix[$j][0] = $date;
        $matrix[$j][1] = $weekDay;
        $matrix[$j][2] = $shiftTime;
        $matrix[$j][3] = $worker->roleString();
        $matrix[$j][4] = $worker->nameString2();
        $matrix[$j][5] = $shiftName;
        $matrix[$j][6] = false;
        $j++;