本文整理汇总了PHP中Job::selectExpo方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::selectExpo方法的具体用法?PHP Job::selectExpo怎么用?PHP Job::selectExpo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::selectExpo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectExpo
/**
* @param DateTime $startTime - provided in the case of an currently running expo; otherwise ignore
* i.e. a currently running expo shouldn't try to schedule 'today'; tomorrow maybe
*/
public static function selectExpo($expoId, $startTime = NULL)
{
if (is_null($startTime)) {
$startTime = new DateTime();
$startTime->setTime(0, 0, 0);
// set time component zero
}
$jobs = Job::selectExpo($expoId);
$jobList = array();
foreach ($jobs as $job) {
// since we're walking the list, we can filter out old stations
if ($startTime > $job->startTime) {
continue;
}
// key by id
$jobList[$job->jobid] = new JobSchedule($job);
}
// $job
$jobs = NULL;
// gc
return $jobList;
}
示例2: createStationHTMLList
function createStationHTMLList($expo, array $stationList)
{
$jobList = Job::selectExpo($expo->expoid);
usort($jobList, "JobCompare");
$date = array();
foreach ($jobList as $j) {
$stationDateTime = swwat_format_shift($j->startTime, $j->stopTime);
list($stationDate, $stationTime, $start) = explode(';', $stationDateTime);
$date[] = $stationDate;
}
$date = array_values(array_unique($date));
echo "<table width=\"50%\">\n";
echo "<tr>\n";
echo "<td>\n";
echo "Select Date: <select id=\"" . PARAM_DATE . "\" name=\"" . PARAM_DATE . "\" onchange=\"hideDateRows()\">\n";
for ($k = 0; $k < count($date); $k++) {
echo "<option value=\"" . $date[$k] . "\"> " . $date[$k] . " </option>\n";
}
echo "<option value=\"All\"> All Dates </option>\n";
echo "</select>\n";
echo "</td>\n";
$jobTitle = JobTitle::titleEnums($expo->expoid);
echo "<td>\n";
echo "Select Job: <select id=\"" . PARAM_JOB . "\" name=\"" . PARAM_JOB . "\" onchange=\"hideJobRows()\">\n";
for ($k = 0; $k < count($jobTitle); $k++) {
echo "<option value=\"" . $jobTitle[$k] . "\"> " . $jobTitle[$k] . " </option>\n";
}
echo "<option value=\"All\" selected=\"selected\"> All Jobs </option>\n";
echo "</select>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<p />Search Shift By: <input type=\"text\" id=\"search\" name=\"search\" onkeyup=\"searchRows()\"\\>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<p />\n";
echo "<div id=\"stationlist_table\">\n";
echo "<table>\n";
echo "<tr>\n";
echo "<th class=\"rowTitle\">Shift</th>\n";
echo "<th class=\"rowTitle\">Job</th>\n";
echo "<th class=\"rowTitle\">Location</th>\n";
echo "<th class=\"rowTitle\">Date</th>\n";
echo "<th class=\"rowTitle\">Time</th>\n";
echo "<th class=\"rowTitle\">Crew</th>\n";
echo "<th class=\"rowTitle\">Supervisors</th>\n";
echo "<th class=\"rowTitle\">Instructions</th>\n";
echo "<th class=\"rowTitle\"></th>\n";
echo "</tr>\n";
$c = count($stationList);
if ($c > 0) {
for ($k = 0; $k < $c; $k++) {
$s = $stationList[$k];
makeStationListHTMLRows($s, $k);
}
} else {
echo "<tr><td class=\"fieldError\" colspan=\"5\">No stations for this Expo currently exist.</td></tr>\n";
}
echo "</table></div><!-- stationlist_table -->\n";
}
示例3: createCheckInStationDashboardHTMLList
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] . "\"> " . $dates[$k] . " </option>\n";
}
echo "<option value=\"All\"> All Dates </option>\n";
echo "</select>\n";
echo "<p />\n";
echo "<input type=\"radio\" name=\"role\" value=\"Supervisors\" onclick=\"hideRoles()\" /> Supervisors";
echo " <input type=\"radio\" name=\"role\" value=\"Crew\" onclick=\"hideRoles()\" /> Crew";
echo " <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> <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";
}
示例4: setShiftPreferences
function setShiftPreferences($workerId, $expoId, $locations)
{
$timePrefs = NewTimePreference::selectID($workerId, $expoId);
$locationPrefs = JobPreference::selectID($workerId, $expoId);
$jobs = Job::selectExpo($expoId);
foreach ($jobs as $job) {
$sp = new ShiftPreference();
$sp->workerid = $workerId;
$sp->jobid = $job->jobid;
$sp->stationid = $job->stationid;
$sp->expoid = $expoId;
$station = Station::selectID($job->stationid);
//time preference
$timeZone = swwat_format_timezone($station->startTime);
$startTime = swwat_format_epoch($station->startTime);
$stopTime = swwat_format_epoch($station->stopTime);
$zeroFlag = FALSE;
$tdesire = 0;
$count = 0;
foreach ($timePrefs as $timePref) {
$epoch = date_format(new DateTime($timePref->day, new DateTimeZone($timeZone)), 'U');
for ($i = 0; $i < 24; $i++) {
$startHour = $epoch;
$endHour = strtotime("+1 hours", $epoch);
if ($startHour >= $startTime && $endHour <= $stopTime) {
$field = 'hour' . ($i + 1);
$value = $timePref->{$field};
if ($value == 0) {
$zeroFlag = TRUE;
}
$tdesire += $value;
$count++;
}
$epoch = strtotime("+1 hours", $epoch);
}
}
if ($zeroFlag || $count == 0) {
$tdesire = 0;
} else {
$tdesire = $tdesire / $count;
}
// location preference
$index = array_search($station->location, $locations);
$field = 'job' . ($index + 1);
$ldesire = $locationPrefs->{$field};
$desire = 0;
if ($tdesire != 0 && $ldesire != 0) {
$desire = ($tdesire + $ldesire) / 2;
}
$sp->desirePercent = $desire;
$sp->update();
}
}
示例5: createSchedulingReportHTMLList
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] . "'> " . $dates[$k] . " </option>\n";
}
echo "<option value='All'> All Dates </option>\n";
echo "</select>\n";
echo "<p />\n";
echo "<input type='radio' name='role' value='Supervisors' onclick='hideRoles()' /> Supervisors";
echo " <input type='radio' name='role' value='Crew' onclick='hideRoles()' /> Crew";
echo " <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> <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";
}
示例6: FPDF
require_once 'db/Job.php';
require_once 'db/ShiftAssignmentView.php';
require_once 'db/Worker.php';
require_once 'swwat/gizmos/format.php';
require_once 'util/session.php';
require_once 'util/log.php';
$font_family = 'Arial';
$font_style = 'B';
$font_size = 8;
$pdf = new FPDF();
$pdf->Addpage();
$pdf->SetFont($font_family, $font_style, $font_size);
$pdf->SetFillCOlor(200);
// 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');
示例7: reviewActionContent
function reviewActionContent($author, $expo)
{
if (isset($_POST[PARAM_MAXHOURS]) && !is_null($_POST[PARAM_MAXHOURS])) {
$author->updateMaxHours($expo->expoid, swwat_parse_string(html_entity_decode($_POST[PARAM_MAXHOURS])));
}
$jobList = Job::selectExpo($expo->expoid);
usort($jobList, "JobCompare");
$prefJobidList = array();
$prefDesireList = array();
if (count($_POST) > 0) {
$keys = array_keys($_POST);
$values = array_values($_POST);
for ($k = 0; $k < count($_POST); $k++) {
if (strpos($keys[$k], 'title') !== false) {
list($prefJobidList[], $prefDesireList[]) = explode(':', $values[$k]);
}
}
}
$shiftpreference = new ShiftPreference();
foreach ($jobList as $j) {
$shiftpreference->workerid = $author->workerid;
$shiftpreference->jobid = $j->jobid;
$shiftpreference->stationid = $j->stationid;
$shiftpreference->expoid = $j->expoid;
$pos = array_search($j->jobid, $prefJobidList);
if ($pos === false) {
$shiftpreference->desirePercent = NULL;
} else {
$shiftpreference->desirePercent = $prefDesireList[$pos];
if ($shiftpreference->desirePercent == 0) {
$shiftpreference->desirePercent = NULL;
}
}
$shiftpreference->update();
}
// note post $shiftpreference save
if ($expo->scheduleAssignAsYouGo) {
if ($expo->scheduleWorkerReset) {
$shifts = ShiftAssignment::selectWorker($expo->expoid, $author->workerid);
ShiftAssignment::deleteList($shifts);
}
FirstComeFirstServed::assignAsYouGo($expo, $author);
if ($expo->scheduleVisible) {
mailSchedule($expo, $author);
header('Location: WorkerSchedulePage.php');
include 'WorkerSchedulePage.php';
return;
}
}
// assignAsYouGo
}