ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilWebLinkItem.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
25 abstract class ilWebLinkItem extends ilWebLinkBaseItem
26 {
27  protected int $webr_id;
28  protected int $link_id;
29 
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  ) {
60  parent::__construct($title, $description, $target, $active, $parameters);
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 }
DateTimeImmutable $create_date
DateTimeImmutable $last_update
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
toXML(ilXmlWriter $writer, int $position)
xmlEndTag(string $tag)
Writes an endtag.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $webr_id, int $link_id, string $title, ?string $description, string $target, bool $active, DateTimeImmutable $create_date, DateTimeImmutable $last_update, array $parameters)
getResolvedLink(bool $with_parameters=true)
__construct(Container $dic, ilPlugin $plugin)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...