1<?php namespace ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item;
2
3use ILIAS\GlobalScreen\Identification\IdentificationInterface;
4use ILIAS\GlobalScreen\Identification\NullIdentification;
5use ILIAS\GlobalScreen\Scope\MainMenu\Factory\AbstractBaseItem;
6use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasAction;
7use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasAsyncContent;
8use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasContent;
9use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle;
10use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isChild;
11use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem;
12use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isParent;
13use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isTopItem;
14use ILIAS\UI\Component\Component;
15
16/**
17 * Class Lost
18 *
19 * @author Fabian Schmid <fs@studer-raimann.ch>
20 */
21class Lost extends AbstractBaseItem implements hasAsyncContent, hasContent, isTopItem, isParent, isChild, hasTitle, hasAction
22{
23
24    /**
25     * @var isChild[]
26     */
27    private $children = array();
28    /**
29     * @var IdentificationInterface
30     */
31    private $parent;
32    /**
33     * @var string
34     */
35    private $title = '';
36
37
38    /**
39     * @inheritDoc
40     */
41    public function __construct(IdentificationInterface $provider_identification)
42    {
43        parent::__construct($provider_identification);
44        $this->parent = new NullIdentification();
45    }
46
47
48    /**
49     * @inheritDoc
50     */
51    public function withTitle(string $title) : hasTitle
52    {
53        $this->title = $title;
54
55        return $this;
56    }
57
58
59    /**
60     * @inheritDoc
61     */
62    public function getTitle() : string
63    {
64        return $this->title;
65    }
66
67
68    /**
69     * @inheritDoc
70     */
71    public function getAsyncContentURL() : string
72    {
73        return "";
74    }
75
76
77    /**
78     * @inheritDoc
79     */
80    public function withAsyncContentURL(string $async_content_url) : hasAsyncContent
81    {
82        return $this;
83    }
84
85
86    /**
87     * @inheritDoc
88     */
89    public function withContent(Component $ui_component) : hasContent
90    {
91        return $this;
92    }
93
94
95    /**
96     * @inheritDoc
97     */
98    public function getContent() : Component
99    {
100        global $DIC;
101
102        return $DIC->ui()->factory()->legacy("");
103    }
104
105
106    /**
107     * @inheritDoc
108     */
109    public function withParent(IdentificationInterface $identification) : isItem
110    {
111        $this->parent = $identification;
112
113        return $this;
114    }
115
116
117    /**
118     * @inheritDoc
119     */
120    public function hasParent() : bool
121    {
122        return $this->parent instanceof isParent;
123    }
124
125
126    /**
127     * @inheritDoc
128     */
129    public function getParent() : IdentificationInterface
130    {
131        return $this->parent;
132    }
133
134
135    /**
136     * @inheritDoc
137     */
138    public function overrideParent(IdentificationInterface $identification) : isChild
139    {
140        $this->parent = $identification;
141
142        return $this;
143    }
144
145
146    /**
147     * @inheritDoc
148     */
149    public function getChildren() : array
150    {
151        return $this->children;
152    }
153
154
155    /**
156     * @inheritDoc
157     */
158    public function withChildren(array $children) : isParent
159    {
160        $this->children = $children;
161
162        return $this;
163    }
164
165
166    /**
167     * @inheritDoc
168     */
169    public function appendChild(isChild $child) : isParent
170    {
171        $this->children[] = $child;
172
173        return $this;
174    }
175
176
177    /**
178     * @inheritDoc
179     */
180    public function hasChildren() : bool
181    {
182        return count($this->children) > 0;
183    }
184
185
186    /**
187     * @inheritDoc
188     */
189    public function withAction(string $action) : hasAction
190    {
191        // noting to to
192        return $this;
193    }
194
195
196    /**
197     * @inheritDoc
198     */
199    public function getAction() : string
200    {
201        return "#";
202    }
203
204
205    /**
206     * @inheritDoc
207     */
208    public function withIsLinkToExternalAction(bool $is_external) : hasAction
209    {
210        // noting to to
211        return $this;
212    }
213
214
215    /**
216     * @inheritDoc
217     */
218    public function isLinkWithExternalAction() : bool
219    {
220        return false;
221    }
222}
223