ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Portal.php
Go to the documentation of this file.
1<?php
2
4{
5 private $pages;
6 private $config;
7
8 public function __construct($pages, $config = null)
9 {
10 $this->pages = $pages;
11 $this->config = $config;
12 }
13
14 public function getTabset($thispage)
15 {
16 if (!isset($this->config)) {
17 return null;
18 }
19 foreach($this->config as $set) {
20 if (in_array($thispage, $set, true)) {
21 return $set;
22 }
23 }
24 return null;
25 }
26
27 public function isPortalized($thispage)
28 {
29 foreach($this->config as $set) {
30 if (in_array($thispage, $set, true)) {
31 return true;
32 }
33 }
34 return false;
35 }
36
37 public function getLoginInfo($translator, $thispage)
38 {
39 $info = array('info' => '', 'translator' => $translator, 'thispage' => $thispage);
40 SimpleSAML\Module::callHooks('portalLoginInfo', $info);
41 return $info['info'];
42 }
43
44 public function getMenu($thispage)
45 {
48 $tabset = $this->getTabset($thispage);
49 $logininfo = $this->getLoginInfo($t, $thispage);
50 $text = '';
51 $text .= '<ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">';
52 foreach ($this->pages as $pageid => $page) {
53 if (isset($tabset) && !in_array($pageid, $tabset, true)) {
54 continue;
55 }
56 $name = 'uknown';
57 if (isset($page['text'])) {
58 $name = $page['text'];
59 }
60 if (isset($page['shorttext'])) {
61 $name = $page['shorttext'];
62 }
63 if (!isset($page['href'])) {
64 $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">' . $t->t($name) . '</a></li>';
65 } else if($pageid === $thispage ) {
66 $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">' . $t->t($name) . '</a></li>';
67 } else {
68 $text .= '<li class="ui-state-default ui-corner-top"><a href="' . $page['href'] . '">' . $t->t($name) . '</a></li>';
69 }
70
71 }
72 $text .= '</ul>';
73 if (!empty($logininfo)) {
74 $text .= '<p class="logininfo" style="text-align: right; margin: 0px">' . $logininfo . '</p>';
75 }
76
77 return $text;
78 }
79}
An exception for terminatinating execution or to throw for unit testing.
static callHooks($hook, &$data=null)
Call a hook in all enabled modules.
Definition: Module.php:281
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
__construct($pages, $config=null)
Definition: Portal.php:8
getMenu($thispage)
Definition: Portal.php:44
isPortalized($thispage)
Definition: Portal.php:27
getLoginInfo($translator, $thispage)
Definition: Portal.php:37
getTabset($thispage)
Definition: Portal.php:14
$translator
Definition: getconsent.php:119
$info
Definition: index.php:5
$text
Definition: errorreport.php:18