ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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 ()
 
 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_ref_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
 
 $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
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

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 $DIC, and setScheduleType().

31  {
32  global $DIC;
33 
34  $this->db = $DIC->database();
35  $this->type = "book";
36  $this->setScheduleType(self::TYPE_FIX_SCHEDULE);
37  parent::__construct($a_id, $a_call_by_reference);
38  }
global $DIC
Definition: saml.php:7
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 255 of file class.ilObjBookingPool.php.

References $DIC, $ilDB, and $row.

Referenced by ilObjBookingPoolListGUI\getProperties().

256  {
257  global $DIC;
258 
259  $ilDB = $DIC->database();
260 
261  $set = $ilDB->query("SELECT pool_offline" .
262  " FROM booking_settings" .
263  " WHERE booking_pool_id = " . $ilDB->quote($a_obj_id, "integer"));
264  $row = $ilDB->fetchAssoc($set);
265  return !(bool) $row["pool_offline"];
266  }
global $DIC
Definition: saml.php:7
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  $new_obj->setOffline($this->isOffline());
167  }
168 
169  $new_obj->setScheduleType($this->getScheduleType());
170  $new_obj->setPublicLog($this->hasPublicLog());
171  $new_obj->setOverallLimit($this->getOverallLimit());
172 
173  $smap = null;
174  if ($this->getScheduleType() == self::TYPE_FIX_SCHEDULE) {
175  // schedules
176  include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
177  foreach (ilBookingSchedule::getList($this->getId()) as $item) {
178  $schedule = new ilBookingSchedule($item["booking_schedule_id"]);
179  $smap[$item["booking_schedule_id"]] = $schedule->doClone($new_obj->getId());
180  }
181  }
182 
183  // objects
184  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
185  foreach (ilBookingObject::getList($this->getId()) as $item) {
186  $bobj = new ilBookingObject($item["booking_object_id"]);
187  $bobj->doClone($new_obj->getId(), $smap);
188  }
189 
190  $new_obj->update();
191 
192  return $new_obj;
193  }
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 60 of file class.ilObjBookingPool.php.

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

61  {
62  $ilDB = $this->db;
63 
64  $new_id = parent::create();
65 
66  $fields = $this->getDBFields();
67  $fields["booking_pool_id"] = array("integer", $new_id);
68 
69  $ilDB->insert("booking_settings", $fields);
70 
71  return $new_id;
72  }
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 121 of file class.ilObjBookingPool.php.

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

122  {
123  $ilDB = $this->db;
124 
125  $id = $this->getId();
126 
127  // always call parent delete function first!!
128  if (!parent::delete()) {
129  return false;
130  }
131 
132  // put here your module specific stuff
133 
134  $ilDB->manipulate('DELETE FROM booking_settings' .
135  ' WHERE booking_pool_id = ' . $ilDB->quote($id, 'integer'));
136 
137  $ilDB->manipulate('DELETE FROM booking_schedule' .
138  ' WHERE pool_id = ' . $ilDB->quote($id, 'integer'));
139 
140  $objects = array();
141  $set = $ilDB->query('SELECT booking_object_id FROM booking_object' .
142  ' WHERE pool_id = ' . $ilDB->quote($id, 'integer'));
143  while ($row = $ilDB->fetchAssoc($set)) {
144  $objects[] = $row['booking_object_id'];
145  }
146 
147  if (sizeof($objects)) {
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_ref_id)
static

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

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

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

320  {
321  $fields = array();
322 
323  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
324  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("book", $a_ref_id, "bobj");
325 
326  foreach ($recs as $record_obj) {
327  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
328  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def) {
329  $fields[$def->getFieldId()] = array(
330  "id" => $def->getFieldId(),
331  "title" => $def->getTitle(),
332  "type" => $def->getType()
333  );
334  }
335  }
336 
337  return $fields;
338  }
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
Create styles array
The data for the language used.
$def
Definition: croninfo.php:21
+ 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 43 of file class.ilObjBookingPool.php.

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

Referenced by create(), and update().

