function loadDepartments($cid, $id) { // subdepartments $departments = array(); if ($id == -1) { $request = "SELECT * FROM department WHERE cid = {$cid} AND did IS NULL"; } else { $request = "SELECT * FROM department WHERE cid = {$cid} and did = {$id}"; } $result = mysql_query($request); $count = mysql_num_rows($result); while ($row = mysql_fetch_object($result)) { $department = new Department(); $department->setId($row->id); $department->setName($row->name); $department->setDepartments(loadDepartments($cid, $row->id)); $employees = loadEmployees($cid, $row->id); $department->setEmployees($employees); $inconsistent = containsManager($employees); if ($inconsistent == true) { $department->setInconsistent(true); $department->setMessage("No Manager!"); } $departments[] = $department; } return $departments; }
$color[1] = "F0F000"; $color[2] = "00FF00"; $color[3] = "00F0F0"; $color[4] = "0000FF"; $color[5] = "0F000F"; $color[6] = "F000F0"; $color[7] = "FFF000"; return $color; } $pageTitle = "Schedule"; $javascript = "schedule.js"; require "includes/adminHeader.php"; $jobs = ""; $s = ""; $jobs = buildJobArray(); $dept = loadDepartments(); //get the date $theDate = date("d F Y"); if (isset($_POST["theDate"])) { $theDate = $_POST["theDate"]; } $lastSunday = strtotime("last Sunday", strtotime($theDate)); $day1 = date("D, M.j", $lastSunday); $day2 = date("D, M.j", strtotime("+1 day", $lastSunday)); $day3 = date("D, M.j", strtotime("+2 day", $lastSunday)); $day4 = date("D, M.j", strtotime("+3 day", $lastSunday)); $day5 = date("D, M.j", strtotime("+4 day", $lastSunday)); $day6 = date("D, M.j", strtotime("+5 day", $lastSunday)); $day7 = date("D, M.j", strtotime("+6 day", $lastSunday)); loadSettings(1); $shiftID = "";