40 $this->db =
$DIC->database();
41 $this->
id = (int) $a_id;
60 $this->title = $a_title;
78 $this->description = $a_value;
96 $this->pool_id = (int) $a_pool_id;
114 $this->schedule_id = (int) $a_schedule_id;
132 $this->nr_of_items = (int) $a_value;
150 $this->info_file = $a_value;
167 if ($this->
id && $this->info_file) {
188 $original = $a_upload[
"name"];
189 if (ilUtil::moveUploadedFile($a_upload[
"tmp_name"], $original,
$path . $original)) {
190 chmod(
$path . $original, 0770);
218 $this->post_text = $a_value;
236 $this->post_file = $a_value;
253 if ($this->
id && $this->post_file) {
274 $original = $a_upload[
"name"];
276 if (ilUtil::moveUploadedFile($a_upload[
"tmp_name"], $original,
$path . $original)) {
277 chmod(
$path . $original, 0770);
305 include_once
"Modules/BookingManager/classes/class.ilFSStorageBooking.php";
323 include_once
"Modules/BookingManager/classes/class.ilFSStorageBooking.php";
327 $path = $storage->getAbsolutePath() .
"/";
330 $path .= $a_subdir .
"/";
332 if (!is_dir(
$path)) {
348 $set =
$ilDB->query(
'SELECT *' .
349 ' FROM booking_object' .
350 ' WHERE booking_object_id = ' .
$ilDB->quote($this->id,
'integer'));
370 'title' => array(
'text', $this->
getTitle()),
374 'info_file' => array(
'text', $this->
getFile()),
375 'post_text' => array(
'text', $this->
getPostText()),
394 $this->
id =
$ilDB->nextId(
'booking_object');
397 $fields[
'booking_object_id'] = array(
'integer', $this->
id);
398 $fields[
'pool_id'] = array(
'integer', $this->
getPoolId());
400 return $ilDB->insert(
'booking_object', $fields);
417 return $ilDB->update(
420 array(
'booking_object_id'=>array(
'integer', $this->
id))
430 public static function getList($a_pool_id, $a_title =
null)
437 ' FROM booking_object' .
438 ' WHERE pool_id = ' .
$ilDB->quote($a_pool_id,
'integer');
441 $sql .=
' AND (' .
$ilDB->like(
'title',
'text',
'%' . $a_title .
'%') .
442 ' OR ' .
$ilDB->like(
'description',
'text',
'%' . $a_title .
'%') .
')';
445 $sql .=
' ORDER BY title';
447 $set =
$ilDB->query($sql);
459 public function delete()
466 return $ilDB->manipulate(
'DELETE FROM booking_object' .
467 ' WHERE booking_object_id = ' .
$ilDB->quote($this->id,
'integer'));
484 $set =
$ilDB->query(
"SELECT booking_object_id,nr_items" .
485 " FROM booking_object" .
486 " WHERE " .
$ilDB->in(
"booking_object_id", $a_obj_ids,
"",
"integer"));
488 $map[
$row[
"booking_object_id"]] =
$row[
"nr_items"];
494 public function doClone($a_pool_id, $a_schedule_map =
null)
496 $new_obj =
new self();
497 $new_obj->setPoolId($a_pool_id);
498 $new_obj->setTitle($this->
getTitle());
501 $new_obj->setFile($this->
getFile());
505 if ($a_schedule_map) {
516 $target = $new_obj->initStorage($new_obj->getId());
532 "SELECT pool_id FROM booking_object " .
533 " WHERE booking_object_id = %s ",
537 $rec =
$db->fetchAssoc($set);
538 return (
int) $rec[
"pool_id"];
An exception for terminatinating execution or to throw for unit testing.
setScheduleId($a_schedule_id)
Set booking schedule id.
setFile($a_value)
Set info file.
uploadFile(array $a_upload)
Upload new info file.
setTitle($a_title)
Set object title.
getScheduleId()
Get booking schedule id.
getPostText()
Get post text.
static lookupPoolId($object_id)
Lookup pool id.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
getPostFile()
Get post file.
setPoolId($a_pool_id)
Set booking pool id.
getTitle()
Get object title.
getNrOfItems()
Get number of items.
setPostFile($a_value)
Set post file.
__construct($a_id=null)
Constructor.
deleteFile()
remove existing info file
uploadPostFile(array $a_upload)
Upload new post file.
setDescription($a_value)
Set object description.
getPoolId()
Get booking pool id.
doClone($a_pool_id, $a_schedule_map=null)
setNrOfItems($a_value)
Set number of items.
getFileFullPath()
Get path to info file.
setPostText($a_value)
Set post text.
getDescription()
Get object description.
deleteFiles()
remove existing files
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
save()
Create new entry in db.
getPostFileFullPath()
Get path to post file.
getDBFields()
Parse properties for sql statements.
deletePostFile()
remove existing post file
static initStorage($a_id, $a_subdir=null)
Init file system storage.
update()
Update entry in db.
read()
Get dataset from db.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
foreach($_POST as $key=> $value) $res