ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
disco.tpl.php
Go to the documentation of this file.
1 <?php
2 
3 if(!array_key_exists('header', $this->data)) {
4  $this->data['header'] = 'selectidp';
5 }
6 $this->data['header'] = $this->t($this->data['header']);
7 $this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE);
8 
9 $this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('discopower/style.css') . '" />';
10 
11 $this->data['head'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleUrl('discopower/js/jquery.livesearch.js') . '"></script>';
12 $this->data['head'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleUrl('discopower/js/' . $this->data['score'] . '.js') . '"></script>';
13 
14 $this->data['head'] .= '<script type="text/javascript">
15 
16 $(document).ready(function() {
17  $("#discotabs").tabs({ selected: ' . $this->data['defaulttab'] . ' }); ';
18 
19 $i = 0;
20 foreach ($this->data['idplist'] AS $tab => $slist) {
21  $this->data['head'] .= "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' .
22  (($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '') .
23  ';';
24 
25 
26 }
27 
28 $this->data['head'] .= '
29 });
30 
31 </script>';
32 
33 
34 
35 
36 
37 if (!empty($this->data['faventry'])) $this->data['autofocus'] = 'favouritesubmit';
38 
39 $this->includeAtTemplateBase('includes/header.php');
40 
41 function showEntry($t, $metadata, $favourite = FALSE) {
42 
43  $basequerystring = '?' .
44  'entityID=' . urlencode($t->data['entityID']) . '&amp;' .
45  'return=' . urlencode($t->data['return']) . '&amp;' .
46  'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&amp;idpentityid=';
47 
48  $extra = ($favourite ? ' favourite' : '');
49  $html = '<a class="metaentry' . $extra . '" href="' . $basequerystring . urlencode($metadata['entityid']) . '">';
50 
51  $html .= '' . htmlspecialchars(getTranslatedName($t, $metadata)) . '';
52 
53  if(array_key_exists('icon', $metadata) && $metadata['icon'] !== NULL) {
55  $html .= '<img alt="Icon for identity provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />';
56  }
57 
58  $html .= '</a>';
59 
60  return $html;
61 }
62 
63 ?>
64 
65 
66 
67 
68 <?php
69 
71  if (isset($metadata['UIInfo']['DisplayName'])) {
72  $displayName = $metadata['UIInfo']['DisplayName'];
73  assert('is_array($displayName)'); // Should always be an array of language code -> translation
74  if (!empty($displayName)) {
75  return $t->getTranslator()->getPreferredTranslation($displayName);
76  }
77  }
78 
79  if (array_key_exists('name', $metadata)) {
80  if (is_array($metadata['name'])) {
81  return $t->getTranslator()->getPreferredTranslation($metadata['name']);
82  } else {
83  return $metadata['name'];
84  }
85  }
86  return $metadata['entityid'];
87 }
88 
89 
90 
91 
92 if (!empty($this->data['faventry'])) {
93 
94 
95  echo('<div class="favourite">');
96  echo($this->t('previous_auth'));
97  echo(' <strong>' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '</strong>');
98  echo('
99  <form id="idpselectform" method="get" action="' . $this->data['urlpattern'] . '">
100  <input type="hidden" name="entityID" value="' . htmlspecialchars($this->data['entityID']) . '" />
101  <input type="hidden" name="return" value="' . htmlspecialchars($this->data['return']) . '" />
102  <input type="hidden" name="returnIDParam" value="' . htmlspecialchars($this->data['returnIDParam']) . '" />
103  <input type="hidden" name="idpentityid" value="' . htmlspecialchars($this->data['faventry']['entityid']) . '" />
104 
105  <input type="submit" name="formsubmit" id="favouritesubmit" value="' . $this->t('login_at') . ' ' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '" />
106  </form>');
107 
108  echo('</div>');
109 }
110 
111 
112 ?>
113 
114 
115 
116 
117 
118 
119 <div id="discotabs">
120 
121  <ul class="tabset_tabs">
122  <?php
123 
124  $tabs = array_keys( $this->data['idplist']);
125  foreach ($tabs AS $tab) {
126  if(!empty($this->data['idplist'][$tab])) {
127  echo '<li><a href="#' . $tab . '"><span>' . $this->t($this->data['tabNames'][$tab]) . '</span></a></li> ';
128  }
129  }
130 
131  ?>
132  </ul>
133 
134 
135 <?php
136 
137 
138 
139 
140 foreach( $this->data['idplist'] AS $tab => $slist) {
141 
142  echo '<div id="' . $tab . '">';
143 
144  if (!empty($slist)) {
145 
146  echo(' <div class="inlinesearch">');
147  echo(' <p>Incremental search...</p>');
148  echo(' <form id="idpselectform" action="?" method="get"><input class="inlinesearchf" type="text" value="" name="query_' . $tab . '" id="query_' . $tab . '" /></form>');
149  echo(' </div>');
150 
151  echo(' <div class="metalist" id="list_' . $tab . '">');
152  if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) {
153  $idpentry = $slist[$this->data['preferredidp']];
154  echo (showEntry($this, $idpentry, TRUE));
155  }
156 
157  foreach ($slist AS $idpentry) {
158  if ($idpentry['entityid'] != $this->data['preferredidp']) {
159  echo (showEntry($this, $idpentry));
160  }
161  }
162  echo(' </div>');
163  }
164  echo '</div>';
165 
166 }
167 
168 ?>
169 
170 
171 
172 </div>
173 
174 
175 <?php $this->includeAtTemplateBase('includes/footer.php');
getTranslatedName($t, $metadata)
Definition: disco.tpl.php:70
$slist
Definition: registry.php:43
$metadata['__DYNAMIC:1__']
if(!array_key_exists('header', $this->data)) $this data['header']
Definition: disco.tpl.php:6
static resolveURL($url, $base=null)
Resolve a (possibly relative) URL relative to a given base URL.
Definition: HTTP.php:1026
Create styles array
The data for the language used.
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
showEntry($t, $metadata, $favourite=FALSE)
Definition: disco.tpl.php:41
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87