ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilContainerReference Class Reference
+ Inheritance diagram for ilContainerReference:
+ Collaboration diagram for ilContainerReference:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 getTargetId ()
 
 setTargetId (int $a_target_id)
 
 setTargetRefId (int $a_id)
 
 getTargetRefId ()
 
 getTitleType ()
 
 setTitleType (int $type)
 
 read ()
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 update ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id, int $new_obj_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupTargetId (int $a_obj_id)
 
static _lookupTargetRefId (int $a_obj_id)
 
static _lookupTitle (int $obj_id)
 
static _lookupTargetTitle (int $a_obj_id)
 
static _lookupSourceId (int $a_target_id)
 
static _lookupSourceIds (int $a_target_id)
 Get ids of all container references that target the object with the given id. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

const TITLE_TYPE_REUSE = 1
 
const TITLE_TYPE_CUSTOM = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Attributes

ilObjUser $user
 
int $target_id = null
 
int $target_ref_id = null
 
int $title_type = self::TITLE_TYPE_REUSE
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilContainerReference.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerReference::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = true 
)

Reimplemented in ilObjCategoryReference, and ilObjStudyProgrammeReference.

Definition at line 34 of file class.ilContainerReference.php.

37 {
38 global $DIC;
39
40 $this->user = $DIC->user();
41 parent::__construct($a_id, $a_call_by_reference);
42 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupSourceId()

static ilContainerReference::_lookupSourceId ( int  $a_target_id)
static

Definition at line 109 of file class.ilContainerReference.php.

109 : ?int
110 {
111 global $DIC;
112
113 $ilDB = $DIC->database();
114
115 $query = "SELECT * FROM container_reference " .
116 "WHERE target_obj_id = " . $ilDB->quote($a_target_id, 'integer') . " ";
117 $res = $ilDB->query($query);
118 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
119 return (int) $row->obj_id;
120 }
121 return null;
122 }
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContainerReferenceAppEventListener\deleteReferences().

+ Here is the caller graph for this function:

◆ _lookupSourceIds()

static ilContainerReference::_lookupSourceIds ( int  $a_target_id)
static

Get ids of all container references that target the object with the given id.

Returns
int[] obj_ids of references

Definition at line 129 of file class.ilContainerReference.php.

129 : array
130 {
131 global $DIC;
132
133 $ilDB = $DIC->database();
134
135 $query = "SELECT * FROM container_reference " .
136 "WHERE target_obj_id = " . $ilDB->quote($a_target_id, 'integer') . " ";
137 $res = $ilDB->query($query);
138 $ret = [];
139 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
140 $ret[] = (int) $row->obj_id;
141 }
142 return $ret;
143 }

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilObjStudyProgramme\getReferencesTo(), ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus(), and ilObjStudyProgrammeReferenceGUI\tryingToCreateCircularReference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupTargetId()

static ilContainerReference::_lookupTargetId ( int  $a_obj_id)
static

Definition at line 44 of file class.ilContainerReference.php.

44 : int
45 {
46 global $DIC;
47
48 $ilDB = $DIC->database();
49
50 $query = "SELECT * FROM container_reference " .
51 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
52 $res = $ilDB->query($query);
53 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
54 return (int) $row->target_obj_id;
55 }
56 return $a_obj_id;
57 }

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjCourseReferenceAccess\_preloadData(), ilPRGAssignmentDBRepository\buildProgressTreeFor(), ilObjStudyProgramme\getCompletedCourses(), ilNoteGUI\getTarget(), ilObjStudyProgrammeReferenceListGUI\hasAssignments(), and ilCourseReferencePathInfo\init().

+ Here is the caller graph for this function:

◆ _lookupTargetRefId()

static ilContainerReference::_lookupTargetRefId ( int  $a_obj_id)
static

Definition at line 59 of file class.ilContainerReference.php.

