33 $this->
id = (int)$a_id;
52 $this->title = $a_title;
70 $this->description = $a_value;
88 $this->pool_id = (int)$a_pool_id;
106 $this->schedule_id = (int)$a_schedule_id;
124 $this->nr_of_items = (int)$a_value;
142 $this->info_file = $a_value;
159 if($this->
id && $this->info_file)
162 return $path.$this->info_file;
182 $original = $a_upload[
"name"];
185 chmod(
$path.$original, 0770);
215 $this->post_text = $a_value;
233 $this->post_file = $a_value;
250 if($this->
id && $this->post_file)
253 return $path.$this->post_file;
273 $original = $a_upload[
"name"];
277 chmod(
$path.$original, 0770);
308 include_once
"Modules/BookingManager/classes/class.ilFSStorageBooking.php";
326 include_once
"Modules/BookingManager/classes/class.ilFSStorageBooking.php";
330 $path = $storage->getAbsolutePath().
"/";
334 $path .= $a_subdir.
"/";
354 $set = $ilDB->query(
'SELECT *'.
355 ' FROM booking_object'.
356 ' WHERE booking_object_id = '.$ilDB->quote($this->id,
'integer'));
357 $row = $ilDB->fetchAssoc($set);
401 $this->
id = $ilDB->nextId(
'booking_object');
404 $fields[
'booking_object_id'] =
array(
'integer', $this->
id);
407 return $ilDB->insert(
'booking_object', $fields);
425 return $ilDB->update(
'booking_object', $fields,
426 array(
'booking_object_id'=>
array(
'integer', $this->
id)));
435 static function getList($a_pool_id, $a_title = null)
440 ' FROM booking_object'.
441 ' WHERE pool_id = '.$ilDB->quote($a_pool_id,
'integer');
445 $sql .=
' AND ('.$ilDB->like(
'title',
'text',
'%'.$a_title.
'%').
446 ' OR '.$ilDB->like(
'description',
'text',
'%'.$a_title.
'%').
')';
449 $sql .=
' ORDER BY title';
451 $set = $ilDB->query($sql);
453 while(
$row = $ilDB->fetchAssoc($set))
472 return $ilDB->manipulate(
'DELETE FROM booking_object'.
473 ' WHERE booking_object_id = '.$ilDB->quote($this->id,
'integer'));
488 $set = $ilDB->query(
"SELECT booking_object_id,nr_items".
489 " FROM booking_object".
490 " WHERE ".$ilDB->in(
"booking_object_id", $a_obj_ids,
"",
"integer"));
491 while(
$row = $ilDB->fetchAssoc($set))
493 $map[
$row[
"booking_object_id"]] = $row[
"nr_items"];
499 public function doClone($a_pool_id, $a_schedule_map = null)
501 $new_obj =
new self();
502 $new_obj->setPoolId($a_pool_id);
503 $new_obj->setTitle($this->
getTitle());
506 $new_obj->setFile($this->
getFile());
523 $target = $new_obj->initStorage($new_obj->getId());
537 $db = $DIC->database();
538 $set = $db->queryF(
"SELECT pool_id FROM booking_object ".
539 " WHERE booking_object_id = %s ",
543 $rec = $db->fetchAssoc($set);
544 return (
int) $rec[
"pool_id"];
getPostFileFullPath()
Get path to post file.
deleteFile()
remove existing info file
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
setPostText($a_value)
Set post text.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getFileFullPath()
Get path to info file.
setScheduleId($a_schedule_id)
Set booking schedule id.
deletePostFile()
remove existing post file
doClone($a_pool_id, $a_schedule_map=null)
getPostFile()
Get post file.
uploadPostFile(array $a_upload)
Upload new post file.
setFile($a_value)
Set info file.
setDescription($a_value)
Set object description.
setTitle($a_title)
Set object title.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
getTitle()
Get object title.
update()
Update entry in db.
getScheduleId()
Get booking schedule id.
uploadFile(array $a_upload)
Upload new info file.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
getDBFields()
Parse properties for sql statements.
__construct($a_id=NULL)
Constructor.
getNrOfItems()
Get number of items.
setNrOfItems($a_value)
Set number of items.
getPoolId()
Get booking pool id.
Create styles array
The data for the language used.
static lookupPoolId($object_id)
Lookup pool id.
getPostText()
Get post text.
read()
Get dataset from db.
setPostFile($a_value)
Set post file.
save()
Create new entry in db.
setPoolId($a_pool_id)
Set booking pool id.
deleteFiles()
remove existing files
getDescription()
Get object description.