- LSsession : Ajout de la méthode displayAjaxReturn()

This commit is contained in:
Benjamin Renard 2008-11-09 23:14:51 +00:00
parent 28f61580d9
commit e598212d76

View file

@ -947,6 +947,40 @@ class LSsession {
$GLOBALS['Smarty'] -> display($this -> template); $GLOBALS['Smarty'] -> display($this -> template);
} }
/**
* Affiche un retour Ajax
*
* @retval void
*/
function displayAjaxReturn($data=array()) {
$data['LSjsConfig'] = $this -> _JSconfigParams;
// Infos
if((!empty($_SESSION['LSsession_infos']))&&(is_array($_SESSION['LSsession_infos']))) {
$txt_infos="<ul>\n";
foreach($_SESSION['LSsession_infos'] as $info) {
$txt_infos.="<li>$info</li>\n";
}
$txt_infos.="</ul>\n";
$data['LSinfos'] = $txt_infos;
$_SESSION['LSsession_infos']=array();
}
if ($GLOBALS['LSerror']->errorsDefined()) {
$data['LSerror'] = $GLOBALS['LSerror']->getErrors();
}
if (isset($_REQUEST['imgload'])) {
$data['imgload'] = $_REQUEST['imgload'];
}
if (LSdebugDefined()) {
$data['LSdebug'] = LSdebug_print(true);
}
echo json_encode($data);
}
/** /**
* Retournne un template Smarty compilé * Retournne un template Smarty compilé
* *