ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjBookingPool Class Reference

Class ilObjBookingPool. More...

+ Inheritance diagram for ilObjBookingPool:
+ Collaboration diagram for ilObjBookingPool:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor. More...
 
 create ()
 create object More...
 
 update ()
 update object data More...
 
 read ()
 
 delete ()
 delete object and all related data More...
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 
 setOffline ($a_value=true)
 Toggle offline property. More...
 
 isOffline ()
 Get offline property. More...
 
 setPublicLog ($a_value=true)
 Toggle public log property. More...
 
 hasPublicLog ()
 Get public log property. More...
 
 setScheduleType ($a_value)
 Set schedule type. More...
 
 getScheduleType ()
 Get schedule type. More...
 
 setOverallLimit ($a_value=null)
 Set overall / global booking limit. More...
 
 getOverallLimit ()
 Get overall / global booking limit. More...
 
 setReservationFilterPeriod ($a_value=null)
 Set reservation filter period default. More...
 
 getReservationFilterPeriod ()
 Get reservation filter period default. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupOnline ($a_obj_id)
 Check object status. More...
 
static getAdvancedMDFields ($a_glossary_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const TYPE_FIX_SCHEDULE = 1
 
const TYPE_NO_SCHEDULE = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 getDBFields ()
 Parse properties for sql statements. More...
 

Protected Attributes

 $offline = true
 
 $public_log
 
 $schedule_type
 
 $overall_limit
 
 $reservation_period
 

Detailed Description

Class ilObjBookingPool.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 13 of file class.ilObjBookingPool.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjBookingPool::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor.

Parameters
int$a_idreference_id or object_id
bool$a_call_by_referencetreat the id as reference_id (true) or object_id (false)

Definition at line 30 of file class.ilObjBookingPool.php.

References setScheduleType().

31  {
32  $this->type = "book";
33  $this->setScheduleType(self::TYPE_FIX_SCHEDULE);
34  parent::__construct($a_id,$a_call_by_reference);
35  }
setScheduleType($a_value)
Set schedule type.
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupOnline()

static ilObjBookingPool::_lookupOnline (   $a_obj_id)
static

Check object status.

Parameters
int$a_obj_id
Returns
boolean

Definition at line 259 of file class.ilObjBookingPool.php.

References $ilDB, and $row.

Referenced by ilObjBookingPoolListGUI\getProperties().

260  {
261  global $ilDB;
262 
263  $set = $ilDB->query("SELECT pool_offline".
264  " FROM booking_settings".
265  " WHERE booking_pool_id = ".$ilDB->quote($a_obj_id, "integer"));
266  $row = $ilDB->fetchAssoc($set);
267  return !(bool)$row["pool_offline"];
268  }
global $ilDB
+ Here is the caller graph for this function:

◆ cloneObject()

ilObjBookingPool::cloneObject (   $a_target_id,
  $a_copy_id = 0,
  $a_omit_tree = false 
)

Definition at line 158 of file class.ilObjBookingPool.php.

References ilCopyWizardOptions\_getInstance(), ilObject\getId(), ilBookingSchedule\getList(), ilBookingObject\getList(), getOverallLimit(), getScheduleType(), hasPublicLog(), and isOffline().

159  {
160  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
161 
162  //copy online status if object is not the root copy object
163  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
164 
165  if(!$cp_options->isRootNode($this->getRefId()))
166  {
167  $new_obj->setOffline($this->isOffline());
168  }
169 
170  $new_obj->setScheduleType($this->getScheduleType());
171  $new_obj->setPublicLog($this->hasPublicLog());
172  $new_obj->setOverallLimit($this->getOverallLimit());
173 
174  $smap = null;
175  if($this->getScheduleType() == self::TYPE_FIX_SCHEDULE)
176  {
177  // schedules
178  include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
179  foreach(ilBookingSchedule::getList($this->getId()) as $item)
180  {
181  $schedule = new ilBookingSchedule($item["booking_schedule_id"]);
182  $smap[$item["booking_schedule_id"]] = $schedule->doClone($new_obj->getId());
183  }
184  }
185 
186  // objects
187  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
188  foreach(ilBookingObject::getList($this->getId()) as $item)
189  {
190  $bobj = new ilBookingObject($item["booking_object_id"]);
191  $bobj->doClone($new_obj->getId(), $smap);
192  }
193 
194  $new_obj->update();
195 
196  return $new_obj;
197  }
a bookable ressource
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
getScheduleType()
Get schedule type.
schedule for booking ressource
hasPublicLog()
Get public log property.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id public
isOffline()
Get offline property.
getOverallLimit()
Get overall / global booking limit.
static getList($a_pool_id)
Get list of booking objects for given pool.
+ Here is the call graph for this function:

◆ create()

ilObjBookingPool::create ( )

create object

Returns
integer

Definition at line 57 of file class.ilObjBookingPool.php.

References $ilDB, array, and getDBFields().

58  {
59  global $ilDB;
60 
61  $new_id = parent::create();
62 
63  $fields = $this->getDBFields();
64  $fields["booking_pool_id"] = array("integer", $new_id);
65 
66  $ilDB->insert("booking_settings", $fields);
67 
68  return $new_id;
69  }
getDBFields()
Parse properties for sql statements.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilObjBookingPool::delete ( )

delete object and all related data

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 118 of file class.ilObjBookingPool.php.

References ilObject\$id, $ilDB, $row, array, and ilObject\getId().

119  {
120  global $ilDB;
121 
122  $id = $this->getId();
123 
124  // always call parent delete function first!!
125  if (!parent::delete())
126  {
127  return false;
128  }
129 
130  // put here your module specific stuff
131 
132  $ilDB->manipulate('DELETE FROM booking_settings'.
133  ' WHERE booking_pool_id = '.$ilDB->quote($id, 'integer'));
134 
135  $ilDB->manipulate('DELETE FROM booking_schedule'.
136  ' WHERE pool_id = '.$ilDB->quote($id, 'integer'));
137 
138  $objects = array();
139  $set = $ilDB->query('SELECT booking_object_id FROM booking_object'.
140  ' WHERE pool_id = '.$ilDB->quote($id, 'integer'));
141  while($row = $ilDB->fetchAssoc($set))
142  {
143  $objects[] = $row['booking_object_id'];
144  }
145 
146  if(sizeof($objects))
147  {
148  $ilDB->manipulate('DELETE FROM booking_reservation'.
149  ' WHERE '.$ilDB->in('object_id', $objects, '', 'integer'));
150  }
151 
152  $ilDB->manipulate('DELETE FROM booking_object'.
153  ' WHERE pool_id = '.$ilDB->quote($id, 'integer'));
154 
155  return true;
156  }
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getAdvancedMDFields()

static ilObjBookingPool::getAdvancedMDFields (   $a_glossary_id)
static

Definition at line 323 of file class.ilObjBookingPool.php.

References ilAdvancedMDRecord\_getSelectedRecordsByObject(), array, and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by ilBookingObjectsTableGUI\__construct(), and ilBookingReservationsTableGUI\__construct().

324  {
325  $fields = array();
326 
327  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
328  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("book", $a_glossary_id, "bobj");
329 
330  foreach($recs as $record_obj)
331  {
332  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
333  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def)
334  {
335  $fields[$def->getFieldId()] = array(
336  "id" => $def->getFieldId(),
337  "title" => $def->getTitle(),
338  "type" => $def->getType()
339  );
340  }
341  }
342 
343  return $fields;
344  }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDBFields()

