summaryrefslogtreecommitdiff
path: root/includes/model/ShiftsFilter.php
blob: 044b32dde177eeed885a5ea6792338ff3bf53115 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php

namespace Engelsystem;

/**
 * BO Class that stores all parameters used to filter shifts for users.
 *
 * @author msquare
 */
class ShiftsFilter {

  /**
   * Shift is completely full.
   */
  const FILLED_FILLED = 1;

  /**
   * Shift has some free slots.
   */
  const FILLED_FREE = 0;

  /**
   * Has the user "user shifts admin" privilege?
   *
   * @var boolean
   */
  private $userShiftsAdmin;

  private $filled = [];

  private $rooms = [];

  private $types = [];

  private $startTime = null;

  private $endTime = null;

  public function __construct($user_shifts_admin, $rooms, $types) {
    $this->user_shifts_admin = $user_shifts_admin;
    $this->rooms = $rooms;
    $this->types = $types;
    
    $this->filled = [
        ShiftsFilter::FILLED_FREE 
    ];
    
    if ($user_shifts_admin) {
      $this->filled[] = ShiftsFilter::FILLED_FILLED;
    }
  }

  public function getStartTime() {
    return $this->startTime;
  }

  public function setStartTime($startTime) {
    $this->startTime = $startTime;
  }

  public function getEndTime() {
    return $this->endTime;
  }

  public function setEndTime($endTime) {
    $this->endTime = $endTime;
  }

  public function getTypes() {
    if (count($this->types) == 0) {
      return [
          0 
      ];
    }
    return $this->types;
  }

  public function setTypes($types) {
    $this->types = $types;
  }

  public function getRooms() {
    if (count($this->rooms) == 0) {
      return [
          0 
      ];
    }
    return $this->rooms;
  }

  public function setRooms($rooms) {
    $this->rooms = $rooms;
  }

  public function isUserShiftsAdmin() {
    return $this->userShiftsAdmin;
  }

  public function setUserShiftsAdmin($userShiftsAdmin) {
    $this->userShiftsAdmin = $userShiftsAdmin;
  }

  public function getFilled() {
    return $this->filled;
  }

  public function setFilled($filled) {
    $this->filled = $filled;
  }
}

?>