Esempio n. 1
0
 /**
  * @param int $filledOutDate The date the timesheet was filled out as a int UNIX timestamp, if no value is passed in
  * today's date is set as the date
  * @param Tutor $tutor The tutor that is associated with this timesheet
  * @param PayPeriod $payPeriod The payperiod that relates to this timesheet.
  * @param array $timesWorked The hours the tutor worked for this time period
  */
 public function __construct(Tutor $tutor, PayPeriod $payPeriod, array $timesWorked, $filledOutDate = null)
 {
     // Auto set to today's date. Can be changed manually by method call
     $this->dateFilledOut = $filledOutDate == null ? date("Y-m-d", time()) : date("Y-m-d", $filledOutDate);
     $this->tutorName = $tutor->getName();
     $this->tutorID = $tutor->getID();
     $this->tutorPhone = $tutor->getPhone();
     $timesheetHours = new TimesheetHours($payPeriod, $timesWorked);
     //
     $this->timeWorkedInPeriod = $timesheetHours->getPayPeriodSchedule();
     $this->totalHoursWorked = $timesheetHours->getTotalHoursWorked();
     $this->periodStart = date("l n/j/y", $this->timeWorkedInPeriod[0]->getDate());
     $this->periodEnd = date("l n/j/y", $this->timeWorkedInPeriod[count($timesWorked) - 1]->getDate());
     $this->filename = "Timesheet_" . $this->tutorID . "_" . date("mdy") . "_" . date("Gis");
     $this->HTML = self::setTimesheetHTML();
     $this->PDFgenerator = new DOMPDF();
 }