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').
259 $ilDB->manipulate(
'UPDATE booking_schedule'.
260 ' SET title = '.$ilDB->quote($this->getTitle(),
'text').
261 ', pool_id = '.$ilDB->quote($this->getPoolId(),
'integer').
262 ', raster = '.$ilDB->quote($this->getRaster(),
'integer').
263 ', rent_min = '.$ilDB->quote($this->getMinRental(),
'integer').
264 ', rent_max = '.$ilDB->quote($this->getMaxRental(),
'integer').
265 ', auto_break = '.$ilDB->quote($this->getAutoBreak(),
'integer').
266 ', deadline = '.$ilDB->quote($this->getDeadline(),
'integer').
267 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
274 $new_obj =
new self();
275 $new_obj->setPoolId($a_pool_id);
276 $new_obj->setTitle($this->
getTitle());
283 return $new_obj->save();
298 $ilDB->manipulate(
'DELETE FROM booking_schedule_slot'.
299 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
306 foreach($slots as $slot_id => $times)
309 "booking_schedule_id" => array(
'integer', $this->
id),
310 "day_id" => array(
'text', $day_id),
311 "slot_id" => array(
'integer', $slot_id),
312 "times" => array(
'text', $times)
314 $ilDB->insert(
'booking_schedule_slot', $fields);
330 $set = $ilDB->query(
"SELECT booking_schedule_id".
331 " FROM booking_schedule".
332 " WHERE pool_id = ".$ilDB->quote($a_pool_id,
'integer'));
333 return (
bool)$ilDB->numRows($set);
345 $set = $ilDB->query(
'SELECT s.booking_schedule_id,s.title,'.
346 'MAX(o.schedule_id) AS object_has_schedule'.
347 ' FROM booking_schedule s'.
348 ' LEFT JOIN booking_object o ON (s.booking_schedule_id = o.schedule_id)'.
349 ' WHERE s.pool_id = '.$ilDB->quote($a_pool_id,
'integer').
350 ' GROUP BY s.booking_schedule_id,s.title'.
351 ' ORDER BY s.title');
353 while(
$row = $ilDB->fetchAssoc($set))
355 if(!
$row[
'object_has_schedule'])
357 $row[
'is_used'] =
false;
361 $row[
'is_used'] =
true;
378 return $ilDB->manipulate(
'DELETE FROM booking_schedule'.
379 ' WHERE booking_schedule_id = '.$ilDB->quote($this->id,
'integer'));
392 foreach($def as $day => $times)
394 foreach($times as $time)
396 $slots[$time][] = $day;
399 foreach($slots as $time => $days)
401 $slots[$time] = array_unique($days);
410 foreach($a_def as $time => $days)
412 foreach($days as $day)
414 $slots[$day][] = $time;