33 $this->
id = (int)$a_id;
43 $this->title = $a_title;
61 $this->pool_id = (int)$a_pool_id;
79 $this->raster = (int)$a_raster;
97 $this->rent_min = (int)$a_min;
115 $this->rent_max = (int)$a_max;
133 $this->auto_break = (int)$a_break;
151 $this->deadline = (int)$a_deadline;
169 $this->definition = $a_definition;
190 $set = $ilDB->query(
'SELECT title,raster,rent_min,rent_max,auto_break,'.
192 ' FROM booking_schedule'.
193 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
194 $row = $ilDB->fetchAssoc($set);
207 $set = $ilDB->query(
'SELECT day_id,slot_id,times'.
208 ' FROM booking_schedule_slot'.
209 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
210 while(
$row = $ilDB->fetchAssoc($set))
231 $this->
id = $ilDB->nextId(
'booking_schedule');
233 $ilDB->manipulate(
'INSERT INTO booking_schedule'.
234 ' (booking_schedule_id,title,pool_id,raster,rent_min,rent_max,auto_break,'.
236 ' VALUES ('.$ilDB->quote($this->id,
'integer').
','.$ilDB->quote($this->
getTitle(),
'text').
237 ','.$ilDB->quote($this->
getPoolId(),
'integer').
','.$ilDB->quote($this->
getRaster(),
'integer').
257 $ilDB->manipulate(
'UPDATE booking_schedule'.
258 ' SET title = '.$ilDB->quote($this->getTitle(),
'text').
259 ', pool_id = '.$ilDB->quote($this->getPoolId(),
'integer').
260 ', raster = '.$ilDB->quote($this->getRaster(),
'integer').
261 ', rent_min = '.$ilDB->quote($this->getMinRental(),
'integer').
262 ', rent_max = '.$ilDB->quote($this->getMaxRental(),
'integer').
263 ', auto_break = '.$ilDB->quote($this->getAutoBreak(),
'integer').
264 ', deadline = '.$ilDB->quote($this->getDeadline(),
'integer').
265 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
282 $ilDB->manipulate(
'DELETE FROM booking_schedule_slot'.
283 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
290 foreach($slots as $slot_id => $times)
293 "booking_schedule_id" => array(
'integer', $this->
id),
294 "day_id" => array(
'text', $day_id),
295 "slot_id" => array(
'integer', $slot_id),
296 "times" => array(
'text', $times)
298 $ilDB->insert(
'booking_schedule_slot', $fields);
314 $set = $ilDB->query(
"SELECT booking_schedule_id".
315 " FROM booking_schedule".
316 " WHERE pool_id = ".$ilDB->quote($a_pool_id,
'integer'));
317 return (
bool)$ilDB->numRows($set);
329 $set = $ilDB->query(
'SELECT s.booking_schedule_id,s.title,'.
330 'MAX(t.schedule_id) AS type_has_schedule, MAX(o.schedule_id) AS object_has_schedule'.
331 ' FROM booking_schedule s'.
332 ' LEFT JOIN booking_type t ON (s.booking_schedule_id = t.schedule_id)'.
333 ' LEFT JOIN booking_object o ON (s.booking_schedule_id = o.schedule_id)'.
334 ' WHERE s.pool_id = '.$ilDB->quote($a_pool_id,
'integer').
335 ' GROUP BY s.booking_schedule_id,s.title'.
336 ' ORDER BY s.title');
338 while(
$row = $ilDB->fetchAssoc($set))
340 if(!
$row[
'type_has_schedule'] && !
$row[
'object_has_schedule'])
342 $row[
'is_used'] =
false;
346 $row[
'is_used'] =
true;
363 return $ilDB->manipulate(
'DELETE FROM booking_schedule'.
364 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));