* @package simpleSAMLphp */ class sspmod_aggregator_ARP { private $metadata; private $attributes; private $prefix; private $suffix; /** * Constructor * * @param */ public function __construct($metadata, $attributemap, $prefix, $suffix) { $this->metadata = $metadata; $this->prefix = $prefix; $this->suffix = $suffix; if (isset($attributemap)) $this->loadAttributeMap($attributemap); } private function loadAttributeMap($attributemap) { $config = SimpleSAML_Configuration::getInstance(); include($config->getPathValue('attributemap', 'attributemap/') . $attributemap . '.php'); $this->attributes = $attributemap; # print_r($attributemap); exit; } private function surround($name) { $ret = ''; if (!empty($this->prefix)) $ret .= htmlspecialchars($this->prefix); $ret .= $name; if (!empty($this->suffix)) $ret .= htmlspecialchars($this->suffix); return $ret; } private function getAttributeID($name) { if (empty($this->attributes)) { return $this->surround($name); } if (array_key_exists($name, $this->attributes)) { return $this->surround($this->attributes[$name]); } return $this->surround($name); } public function getXML() { $xml = ' '; foreach($this->metadata AS $metadata) { #echo '
'; print_r($metadata); # exit;
			if (isset($metadata['saml20-sp-remote'])) {
				#echo '
'; print_r($metadata); exit;
				$xml .= $this->getEntryXML($metadata['saml20-sp-remote']);
			}
			
		}
		
		$xml .= '';
		return $xml;
	}

	private function getEntryXML($entry) {
		$entityid = $entry['entityid'];
		return '	
		
' . $this->getEntryXMLcontent($entry) . '
	
';
	}
	
	private function getEntryXMLcontent($entry) {
		$ids = array();
		if (!array_key_exists('attributes', $entry)) 
			return '';
		
		$ret = '';
		foreach($entry['attributes'] AS $a) {
			
			$ret .= '			
				
			
';
			
		}
		return $ret;
	}

}