44  {
45  $fields = array(
46  "schedule_type" => array("integer", $this->getScheduleType()),
47  "pool_offline" => array("integer", $this->isOffline()),
48  "public_log" => array("integer", $this->hasPublicLog()),
49  "ovlimit" => array("integer", $this->getOverallLimit()),
50  "rsv_filter_period" => array("integer", $this->getReservationFilterPeriod())
51  );
52 
53  return $fields;
54  }
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 286 of file class.ilObjBookingPool.php.

References $overall_limit.

Referenced by cloneObject(), and getDBFields().

287  {
288  return $this->overall_limit;
289  }
+ Here is the caller graph for this function:

◆ getReservationFilterPeriod()

ilObjBookingPool::getReservationFilterPeriod ( )

Get reservation filter period default.

Returns
int

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

References $reservation_period.

Referenced by getDBFields().

310  {
312  }
+ Here is the caller graph for this function:

◆ getScheduleType()

ilObjBookingPool::getScheduleType ( )

Get schedule type.

Returns
int

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

References $schedule_type.

Referenced by cloneObject(), and getDBFields().

245  {
246  return $this->schedule_type;
247  }
+ Here is the caller graph for this function:

◆ hasPublicLog()

ilObjBookingPool::hasPublicLog ( )

Get public log property.

Returns
bool

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

References $public_log.

Referenced by cloneObject(), and getDBFields().

227  {
228  return (bool) $this->public_log;
229  }
+ Here is the caller graph for this function:

◆ isOffline()

ilObjBookingPool::isOffline ( )

Get offline property.

Returns
bool

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

References $offline.

Referenced by cloneObject(), and getDBFields().

209  {
210  return (bool) $this->offline;
211  }
+ Here is the caller graph for this function:

◆ read()

ilObjBookingPool::read ( )

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

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

99  {
100  $ilDB = $this->db;
101 
102  parent::read();
103 
104  // put here object specific stuff
105  if ($this->getId()) {
106  $set = $ilDB->query('SELECT * FROM booking_settings' .
107  ' WHERE booking_pool_id = ' . $ilDB->quote($this->getId(), 'integer'));
108  $row = $ilDB->fetchAssoc($set);
109  $this->setOffline($row['pool_offline']);
110  $this->setPublicLog($row['public_log']);
111  $this->setScheduleType($row['schedule_type']);
112  $this->setOverallLimit($row['ovlimit']);
113  $this->setReservationFilterPeriod($row['rsv_filter_period']);
114  }
115  }
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 199 of file class.ilObjBookingPool.php.

Referenced by read().

200  {
201  $this->offline = (bool) $a_value;
202  }
+ 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 273 of file class.ilObjBookingPool.php.

Referenced by read().

274  {
275  if ($a_value !== null) {
276  $a_value = (int) $a_value;
277  }
278  $this->overall_limit = $a_value;
279  }
+ 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 217 of file class.ilObjBookingPool.php.

Referenced by read().

218  {
219  $this->public_log = (bool) $a_value;
220  }
+ 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 296 of file class.ilObjBookingPool.php.

Referenced by read().

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

◆ setScheduleType()

ilObjBookingPool::setScheduleType (   $a_value)

Set schedule type.

Parameters
int$a_value

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

Referenced by __construct(), and read().

236  {
237  $this->schedule_type = (int) $a_value;
238  }
+ Here is the caller graph for this function:

◆ update()

ilObjBookingPool::update ( )

update object data

Returns
boolean

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

References ilObject\$db, $ilDB, array, getDBFields(), ilObject\getId(), and League\Flysystem\Adapter\Polyfill\update().

79  {
80  $ilDB = $this->db;
81 
82  if (!parent::update()) {
83  return false;
84  }
85 
86  // put here object specific stuff
87  if ($this->getId()) {
88  $ilDB->update(
89  "booking_settings",
90  $this->getDBFields(),
91  array("booking_pool_id" => array("integer", $this->getId()))
92  );
93  }
94 
95  return true;
96  }
getDBFields()
Parse properties for sql statements.
getId()
get object id public
Create styles array
The data for the language used.
update($pash, $contents, Config $config)
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: