ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Services/Object/classes/class.ilObject.php");
5 
14 abstract class ilObject2 extends ilObject
15 {
22  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 function withReferences() { return parent::withReferences(); }
31 
35  final public function read()
36  {
37  parent::read();
38  $this->doRead();
39  }
40  protected function doRead()
41  {
42 
43  }
44 
45  function getId() { return parent::getId(); }
46  function setId($a_id) { return parent::setId($a_id); }
47  final function setRefId($a_id) { return parent::setRefId($a_id); }
48  final function getRefId() { return parent::getRefId(); }
49  final function getType() { return parent::getType(); }
50  final function setType($a_type) { return parent::setType($a_type); }
51  final function getPresentationTitle() { return parent::getPresentationTitle(); }
52  final function getTitle() { return parent::getTitle(); }
53  final function getUntranslatedTitle() { return parent::getUntranslatedTitle(); }
54  final function setTitle($a_title) { return parent::setTitle($a_title); }
55  final function getDescription() { return parent::getDescription(); }
56  final function setDescription($a_desc) { return parent::setDescription($a_desc); }
57  final function getLongDescription() { return parent::getLongDescription(); }
58  final function getImportId() { return parent::getImportId(); }
59  final function setImportId($a_import_id) { return parent::setImportId($a_import_id); }
60  final static function _lookupObjIdByImportId($a_import_id) { return parent::_lookupObjIdByImportId($a_import_id); }
61  final function getOwner() { return parent::getOwner(); }
62  final function getOwnerName() { return parent::getOwnerName(); }
63  final static function _lookupOwnerName($a_owner_id) { return parent::_lookupOwnerName($a_owner_id); }
64  final function setOwner($a_owner) { return parent::setOwner($a_owner); }
65  final function getCreateDate() { return parent::getCreateDate(); }
66  final function getLastUpdateDate() { return parent::getLastUpdateDate(); }
67 
68  final function create($a_clone_mode = false)
69  {
70  if($this->beforeCreate())
71  {
72  $id = parent::create();
73  if($id)
74  {
75  $this->doCreate($a_clone_mode);
76  return $id;
77  }
78  }
79  }
80 
81  protected function doCreate()
82  {
83 
84  }
85 
86  protected function beforeCreate()
87  {
88  return true;
89  }
90 
91  final function update()
92  {
93  if($this->beforeUpdate())
94  {
95  if (!parent::update())
96  {
97  return false;
98  }
99  $this->doUpdate();
100 
101  return true;
102  }
103 
104  return false;
105  }
106 
107  protected function doUpdate()
108  {
109 
110  }
111 
112  protected function beforeUpdate()
113  {
114  return true;
115  }
116 
117  final function MDUpdateListener($a_element)
118  {
119  if($this->beforeMDUpdateListener($a_element))
120  {
121  if(parent::MDUpdateListener($a_element))
122  {
123  $this->doMDUpdateListener($a_element);
124  return true;
125  }
126  }
127  return false;
128  }
129 
130  protected function doMDUpdateListener($a_element)
131  {
132 
133  }
134 
135  protected function beforeMDUpdateListener($a_element)
136  {
137  return true;
138  }
139 
140  final function createMetaData()
141  {
142  if($this->beforeCreateMetaData())
143  {
144  if(parent::createMetaData())
145  {
146  $this->doCreateMetaData();
147  return true;
148  }
149  }
150  return false;
151  }
152 
153  protected function doCreateMetaData()
154  {
155 
156  }
157 
158  protected function beforeCreateMetaData()
159  {
160  return true;
161  }
162 
163  final function updateMetaData()
164  {
165  if($this->beforeUpdateMetaData())
166  {
167  if(parent::updateMetaData())
168  {
169  $this->doUpdateMetaData();
170  return true;
171  }
172  }
173  return false;
174  }
175 
176  protected function doUpdateMetaData()
177  {
178 
179  }
180 
181  protected function beforeUpdateMetaData()
182  {
183  return true;
184  }
185 
186  final function deleteMetaData() { return parent::deleteMetaData(); }
187  final function updateOwner() { return parent::updateOwner(); }
188  final static function _getIdForImportId($a_import_id) { return parent::_getIdForImportId($a_import_id); }
189  static final function _getAllReferences($a_id) { return parent::_getAllReferences($a_id); }
190  final static function _lookupTitle($a_id) { return parent::_lookupTitle($a_id); }
191  final static function _lookupOwner($a_id) { return parent::_lookupOwner($a_id); }
192  final static function _getIdsForTitle($title, $type = '', $partialmatch = false) { return parent::_getIdsForTitle($title, $type, $partialmatch); }
193  final static function _lookupDescription($a_id) { return parent::_lookupDescription($a_id); }
194  final static function _lookupLastUpdate($a_id, $a_as_string = false) { return parent::_lookupLastUpdate($a_id, $a_as_string); }
195  final static function _getLastUpdateOfObjects($a_objs) { return parent::_getLastUpdateOfObjects($a_objs); }
196  final static function _lookupObjId($a_id) { return parent::_lookupObjId($a_id); }
197  final static function _setDeletedDate($a_ref_id) { return parent::_setDeletedDate($a_ref_id); }
198  final public static function _resetDeletedDate($a_ref_id) { return parent::_resetDeletedDate($a_ref_id); }
199  final static function _lookupDeletedDate($a_ref_id) { return parent::_lookupDeletedDate($a_ref_id); }
200  final static function _writeTitle($a_obj_id, $a_title) { return parent::_writeTitle($a_obj_id, $a_title); }
201  final static function _writeDescription($a_obj_id, $a_desc) { return parent::_writeDescription($a_obj_id, $a_desc); }
202  final static function _writeImportId($a_obj_id, $a_import_id) { return parent::_writeImportId($a_obj_id, $a_import_id); }
203  final static function _lookupType($a_id,$a_reference = false) { return parent::_lookupType($a_id,$a_reference); }
204  final public static function _isInTrash($a_ref_id) { return parent::_isInTrash($a_ref_id); }
205  final static function _hasUntrashedReference($a_obj_id) { return parent::_hasUntrashedReference($a_obj_id); }
206  final static function _lookupObjectId($a_ref_id) { return parent::_lookupObjectId($a_ref_id); }
207  final static function _getObjectsDataForType($a_type, $a_omit_trash = false) { return parent::_getObjectsDataForType($a_type, $a_omit_trash); }
208  final function putInTree($a_parent_ref) { return parent::putInTree($a_parent_ref); }
209  final function setPermissions($a_parent_ref) { return parent::setPermissions($a_parent_ref); }
210  final function createReference() { return parent::createReference(); }
211  final function countReferences() { return parent::countReferences(); }
212 
213  final function delete()
214  {
215  if($this->beforeDelete())
216  {
217  if(parent::delete())
218  {
219  $this->doDelete();
220  $this->id = null;
221  return true;
222  }
223  }
224  return false;
225  }
226 
227  protected function doDelete()
228  {
229 
230  }
231 
232  protected function beforeDelete()
233  {
234  return true;
235  }
236 
237  function initDefaultRoles() { return array(); }
238 
239  final public static function _exists($a_id, $a_reference = false, $a_type = null) { return parent::_exists($a_id, $a_reference, $a_type); }
240  final function setRegisterMode($a_bool) { return parent::setRegisterMode($a_bool); }
241  final function isUserRegistered($a_user_id = 0) { return parent::isUserRegistered($a_user_id); }
242  final function requireRegistration() { return parent::requireRegistration(); }
243  //final function getXMLZip() { return parent::getXMLZip(); }
244  //final function getHTMLDirectory() { return parent::getHTMLDirectory(); }
245  final static function _getObjectsByType($a_obj_type = "", $a_owner = "") { return parent::_getObjectsByType($a_obj_type, $a_owner); }
246 
247  final static function _prepareCloneSelection($a_ref_ids,$new_type, $a_show_path = true) { return parent::_prepareCloneSelection($a_ref_ids,$new_type, $a_show_path); }
248  final function appendCopyInfo($a_target_id,$a_copy_id) { return parent::appendCopyInfo($a_target_id,$a_copy_id); }
249  final function cloneMetaData($target_obj) { return parent::cloneMetaData($target_obj); }
250 
251  final function cloneObject($a_target_id, $a_copy_id = null, $a_omit_tree = false)
252  {
253  if($this->beforeCloneObject())
254  {
255  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
256  if($new_obj)
257  {
258  $this->doCloneObject($new_obj, $a_target_id, $a_copy_id);
259  return $new_obj;
260  }
261  }
262  }
263 
264  protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
265  {
266 
267  }
268 
269  protected function beforeCloneObject()
270  {
271  return true;
272  }
273 
274  function cloneDependencies($a_target_id,$a_copy_id) { return parent::cloneDependencies($a_target_id,$a_copy_id); }
275 
276  final public static function _getIcon($a_obj_id = "", $a_size = "big", $a_type = "", $a_offline = false) { return parent::_getIcon($a_obj_id, $a_size, $a_type, $a_offline); }
277 
278 }
279 ?>
putInTree($a_parent_ref)
static _lookupObjId($a_id)
static _lookupObjIdByImportId($a_import_id)
static _lookupDeletedDate($a_ref_id)
static _lookupLastUpdate($a_id, $a_as_string=false)
setType($a_type)
appendCopyInfo($a_target_id, $a_copy_id)
setDescription($a_desc)
static _lookupTitle($a_id)
Class ilObject Basic functions for all objects.
static _getObjectsDataForType($a_type, $a_omit_trash=false)
MDUpdateListener($a_element)
static _lookupObjectId($a_ref_id)
static _writeImportId($a_obj_id, $a_import_id)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
static _prepareCloneSelection($a_ref_ids, $new_type, $a_show_path=true)
static _getObjectsByType($a_obj_type="", $a_owner="")
read()
Read data from db.
setPermissions($a_parent_ref)
static _lookupOwner($a_id)
static _writeDescription($a_obj_id, $a_desc)
static _getLastUpdateOfObjects($a_objs)
setOwner($a_owner)
static _lookupOwnerName($a_owner_id)
doMDUpdateListener($a_element)
$a_type
Definition: workflow.php:93
static _getAllReferences($a_id)
doCloneObject($new_obj, $a_target_id, $a_copy_id=null)
__construct($a_id=0, $a_reference=true)
Constructor public.
static _isInTrash($a_ref_id)
static _setDeletedDate($a_ref_id)
setImportId($a_import_id)
static _getIdsForTitle($title, $type='', $partialmatch=false)
static _getIdForImportId($a_import_id)
static _lookupDescription($a_id)
setTitle($a_title)
static _hasUntrashedReference($a_obj_id)
Create styles array
The data for the language used.
static _writeTitle($a_obj_id, $a_title)
static _resetDeletedDate($a_ref_id)
static _lookupType($a_id, $a_reference=false)
static _exists($a_id, $a_reference=false, $a_type=null)
cloneObject($a_target_id, $a_copy_id=null, $a_omit_tree=false)
Class ilObject2 This is an intermediate progress of ilObject class.
create($a_clone_mode=false)
setRegisterMode($a_bool)
cloneDependencies($a_target_id, $a_copy_id)
beforeMDUpdateListener($a_element)
isUserRegistered($a_user_id=0)
setRefId($a_id)
cloneMetaData($target_obj)