2010-06-01 14:38:41 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-03-06 08:32:51 +01:00
|
|
|
* EGroupware API: JSON - Contains functions and classes for doing JSON requests.
|
2010-06-01 14:38:41 +02:00
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2010-06-16 08:44:19 +02:00
|
|
|
* @package api
|
2010-06-01 14:38:41 +02:00
|
|
|
* @subpackage ajax
|
2010-06-01 20:54:31 +02:00
|
|
|
* @author Andreas Stoeckel <as@stylite.de>
|
2010-06-01 16:20:55 +02:00
|
|
|
* @version $Id$
|
2010-06-01 14:38:41 +02:00
|
|
|
*/
|
|
|
|
|
2016-03-20 14:02:55 +01:00
|
|
|
use EGroupware\Api\Json;
|
2010-06-01 14:38:41 +02:00
|
|
|
|
2010-06-01 20:54:31 +02:00
|
|
|
/**
|
2016-03-20 14:02:55 +01:00
|
|
|
* Class handling JSON requests to the server
|
|
|
|
*
|
|
|
|
* @deprecated use Api\Json\Request
|
2010-06-01 20:54:31 +02:00
|
|
|
*/
|
2016-03-20 14:02:55 +01:00
|
|
|
class egw_json_request extends Json\Request {}
|
2014-08-22 16:29:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class used to send ajax responses
|
|
|
|
*/
|
2016-03-20 14:02:55 +01:00
|
|
|
class egw_json_response extends Json\Response
|
2014-08-22 16:29:18 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* xAjax compatibility function
|
|
|
|
*/
|
|
|
|
public function printOutput()
|
|
|
|
{
|
|
|
|
// do nothing, as output is triggered by egw::__destruct()
|
|
|
|
}
|
2010-06-01 14:38:41 +02:00
|
|
|
}
|
2010-06-09 15:46:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deprecated legacy xajax wrapper functions for the new egw_json interface
|
2016-03-20 14:02:55 +01:00
|
|
|
*
|
|
|
|
* @deprecated use Api\Json\Response methods
|
2010-06-09 15:46:35 +02:00
|
|
|
*/
|
2013-08-25 17:14:19 +02:00
|
|
|
class xajaxResponse
|
2010-06-09 15:46:35 +02:00
|
|
|
{
|
2013-08-25 17:14:19 +02:00
|
|
|
public function __call($name, $args)
|
2010-06-09 15:46:35 +02:00
|
|
|
{
|
2013-08-25 17:14:19 +02:00
|
|
|
if (substr($name, 0, 3) == 'add')
|
|
|
|
{
|
|
|
|
$name = substr($name, 3);
|
|
|
|
$name[0] = strtolower($name[0]);
|
|
|
|
}
|
|
|
|
return call_user_func_array(array(egw_json_response::get(), $name), $args);
|
2010-06-09 15:46:35 +02:00
|
|
|
}
|
|
|
|
|
2015-08-31 14:21:11 +02:00
|
|
|
public function addScriptCall()
|
2010-06-11 13:41:12 +02:00
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$func = array_shift($args);
|
|
|
|
|
2013-08-25 17:14:19 +02:00
|
|
|
return call_user_func(array(egw_json_response::get(), 'apply'), $func, $args);
|
2010-06-11 13:41:12 +02:00
|
|
|
}
|
|
|
|
|
2010-06-09 15:46:35 +02:00
|
|
|
public function getXML()
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
2010-06-10 08:59:54 +02:00
|
|
|
}
|