예제 #1
0
function makeWorkerScheduleListHTMLRows(ShiftAssignmentView $s, $position)
{
    echo '<tr>' . "\n";
    echo '<td class="fieldValueFirst"><a href="StationViewPage.php?';
    echo PARAM_LIST2_INDEX, '=', $position, '">';
    echo htmlspecialchars($s->stationTitle), "</a></td>\n";
    echo '<td class="fieldValue">' . htmlspecialchars($s->location) . '</td>' . "\n";
    $stationDateTime = swwat_format_shift($s->startTime, $s->stopTime);
    list($stationDate, $stationTime, $start) = explode(';', $stationDateTime);
    echo '<td class="fieldValue">' . htmlspecialchars($stationDate) . '</td>' . "\n";
    echo '<td class="fieldValue">' . htmlspecialchars($stationTime) . '</td>' . "\n";
    echo '<td class="fieldValue">' . htmlspecialchars($s->instruction) . '</td>' . "\n";
    $expo = Expo::selectID($s->expoid);
    if ($expo->isPast() || $expo->isRunning()) {
        $hours = ShiftStatus::WorkerStationHours($s->workerid, $s->stationid, $s->expoid);
    } else {
        $hours = "-";
    }
    echo "<td class=\"fieldValue\"><a href=\"ShiftStatusViewPage.php?";
    echo PARAM_LIST_INDEX, '=S:', $s->stationid, '">';
    echo htmlspecialchars($hours);
    echo "</a></td>\n";
    if ($s->URL != NULL) {
        echo '<td><iframe src="https://www.facebook.com/plugins/like.php?href=' . $s->URL . '&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe></td>' . "\n";
    }
    echo '</tr>' . "\n";
}
예제 #2
0
function expoListStartRow(Expo $expo, $position, $isOrganizer)
{
    echo "<tr>\n  <td class='fieldValueFirst'>";
    if ($isOrganizer) {
        echo "<a href='ExpoViewPage.php?" . PARAM_LIST_INDEX . "=" . $position . "'>" . htmlspecialchars($expo->title) . "</a>";
    } else {
        if (!$expo->isPast()) {
            echo "<a href='PreferenceWelcomePage.php?" . PARAM_LIST_INDEX . "=" . $position . "'>" . htmlspecialchars($expo->title) . "</a>";
        } else {
            echo htmlspecialchars($expo->title);
        }
    }
    echo "</td>\n";
    echo "  <td class='fieldValue'>" . htmlspecialchars(swwat_format_usdate($expo->startTime)) . "</td>\n";
    echo "  <td class='fieldValue'>" . htmlspecialchars(swwat_format_usdate($expo->stopTime)) . "</td>\n";
}
예제 #3
0
 public function addJob(JobSchedule $job, $expoId, $override = FALSE)
 {
     if (array_key_exists($job->jobid, $this->jobList)) {
         return;
     }
     // already added
     if (!$override) {
         $expo = Expo::selectID($expoId);
         $preference = $this->jobPreferences[$job->jobid];
         if (is_null($preference->desirePercent)) {
             $job->subWorker($this, $expoId, TRUE);
             // we may have added it
             throw new ScheduleImpossibleException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid);
         }
         $newJobMinutes = $this->jobMinutes + $job->jobMinutes();
         if ($newJobMinutes > $this->maxMinutes) {
             $job->subWorker($this, $expoId, TRUE);
             // we may have added it
             throw new ScheduleOverMaxHoursException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " as will have total minutes above max:" . ($newJobMinutes - $this->maxMinutes));
         }
         if ($newJobMinutes > 60 * $expo->expoHourCeiling) {
             $job->subWorker($this, $expoId, TRUE);
             // we may have added it
             throw new ScheduleOverMaxHoursException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " as will have total minutes above expo max:" . ($newJobMinutes - 60 * $expo->expoHourCeiling));
         }
         foreach ($this->jobList as $existing) {
             if ($job->isTimeConflict($existing)) {
                 if ($expo->allowScheduleTimeConflict) {
                     logMessage("WorkerSchedule", "overlapping conflict allowed");
                     if ($job->isStartTimeConflict($existing)) {
                         $job->subWorker($this, $expoId, TRUE);
                         // we may have added it
                         $sce = new ScheduleConflictException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " due to identical start time conflict with existing Job:" . $existing->jobid);
                         $sce->conflict = $existing;
                         logMessage("WorkerSchedule", $sce);
                         throw $sce;
                     }
                 } else {
                     $job->subWorker($this, $expoId, TRUE);
                     // we may have added it
                     $sce = new ScheduleConflictException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " due to conflict with existing Job:" . $existing->jobid);
                     $sce->conflict = $existing;
                     logMessage("WorkerSchedule", $sce);
                     throw $sce;
                 }
                 // allowScheduleTimeConflict
             }
         }
         // $existing
     }
     // $override
     $this->jobList[$job->jobid] = $job;
     $this->jobMinutes += $job->jobMinutes();
     $job->addWorker($this, $expoId, $override);
     // must be at very end
     return;
 }
