/** * Sets both the direcories used by this class */ private static function setDirectories() { if (is_null(self::$SAVE_DIRECTORY)) { self::$SAVE_DIRECTORY = __DIR__ . '/../../timesheets/'; } if (is_null(self::$WEB_SAVE_DIRECTORY)) { self::$WEB_SAVE_DIRECTORY = "/~grifftutor/timesheets/"; } }
<?php require_once 'checkLogin.php'; if ($USER != null) { require_once __DIR__ . '/../oop/PayPeriod.php'; require_once __DIR__ . '/../oop/SingleDay.php'; require_once __DIR__ . '/../oop/Timesheet.php'; require_once __DIR__ . '/../oop/manager/TimesheetManager.php'; $hoursArray = json_decode($_POST['hours']); $startDate = $_POST['startDate']; $payperiod = new PayPeriod(strtotime($startDate)); $timesheet = new Timesheet($USER, $payperiod, $hoursArray); $timesheetManager = new TimesheetManager(); $timesheetManager->save($timesheet); $timesheet->toPDF(); }
/** * Removes all traces of a tutor from the database/system * Use with caution! * * @param int $ID The ID of the tutor to destroy */ function destroyTutor($ID) { if ($this->userExists($ID)) { $db = $this->getDB(); $queryTutor = "DELETE FROM " . self::TABLE_TUTOR . " WHERE userID = " . $ID; $queryUser = "******" . self::TABLE_USER . " WHERE userID = " . $ID; $db->query($queryTutor); $db->query($queryUser); $timesheetManager = new TimesheetManager(); $timesheetManager->removeTimesheets($ID); $reportManager = new ReportManager(); $reportManager->removeReports($ID); $scheduleManager = self::$scheduleManager; $scheduleManager->removeSchedule($ID); } }
<tr> <td></td> <td> <input type="button" id="buttonSearch" value="Search"> <input type="button" id="buttonReset" value="Reset"> </td> </tr> </table> </form> '; } ?> <?php // Create the managers $timesheetManager = new TimesheetManager(); $userManager = new UserManager(); $timesheetListBackwards = array(); if ($isSupervisor) { $timesheetListBackwards = $timesheetManager->getAll(); } else { $timesheetListBackwards = $timesheetManager->get($USER->getID()); } $directory = $timesheetManager->getSaveDirectory(); if (is_null($timesheetListBackwards)) { echo "There are currently no timesheets to display."; } else { $timesheetList = array_reverse($timesheetListBackwards); echo '<table id="viewTimesheetTable">'; echo '<tr>'; echo '<th>Date</th>';