3 * @file mod_roomReservationBooking.inc
4 * Container class for the representation of a single booking
5 * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
8 * Copyright © 2007 Roland Hieber
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:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
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
31 * Container class for the representation of a single booking
33 class mod_roomReservationBooking {
35 /** (int / null) Unique ID in database */
37 /** (string) Name of the room */
39 /** (timestamp) Date when the booking takes place */
41 /** (int) Number of the first timeslice */
43 /** (int) Number of the last timeslice (may be nBegin) */
45 /** (string) Account name of the owner */
47 /** (string) Reason for the booking */
49 /** (bool) Recurrence interval in weeks */
52 /***************************************************************************/
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
68 public function __construct($strRoom, $tsDate, $nTsFirst, $nTsLast, $strAct,
69 $strReason, $nInterval = 0) {
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);
80 /***************************************************************************/
83 * @name Access to attributes
88 * Set the unique ID in database
89 * @param $n (int) Unique ID in database
92 public function setUid($n) {
96 $this->nUid = intval($n);
101 * Set the name of the room
102 * @param $str (string) Name of the room
105 public function setRoom($str) { $this->strRoom = $str; }
108 * Set the date when the booking takes place
109 * @param $ts (timestamp) Date, only the date part is taken care of
112 public function setDate($ts) {
113 // Only take the date part
114 $this->tsDate = intval(strtotime(date("Y\-m\-d", intval($ts)))); }
117 * Set the first timeslice
118 * @param $n (int) Number of the first timeslice
121 public function setTsFirst($n) { $this->nTsFirst = intval($n); }
124 * Set the end timeslice
125 * @param $n (int) Number of the last timeslice (may be the start timeslice)
128 public function setTsLast($n) { $this->nTsLast = intval($n); }
131 * Set the account name of the owner
132 * @param $str (string) Account name
135 public function setAct($str) { $this->strAct = $str; }
138 * Set the reason for the booking
139 * @param $str (string) Reason
142 public function setReason($str) { $this->strReason = $str; }
145 * Set the flag whether the booking repeates every week
146 * @param $n (int) interval in weeks, 0 for no recurrence
149 public function setInterval($n) { $this->nInterval = intval(abs($n)); }
152 * Get the unique ID in database
155 public function getUid() { return intval($this->nUid); }
158 * Get the name of the room
161 public function getRoom() { return $this->strRoom; }
164 * Get the date when the booking takes place
167 public function getDate() { return intval($this->tsDate); }
170 * Get the the number of the first timeslice
173 public function getTsFirst() { return intval($this->nTsFirst); }
176 * Get the number of the last timeslice (may be the start timeslice)
179 public function getTsLast() { return intval($this->nTsLast); }
182 * Get the account name of the owner
185 public function getAct() { return $this->strAct; }
188 * Get the reason for the booking
191 public function getReason() { return $this->strReason; }
194 * Get the recurrence interval
197 public function getInterval() { return $this->nInterval; }