59 : ?int
60 {
61 global $DIC;
62
63 $ilDB = $DIC->database();
64
65 $query = "SELECT ref_id FROM object_reference obr " .
66 "JOIN container_reference cr ON obr.obj_id = cr.target_obj_id " .
67 "WHERE cr.obj_id = " . $ilDB->quote($a_obj_id, 'integer');
68 $res = $ilDB->query($query);
69 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
70 return (int) $row->ref_id;
71 }
72 return null;
73 }

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjStudyProgrammeReferenceAccess\_checkAccess(), ilObjCourseReferenceAccess\_checkAccess(), ilObjGroupReferenceAccess\_checkAccess(), ilObjStudyProgrammeReferenceAccess\_getCommands(), ilObjCourseReferenceGUI\_goto(), ilObjGroupReferenceGUI\_goto(), ilObjCategoryReferenceGUI\_goto(), ilObjStudyProgrammeReferenceGUI\_goto(), ilObjStudyProgramme\getCompletedCourses(), ilCourseReferenceLP\getMembers(), and ilLPStatusCourseReference\readTargetObjId().

+ Here is the caller graph for this function:

◆ _lookupTargetTitle()

static ilContainerReference::_lookupTargetTitle ( int  $a_obj_id)
static

Definition at line 93 of file class.ilContainerReference.php.

93 : string
94 {
95 global $DIC;
96
97 $ilDB = $DIC->database();
98
99 $query = "SELECT title FROM object_data od " .
100 "JOIN container_reference cr ON target_obj_id = od.obj_id " .
101 "WHERE cr.obj_id = " . $ilDB->quote($a_obj_id, 'integer');
102 $res = $ilDB->query($query);
103 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
104 return (string) $row->title;
105 }
106 return '';
107 }

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by _lookupTitle(), ilCourseObjectivesTableGUI\fillRow(), and ilTrMatrixTableGUI\getSelectableColumns().

+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilContainerReference::_lookupTitle ( int  $obj_id)
static

Reimplemented from ilObject.

Definition at line 75 of file class.ilContainerReference.php.

75 : string
76 {
77 global $DIC;
78
79 $ilDB = $DIC->database();
80
81 $query = 'SELECT title,title_type FROM container_reference cr ' .
82 'JOIN object_data od ON cr.obj_id = od.obj_id ' .
83 'WHERE cr.obj_id = ' . $ilDB->quote($obj_id, 'integer');
84 $res = $ilDB->query($query);
85 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
86 if ((int) $row->title_type === self::TITLE_TYPE_CUSTOM) {
87 return (string) $row->title;
88 }
89 }
90 return self::_lookupTargetTitle($obj_id);
91 }
static _lookupTargetTitle(int $a_obj_id)

References $DIC, $ilDB, $res, _lookupTargetTitle(), and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilTree\fetchNodeData(), ilObjStudyProgramme\getCompletedCourses(), and ilNoteGUI\getOriginHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneObject()

ilContainerReference::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Reimplemented in ilObjCourseReference.

Definition at line 247 of file class.ilContainerReference.php.

247 : ?ilObject
248 {
249 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
250 $new_obj->setTargetId($this->getTargetId());
251 $new_obj->setTitleType($this->getTitleType());
252 $new_obj->update();
253 return $new_obj;
254 }
Class ilObject Basic functions for all objects.

References $target_id, getTargetId(), and getTitleType().

+ Here is the call graph for this function:

◆ delete()

ilContainerReference::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

Reimplemented in ilObjCourseReference.

Definition at line 232 of file class.ilContainerReference.php.

232 : bool
233 {
235
236 if (!parent::delete()) {
237 return false;
238 }
239
240 $query = "DELETE FROM container_reference " .
241 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
242 $ilDB->manipulate($query);
243
244 return true;
245 }
ilDBInterface $db

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

+ Here is the call graph for this function:

◆ getPresentationTitle()

ilContainerReference::getPresentationTitle ( )

get presentation title Normally same as title Overwritten for sessions

Reimplemented from ilObject.

Definition at line 203 of file class.ilContainerReference.php.

203 : string
204 {
205 if ($this->getTitleType() === self::TITLE_TYPE_CUSTOM) {
206 return $this->getTitle();
207 }
208
209 return $this->lng->txt('reference_of') . ' ' . $this->getTitle();
210 }

