ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLinkResource Class Reference

Class ilObjLinkResource. More...

+ Inheritance diagram for ilObjLinkResource:
+ Collaboration diagram for ilObjLinkResource:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create ($a_upload=false)
 
 update ()
 
 delete ()
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
 toXML (ilXmlWriter $writer)
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 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 $desc)
 
 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)
 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...
 

Protected Member Functions

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

Protected Attributes

ilWebLinkDatabaseRepository $repo
 
- 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
 
int $id
 
bool $referenced
 
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 = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- 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 _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 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
 

Detailed Description

Class ilObjLinkResource.

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

Definition at line 25 of file class.ilObjLinkResource.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\GlobalScreen\Provider\__construct().

30  {
31  $this->type = "webr";
32  parent::__construct($a_id, $a_call_by_reference);
33  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneObject()

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

Definition at line 122 of file class.ilObjLinkResource.php.

References $container, ilObjLinkResourceAccess\_getFirstLink(), ilObject\cloneMetaData(), ilWebLinkDatabaseRepository\createAllItemsInDraftContainer(), and getWebLinkRepo().

126  : ?ilObject {
127  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
128  $this->cloneMetaData($new_obj);
129 
130  // object created, now copy items and parameters
131  $items = $this->getWebLinkRepo()->getAllItemsAsContainer()->getItems();
133 
134  foreach ($items as $item) {
135  $draft = new ilWebLinkDraftItem(
136  $item->isInternal(),
137  $item->getTitle(),
138  $item->getDescription(),
139  $item->getTarget(),
140  $item->isActive(),
141  $item->getParameters()
142  );
143 
144  $container->addItem($draft);
145  }
146 
147  $new_web_link_repo = new ilWebLinkDatabaseRepository($new_obj->getId());
148  $new_web_link_repo->createAllItemsInDraftContainer($container);
149 
150  // append copy info weblink title
151  if ($new_web_link_repo->doesOnlyOneItemExist(true)) {
152  $item = ilObjLinkResourceAccess::_getFirstLink($new_obj->getId());
153  $draft = new ilWebLinkDraftItem(
154  $item->isInternal(),
155  $new_obj->getTitle(),
156  $new_obj->getDescription(),
157  $item->getTarget(),
158  $item->isActive(),
159  $item->getParameters()
160  );
161  $new_web_link_repo->updateItem($item, $draft);
162  }
163  return $new_obj;
164  }
createAllItemsInDraftContainer(ilWebLinkDraftItemsContainer $container)
$target_id
Definition: goto.php:52
$container
Definition: wac.php:14
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
cloneMetaData(ilObject $target_obj)
Copy meta data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getFirstLink(int $a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
+ Here is the call graph for this function:

◆ create()

ilObjLinkResource::create (   $a_upload = false)
Todo:
how to handle this meta data switch

Definition at line 46 of file class.ilObjLinkResource.php.

References ilObject\createMetaData().

46  : int
47  {
48  $new_id = parent::create();
49  if (!$a_upload) {
50  $this->createMetaData();
51  }
52  return $new_id;
53  }
+ Here is the call graph for this function:

◆ delete()

ilObjLinkResource::delete ( )

Definition at line 103 of file class.ilObjLinkResource.php.

References ilObject\deleteMetaData(), and getWebLinkRepo().

103  : bool
104  {
105  // always call parent delete function first!!
106  if (!parent::delete()) {
107  return false;
108  }
109 
110  // delete items and list
111  $this->getWebLinkRepo()->deleteAllItems();
112  if ($this->getWebLinkRepo()->doesListExist()) {
113  $this->getWebLinkRepo()->deleteList();
114  }
115 
116  // delete meta data
117  $this->deleteMetaData();
118 
119  return true;
120  }
+ Here is the call graph for this function:

◆ doMDUpdateListener()

ilObjLinkResource::doMDUpdateListener ( string  $a_element)
protected

Definition at line 61 of file class.ilObjLinkResource.php.

References ilObject\$id, ilObject\$title, ilObject\getId(), ilObject\getType(), and getWebLinkRepo().

61  : void
62  {
63  $md = new ilMD($this->getId(), 0, $this->getType());
64  if (!is_object($md_gen = $md->getGeneral())) {
65  return;
66  }
67  $title = $md_gen->getTitle();
68  $description = '';
69  foreach ($md_gen->getDescriptionIds() as $id) {
70  $md_des = $md_gen->getDescription($id);
71  $description = $md_des->getDescription();
72  break;
73  }
74  if (
75  $a_element === 'General' &&
76  !$this->getWebLinkRepo()->doesListExist() &&
77  $this->getWebLinkRepo()->doesOnlyOneItemExist()
78  ) {
79  $item = $this->getWebLinkRepo()->getAllItemsAsContainer()->getFirstItem();
80  $draft = new ilWebLinkDraftItem(
81  $item->isInternal(),
82  $title,
83  $description,
84  $item->getTarget(),
85  $item->isActive(),
86  $item->getParameters()
87  );
88  $this->getWebLinkRepo()->updateItem($item, $draft);
89  }
90  if (
91  $a_element === 'General' &&
92  $this->getWebLinkRepo()->doesListExist()
93  ) {
94  $list = $this->getWebLinkRepo()->getList();
95  $draft = new ilWebLinkDraftList(
96  $title,
97  $description
98  );
99  $this->getWebLinkRepo()->updateList($list, $draft);
100  }
101  }
string $title
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getWebLinkRepo()

ilObjLinkResource::getWebLinkRepo ( )
protected

Definition at line 35 of file class.ilObjLinkResource.php.

References $repo, and ilObject\getId().

Referenced by cloneObject(), delete(), doMDUpdateListener(), and toXML().

36  {
37  if (isset($this->repo)) {
38  return $this->repo;
39  }
40  return $this->repo = new ilWebLinkDatabaseRepository($this->getId());
41  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilWebLinkDatabaseRepository $repo
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

ilObjLinkResource::toXML ( ilXmlWriter  $writer)

Definition at line 166 of file class.ilObjLinkResource.php.

References ilContainerSortingSettings\_lookupSortMode(), ilXmlWriter\appendXML(), ilObject\getDescription(), ilObject\getId(), ilObject\getTitle(), getWebLinkRepo(), IL_INST_ID, ilContainer\SORT_MANUAL, ilContainer\SORT_TITLE, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

166  : void
167  {
168  $attribs = array("obj_id" => "il_" . IL_INST_ID . "_webr_" . $this->getId(
169  )
170  );
171 
172  $writer->xmlStartTag('WebLinks', $attribs);
173 
174  // LOM MetaData
175  $md2xml = new ilMD2XML($this->getId(), $this->getId(), 'webr');
176  $md2xml->startExport();
177  $writer->appendXML($md2xml->getXML());
178 
179  // Sorting
182  $writer->xmlElement(
183  'Sorting',
184  array('type' => 'Manual')
185  );
186  break;
187 
189  default:
190  $writer->xmlElement(
191  'Sorting',
192  array('type' => 'Title')
193  );
194  break;
195  }
196 
197  if ($this->getWebLinkRepo()->doesListExist()) {
198  $writer->xmlStartTag('ListSettings');
199  $writer->xmlElement('ListTitle', [], $this->getTitle());
200  $writer->xmlElement('ListDescription', [], $this->getDescription());
201  $writer->xmlEndTag('ListSettings');
202  }
203 
204  // All items
205  $items = $this->getWebLinkRepo()->getAllItemsAsContainer()
206  ->sort()
207  ->getItems();
208 
209  $position = 0;
210  foreach ($items as $item) {
211  ++$position;
212  $item->toXML($writer, $position);
213  }
214 
215  $writer->xmlEndTag('WebLinks');
216  }
const IL_INST_ID
Definition: constants.php:40
appendXML(string $a_str)
append xml string to document
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilObjLinkResource::update ( )

Definition at line 55 of file class.ilObjLinkResource.php.

References ilObject\updateMetaData().

55  : bool
56  {
57  $this->updateMetaData();
58  return parent::update();
59  }
+ Here is the call graph for this function:

Field Documentation

◆ $repo

ilWebLinkDatabaseRepository ilObjLinkResource::$repo
protected

Definition at line 27 of file class.ilObjLinkResource.php.

Referenced by getWebLinkRepo().


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