ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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("./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::ilObject($a_id, $a_reference);
26  }
27 
28  abstract function initType();
29 
30  final function withReferences() { return parent::withReferences(); }
31 
35  final function read($a_force_db = false)
36  {
37  parent::read($a_force_db);
38  $this->doRead();
39  }
40  abstract function doRead();
41 
42  final function getId() { return parent::getId(); }
43  final function setId($a_id) { return parent::setId($a_id); }
44  final function setRefId($a_id) { return parent::setRefId($a_id); }
45  final function getRefId() { return parent::getRefId(); }
46  final function getType() { return parent::getType(); }
47  final function setType($a_type) { return parent::setType($a_type); }
48  final function getPresentationTitle() { return parent::getPresentationTitle(); }
49  final function getTitle() { return parent::getTitle(); }
50  final function getUntranslatedTitle() { return parent::getUntranslatedTitle(); }
51  final function setTitle($a_title) { return parent::setTitle($a_title); }
52  final function getDescription() { return parent::getDescription(); }
53  final function setDescription($a_desc) { return parent::setDescription($a_desc); }
54  final function getLongDescription() { return parent::getLongDescription(); }
55  final function getImportId() { return parent::getImportId(); }
56  final function setImportId($a_import_id) { return parent::setImportId($a_import_id); }
57  final function _lookupObjIdByImportId($a_import_id) { return parent::_lookupObjIdByImportId($a_import_id); }
58  final function getOwner() { return parent::getOwner(); }
59  final function getOwnerName() { return parent::getOwnerName(); }
60  final function _lookupOwnerName($a_owner_id) { return parent::_lookupOwnerName($a_owner_id); }
61  final function setOwner($a_owner) { return parent::setOwner($a_owner); }
62  final function getCreateDate() { return parent::getCreateDate(); }
63  final function getLastUpdateDate() { return parent::getLastUpdateDate(); }
64  final function setObjDataRecord($a_record) { return parent::setObjDataRecord($a_record); }
65 
66  final function create()
67  {
68  $this->beforeCreate();
69  $id = parent::create();
70  $this->doCreate();
71  }
72  abstract function doCreate();
73 
74  protected function beforeCreate()
75  {
76  return true;
77  }
78 
79  final function update()
80  {
81  if($this->beforeUpdate())
82  {
83  if (!parent::update())
84  {
85  return false;
86  }
87  $this->doUpdate();
88 
89  return true;
90  }
91 
92  return false;
93  }
94  abstract function doUpdate();
95 
96  protected function beforeUpdate()
97  {
98  return true;
99  }
100 
101  final function MDUpdateListener($a_element) { return parent::MDUpdateListener($a_element); }
102  final function createMetaData() { return parent::createMetaData(); }
103  final function updateMetaData() { return parent::updateMetaData(); }
104  final function deleteMetaData() { return parent::deleteMetaData(); }
105  final function updateOwner() { return parent::updateOwner(); }
106  final function _getIdForImportId($a_import_id) { return parent::_getIdForImportId($a_import_id); }
107  final function _getAllReferences($a_id) { return parent::_getAllReferences($a_id); }
108  final static function _lookupTitle($a_id) { return parent::_lookupTitle($a_id); }
109  final function _lookupOwner($a_id) { return parent::_lookupOwner($a_id); }
110  final static function _getIdsForTitle($title, $type = '', $partialmatch = false) { return parent::_getIdsForTitle($title, $type, $partialmatch); }
111  final function _lookupDescription($a_id) { return parent::_lookupDescription($a_id); }
112  final function _lookupLastUpdate($a_id, $a_as_string = false) { return parent::_lookupLastUpdate($a_id, $a_as_string); }
113  final function _getLastUpdateOfObjects($a_objs) { return parent::_getLastUpdateOfObjects($a_objs); }
114  final static function _lookupObjId($a_id) { return parent::_lookupObjId($a_id); }
115  final function _setDeletedDate($a_ref_id) { return parent::_setDeletedDate($a_ref_id); }
116  final function _resetDeletedDate($a_ref_id) { return parent::_resetDeletedDate($a_ref_id); }
117  final function _lookupDeletedDate($a_ref_id) { return parent::_lookupDeletedDate($a_ref_id); }
118  final function _writeTitle($a_obj_id, $a_title) { return parent::_writeTitle($a_obj_id, $a_title); }
119  final function _writeDescription($a_obj_id, $a_desc) { return parent::_writeDescription($a_obj_id, $a_desc); }
120  final function _writeImportId($a_obj_id, $a_import_id) { return parent::_writeImportId($a_obj_id, $a_import_id); }
121  final static function _lookupType($a_id,$a_reference = false) { return parent::_lookupType($a_id,$a_reference); }
122  final function _isInTrash($a_ref_id) { return parent::_isInTrash($a_ref_id); }
123  final function _hasUntrashedReference($a_obj_id) { return parent::_hasUntrashedReference($a_obj_id); }
124  final function _lookupObjectId($a_ref_id) { return parent::_lookupObjectId($a_ref_id); }
125  final function _getObjectsDataForType($a_type, $a_omit_trash = false) { return parent::_getObjectsDataForType($a_type, $a_omit_trash); }
126  final function putInTree($a_parent_ref) { return parent::putInTree($a_parent_ref); }
127  final function setPermissions($a_parent_ref) { return parent::setPermissions($a_parent_ref); }
128  final function createReference() { return parent::createReference(); }
129  final function countReferences() { return parent::countReferences(); }
130 
131  final function delete()
132  {
133  if($this->beforeDelete())
134  {
135  if (!parent::delete())
136  {
137  return false;
138  }
139  $this->doDelete();
140 
141  return true;
142  }
143 
144  return false;
145  }
146  abstract function doDelete();
147 
148  protected function beforeDelete()
149  {
150  return true;
151  }
152 
153  function initDefaultRoles() { return array(); }
154 
155  final function createRoleFolder() { return parent::createRoleFolder(); }
156  final function _exists($a_id, $a_reference = false) { return parent::_exists($a_id, $a_reference); }
157  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0) { return parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params); }
158  final function setRegisterMode($a_bool) { return parent::setRegisterMode($a_bool); }
159  final function isUserRegistered($a_user_id = 0) { return parent::isUserRegistered($a_user_id); }
160  final function requireRegistration() { return parent::requireRegistration(); }
161  final function getXMLZip() { return parent::getXMLZip(); }
162  final function getHTMLDirectory() { return parent::getHTMLDirectory(); }
163  final static function _getObjectsByType($a_obj_type = "", $a_owner = "") { return parent::_getObjectsByType($a_obj_type, $a_owner); }
164 
165  final static function _prepareCloneSelection($a_ref_ids,$new_type) { return parent::_prepareCloneSelection($a_ref_ids,$new_type); }
166  final function appendCopyInfo($a_target_id,$a_copy_id) { return parent::appendCopyInfo($a_target_id,$a_copy_id); }
167  final function cloneMetaData($target_obj) { return parent::cloneMetaData($target_obj); }
168 
169  final function cloneObject($a_target_id,$a_copy_id = 0)
170  {
171  $this->beforeClone();
172  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
173  $this->doClone($a_target_id,$a_copy_id,$new_obj);
174  return $new_obj;
175  }
176  abstract function doClone($a_target_id,$a_copy_id,$new_obj);
177 
178  protected function beforeClone()
179  {
180  return true;
181  }
182 
183  function cloneDependencies($a_target_id,$a_copy_id) { return parent::cloneDependencies($a_target_id,$a_copy_id); }
184 
185  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); }
186 
187 }
188 ?>