Example #1
0
 function __construct($month)
 {
     foreach ($month as $date) {
         $this->schema[$date][0] = ShiftFactory::createShift($date, 0);
         $this->schema[$date][1] = ShiftFactory::createShift($date, 1);
         $this->schema[$date][2] = ShiftFactory::createShift($date, 2);
         $this->schema[$date][3] = ShiftFactory::createShift($date, 3);
     }
 }
Example #2
0
 function shift()
 {
     if ($user = $this->models->getUser()) {
         //fix date format
         $shift = ShiftFactory::createShift($this->route->getParam(3), $this->route->getParam(4));
         $this->views->populate('shift', $shift);
         $this->views->flush('body', 'shift');
     } else {
         header('location: /Users/Login/');
     }
 }
Example #3
0
 function __construct($startDate, $slutdate)
 {
     $this->endDate = $slutdate;
     $this->startDate = $startDate;
     $this->typePointer = 0;
     $this->datePointer = $startDate;
     $month = array();
     $i = $startDate;
     while ($i <= $slutdate) {
         $month[$i] = $i;
         $i += 86400;
     }
     foreach ($month as $date) {
         $this->schema[$date][0] = ShiftFactory::createShift($date, 0);
         $this->schema[$date][1] = ShiftFactory::createShift($date, 1);
         $this->schema[$date][2] = ShiftFactory::createShift($date, 2);
         $this->schema[$date][3] = ShiftFactory::createShift($date, 3);
     }
 }
Example #4
0
 function commitShift()
 {
     ShiftFactory::insertShift($this->date, $this->type, $this->empID);
 }
Example #5
0
 function accept()
 {
     if (isset($_POST['accept'])) {
         ShiftFactory::acceptChangeOffer($_POST['shift_id']);
     }
     if (isset($_POST['reject'])) {
         ShiftFactory::rejectChangeOffer($_POST['shift_id']);
     }
     header('location: /Schemas/');
 }
Example #6
0
 function acceptChangeOffer($switch_id)
 {
     $switches = mysql_query("select * from switchdata where switch_id = {$switch_id}");
     while ($row = mysql_fetch_assoc($switches)) {
         ShiftFactory::addEmployee($row['day'], $row['type'], $row['new_emp']);
     }
     mysql_query("UPDATE switch SET status = true WHERE switch_id = {$switch_id}");
 }