<?php
	include '../../autoload.php';
	
	$id=$_POST['id'];
	if(!isset($_SESSION['language']))
		$_SESSION['language']="FR";
	$language=$_SESSION['language'];
	
	$conn = get_dbconnection();
	$sql = "select id, type, name_fr from procedure";
	
	/*
	$answer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>";
	*/
	
	$answer = "<proclist>";
	
	$query = pg_query ( $conn, $sql );
	if ( $query )
	{
		while ($row = pg_fetch_row($query))
		{
			// $answer.= "<id>".htmlspecialchars 		( $row[1], ENT_XML1, 'UTF-8' )."</id>";
			// $answer.= "<type>".htmlspecialchars		( $row[2], ENT_XML1, 'UTF-8' )."</type>";
			// $answer.= "<name_fr>".htmlspecialchars	( $row[2], ENT_XML1, 'UTF-8' )."</name_fr>";
			
			$answer.="<procedure id=\"".$row[0]."\" type=\"".htmlspecialchars 		( $row[1], ENT_XML1 )."\" name_fr=\"".htmlspecialchars 		( $row[2], ENT_XML1 )."\"></procedure>";
			// $answer.="<procedure id=\"".htmlspecialchars 		( $row[1], ENT_XML1)."\" type=\"aaaa\"></procedure>";
		}
	}
	
	/*
	$answer.="</root>";
	*/
	
	$answer.="</proclist>";
	
	/*
	$answer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>hi</root>";
	*/
	
	header('Content-Type: text/xml');
	echo $answer;
?>