ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObject2.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObject.php");
5
14abstract class ilObject2 extends ilObject
15{
22 public function __construct($a_id = 0, $a_reference = true)
23 {
24 $this->initType();
25 parent::__construct($a_id, $a_reference);
26 }
27
28 abstract protected function initType();
29
30 final public function withReferences()
31 {
32 return parent::withReferences();
33 }
34
38 final public function read()
39 {
40 parent::read();
41 $this->doRead();
42 }
43 protected function doRead()
44 {
45 }
46
47 final public function setRefId($a_id)
48 {
49 return parent::setRefId($a_id);
50 }
51 final public function getRefId()
52 {
53 return parent::getRefId();
54 }
55 final public function getType()
56 {
57 return parent::getType();
58 }
59 final public function setType($a_type)
60 {
61 return parent::setType($a_type);
62 }
63 final public function getPresentationTitle()
64 {
65 return parent::getPresentationTitle();
66 }
67 final public function getTitle()
68 {
69 return parent::getTitle();
70 }
71 final public function getUntranslatedTitle()
72 {
73 return parent::getUntranslatedTitle();
74 }
75 final public function setTitle($a_title)
76 {
77 return parent::setTitle($a_title);
78 }
79 final public function getDescription()
80 {
81 return parent::getDescription();
82 }
83 final public function setDescription($a_desc)
84 {
85 return parent::setDescription($a_desc);
86 }
87 final public function getLongDescription()
88 {
89 return parent::getLongDescription();
90 }
91 final public function getImportId()
92 {
93 return parent::getImportId();
94 }
95 final public function setImportId($a_import_id)
96 {
97 return parent::setImportId($a_import_id);
98 }
99 final public static function _lookupObjIdByImportId($a_import_id)
100 {
101 return parent::_lookupObjIdByImportId($a_import_id);
102 }
103 final public function getOwner()
104 {
105 return parent::getOwner();
106 }
107 final public function getOwnerName()
108 {
109 return parent::getOwnerName();
110 }
111 final public static function _lookupOwnerName($a_owner_id)
112 {
113 return parent::_lookupOwnerName($a_owner_id);
114 }
115 final public function setOwner($a_owner)
116 {
117 return parent::setOwner($a_owner);
118 }
119 final public function getCreateDate()
120 {
121 return parent::getCreateDate();
122 }
123 final public function getLastUpdateDate()
124 {
125 return parent::getLastUpdateDate();
126 }
127
128 final public function create($a_clone_mode = false)
129 {
130 if ($this->beforeCreate()) {
131 $id = parent::create();
132 if ($id) {
133 $this->doCreate($a_clone_mode);
134 return $id;
135 }
136 }
137 }
138
139 protected function doCreate()
140 {
141 }
142
148 protected function beforeCreate()
149 {
150 return true;
151 }
152
153 final public function update()
154 {
155 if ($this->beforeUpdate()) {
156 if (!parent::update()) {
157 return false;
158 }
159 $this->doUpdate();
160
161 return true;
162 }
163
164 return false;
165 }
166
167 protected function doUpdate()
168 {
169 }
170
171 protected function beforeUpdate()
172 {
173 return true;
174 }
175
176 final public function MDUpdateListener($a_element)
177 {
178 if ($this->beforeMDUpdateListener($a_element)) {
179 if (parent::MDUpdateListener($a_element)) {
180 $this->doMDUpdateListener($a_element);
181 return true;
182 }
183 }
184 return false;
185 }
186
187 protected function doMDUpdateListener($a_element)
188 {
189 }
190
191 protected function beforeMDUpdateListener($a_element)
192 {
193 return true;
194 }
195
196 final public function createMetaData()
197 {
198 if ($this->beforeCreateMetaData()) {
199 if (parent::createMetaData()) {
200 $this->doCreateMetaData();
201 return true;
202 }
203 }
204 return false;
205 }
206
207 protected function doCreateMetaData()
208 {
209 }
210
211 protected function beforeCreateMetaData()
212 {
213 return true;
214 }
215
216 final public function updateMetaData()
217 {
218 if ($this->beforeUpdateMetaData()) {
219 if (parent::updateMetaData()) {
220 $this->doUpdateMetaData();
221 return true;
222 }
223 }
224 return false;
225 }
226
227 protected function doUpdateMetaData()
228 {
229 }
230
231 protected function beforeUpdateMetaData()
232 {
233 return true;
234 }
235
236 final public function deleteMetaData()
237 {
238 return parent::deleteMetaData();
239 }
240 final public function updateOwner()
241 {
242 return parent::updateOwner();
243 }
244 final public static function _getIdForImportId($a_import_id)
245 {
246 return parent::_getIdForImportId($a_import_id);
247 }
248 final public static function _getAllReferences($a_id)
249 {
250 return parent::_getAllReferences($a_id);
251 }
252 final public static function _lookupTitle($a_id)
253 {
254 return parent::_lookupTitle($a_id);
255 }
256 final public static function _lookupOwner($a_id)
257 {
258 return parent::_lookupOwner($a_id);
259 }
260 final public static function _getIdsForTitle($title, $type = '', $partialmatch = false)
261 {
262 return parent::_getIdsForTitle($title, $type, $partialmatch);
263 }
264 final public static function _lookupDescription($a_id)
265 {
266 return parent::_lookupDescription($a_id);
267 }
268 final public static function _lookupLastUpdate($a_id, $a_as_string = false)
269 {
270 return parent::_lookupLastUpdate($a_id, $a_as_string);
271 }
272 final public static function _getLastUpdateOfObjects($a_objs)
273 {
274 return parent::_getLastUpdateOfObjects($a_objs);
275 }
276 final public static function _lookupObjId($a_id)
277 {
278 return parent::_lookupObjId($a_id);
279 }
280 final public static function _setDeletedDate($a_ref_id, $a_deleted_by)
281 {
282 return parent::_setDeletedDate($a_ref_id, $a_deleted_by);
283 }
284 final public static function _resetDeletedDate($a_ref_id)
285 {
286 return parent::_resetDeletedDate($a_ref_id);
287 }
288 final public static function _lookupDeletedDate($a_ref_id)
289 {
290 return parent::_lookupDeletedDate($a_ref_id);
291 }
292 final public static function _writeTitle($a_obj_id, $a_title)
293 {
294 return parent::_writeTitle($a_obj_id, $a_title);
295 }
296 final public static function _writeDescription($a_obj_id, $a_desc)
297 {
298 return parent::_writeDescription($a_obj_id, $a_desc);
299 }
300 final public static function _writeImportId($a_obj_id, $a_import_id)
301 {
302 return parent::_writeImportId($a_obj_id, $a_import_id);
303 }
304 final public static function _lookupType($a_id, $a_reference = false)
305 {
306 return parent::_lookupType($a_id, $a_reference);
307 }
308 final public static function _isInTrash($a_ref_id)
309 {
310 return parent::_isInTrash($a_ref_id);
311 }
312 final public static function _hasUntrashedReference($a_obj_id)
313 {
314 return parent::_hasUntrashedReference($a_obj_id);
315 }
316 final public static function _lookupObjectId($a_ref_id)
317 {
318 return parent::_lookupObjectId($a_ref_id);
319 }
320 final public static function _getObjectsDataForType($a_type, $a_omit_trash = false)
321 {
322 return parent::_getObjectsDataForType($a_type, $a_omit_trash);
323 }
324 final public function putInTree($a_parent_ref)
325 {
326 return parent::putInTree($a_parent_ref);
327 }
328 final public function setPermissions($a_parent_ref)
329 {
330 return parent::setPermissions($a_parent_ref);
331 }
332 final public function createReference()
333 {
334 return parent::createReference();
335 }
336 final public function countReferences()
337 {
338 return parent::countReferences();
339 }
340
341 final public function delete()
342 {
343 if ($this->beforeDelete()) {
344 if (parent::delete()) {
345 $this->doDelete();
346 $this->id = null;
347 return true;
348 }
349 }
350 return false;
351 }
352
353 protected function doDelete()
354 {
355 }
356
357 protected function beforeDelete()
358 {
359 return true;
360 }
361
362 public function initDefaultRoles()
363 {
364 return array();
365 }
366
367 final public static function _exists($a_id, $a_reference = false, $a_type = null)
368 {
369 return parent::_exists($a_id, $a_reference, $a_type);
370 }
371 final public function setRegisterMode($a_bool)
372 {
373 return parent::setRegisterMode($a_bool);
374 }
375 final public function isUserRegistered($a_user_id = 0)
376 {
377 return parent::isUserRegistered($a_user_id);
378 }
379 final public function requireRegistration()
380 {
381 return parent::requireRegistration();
382 }
383 //final function getXMLZip() { return parent::getXMLZip(); }
384 //final function getHTMLDirectory() { return parent::getHTMLDirectory(); }
385 final public static function _getObjectsByType($a_obj_type = "", $a_owner = "")
386 {
387 return parent::_getObjectsByType($a_obj_type, $a_owner);
388 }
389
390 final public static function _prepareCloneSelection($a_ref_ids, $new_type, $a_show_path = true)
391 {
392 return parent::_prepareCloneSelection($a_ref_ids, $new_type, $a_show_path);
393 }
394 final public function appendCopyInfo($a_target_id, $a_copy_id)
395 {
396 return parent::appendCopyInfo($a_target_id, $a_copy_id);
397 }
398 final public function cloneMetaData($target_obj)
399 {
400 return parent::cloneMetaData($target_obj);
401 }
402
403 final public function cloneObject($a_target_id, $a_copy_id = null, $a_omit_tree = false)
404 {
405 if ($this->beforeCloneObject()) {
406 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
407 if ($new_obj) {
408 $this->doCloneObject($new_obj, $a_target_id, $a_copy_id);
409 return $new_obj;
410 }
411 }
412 }
413
414 protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
415 {
416 }
417
418 protected function beforeCloneObject()
419 {
420 return true;
421 }
422
423 public function cloneDependencies($a_target_id, $a_copy_id)
424 {
425 return parent::cloneDependencies($a_target_id, $a_copy_id);
426 }
427
428 final public static function _getIcon($a_obj_id = "", $a_size = "big", $a_type = "", $a_offline = false)
429 {
430 return parent::_getIcon($a_obj_id, $a_size, $a_type, $a_offline);
431 }
432}
An exception for terminatinating execution or to throw for unit testing.
Class ilObject2 This is an intermediate progress of ilObject class.
setRegisterMode($a_bool)
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
setType($a_type)
set object type @access public
beforeCreate()
If overwritten this method should return true, there is currently no "abort" handling for cases where...
getRefId()
get reference id @access public
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
setTitle($a_title)
set object title
MDUpdateListener($a_element)
Meta data update listener.
create($a_clone_mode=false)
createMetaData()
create meta data entry
countReferences()
count references of object
getOwner()
get object owner
cloneMetaData($target_obj)
Copy meta data.
isUserRegistered($a_user_id=0)
static _setDeletedDate($a_ref_id, $a_deleted_by)
static _getIdForImportId($a_import_id)
get current object id for import id (static)
getLongDescription()
get object long description (stored in object_description)
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
putInTree($a_parent_ref)
maybe this method should be in tree object!?
deleteMetaData()
delete meta data entry
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
static _lookupLastUpdate($a_id, $a_as_string=false)
lookup last update
static _lookupDescription($a_id)
lookup object description
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies.
static _getIdsForTitle($title, $type='', $partialmatch=false)
setRefId($a_id)
set reference id @access public
cloneObject($a_target_id, $a_copy_id=null, $a_omit_tree=false)
getImportId()
get import id
getUntranslatedTitle()
get untranslated object title @access public
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
updateOwner()
update owner of object in db
appendCopyInfo($a_target_id, $a_copy_id)
Prepend Copy info if object with same name exists in that container.
static _lookupObjIdByImportId($a_import_id)
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static _prepareCloneSelection($a_ref_ids, $new_type, $a_show_path=true)
Prepare copy wizard object selection.
static _lookupOwner($a_id)
lookup object owner
doMDUpdateListener($a_element)
static _writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
updateMetaData()
update meta data entry
setPermissions($a_parent_ref)
set permissions of object
static _resetDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static _getAllReferences($a_id)
get all reference ids of object
static _getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
read()
Read data from db.
static _lookupTitle($a_id)
lookup object title
getType()
get object type @access public
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
getDescription()
get object description
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
beforeMDUpdateListener($a_element)
static _lookupObjId($a_id)
setOwner($a_owner)
set object owner
update()
update object in db
setDescription($a_desc)
set object description
static _lookupType($a_id, $a_reference=false)
lookup object type
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
createReference()
creates reference for object
static _isInTrash($a_ref_id)
checks wether object is in trash
__construct($a_id=0, $a_reference=true)
Constructor @access public.
setImportId($a_import_id)
set import id
getTitle()
get object title @access public
getCreateDate()
get create date @access public
getLastUpdateDate()
get last update date @access public
doCloneObject($new_obj, $a_target_id, $a_copy_id=null)
static _lookupObjectId($a_ref_id)
lookup object id
Class ilObject Basic functions for all objects.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc