ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
143 protected function beforeCreate()
144 {
145 return true;
146 }
147
148 final public function update()
149 {
150 if ($this->beforeUpdate()) {
151 if (!parent::update()) {
152 return false;
153 }
154 $this->doUpdate();
155
156 return true;
157 }
158
159 return false;
160 }
161
162 protected function doUpdate()
163 {
164 }
165
166 protected function beforeUpdate()
167 {
168 return true;
169 }
170
171 final public function MDUpdateListener($a_element)
172 {
173 if ($this->beforeMDUpdateListener($a_element)) {
174 if (parent::MDUpdateListener($a_element)) {
175 $this->doMDUpdateListener($a_element);
176 return true;
177 }
178 }
179 return false;
180 }
181
182 protected function doMDUpdateListener($a_element)
183 {
184 }
185
186 protected function beforeMDUpdateListener($a_element)
187 {
188 return true;
189 }
190
191 final public function createMetaData()
192 {
193 if ($this->beforeCreateMetaData()) {
194 if (parent::createMetaData()) {
195 $this->doCreateMetaData();
196 return true;
197 }
198 }
199 return false;
200 }
201
202 protected function doCreateMetaData()
203 {
204 }
205
206 protected function beforeCreateMetaData()
207 {
208 return true;
209 }
210
211 final public function updateMetaData()
212 {
213 if ($this->beforeUpdateMetaData()) {
214 if (parent::updateMetaData()) {
215 $this->doUpdateMetaData();
216 return true;
217 }
218 }
219 return false;
220 }
221
222 protected function doUpdateMetaData()
223 {
224 }
225
226 protected function beforeUpdateMetaData()
227 {
228 return true;
229 }
230
231 final public function deleteMetaData()
232 {
233 return parent::deleteMetaData();
234 }
235 final public function updateOwner()
236 {
237 return parent::updateOwner();
238 }
239 final public static function _getIdForImportId($a_import_id)
240 {
241 return parent::_getIdForImportId($a_import_id);
242 }
243 final public static function _getAllReferences($a_id)
244 {
245 return parent::_getAllReferences($a_id);
246 }
247 final public static function _lookupTitle($a_id)
248 {
249 return parent::_lookupTitle($a_id);
250 }
251 final public static function _lookupOwner($a_id)
252 {
253 return parent::_lookupOwner($a_id);
254 }
255 final public static function _getIdsForTitle($title, $type = '', $partialmatch = false)
256 {
257 return parent::_getIdsForTitle($title, $type, $partialmatch);
258 }
259 final public static function _lookupDescription($a_id)
260 {
261 return parent::_lookupDescription($a_id);
262 }
263 final public static function _lookupLastUpdate($a_id, $a_as_string = false)
264 {
265 return parent::_lookupLastUpdate($a_id, $a_as_string);
266 }
267 final public static function _getLastUpdateOfObjects($a_objs)
268 {
269 return parent::_getLastUpdateOfObjects($a_objs);
270 }
271 final public static function _lookupObjId($a_id)
272 {
273 return parent::_lookupObjId($a_id);
274 }
275 final public static function _setDeletedDate($a_ref_id, $a_deleted_by)
276 {
277 return parent::_setDeletedDate($a_ref_id, $a_deleted_by);
278 }
279 final public static function _resetDeletedDate($a_ref_id)
280 {
281 return parent::_resetDeletedDate($a_ref_id);
282 }
283 final public static function _lookupDeletedDate($a_ref_id)
284 {
285 return parent::_lookupDeletedDate($a_ref_id);
286 }
287 final public static function _writeTitle($a_obj_id, $a_title)
288 {
289 return parent::_writeTitle($a_obj_id, $a_title);
290 }
291 final public static function _writeDescription($a_obj_id, $a_desc)
292 {
293 return parent::_writeDescription($a_obj_id, $a_desc);
294 }
295 final public static function _writeImportId($a_obj_id, $a_import_id)
296 {
297 return parent::_writeImportId($a_obj_id, $a_import_id);
298 }
299 final public static function _lookupType($a_id, $a_reference = false)
300 {
301 return parent::_lookupType($a_id, $a_reference);
302 }
303 final public static function _isInTrash($a_ref_id)
304 {
305 return parent::_isInTrash($a_ref_id);
306 }
307 final public static function _hasUntrashedReference($a_obj_id)
308 {
309 return parent::_hasUntrashedReference($a_obj_id);
310 }
311 final public static function _lookupObjectId($a_ref_id)
312 {
313 return parent::_lookupObjectId($a_ref_id);
314 }
315 final public static function _getObjectsDataForType($a_type, $a_omit_trash = false)
316 {
317 return parent::_getObjectsDataForType($a_type, $a_omit_trash);
318 }
319 final public function putInTree($a_parent_ref)
320 {
321 return parent::putInTree($a_parent_ref);
322 }
323 final public function setPermissions($a_parent_ref)
324 {
325 return parent::setPermissions($a_parent_ref);
326 }
327 final public function createReference()
328 {
329 return parent::createReference();
330 }
331 final public function countReferences()
332 {
333 return parent::countReferences();
334 }
335
336 final public function delete()
337 {
338 if ($this->beforeDelete()) {
339 if (parent::delete()) {
340 $this->doDelete();
341 $this->id = null;
342 return true;
343 }
344 }
345 return false;
346 }
347
348 protected function doDelete()
349 {
350 }
351
352 protected function beforeDelete()
353 {
354 return true;
355 }
356
357 public function initDefaultRoles()
358 {
359 return array();
360 }
361
362 final public static function _exists($a_id, $a_reference = false, $a_type = null)
363 {
364 return parent::_exists($a_id, $a_reference, $a_type);
365 }
366 final public function setRegisterMode($a_bool)
367 {
368 return parent::setRegisterMode($a_bool);
369 }
370 final public function isUserRegistered($a_user_id = 0)
371 {
372 return parent::isUserRegistered($a_user_id);
373 }
374 final public function requireRegistration()
375 {
376 return parent::requireRegistration();
377 }
378 //final function getXMLZip() { return parent::getXMLZip(); }
379 //final function getHTMLDirectory() { return parent::getHTMLDirectory(); }
380 final public static function _getObjectsByType($a_obj_type = "", $a_owner = "")
381 {
382 return parent::_getObjectsByType($a_obj_type, $a_owner);
383 }
384
385 final public static function _prepareCloneSelection($a_ref_ids, $new_type, $a_show_path = true)
386 {
387 return parent::_prepareCloneSelection($a_ref_ids, $new_type, $a_show_path);
388 }
389 final public function appendCopyInfo($a_target_id, $a_copy_id)
390 {
391 return parent::appendCopyInfo($a_target_id, $a_copy_id);
392 }
393 final public function cloneMetaData($target_obj)
394 {
395 return parent::cloneMetaData($target_obj);
396 }
397
398 final public function cloneObject($a_target_id, $a_copy_id = null, $a_omit_tree = false)
399 {
400 if ($this->beforeCloneObject()) {
401 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
402 if ($new_obj) {
403 $this->doCloneObject($new_obj, $a_target_id, $a_copy_id);
404 return $new_obj;
405 }
406 }
407 }
408
409 protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
410 {
411 }
412
413 protected function beforeCloneObject()
414 {
415 return true;
416 }
417
418 public function cloneDependencies($a_target_id, $a_copy_id)
419 {
420 return parent::cloneDependencies($a_target_id, $a_copy_id);
421 }
422
423 final public static function _getIcon($a_obj_id = "", $a_size = "big", $a_type = "", $a_offline = false)
424 {
425 return parent::_getIcon($a_obj_id, $a_size, $a_type, $a_offline);
426 }
427}
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
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)
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
$a_type
Definition: workflow.php:92