Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit a092299

Browse files
BaranekDvyskocilpavel
authored andcommitted
Added disco-tpl template file
1 parent dcda7a8 commit a092299

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ All notable changes to this project will be documented in this file.
4242
- sspmod_perun_IdpListsServiceDB to SimpleSAML\Module\perun\IdpListsServiceDB
4343
- sspmod_perun_LdapConnector to SimpleSAML\Module\perun\LdapConnector
4444
- sspmod_perun_RpcConnector to SimpleSAML\Module\perun\RpcConnector
45+
- Added disco-tpl template file
4546

4647
[Fixed]
4748
- Fixed the bug generating Array to string conversion Exception in PerunAttributes,

templates/disco-tpl.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
use SimpleSAML\Module\perun\DiscoTemplate;
4+
5+
/**
6+
* This is simple example of template for perun Discovery service
7+
*
8+
* Allow type hinting in IDE
9+
* @var DiscoTemplate $this
10+
*/
11+
12+
$this->includeAtTemplateBase('includes/header.php');
13+
14+
if (!empty($this->getPreferredIdp())) {
15+
echo '<h4>' . $this->t('{perun:perun:disco-tpl_previous-selection}') . '</h4>' .
16+
'<div class="metalist list-group">' .
17+
buildEntry($this, $this->getPreferredIdp(), true) .
18+
'</div>' .
19+
'<p style="text-align: center"> - ' . $this->t('{perun:perun:disco-tpl_or}') . ' - </p>';
20+
}
21+
22+
echo '<h4>' . $this->t('{perun:perun:disco-tpl_institutional-account}') . '</h4>';
23+
24+
foreach ($this->getTaggedIdps() as $tag => $idplist) {
25+
echo $tag;
26+
echo '<div class="metalist list-group" id="list">';
27+
foreach ($idplist as $idpentry) {
28+
echo buildEntry($this, $idpentry);
29+
}
30+
echo '</div>';
31+
}
32+
33+
$this->includeAtTemplateBase('includes/footer.php');
34+
35+
function buildEntry(DiscoTemplate $t, $idp, $favourite = false)
36+
{
37+
38+
$extra = ($favourite ? 'favourite' : '');
39+
$html = '<a class="metaentry ' . $extra . ' list-group-item" ' .
40+
' href="' . $t->getContinueUrl($idp['entityid']) . '">';
41+
42+
$html .= '<strong>' . htmlspecialchars($t->getTranslatedEntityName($idp)) . '</strong>';
43+
$html .= '</a>';
44+
45+
return $html;
46+
}

0 commit comments

Comments
 (0)