documentation: Makefile puts sourcedoc in doc/source, installs everything in /usr...
[iserv-mod-room-reservation.git] / includes / mod_roomReservationBooking.inc
1 <?php
2 /**
3 * @file mod_roomReservationBooking.inc
4 * Container class for the representation of a single booking
5 * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
6 * @date 12.11.2007
7 *
8 * Copyright © 2007 Roland Hieber
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 * THE SOFTWARE.
27 */
28
29 /** @todo document */
30 /**
31 * Container class for the representation of a single booking
32 */
33 class mod_roomReservationBooking {
34
35 /** (int / null) Unique ID in database */
36 protected $nUid;
37 /** (string) Name of the room */
38 protected $strRoom;
39 /** (timestamp) Date when the booking takes place */
40 protected $tsDate;
41 /** (int) Number of the first timeslice */
42 protected $nTsFirst;
43 /** (int) Number of the last timeslice (may be nBegin) */
44 protected $nTsLast;
45 /** (string) Account name of the owner */
46 protected $strAct;
47 /** (string) Reason for the booking */
48 protected $strReason;
49 /** (bool) Recurrence interval in weeks */
50 protected $nInterval;
51
52 /***************************************************************************/
53 /**
54 * @name Constructor
55 * @{
56 */
57 /**
58 * Constructor.
59 * @param $strRoom (string) Name of the room
60 * @param $tsDate (timestamp) Date when the booking takes place
61 * @param $nTsFirst (int) Number of the first timeslice
62 * @param $nTsLast (int) Number of the last timeslice (may be nBegin)
63 * @param $strAct (string) Account name of the owner
64 * @param $strReason (string) Reason for the booking
65 * @param $nInterval (int) Recurrence interval, 0 for no recurrence
66 * @return mod_roomReservationBooking
67 */
68 public function __construct($strRoom, $tsDate, $nTsFirst, $nTsLast, $strAct,
69 $strReason, $nInterval = 0) {
70 $this->setUid(null);
71 $this->setRoom($strRoom);
72 $this->setDate($tsDate);
73 $this->setTsFirst($nTsFirst);
74 $this->setTsLast($nTsLast);
75 $this->setAct($strAct);
76 $this->setReason($strReason);
77 $this->setInterval($nInterval);
78 }
79
80 /***************************************************************************/
81 /**
82 * @}
83 * @name Access to attributes
84 * @{
85 */
86
87 /**
88 * Set the unique ID in database
89 * @param $n (int) Unique ID in database
90 * @return void
91 */
92 public function setUid($n) {
93 if(is_null($n)) {
94 $this->nUid = null;
95 } else {
96 $this->nUid = intval($n);
97 }
98 }
99
100 /**
101 * Set the name of the room
102 * @param $str (string) Name of the room
103 * @return void
104 */
105 public function setRoom($str) { $this->strRoom = $str; }
106
107 /**
108 * Set the date when the booking takes place
109 * @param $ts (timestamp) Date, only the date part is taken care of
110 * @return void
111 */
112 public function setDate($ts) {
113 // Only take the date part
114 $this->tsDate = intval(strtotime(date("Y\-m\-d", intval($ts)))); }
115
116 /**
117 * Set the first timeslice
118 * @param $n (int) Number of the first timeslice
119 * @return void
120 */
121 public function setTsFirst($n) { $this->nTsFirst = intval($n); }
122
123 /**
124 * Set the end timeslice
125 * @param $n (int) Number of the last timeslice (may be the start timeslice)
126 * @return void
127 */
128 public function setTsLast($n) { $this->nTsLast = intval($n); }
129
130 /**
131 * Set the account name of the owner
132 * @param $str (string) Account name
133 * @return void
134 */
135 public function setAct($str) { $this->strAct = $str; }
136
137 /**
138 * Set the reason for the booking
139 * @param $str (string) Reason
140 * @return void
141 */
142 public function setReason($str) { $this->strReason = $str; }
143
144 /**
145 * Set the flag whether the booking repeates every week
146 * @param $n (int) interval in weeks, 0 for no recurrence
147 * @return void
148 */
149 public function setInterval($n) { $this->nInterval = intval(abs($n)); }
150
151 /**
152 * Get the unique ID in database
153 * @return int / null
154 */
155 public function getUid() { return intval($this->nUid); }
156
157 /**
158 * Get the name of the room
159 * @return string
160 */
161 public function getRoom() { return $this->strRoom; }
162
163 /**
164 * Get the date when the booking takes place
165 * @return timestamp
166 */
167 public function getDate() { return intval($this->tsDate); }
168
169 /**
170 * Get the the number of the first timeslice
171 * @return int
172 */
173 public function getTsFirst() { return intval($this->nTsFirst); }
174
175 /**
176 * Get the number of the last timeslice (may be the start timeslice)
177 * @return int
178 */
179 public function getTsLast() { return intval($this->nTsLast); }
180
181 /**
182 * Get the account name of the owner
183 * @return string
184 */
185 public function getAct() { return $this->strAct; }
186
187 /**
188 * Get the reason for the booking
189 * @return string
190 */
191 public function getReason() { return $this->strReason; }
192
193 /**
194 * Get the recurrence interval
195 * @return int
196 */
197 public function getInterval() { return $this->nInterval; }
198
199 /**@}*/
200 }
201 ?>
This page took 0.053225 seconds and 5 git commands to generate.