public function fillData(ShiftAssignmentView $shiftassignment) { $this->workerid = $shiftassignment->workerid; $this->stationid = $shiftassignment->stationid; $this->expoid = $shiftassignment->expoid; $this->expo = $shiftassignment->expoTitle; $this->station = $shiftassignment->location . " (" . $shiftassignment->stationTitle . ")"; $this->startTime = $shiftassignment->startTime; $this->stopTime = $shiftassignment->stopTime; $worker = Worker::selectID($shiftassignment->workerid); $this->workerName = $worker->nameString2(); $this->workerEmail = $worker->email; return $this; }
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 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"; }
<link href="css/site.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <?php $type = NULL; $index = NULL; if (isset($_REQUEST[PARAM_LIST_INDEX])) { list($type, $index) = explode(':', $_REQUEST[PARAM_LIST_INDEX]); } if ($type == 'W') { $expo = getExpoCurrent(); $station = getStationCurrent(); $worker = Worker::selectID($index); setWorkerCurrent($worker); } else { if ($type == 'S') { $expo = getExpoCurrent(); $worker = getWorkerCurrent(); $station = StationJob::selectID($index); setStationCurrent($station); } } // ok, start the html include 'section/header.php'; ?> <div id="main"> <?php
public static function password_change($workerId, $password) { try { $dbh = getPDOConnection(); $stmt = $dbh->prepare("SELECT isDisabled, externalAuthentication FROM worker WHERE workerid = ?"); $stmt->execute(array($workerId)); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($rows) != 1) { throw new Exception('Can not find worker account.'); } $isDisabled = $rows[0]['isDisabled']; $externalAuthentication = $rows[0]['externalAuthentication']; if ($isDisabled == TRUE) { throw new Exception('Worker account is disabled.'); } if ($externalAuthentication == TRUE) { throw new Exception('This worker account uses external authentication.'); } $dbh->beginTransaction(); // with new password; resetCode is no longer needed $stmt = $dbh->prepare("UPDATE worker SET passwordHash = ?, resetCodeHash = NULL WHERE workerid = ?"); $stmt->execute(array(hashField($password), $workerId)); $dbh->commit(); // we login, proper this time logout(); // paranoia session_cache_limiter('nocache'); session_start(); $worker = Worker::selectID($workerId); $_SESSION[AUTHENTICATED] = $worker; $_SESSION[AUTHENTICATED_TEMP] = NULL; return; } catch (PDOException $pe) { // do NOT log password logMessage('WorkerLogin::password_change(' . $workerId . ", {$password})", $pe->getMessage()); } }
$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++; } } //find column widths $colwidth = array(0, 0, 0, 0, 0, 0); for ($j = 0; $j < count($matrix); $j++) { for ($k = 0; $k < 6; $k++) { if ($colwidth[$k] < $pdf->GetStringWidth($matrix[$j][$k])) {