예제 #4
0
 public static function assignAsYouGo(Expo $expo, Worker $worker)
 {
     if ($expo->scheduleAssignAsYouGo) {
         $workerList = NULL;
         $stationList = NULL;
         $assignmentList = NULL;
         try {
             // needed for all
             $workerList = WorkerSchedule::selectExpo($expo->expoid);
             $stationList = JobSchedule::selectExpo($expo->expoid);
             $assignmentList = ShiftAssignment::selectExpo($expo->expoid);
         } catch (PDOException $ex) {
             logMessage("FirstComeFirstServed", "assignAsYouGo(" . $expo->titleString() . ", " . $worker->email . ") - " . $ex->getMessage());
             return;
         }
         foreach ($workerList as $w) {
             if ($w->workerid == $worker->workerid) {
                 $worker = $w;
                 break;
             }
         }
         // $w
         $aas = new FirstComeFirstServed($expo->expoid, $stationList, $workerList, $assignmentList, TRUE);
         $stationList = NULL;
         $assignmentList = NULL;
         $workerList = NULL;
         $d1 = new DateTime();
         logMessage("FirstComeFirstServed", "**** assignSchedule(" . $expoId . ") ****", $d1->format('H:i'), "\n");
         $aas->assignWorker($worker, $expoId);
         $d2 = new DateTime();
         logMessage("FirstComeFirstServed", "****assignSchedule(" . $expoId . ") ****", $d2->format('H:i'), "  elapsed: ", $d2->getTimestamp() - $d1->getTimestamp(), "\n");
         // $aas->logJobListState("FirstComeFirstServed", "jobs after assignment");
         // $aas->logWorkerListState("FirstComeFirstServed", "workers after assignment");
         AbstractScheduler::commitSchedule($expo->expoid, TRUE, $aas->getSchedule());
     }
     return;
 }
예제 #5
0
echo SITE_NAME;
?>
 - Worker Registration Page</title>
	<link href="css/site.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="container">

<?php 
$author = getWorkerAuthenticated();
$invitationList = Invitation::selectWorker($author->workerid);
$expoList = array();
foreach ($invitationList as $invitation) {
    if (!is_null($invitation->expoid)) {
        $expoList[] = Expo::selectID($invitation->expoid);
    }
}
$_SESSION[PARAM_LIST] = $expoList;
//setExpoCurrent(NULL);
$invitationList = NULL;
// gc hint
// ok, start the html
include 'section/header.php';
?>


<div id="main">

    <div id="workerregistrationpage_register">
        <h5>Register for Expos</h5>
예제 #6
0
파일: Expo.php 프로젝트: ConSked/scheduler
 /**
  * Returns back the 'active' Expo (current time or next in future)
  * NULL if none currently or no future expo
  */
 public static function selectActive($workerId)
 {
     $expoList = Expo::selectWorker($workerId);
     usort($expoList, "ExpoCompare");
     $expoList = array_reverse($expoList);
     foreach ($expoList as $exp) {
         if (!$exp->isPast()) {
             return $exp;
         }
     }
     return NULL;
 }
예제 #7
0
    <div id="workerviewpage_schedule">
        <table><tr><td>
            <form method="GET" name="workerviewpage_schedule_form" action="WorkerSchedulePage.php">
                <input type="submit" name="schedule" value="View Schedule"/>
            </form>
        </td></tr></table>
		<br />
    </div><!-- workerviewpage_schedule -->
    <?php 
}
?>

    <div id="workerviewpage_expohistory">
        <h5>Expo History</h5>
        <?php 