References ilObject\getTitle(), getTitleType(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getTargetId()

ilContainerReference::getTargetId ( )

Definition at line 145 of file class.ilContainerReference.php.

145 : ?int
146 {
147 return $this->target_id;
148 }

References $target_id.

Referenced by cloneObject(), read(), and update().

+ Here is the caller graph for this function:

◆ getTargetRefId()

ilContainerReference::getTargetRefId ( )

Definition at line 160 of file class.ilContainerReference.php.

160 : ?int
161 {
163 }

References $target_ref_id.

◆ getTitleType()

ilContainerReference::getTitleType ( )

Definition at line 165 of file class.ilContainerReference.php.

165 : int
166 {
167 return $this->title_type;
168 }

References $title_type.

Referenced by cloneObject(), getPresentationTitle(), read(), and update().

+ Here is the caller graph for this function:

◆ read()

ilContainerReference::read ( )

Reimplemented from ilObject.

Reimplemented in ilObjCourseReference.

Definition at line 175 of file class.ilContainerReference.php.

175 : void
176 {
178
179 parent::read();
180
181 $query = "SELECT * FROM container_reference " .
182 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
183 $res = $ilDB->query($query);
184
185 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
186 $this->setTargetId((int) $row->target_obj_id);
187 $this->setTitleType((int) $row->title_type);
188 }
189 if ($this->getTargetId()) {// might be null...
190 $ref_ids = ilObject::_getAllReferences($this->getTargetId());
191 $ref_id = current($ref_ids); // might be null in deletion cases, see #35150
192
193 if ($ref_id) {
194 $this->setTargetRefId($ref_id);
195 }
196
197 if ($this->getTitleType() === self::TITLE_TYPE_REUSE) {
198 $this->title = ilObject::_lookupTitle($this->getTargetId());
199 }
200 }
201 }
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)

References ilObject\$db, $ilDB, ilObject\$ref_id, $res, ilObject\_getAllReferences(), ilObject\_lookupTitle(), ilDBConstants\FETCHMODE_OBJECT, ilObject\getId(), getTargetId(), getTitleType(), setTargetId(), setTargetRefId(), and setTitleType().

Referenced by ilObjStudyProgrammeReference\getReferencedObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargetId()

ilContainerReference::setTargetId ( int  $a_target_id)

Definition at line 150 of file class.ilContainerReference.php.

150 : void
151 {
152 $this->target_id = $a_target_id;
153 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTargetRefId()

ilContainerReference::setTargetRefId ( int  $a_id)

Definition at line 155 of file class.ilContainerReference.php.

155 : void
156 {
157 $this->target_ref_id = $a_id;
158 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitleType()

ilContainerReference::setTitleType ( int  $type)

Definition at line 170 of file class.ilContainerReference.php.

170 : void
171 {
172 $this->title_type = $type;
173 }
string $type

References ilObject\$type.

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilContainerReference::update ( )

Reimplemented from ilObject.

Reimplemented in ilObjCourseReference.

Definition at line 212 of file class.ilContainerReference.php.

212 : bool
213 {
215
216 parent::update();
217
218 $query = "DELETE FROM container_reference " .
219 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
220 $ilDB->manipulate($query);
221
222 $query = "INSERT INTO container_reference (obj_id, target_obj_id, title_type) " .
223 "VALUES( " .
224 $ilDB->quote($this->getId(), 'integer') . ", " .
225 $ilDB->quote($this->getTargetId(), 'integer') . ", " .
226 $ilDB->quote($this->getTitleType(), 'integer') . ' ' .
227 ")";
228 $ilDB->manipulate($query);
229 return true;
230 }

References ilObject\$db, $ilDB, ilObject\getId(), getTargetId(), and getTitleType().

+ Here is the call graph for this function:

Field Documentation

◆ $target_id

int ilContainerReference::$target_id = null
protected

Definition at line 30 of file class.ilContainerReference.php.

Referenced by cloneObject(), and getTargetId().

◆ $target_ref_id

int ilContainerReference::$target_ref_id = null
protected

Definition at line 31 of file class.ilContainerReference.php.

Referenced by getTargetRefId().

◆ $title_type

int ilContainerReference::$title_type = self::TITLE_TYPE_REUSE
protected

Definition at line 32 of file class.ilContainerReference.php.

Referenced by getTitleType().

◆ $user

ilObjUser ilContainerReference::$user
protected

Definition at line 29 of file class.ilContainerReference.php.

◆ TITLE_TYPE_CUSTOM

◆ TITLE_TYPE_REUSE


The documentation for this class was generated from the following file: