From e598212d767b1a72858188e4bc4e941121ab413b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 9 Nov 2008 23:14:51 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSsession=20:=20Ajout=20de=20la=20m=C3=A9th?= =?UTF-8?q?ode=20displayAjaxReturn()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/includes/class/class.LSsession.php | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 40b7a54d..a72c3b98 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -946,6 +946,40 @@ class LSsession { $this -> setTemplate('empty.tpl'); $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="\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é