<?php
# ************** LICENCE *******************************************************
/*
	Copyright (c) PORTANEO.

	This file is part of POSH (Portaneo Open Source Homepage) http://sourceforge.net/projects/posh/.

	POSH is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version

	POSH is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Posh.  If not, see <http://www.gnu.org/licenses/>.
*/
# *********************************************************************************
# POSH User management - User modification and adding form
#
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
# *********************************************************************************
/**
*
* \brief Get all specific users profile information (job,country...)
*
*   return xml file
*
*  \relatesalso
*   ajax.js
*   $p.app.connection.loadMenuCriterias
*   $p.network.modifyCriteria
*
* !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
*
**/
$folder="";
$not_access=0;
$granted="I";
$pagename="portal/xmldisplayhtmlcriteria.php";
//$info="";
$nb=0;
$total=1;

//includes
require_once('includes.php');
require_once('../includes/xml.inc.php');

$file=new xmlFile();
$file->header("htmlcriterias");

if (isset($_SESSION['user_id']))
$DB->getResults($criteria_getInformationsForUser,$DB->escape($_SESSION['user_id']));
else
$DB->getResults($criteria_getInformations);
if ($DB->nbResults()!=0) {
    $nb = $DB->nbResults();
}

echo "<nbcriterias>".$nb."</nbcriterias>";

if ($nb>0) {
    while ($row=$DB->fetch(0)) {
        $infoID=$row["id"];
        $type=$row["type"];
        $label=$row["label"];
        $options=$row["options"];
        $mandatory=$row["mandatory"];
        
        echo "<criteria>";
        echo "<id>".$infoID."</id>";
        echo "<type>".$type."</type>";
        echo "<label><![CDATA[".$label."]]></label>";
        echo "<options><![CDATA[".$options."]]></options>";
        echo "<mandatory>".$mandatory."</mandatory>";
        echo "</criteria>";
    }  
    $DB->freeResults();
}

$file->footer(); 
?>