3 declare(strict_types=1);
    35     public function __construct(
int $webr_id, 
bool $update_history = 
true)
    39         $this->db = $DIC->database();
    40         $this->
user = $DIC->user();
    47         $next_link_id = $this->db->nextId(self::ITEMS_TABLE);
    54             $next_param_id = $this->db->nextId(self::PARAMS_TABLE);
    68                 $parameter->getValue(),
    75                     'webr_id' => [
'integer', $new_parameter->getWebrId()],
    76                     'link_id' => [
'integer', $new_parameter->getLinkId()],
    77                     'param_id' => [
'integer', $new_parameter->getParamId()],
    78                     'name' => [
'text', $new_parameter->getName()],
    79                     'value' => [
'integer', $new_parameter->getValue()]
    83             $new_parameters[] = $new_parameter;
    88             $class = ilWebLinkItemInternal::class;
    90             $class = ilWebLinkItemExternal::class;
    93         $new_item = 
new $class(
   108                 'internal' => [
'integer', (
int) $new_item->isInternal()],
   109                 'webr_id' => [
'integer', $new_item->getWebrId()],
   110                 'link_id' => [
'integer', $new_item->getLinkId()],
   111                 'title' => [
'text', $new_item->getTitle()],
   112                 'description' => [
'text', $new_item->getDescription() ?? 
''],
   113                 'target' => [
'text', $new_item->getTarget()],
   114                 'active' => [
'integer', (
int) $new_item->isActive()],
   115                 'create_date' => [
'integer', $new_item->getCreateDate()
   117                 'last_update' => [
'integer', $new_item->getLastUpdate()
   126                 [$new_item->getTitle()]
   146                 'webr_id' => [
'integer', $new_list->getWebrId()],
   147                 'title' => [
'text', $new_list->getTitle()],
   148                 'description' => [
'text', $new_list->getDescription() ?? 
''],
   149                 'create_date' => [
'integer', $new_list->getCreateDate()
   151                 'last_update' => [
'integer', $new_list->getLastUpdate()
   160                 [$new_list->getTitle()]
   171         foreach ($container->
getItems() as $item) {
   183         $query = 
"SELECT * FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . 
" " .
   184             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer');
   187             $query .= 
" AND active = " . $this->db->quote(1, 
'integer');
   190         $res = $this->db->query($query);
   196             if ($row->internal) {
   197                 $class = ilWebLinkItemInternal::class;
   199                 $class = ilWebLinkItemExternal::class;
   202             $items[] = 
new $class(
   205                 (
string) $row->title,
   206                 ((
string) $row->description) !== 
'' ? (
string) $row->description : null,
   207                 (
string) $row->target,
   209                 $this->getNewDateTimeImmutable()->setTimestamp((
int) $row->create_date),
   223         $query = 
"SELECT * FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . 
" " .
   224             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   225             "AND link_id = " . $this->db->quote($link_id, 
'integer');
   227         $res = $this->db->query($query);
   232             if ($row->internal) {
   233                 $class = ilWebLinkItemInternal::class;
   235                 $class = ilWebLinkItemExternal::class;
   241                 (
string) $row->title,
   242                 ((
string) $row->description) !== 
'' ? (
string) $row->description : null,
   243                 (
string) $row->target,
   245                 $this->getNewDateTimeImmutable()->setTimestamp((
int) $row->create_date),
   252             'No item with the given link_id was found in this web link object.'   258         $query = 
"SELECT COUNT(*) AS num FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . 
" " .
   259             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer');
   262             $query .= 
" AND active = " . $this->db->quote(1, 
'integer');
   265         $row = $this->db->query($query)
   268         return $row->num == 1;
   275         $res = $this->db->query(
   276             "SELECT * FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . 
" " .
   277             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   278             "AND link_id = " . $this->db->quote($item->
getLinkId(), 
'integer') . 
" " .
   279             "AND param_id = " . $this->db->quote($param_id, 
'integer')
   287                 (
int) $row->param_id,
   294             'In the given item of this web link object, no parameter with the given param_id was found.'   300         $res = $this->db->query(
   301             "SELECT * FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . 
" " .
   302             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer')
   308                 (
string) $row->title,
   309                 ((
string) $row->description) !== 
'' ? (
string) $row->description : null,
   310                 $this->getNewDateTimeImmutable()->setTimestamp((
int) $row->create_date),
   316             'No list exists in this web link object.'   322         $res = $this->db->query(
   323             "SELECT COUNT(*) AS num FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . 
" " .
   324             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer')
   329         return ((
int) $row->num) > 0;
   338                 'Cannot update an item from a different web link object.'   347                 'title' => [
'text', $drafted_item->
getTitle()],
   349                 'target' => [
'text', $drafted_item->
getTarget()],
   350                 'active' => [
'integer', (
int) $drafted_item->
isActive()],
   351                 'internal' => [
'integer', (
int) $drafted_item->
isInternal()],
   355                 'webr_id' => [
'integer', $item->
getWebrId()],
   356                 'link_id' => [
'integer', $item->
getLinkId()]
   367                 $param_ids[] = $parameter->getParamId();
   377             if ($old_parameter = $parameter->getOldParameter()) {
   379                     $old_parameter->getLinkId() !== $item->
getLinkId() ||
   380                     $old_parameter->getWebrId() !== $item->
getWebrId()
   383                         'Cannot update a parameter from a different item.'   390                         'name' => [
'text', $drafted_item->
getTitle()],
   391                         'value' => [
'integer', $drafted_item->
getTitle()]
   394                         'webr_id' => [
'integer', $item->
getWebrId()],
   395                         'link_id' => [
'integer', $item->
getLinkId()],
   396                         'param_id' => [
'integer', $parameter->getOldParameter()
   403             $next_param_id = $this->db->nextId(self::PARAMS_TABLE);
   407                     'webr_id' => [
'integer', $this->
getWebrId()],
   408                     'link_id' => [
'integer', $item->
getLinkId()],
   409                     'param_id' => [
'integer', $next_param_id],
   410                     'name' => [
'text', $parameter->getName()],
   411                     'value' => [
'integer', $parameter->getValue()]
   421             if (!in_array($parameter->getParamId(), $param_ids)) {
   424                     $parameter->getParamId()
   444                 'Cannot update a list from a different web link object.'   451                 'title' => [
'text', $drafted_list->
getTitle()],
   456                 'webr_id' => [
'integer', $list->
getWebrId()]
   471         $this->db->manipulate(
   472             "DELETE FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . 
" " .
   473             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer')
   476         $this->db->manipulate(
   477             "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . 
" " .
   478             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer')
   488         $this->db->manipulate(
   489             "DELETE FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . 
" " .
   490             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   491             "AND link_id = " . $this->db->quote($link_id, 
'integer')
   494         $this->db->manipulate(
   495             "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . 
" " .
   496             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   497             "AND link_id = " . $this->db->quote($link_id, 
'integer')
   513         $this->db->manipulate(
   514             "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . 
" " .
   515             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   516             "AND link_id = " . $this->db->quote($link_id, 
'integer') . 
" " .
   517             "AND param_id = " . $this->db->quote($param_id, 
'integer')
   524             $title = $this->
getList()->getTitle();
   527         $res = $this->db->manipulate(
   528             "DELETE FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . 
" " .
   529             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer')
   546         $res = $this->db->query(
   547             "SELECT * FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . 
" " .
   548             "WHERE webr_id = " . $this->db->quote($this->
getWebrId(), 
'integer') . 
" " .
   549             "AND link_id = " . $this->db->quote($link_id, 
'integer')
   558                 (
int) $row->param_id,
   567             $parameters[] = $parameter;
   583                 'The value of the parameter you are trying to create is invalid.'   598                 'The target of this internal link item is not internal.' 
doesOnlyOneItemExist(bool $only_active=false)
 
createAllItemsInDraftContainer(ilWebLinkDraftItemsContainer $container)
 
getParameterinItemByParamId(ilWebLinkItem $item, int $param_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object. 
 
setUpdateHistory(bool $update_history)
 
__construct(int $webr_id, bool $update_history=true)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
createItem(ilWebLinkDraftItem $item)
Creates a new item, complete with parameters. 
 
createHistoryEntry(int $webr_id, string $action, array $parameters)
 
getAllItemsAsContainer(bool $only_active=false)
 
validateInternalItemTarget(ilWebLinkDraftItem $item)
 
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...
 
getItemByLinkId(int $link_id)
 
deleteItemByLinkID(int $link_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getNewDateTimeImmutable()
 
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...
 
updateItem(ilWebLinkItem $item, ilWebLinkDraftItem $drafted_item)
Updates an item. 
 
isInternalLink(string $value)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
deleteParameterByLinkIdAndParamId(int $link_id, int $param_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const VALUES
TODO Once the GUI is updated, undefined can be dropped. 
 
updateList(ilWebLinkList $list, ilWebLinkDraftList $drafted_list)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
createList(ilWebLinkDraftList $list)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getParametersByLinkId(int $link_id)
 
validateParameter(ilWebLinkBaseParameter $parameter)