$expoList = Expo::selectWorker($worker->workerid);
// needed for createExpoHTMLList
usort($expoList, "ExpoCompare");
createWorkerExpoHTMLList($expoList, $worker, $author->isOrganizer());
?>
    </div><!-- workerviewpage_expohistory -->
</div><!-- main -->

<?php 
$menuItemArray = array();
if ($author->isOrganizer()) {
    $menuItemArray[] = MENU_VIEW_SITEADMIN;
    $menuItemArray[] = MENU_SEND_MESSAGE;
    $menuItemArray[] = MENU_VIEW_WORKERLIST;
}
Menu::addMenu($menuItemArray);
예제 #8
0
<?php 
$author = getWorkerAuthenticated();
$worker = getWorkerCurrent();
if (isset($_REQUEST[MENU_VIEW_SCHEDULE])) {
    // must have come from menu
    $worker = NULL;
}
if (is_null($worker)) {
    $worker = $author;
    // can always get self schedule
    setWorkerCurrent($worker);
}
$expo = getExpoCurrent();
if (is_null($expo)) {
    $expo = Expo::selectActive($worker->workerid);
    // note may be NULL
}
// ok, start the html
include 'section/header.php';
?>

<div id="main">
    <?php 
include 'section/LinkExpoWorker.php';
if (is_null($expo)) {
    echo "<h4 class='fieldError'>You are not assigned to any future expos.</h4>";
} else {
    setExpoCurrent($expo);
    ?>
	<div id="workerschedule_list">
예제 #9
0
 - Site Admin Page</title>
    <link href="css/site.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="container">

<?php 
require_once 'db/Expo.php';
require_once 'db/Worker.php';
require_once 'section/ExpoList.php';
require_once 'section/Menu.php';
require_once 'swwat/gizmos/format.php';
require_once 'util/date.php';
setWorkerCurrent(NULL);
$expoList = Expo::selectMultiple();
// should be in order for display
usort($expoList, "ExpoCompare");
$_SESSION[PARAM_LIST] = $expoList;
setExpoCurrent(NULL);
$_REQUEST[PARAM_LIST_INDEX] = NULL;
setStationCurrent(NULL);
// ok, start the html
include 'section/header.php';
?>

<div id="main">

    <div id="expolistpage_filters">
    </div><!-- expolistpage_filters -->
예제 #10
0
function getExpoOne()
{
    $expo = Expo::selectID(1);
    return $expo;
    //return isset($_SESSION[EXPOCURRENT]) ? $_SESSION[EXPOCURRENT] : NULL;
}
예제 #11
0
 public function selectExpos()
 {
     // go get the expolist; presumably using the Expo object
     $this->arrayExpo = Expo::selectWorker($this->workerid);
 }
예제 #12
0
    }
}
// $registration
foreach ($registrationArray as $registration) {
    try {
        $registration->delete();
        // accepted, so don't keep around
    } catch (PDOException $ex) {
        logMessage("RegistrationAction", "delete registration for worker:{$worker->workerid} failure " . $ex->getMessage());
        // but ignore and continue
    }
}
// $registration
$expoArray = array();
try {
    $expoArray = Expo::selectMultiple();
} catch (PDOException $ex) {
    logMessage("RegistrationAction", "selecting expo list " . $ex->getMessage());
    // but ignore and continue
}
foreach ($expoArray as $expo) {
    if ($expo->newUserAddedOnRegistration && !$expo->isPast()) {
        if (!$worker->isAssignedToExpo($expo->expoid)) {
            try {
                $worker->assignToExpo($expo->expoid);
            } catch (PDOException $ex) {
                logMessage("RegistrationAction", "assign worker:{$worker->workerid} failure " . $ex->getMessage());
                // but ignore and continue
            }
        }
    }
예제 #13
0
<?php

// $Id: WorkerMessageAction.php 1958 2012-09-13 21:33:05Z preston $ Copyright (c) ConSked, LLC. All Rights Reserved.
include 'util/authenticate.php';
require_once 'properties/constants.php';
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";