ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWebLinkItem.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25abstract class ilWebLinkItem extends ilWebLinkBaseItem
26{
27 protected int $webr_id;
28 protected int $link_id;
29
30 protected DateTimeImmutable $create_date;
31 protected DateTimeImmutable $last_update;
32
36 protected array $parameters;
37
49 public function __construct(
50 int $webr_id,
51 int $link_id,
52 string $title,
53 ?string $description,
54 string $target,
55 bool $active,
56 DateTimeImmutable $create_date,
57 DateTimeImmutable $last_update,
58 array $parameters
59 ) {
61 $this->webr_id = $webr_id;
62 $this->link_id = $link_id;
63 $this->create_date = $create_date;
64 $this->last_update = $last_update;
65 }
66
67 abstract public function getResolvedLink(bool $with_parameters = true): string;
68
69 abstract public function isInternal(): bool;
70
71 public function toXML(ilXmlWriter $writer, int $position): void
72 {
73 $writer->xmlStartTag(
74 'WebLink',
75 [
76 'id' => $this->getLinkId(),
77 'active' => (int) $this->isActive(),
78 'position' => $position,
79 'internal' => (int) $this->isInternal(),
80 ]
81 );
82 $writer->xmlElement('Title', [], $this->getTitle());
83 $writer->xmlElement('Description', [], $this->getDescription());
84 $writer->xmlElement('Target', [], $this->getTarget());
85
86 foreach ($this->getParameters() as $parameter) {
87 $parameter->toXML($writer);
88 }
89
90 $writer->xmlEndTag('WebLink');
91 }
92
93 public function getWebrId(): int
94 {
95 return $this->webr_id;
96 }
97
98 public function getLinkId(): int
99 {
100 return $this->link_id;
101 }
102
103 public function getCreateDate(): DateTimeImmutable
104 {
105 return $this->create_date;
106 }
107
108 public function getLastUpdate(): DateTimeImmutable
109 {
110 return $this->last_update;
111 }
112
116 public function getParameters(): array
117 {
118 return $this->parameters;
119 }
120}
Base class for Web Link items.
Immutable class for Web Link items.
toXML(ilXmlWriter $writer, int $position)
DateTimeImmutable $create_date
getResolvedLink(bool $with_parameters=true)
DateTimeImmutable $last_update
__construct(int $webr_id, int $link_id, string $title, ?string $description, string $target, bool $active, DateTimeImmutable $create_date, DateTimeImmutable $last_update, array $parameters)
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