ilObjBookingPool::getDBFields ( )
protected

Parse properties for sql statements.

Definition at line 40 of file class.ilObjBookingPool.php.

References array, getOverallLimit(), getReservationFilterPeriod(), getScheduleType(), hasPublicLog(), and isOffline().

Referenced by create(), and update().

41  {
42  $fields = array(
43  "schedule_type" => array("integer", $this->getScheduleType()),
44  "pool_offline" => array("integer", $this->isOffline()),
45  "public_log" => array("integer", $this->hasPublicLog()),
46  "ovlimit" => array("integer", $this->getOverallLimit()),
47  "rsv_filter_period" => array("integer", $this->getReservationFilterPeriod())
48  );
49 
50  return $fields;
51  }
getScheduleType()
Get schedule type.
hasPublicLog()
Get public log property.
Create styles array
The data for the language used.
getReservationFilterPeriod()
Get reservation filter period default.
isOffline()
Get offline property.
getOverallLimit()
Get overall / global booking limit.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverallLimit()

ilObjBookingPool::getOverallLimit ( )

Get overall / global booking limit.

Returns
int $a_value

Definition at line 289 of file class.ilObjBookingPool.php.

References $overall_limit.

Referenced by cloneObject(), and getDBFields().

290  {
291  return $this->overall_limit;
292  }
+ Here is the caller graph for this function:

◆ getReservationFilterPeriod()

ilObjBookingPool::getReservationFilterPeriod ( )

Get reservation filter period default.

Returns
int

Definition at line 313 of file class.ilObjBookingPool.php.

References $reservation_period.

Referenced by getDBFields().

314  {
316  }
+ Here is the caller graph for this function:

◆ getScheduleType()

ilObjBookingPool::getScheduleType ( )

Get schedule type.

Returns
int

Definition at line 248 of file class.ilObjBookingPool.php.

References $schedule_type.

Referenced by cloneObject(), and getDBFields().

249  {
250  return $this->schedule_type;
251  }
+ Here is the caller graph for this function:

◆ hasPublicLog()

ilObjBookingPool::hasPublicLog ( )

Get public log property.

Returns
bool

Definition at line 230 of file class.ilObjBookingPool.php.

References $public_log.

Referenced by cloneObject(), and getDBFields().

231  {
232  return (bool)$this->public_log;
233  }
+ Here is the caller graph for this function:

◆ isOffline()

ilObjBookingPool::isOffline ( )

Get offline property.

Returns
bool

Definition at line 212 of file class.ilObjBookingPool.php.

