From e7a8dad4dd3ec69e2ae71c015f4ab61e8b4cda2e Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 9 Jun 2008 08:05:15 +0000
Subject: [PATCH] Add support for icons in discovery service.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@619 44740490-163a-0410-bde0-09ae8108e29a
---
 templates/default/selectidp-links.php | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/templates/default/selectidp-links.php b/templates/default/selectidp-links.php
index db9e9cde8..e57cdf6d0 100644
--- a/templates/default/selectidp-links.php
+++ b/templates/default/selectidp-links.php
@@ -15,7 +15,14 @@
 			$idpentry = $this->data['idplist'][$this->data['preferredidp']];
 			echo '<div class="preferredidp">';
 			echo '	<img src="/' . $this->data['baseurlpath'] .'resources/icons/star.png" style="float: right" />';
-			echo '	<h3>' . htmlspecialchars($idpentry['name']) . '</h3>';
+
+			echo '	<h3>';
+			if(array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) {
+				$iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']);
+				echo '<img style="display: inline" src="' . htmlspecialchars($iconUrl) . '" />';
+			}
+			echo htmlspecialchars($idpentry['name']) . '</h3>';
+
 			echo '	<p>' . htmlspecialchars($idpentry['description']) . '<br />';
 			echo '	[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			echo '</div>';
@@ -24,7 +31,13 @@
 		
 		foreach ($this->data['idplist'] AS $idpentry) {
 			if ($idpentry['entityid'] != $this->data['preferredidp']) {
-				echo '<h3>' . htmlspecialchars($idpentry['name']) . '</h3>';
+				echo '	<h3>';
+				if(array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) {
+					$iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']);
+					echo '<img style="display: inline" src="' . htmlspecialchars($iconUrl) . '" />';
+				}
+				echo htmlspecialchars($idpentry['name']) . '</h3>';
+
 				echo '<p>' . htmlspecialchars($idpentry['description']) . '<br />';
 				echo '[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			}
-- 
GitLab