Exemple #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);
}
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;
}
    </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();
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';