References $offline.

Referenced by cloneObject(), and getDBFields().

213  {
214  return (bool)$this->offline;
215  }
+ Here is the caller graph for this function:

◆ read()

ilObjBookingPool::read ( )

Definition at line 94 of file class.ilObjBookingPool.php.

References $ilDB, $row, ilObject\getId(), setOffline(), setOverallLimit(), setPublicLog(), setReservationFilterPeriod(), and setScheduleType().

95  {
96  global $ilDB;
97 
98  parent::read();
99 
100  // put here object specific stuff
101  if($this->getId())
102  {
103  $set = $ilDB->query('SELECT * FROM booking_settings'.
104  ' WHERE booking_pool_id = '.$ilDB->quote($this->getId(), 'integer'));
105  $row = $ilDB->fetchAssoc($set);
106  $this->setOffline($row['pool_offline']);
107  $this->setPublicLog($row['public_log']);
108  $this->setScheduleType($row['schedule_type']);
109  $this->setOverallLimit($row['ovlimit']);
110  $this->setReservationFilterPeriod($row['rsv_filter_period']);
111  }
112  }
setOffline($a_value=true)
Toggle offline property.
setScheduleType($a_value)
Set schedule type.
setPublicLog($a_value=true)
Toggle public log property.
setReservationFilterPeriod($a_value=null)
Set reservation filter period default.
getId()
get object id public
global $ilDB
setOverallLimit($a_value=null)
Set overall / global booking limit.
+ Here is the call graph for this function:

◆ setOffline()

ilObjBookingPool::setOffline (   $a_value = true)

Toggle offline property.

Parameters
bool$a_value

Definition at line 203 of file class.ilObjBookingPool.php.

Referenced by read().

204  {
205  $this->offline = (bool)$a_value;
206  }
+ Here is the caller graph for this function:

◆ setOverallLimit()

ilObjBookingPool::setOverallLimit (   $a_value = null)

Set overall / global booking limit.

Parameters
int$a_value

Definition at line 275 of file class.ilObjBookingPool.php.

Referenced by read().

276  {
277  if($a_value !== null)
278  {
279  $a_value = (int)$a_value;
280  }
281  $this->overall_limit = $a_value;
282  }
+ Here is the caller graph for this function:

◆ setPublicLog()

ilObjBookingPool::setPublicLog (   $a_value = true)

Toggle public log property.

Parameters
bool$a_value

Definition at line 221 of file class.ilObjBookingPool.php.

Referenced by read().

222  {
223  $this->public_log = (bool)$a_value;
224  }
+ Here is the caller graph for this function:

◆ setReservationFilterPeriod()

ilObjBookingPool::setReservationFilterPeriod (   $a_value = null)

Set reservation filter period default.

Parameters
int$a_value

Definition at line 299 of file class.ilObjBookingPool.php.

Referenced by read().

300  {
301  if($a_value !== null)
302  {
303  $a_value = (int)$a_value;
304  }
305  $this->reservation_period = $a_value;
306  }
+ Here is the caller graph for this function:

◆ setScheduleType()

ilObjBookingPool::setScheduleType (   $a_value)

Set schedule type.

Parameters
int$a_value

Definition at line 239 of file class.ilObjBookingPool.php.

Referenced by __construct(), and read().

240  {
241  $this->schedule_type = (int)$a_value;
242  }
+ Here is the caller graph for this function:

◆ update()

ilObjBookingPool::update ( )

update object data

Returns
boolean

Definition at line 75 of file class.ilObjBookingPool.php.

References $ilDB, array, getDBFields(), and ilObject\getId().

76  {
77  global $ilDB;
78 
79  if (!parent::update())
80  {
81  return false;
82  }
83 
84  // put here object specific stuff
85  if($this->getId())
86  {
87  $ilDB->update("booking_settings", $this->getDBFields(),
88  array("booking_pool_id" => array("integer", $this->getId())));
89  }
90 
91  return true;
92  }
getDBFields()
Parse properties for sql statements.
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $offline

ilObjBookingPool::$offline = true
protected

Definition at line 16 of file class.ilObjBookingPool.php.

Referenced by isOffline().

◆ $overall_limit

ilObjBookingPool::$overall_limit
protected

Definition at line 19 of file class.ilObjBookingPool.php.

Referenced by getOverallLimit().

◆ $public_log

ilObjBookingPool::$public_log
protected

Definition at line 17 of file class.ilObjBookingPool.php.

Referenced by hasPublicLog().

◆ $reservation_period

ilObjBookingPool::$reservation_period
protected

Definition at line 20 of file class.ilObjBookingPool.php.

Referenced by getReservationFilterPeriod().

◆ $schedule_type

ilObjBookingPool::$schedule_type
protected

Definition at line 18 of file class.ilObjBookingPool.php.

Referenced by getScheduleType().

◆ TYPE_FIX_SCHEDULE

const ilObjBookingPool::TYPE_FIX_SCHEDULE = 1

◆ TYPE_NO_SCHEDULE


The documentation for this class was generated from the following file: