<?php /** * @file * phpAnvilTools Ajax Include * * @author Nick Slevkoff <*****@*****.**> * @copyright Copyright (c) 2010 Nick Slevkoff (http://www.slevkoff.com) * @license * This source file is subject to the new BSD license that is * bundled with this package in the file LICENSE.txt. It is also * available on the Internet at: http://www.phpanvil.com/LICENSE.txt * @ingroup phpAnvilTools anvilAjax */ require 'anvilAjax.class.php'; $objAjax = new anvilAjax(); //$agent = new Agent; if (isset($_POST['ata_afunc'])) { $ata_afunc = $_POST['ata_afunc']; } else { $ata_afunc = ""; } if (isset($_POST['ata_sfunc'])) { $ata_sfunc = $_POST['ata_sfunc']; } else { $ata_sfunc = ""; } if (isset($_POST['ata_event'])) { $ata_event = $_POST['ata_event']; } else { $ata_event = "";
public function processAjaxAction() { $objAjax = new anvilAjax(); $ajaxPacket = $_POST['request_packet']; $ajaxPacket = str_replace('\\"', '"', $ajaxPacket); $requestPacket = json_decode($ajaxPacket); foreach ($requestPacket as $ajaxRequest) { $moduleID = $ajaxRequest->moduleID; $moduleCode = $this->getModuleCode($moduleID); $moduleActionID = $ajaxRequest->moduleActionID; // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Processing Ajax Action (' . $moduleActionID . ') for Module (' . $moduleCode . ')', self::TRACE_TYPE_DEBUG); $this->_logVerbose('Processing Ajax Action (' . $moduleActionID . ') for Module (' . $moduleCode . ')'); $data['sourceID'] = $ajaxRequest->sourceID; $data['responseTargetID'] = $ajaxRequest->responseTargetID; $data['responseActionID'] = $ajaxRequest->responseActionID; $data['data'] = $ajaxRequest->data; $action = $this->prepareNewAction(SOURCE_TYPE_AJAX, $moduleID, $moduleActionID, $data); $return = $this->processAction($action); if (!empty($return)) { $objAjax->addResponse($ajaxRequest->sourceID, $ajaxRequest->responseActionID, $ajaxRequest->responseTargetID, $return); } } $objAjax->send(); return true; }