19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
36 public function legacyPanel(
string $title,
C\Legacy\Legacy $content): I\Component\Panel\Secondary\Legacy
38 return new I\Component\Panel\Secondary\Legacy($title, $content);
41 public function legacy(
string $content): C\Legacy\Legacy
44 return $f->legacy($content);
47 public function dropdown(): C\Dropdown\Factory
49 return new I\Component\Dropdown\Factory();
52 public function viewControl(): C\ViewControl\Factory
57 public function button(): C\Button\Factory
59 return new I\Component\Button\Factory();
62 public function symbol(): C\Symbol\Factory
64 return new I\Component\Symbol\Factory(
75 $html = str_replace([
"\n",
"\t"],
"", $html);
82 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
83 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"List Title", $legacy);
85 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Panel\\Secondary\\Legacy", $secondary_panel);
90 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
91 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"Title", $legacy);
93 $this->assertEquals(
"Title", $secondary_panel->getTitle());
98 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
99 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy);
101 $this->assertEquals($secondary_panel->getLegacyComponent(), $legacy);
106 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
107 $actions = $this->
getUIFactory()->dropdown()->standard(array(
112 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy)
113 ->withActions($actions);
115 $this->assertEquals($secondary_panel->getActions(), $actions);
120 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
121 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy);
122 $array_vc = $secondary_panel->getViewControls();
124 $this->assertEquals(null, $array_vc);
129 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
130 $sort_options = array(
131 'internal_rating' =>
'Best',
132 'date_desc' =>
'Most Recent',
133 'date_asc' =>
'Oldest',
135 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options,
'internal_rating');
137 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy)
138 ->withViewControls([$sortation]);
140 $array_vc = $secondary_panel->getViewControls();
142 $this->assertEquals($array_vc[0], $sortation);
147 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
148 $pagination = $this->
getUIFactory()->viewControl()->pagination()
149 ->withTargetURL(
"http://ilias.de",
'page')
150 ->withTotalEntries(98)
152 ->withCurrentPage(1);
154 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy)
155 ->withViewControls([$pagination]);
157 $array_vc = $secondary_panel->getViewControls();
159 $this->assertEquals($array_vc[0], $pagination);
164 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
165 $back = $this->
getUIFactory()->button()->standard(
"previous",
"http://www.ilias.de");
166 $next = $this->
getUIFactory()->button()->standard(
"next",
"http://www.github.com");
167 $current = $this->
getUIFactory()->button()->standard(
"current",
"");
168 $section = $this->
getUIFactory()->viewControl()->section($back, $current, $next);
170 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"title", $legacy)
171 ->withViewControls([$section]);
173 $array_vc = $secondary_panel->getViewControls();
175 $this->assertEquals($array_vc[0], $section);
182 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
183 $actions = $this->
getUIFactory()->dropdown()->standard(array(
188 $sec = $this->
getUIFactory()->legacyPanel(
"Title", $legacy)->withActions($actions);
190 $html = $this->getDefaultRenderer()->render($sec);
192 $expected_html = <<<EOT
193 <div
class=
"panel panel-secondary panel-flex">
194 <div
class=
"panel-heading ilHeader">
195 <div
class=
"panel-title"><h2>
Title</h2></div>
196 <div
class=
"panel-controls">
197 <div
class=
"dropdown" id=
"id_3"><
button class=
"btn btn-default dropdown-toggle" type=
"button" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_3_menu" ><span
class=
"caret"></span></
button>
198 <ul
id=
"id_3_menu" class=
"dropdown-menu">
199 <li><
button class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
200 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">Github</button></li>
206 <div
class=
"panel-body">
211 $this->assertHTMLEquals(
212 $this->brutallyTrimHTML($expected_html),
213 $this->brutallyTrimHTML($html)
219 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
220 $sort_options = array(
224 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options,
'b');
225 $sec = $this->
getUIFactory()->legacyPanel(
"Title", $legacy)
226 ->withViewControls([$sortation]);
228 $html = $this->getDefaultRenderer()->render($sec);
230 $expected_html = <<<EOT
231 <div
class=
"panel panel-secondary panel-flex">
232 <div
class=
"panel-heading ilHeader">
233 <div
class=
"panel-title"><h2>
Title</h2></div>
234 <div
class=
"panel-viewcontrols l-bar__space-keeper">
235 <div
class=
"dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id=
"id_1">
236 <
button class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"sortation" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_1_ctrl">
237 <span
class=
"label">vc_sort
B</span>
238 <span
class=
"caret"></span>
240 <ul
id=
"id_1_ctrl" class=
"dropdown-menu">
241 <li><
button class=
"btn btn-link" data-action=
"?sortation=a" id=
"id_2">
A</button></li>
242 <li
class=
"selected"><button
class=
"btn btn-link" data-action=
"?sortation=b" id=
"id_3">
B</button></li>
246 <div
class=
"panel-controls"></div>
248 <div
class=
"panel-body">Legacy content</div>
251 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
256 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
258 $pagination = $this->
getUIFactory()->viewControl()->pagination()
259 ->withTargetURL(
'http://ilias.de',
'page')
260 ->withTotalEntries(10)
262 ->withCurrentPage(1);
264 $sec = $this->
getUIFactory()->legacyPanel(
"Title", $legacy)
265 ->withViewControls([$pagination]);
267 $html = $this->getDefaultRenderer()->render($sec);
269 $expected_html = <<<EOT
270 <div
class=
"panel panel-secondary panel-flex">
271 <div
class=
"panel-heading ilHeader">
272 <div
class=
"panel-title"><h2>
Title</h2></div>
273 <div
class=
"panel-viewcontrols l-bar__space-keeper">
274 <div
class=
"il-viewcontrol-pagination l-bar__element">
275 <
button class=
"btn btn-default" data-action=
"http://ilias.de?page=0" id=
"id_6">
276 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
278 <
button class=
"btn btn-link" data-action=
"http://ilias.de?page=0" id=
"id_1">1</button>
279 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"http://ilias.de?page=1" id=
"id_2">2</button>
280 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=2" id=
"id_3">3</button>
281 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=3" id=
"id_4">4</button>
282 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=4" id=
"id_5">5</button>
283 <button
class=
"btn btn-default" data-action=
"http://ilias.de?page=2" id=
"id_7">
284 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
288 <div
class=
"panel-controls"></div>
290 <div
class=
"panel-body">Legacy content</div>
293 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
298 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
299 $back = $this->
getUIFactory()->button()->standard(
"previous",
"http://www.ilias.de");
300 $next = $this->
getUIFactory()->button()->standard(
"next",
"http://www.github.com");
301 $current = $this->
getUIFactory()->button()->standard(
"current",
"");
302 $section = $this->
getUIFactory()->viewControl()->section($back, $current, $next);
304 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"Title", $legacy)
305 ->withViewControls([$section]);
307 $html = $this->getDefaultRenderer()->render($secondary_panel);
309 $expected_html = <<<EOT
310 <div
class=
"panel panel-secondary panel-flex">
311 <div
class=
"panel-heading ilHeader">
312 <div
class=
"panel-title"><h2>
Title</h2></div>
313 <div
class=
"panel-viewcontrols l-bar__space-keeper">
314 <div
class=
"il-viewcontrol-section l-bar__element">
315 <a
class=
"btn btn-ctrl browse previous" href=
"http://www.ilias.de" aria-label=
"previous" data-action=
"http://www.ilias.de" id=
"id_1"><span
class=
"glyphicon glyphicon-chevron-left"></span></a>
316 <
button class=
"btn btn-default" data-action=
"">current</button>
317 <a
class=
"btn btn-ctrl browse next" href=
"http://www.github.com" aria-label=
"next" data-action=
"http://www.github.com" id=
"id_2"><span
class=
"glyphicon glyphicon-chevron-right"></span></a>
320 <div
class=
"panel-controls"></div>
322 <div
class=
"panel-body">Legacy content</div>
325 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
330 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
331 $footer_shy_button = $this->
getUIFactory()->button()->shy(
"Action",
"");
333 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"Title", $legacy)
334 ->withFooter($footer_shy_button);
336 $html = $this->getDefaultRenderer()->render($secondary_panel);
338 $expected_html = <<<EOT
339 <div
class=
"panel panel-secondary panel-flex">
340 <div
class=
"panel-heading ilHeader">
341 <div
class=
"panel-title"><h2>
Title</h2></div>
342 <div
class=
"panel-controls"></div>
344 <div
class=
"panel-body">
347 <div
class=
"panel-footer ilBlockInfo">
352 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
357 $legacy = $this->
getUIFactory()->legacy(
"Legacy content");
359 $secondary_panel = $this->
getUIFactory()->legacyPanel(
"", $legacy);
361 $html = $this->getDefaultRenderer()->render($secondary_panel);
363 $expected_html = <<<EOT
364 <div
class=
"panel panel-secondary panel-flex">
365 <div
class=
"panel-body">Legacy content</div>
368 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRenderPanelSecondaryWithNoHeader()
testRenderPanelSecondaryWithFooter()
testWithSortationViewControl()
testWithoutViewControls()
testRenderPanelSecondaryWithSortation()
testWithPaginationViewControl()
testImplementsFactoryInterface()
testRenderPanelSecondaryWithSection()
testRenderPanelSecondaryWithActions()
legacy()
expected output: > ILIAS shows the rendered Component.
Test secondary legacy panels.
testRenderPanelSecondaryWithPagination()
testWithSectionViewControl()