ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Portal.php
Go to the documentation of this file.
1<?php
2
4
5 private $pages;
6 private $config;
7
8 function __construct($pages, $config = NULL) {
9 $this->pages = $pages;
10 $this->config = $config;
11 }
12
13 function getTabset($thispage) {
14 if (!isset($this->config)) return NULL;
15 foreach($this->config AS $set) {
16 if (in_array($thispage, $set, true)) {
17 return $set;
18 }
19 }
20 return NULL;
21 }
22
23 function isPortalized($thispage) {
24
25 foreach($this->config AS $set) {
26 if (in_array($thispage, $set, true)) {
27 return TRUE;
28 }
29 }
30 return FALSE;
31 }
32
33 function getLoginInfo($translator, $thispage) {
34 $info = array('info' => '', 'translator' => $translator, 'thispage' => $thispage);
35 SimpleSAML\Module::callHooks('portalLoginInfo', $info);
36 return $info['info'];
37 }
38
39 function getMenu($thispage) {
42 $tabset = $this->getTabset($thispage);
43 $logininfo = $this->getLoginInfo($t, $thispage);
44 $text = '';
45 $text .= '<ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">';
46 foreach($this->pages AS $pageid => $page) {
47
48 if (isset($tabset) && !in_array($pageid, $tabset, TRUE)) continue;
49 $name = 'uknown';
50 if (isset($page['text'])) $name = $page['text'];
51 if (isset($page['shorttext'])) $name = $page['shorttext'];
52
53 if (!isset($page['href'])) {
54 $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">' . $t->t($name) . '</a></li>';
55 } else if($pageid === $thispage ) {
56 $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">' . $t->t($name) . '</a></li>';
57 } else {
58 $text .= '<li class="ui-state-default ui-corner-top"><a href="' . $page['href'] . '">' . $t->t($name) . '</a></li>';
59 }
60
61 }
62 $text .= '</ul>';
63 if (!empty($logininfo)) {
64 $text .= '<p class="logininfo" style="text-align: right; margin: 0px">' . $logininfo . '</p>';
65 }
66
67 return $text;
68 }
69
70
71}
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:364
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:39
isPortalized($thispage)
Definition: Portal.php:23
getLoginInfo($translator, $thispage)
Definition: Portal.php:33
getTabset($thispage)
Definition: Portal.php:13
$translator
if($format !==null) $name
Definition: metadata.php:146
$info
Definition: index.php:5
$text
Definition: errorreport.php:18