ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
selectidp-dropdown.php
Go to the documentation of this file.
1<?php
2
3if (!array_key_exists('header', $this->data)) {
4 $this->data['header'] = 'selectidp';
5}
6$this->data['header'] = $this->t($this->data['header']);
7$this->data['autofocus'] = 'dropdownlist';
8$this->includeAtTemplateBase('includes/header.php');
9
10foreach ($this->data['idplist'] as $idpentry) {
11 if (!empty($idpentry['name'])) {
12 $this->getTranslator()->includeInlineTranslation(
13 'idpname_'.$idpentry['entityid'],
14 $idpentry['name']
15 );
16 } elseif (!empty($idpentry['OrganizationDisplayName'])) {
17 $this->getTranslator()->includeInlineTranslation(
18 'idpname_'.$idpentry['entityid'],
19 $idpentry['OrganizationDisplayName']
20 );
21 }
22 if (!empty($idpentry['description'])) {
23 $this->getTranslator()->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
24 }
25}
26?>
27 <h2><?php echo $this->data['header']; ?></h2>
28 <p><?php echo $this->t('selectidp_full'); ?></p>
29 <form method="get" action="<?php echo $this->data['urlpattern']; ?>">
30 <input type="hidden" name="entityID" value="<?php echo htmlspecialchars($this->data['entityID']); ?>"/>
31 <input type="hidden" name="return" value="<?php echo htmlspecialchars($this->data['return']); ?>"/>
32 <input type="hidden" name="returnIDParam"
33 value="<?php echo htmlspecialchars($this->data['returnIDParam']); ?>"/>
34 <select id="dropdownlist" name="idpentityid">
35 <?php
36 /*
37 * TODO: change this to use $this instead when PHP 5.4 is the minimum requirement.
38 *
39 * This is a dirty hack because PHP 5.3 does not allow the use of $this inside closures. Therefore, the
40 * translation function must be passed somehow inside the closure. PHP 5.4 allows using $this, so we can
41 * then go back to the previous behaviour.
42 */
43 $GLOBALS['__t'] = $this;
44 usort($this->data['idplist'], function ($idpentry1, $idpentry2) {
45 return strcmp(
46 $GLOBALS['__t']->t('idpname_'.$idpentry1['entityid']),
47 $GLOBALS['__t']->t('idpname_'.$idpentry2['entityid'])
48 );
49 });
50 unset($GLOBALS['__t']);
51
52 foreach ($this->data['idplist'] as $idpentry) {
53 echo '<option value="'.htmlspecialchars($idpentry['entityid']).'"';
54 if (isset($this->data['preferredidp']) && $idpentry['entityid'] == $this->data['preferredidp']) {
55 echo ' selected="selected"';
56 }
57 echo '>'.htmlspecialchars($this->t('idpname_'.$idpentry['entityid'])).'</option>';
58 }
59 ?>
60 </select>
61 <button class="btn" type="submit"><?php echo $this->t('select'); ?></button>
62 <?php
63 if ($this->data['rememberenabled']) {
64 echo('<br/><input type="checkbox" name="remember" value="1" />'.$this->t('remember'));
65 }
66 ?>
67 </form>
68<?php $this->includeAtTemplateBase('includes/footer.php');
An exception for terminatinating execution or to throw for unit testing.
if(!array_key_exists('header', $this->data)) $this data['header']
$GLOBALS['__t']