<?php
	require_once '../../autoload.php';

	$type 	= -1;

	if ( isset($_GET['type']) )
		$type	= $_GET['type'];

	$type = ($type == -1)? "" : $type;
		
	$conn = get_dbconnection();
	
	$answer = "<results>";
	
	if ( $conn )
	{
		$sql = "select id,name from institution where removed=false";

		if ( $query = pg_query($conn,$sql) )
		{
			while ( $row = pg_fetch_row($query) )
			{
				$answer .= "<institution id=\"".$row[0]."\" name=\"".$row[1]."\"></institution>";
			}
		}
	}
	
	$answer .= "</results>";

	header ('Content-type: text/xml' );
	
	echo $answer;
?>