ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilObjLinkResource Class Reference
+ 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
 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...
 

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

LOMServices $lom_services
 
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
 
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

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

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

32  {
33  global $DIC;
34 
35  $this->type = "webr";
36  parent::__construct($a_id, $a_call_by_reference);
37 
38  $this->lom_services = $DIC->learningObjectMetadata();
39  }
global $DIC
Definition: shib_login.php:26
__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 123 of file class.ilObjLinkResource.php.

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

127  : ?ilObject {
128  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
129  $this->cloneMetaData($new_obj);
130 
131  // object created, now copy items and parameters
132  $items = $this->getWebLinkRepo()->getAllItemsAsContainer()->getItems();
134 
135  foreach ($items as $item) {
136  $draft = new ilWebLinkDraftItem(
137  $item->isInternal(),
138  $item->getTitle(),
139  $item->getDescription(),
140  $item->getTarget(),
141  $item->isActive(),
142  $item->getParameters()
143  );
144 
145  $container->addItem($draft);
146  }
147 
148  $new_web_link_repo = new ilWebLinkDatabaseRepository($new_obj->getId());
149  $new_web_link_repo->createAllItemsInDraftContainer($container);
150 
151  // append copy info weblink title
152  if ($new_web_link_repo->doesOnlyOneItemExist(true)) {
153  $item = ilObjLinkResourceAccess::_getFirstLink($new_obj->getId());
154  $draft = new ilWebLinkDraftItem(
155  $item->isInternal(),
156  $new_obj->getTitle(),
157  $new_obj->getDescription(),
158  $item->getTarget(),
159  $item->isActive(),
160  $item->getParameters()
161  );
162  $new_web_link_repo->updateItem($item, $draft);
163  }
164 
165  // make the new object a list if needed
166  if ($this->getWebLinkRepo()->doesListExist()) {
167  $draft_list = new ilWebLinkDraftList(
168  $new_obj->getTitle(),
169  $new_obj->getDescription()
170  );
171  $new_web_link_repo->createList($draft_list);
172  }
173 
174  return $new_obj;
175  }
createAllItemsInDraftContainer(ilWebLinkDraftItemsContainer $container)
$container
Definition: wac.php:37
cloneMetaData(ilObject $target_obj)
Copy meta data.
Container class for drafted Web Link items.
Draft class for creating or updating a Web Link list.
Draft class for creating and updating a Web Link item.
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)

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

References ilObject\createMetaData().

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

◆ delete()

ilObjLinkResource::delete ( )

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

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

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

◆ doMDUpdateListener()

ilObjLinkResource::doMDUpdateListener ( string  $a_element)
protected

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

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

62  : void
63  {
64  if ($a_element !== 'General') {
65  return;
66  }
67 
68  $paths = $this->lom_services->paths();
69  $reader = $this->lom_services->read(
70  $this->getId(),
71  0,
72  $this->getType(),
73  $paths->custom()->withNextStep('general')->get()
74  );
75 
76  $title = $reader->firstData($paths->title())->value();
77  $description = $reader->firstData($paths->firstDescription())->value();
78 
79  if (
80  !$this->getWebLinkRepo()->doesListExist() &&
81  $this->getWebLinkRepo()->doesOnlyOneItemExist()
82  ) {
83  $item = $this->getWebLinkRepo()->getAllItemsAsContainer()->getFirstItem();
84  $draft = new ilWebLinkDraftItem(
85  $item->isInternal(),
86  $title,
87  $description,
88  $item->getTarget(),
89  $item->isActive(),
90  $item->getParameters()
91  );
92  $this->getWebLinkRepo()->updateItem($item, $draft);
93  }
94  if ($this->getWebLinkRepo()->doesListExist()) {
95  $list = $this->getWebLinkRepo()->getList();
96  $draft = new ilWebLinkDraftList(
97  $title,
98  $description
99  );
100  $this->getWebLinkRepo()->updateList($list, $draft);
101  }
102  }
string $title
Draft class for creating or updating a Web Link list.
Draft class for creating and updating a Web Link item.
+ Here is the call graph for this function:

◆ getWebLinkRepo()

ilObjLinkResource::getWebLinkRepo ( )
protected

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

References $repo, and ilObject\getId().

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

42  {
43  if (isset($this->repo)) {
44  return $this->repo;
45  }
46  return $this->repo = new ilWebLinkDatabaseRepository($this->getId());
47  }
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 177 of file class.ilObjLinkResource.php.

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

177  : void
178  {
179  $attribs = array("obj_id" => "il_" . IL_INST_ID . "_webr_" . $this->getId(
180  )
181  );
182 
183  $writer->xmlStartTag('WebLinks', $attribs);
184 
185  // Sorting
188  $writer->xmlElement(
189  'Sorting',
190  array('type' => 'Manual')
191  );
192  break;
193 
195  default:
196  $writer->xmlElement(
197  'Sorting',
198  array('type' => 'Title')
199  );
200  break;
201  }
202 
203  if ($this->getWebLinkRepo()->doesListExist()) {
204  $writer->xmlStartTag('ListSettings');
205  $writer->xmlElement('ListTitle', [], $this->getTitle());
206  $writer->xmlElement('ListDescription', [], $this->getDescription());
207  $writer->xmlEndTag('ListSettings');
208  }
209 
210  // All items
211  $items = $this->getWebLinkRepo()->getAllItemsAsContainer()
212  ->sort()
213  ->getItems();
214 
215  $position = 0;
216  foreach ($items as $item) {
217  ++$position;
218  $item->toXML($writer, $position);
219  }
220 
221  $writer->xmlEndTag('WebLinks');
222  }
const IL_INST_ID
Definition: constants.php:40
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 56 of file class.ilObjLinkResource.php.

References ilObject\updateMetaData().

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

Field Documentation

◆ $lom_services

LOMServices ilObjLinkResource::$lom_services
protected

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

◆ $repo

ilWebLinkDatabaseRepository ilObjLinkResource::$repo
protected

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

Referenced by getWebLinkRepo().


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