<?php
# ************** LICENCE ****************
/*
	Copyright (c) PORTANEO.
*/
# ***************************************
# POSH Widgets management mobile - XML widget informations
#
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
# ***************************************

$folder="../includes/plugins/mobile/admin/";
$not_access=1;
$granted="A";
$pagename="../includes/plugins/mobile/admin/xml_loadwidget.php";

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

//control that the current administrator has access to the script
$grantedCalls = array("modulestab");
require('../../../../admin/adm_ctrl_access.php');

$file=new xmlFile();

$file->header("widgets");

$id=$_GET["id"];

$nbIcons = 0;
$dirname = '../images/icons/';
$dir_handle = opendir($dirname);
while($entry = readdir($dir_handle)) {
    if(is_file($dirname.'/'.$entry))
        $nbIcons++;
}
closedir($dir_handle);

$DB->getResults($widgets_mob_getWidget,$DB->escape($id));
$row = $DB->fetch(0);
echo "<widget>";
echo "<id>".$row["id"]."</id>";
echo "<name><![CDATA[".$row["name"]."]]></name>";
echo "<title><![CDATA[".$row["title"]."]]></title>";
echo "<picture><![CDATA[".$row["picture"]."]]></picture>";
echo "<available>".$row["available"]."</available>";
echo "<nbicons>".$nbIcons."</nbicons>";
echo "</widget>";
$DB->freeResults();

$file->footer("widgets");
?>