19declare(strict_types=1);
31 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
38 $this->lom_services =
$DIC->learningObjectMetadata();
43 if (isset($this->repo)) {
51 $new_id = parent::create();
59 return parent::update();
64 if ($a_element !==
'General') {
68 $paths = $this->lom_services->paths();
69 $reader = $this->lom_services->read(
73 $paths->custom()->withNextStep(
'general')->get()
76 $title = $reader->firstData($paths->title())->value();
77 $description = $reader->firstData($paths->firstDescription())->value();
83 $item = $this->
getWebLinkRepo()->getAllItemsAsContainer()->getFirstItem();
90 $item->getParameters()
104 public function delete():
bool
107 if (!parent::delete()) {
126 bool $omit_tree =
false
128 $new_obj = parent::
cloneObject($target_id, $copy_id, $omit_tree);
132 $items = $this->
getWebLinkRepo()->getAllItemsAsContainer()->getItems();
135 foreach ($items as $item) {
139 $item->getDescription(),
142 $item->getParameters()
149 $new_web_link_repo->createAllItemsInDraftContainer(
$container);
152 if ($new_web_link_repo->doesOnlyOneItemExist(
true)) {
156 $new_obj->getTitle(),
157 $new_obj->getDescription(),
160 $item->getParameters()
162 $new_web_link_repo->updateItem($item, $draft);
168 $new_obj->getTitle(),
169 $new_obj->getDescription()
171 $new_web_link_repo->createList($draft_list);
179 $attribs = array(
"obj_id" =>
"il_" .
IL_INST_ID .
"_webr_" . $this->
getId(
190 array(
'type' =>
'Manual')
198 array(
'type' =>
'Title')
203 if ($this->getWebLinkRepo()->doesListExist()) {
206 $writer->
xmlElement(
'ListDescription', [], $this->getDescription());
211 $items = $this->getWebLinkRepo()->getAllItemsAsContainer()
216 foreach ($items as $item) {
218 $item->toXML($writer, $position);
static _lookupSortMode(int $a_obj_id)
static _getFirstLink(int $a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
LOMServices $lom_services
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
__construct(int $a_id=0, bool $a_call_by_reference=true)
toXML(ilXmlWriter $writer)
doMDUpdateListener(string $a_element)
ilWebLinkDatabaseRepository $repo
Class ilObject Basic functions for all objects.
cloneMetaData(ilObject $target_obj)
Copy meta data.
Draft class for creating and updating a Web Link item.
Container class for drafted Web Link items.
Draft class for creating or updating a Web Link list.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc