本文整理汇总了PHP中AjaxResponse::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP AjaxResponse::setMessage方法的具体用法?PHP AjaxResponse::setMessage怎么用?PHP AjaxResponse::setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AjaxResponse
的用法示例。
在下文中一共展示了AjaxResponse::setMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
protected function error($msg)
{
$this->setNoRender();
$this->_request->setDispatched(true);
if ($this->_request->isXmlHttpRequest()) {
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$arp->setMessage($msg);
$this->json($arp);
} else {
$this->view->msg = $msg;
$this->renderScript('common/error.phtml');
}
}
示例2: dirname
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_gml2.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
$ajaxResponse = new AjaxResponse($_POST);
if ($ajaxResponse->getMethod() != "createUsemap") {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("method invalid");
$ajaxResponse->send();
exit;
}
$url = $ajaxResponse->getParameter('url');
//urldecode($_REQUEST["url"]);
$g = new gml2();
$g->parsegml($url);
$um_title = array();
$um_x = array();
$um_y = array();
for ($i = 0; $i < $g->getMemberCount(); $i++) {
$um_title[] = utf8_decode($g->getValueBySeparatedKey($i, "name"));
$um_x[] = $g->getXfromMemberAsString($i, 0);
$um_y[] = $g->getYfromMemberAsString($i, 0);
}
示例3: X
* @security_patch sqli done
*/
$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(" . pg_escape_string($x) . " " . pg_escape_string($y) . ")'," . pg_escape_string($oldEPSG) . ")," . pg_escape_string($newEPSG) . ")) as minx";
$resMinx = pg_query($con, $sqlMinx);
$minx = floatval(pg_fetch_result($resMinx, 0, "minx"));
$sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(" . pg_escape_string($x) . " " . pg_escape_string($y) . ")'," . pg_escape_string($oldEPSG) . ")," . pg_escape_string($newEPSG) . ")) as miny";
$resMiny = pg_query($con, $sqlMiny);
$miny = floatval(pg_fetch_result($resMiny, 0, "miny"));
}
return array("x" => $minx, "y" => $miny);
}
switch ($ajaxResponse->getMethod()) {
case "transform":
if (!Mapbender::postgisAvailable()) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage(_mb("PostGIS is not available. Please contact the administrator."));
$ajaxResponse->send();
}
$fromSrs = $ajaxResponse->getParameter("fromSrs");
$toSrs = $ajaxResponse->getParameter("toSrs");
$x = $ajaxResponse->getParameter("x");
$y = $ajaxResponse->getParameter("y");
$bboxStr = $ajaxResponse->getParameter("bbox");
$bbox = explode(",", $bboxStr);
$response = null;
$oldEPSG = preg_replace("/EPSG:/", "", $fromSrs);
$newEPSG = preg_replace("/EPSG:/", "", $toSrs);
if (!is_null($bbox) && is_array($bbox) && count($bbox) === 4) {
$response = array("newSrs" => $toSrs, "points" => array());
for ($i = 0; $i < count($bbox); $i += 2) {
$pt = transform(floatval($bbox[$i]), floatval($bbox[$i + 1]), $oldEPSG, $newEPSG);
示例4: response_expired
/**
* Set the response expired
*
* @param bool $inAjax
*
* @return void
*/
protected function response_expired($inAjax)
{
$message = "Your current session with this application has expired. Please refresh your browser window to continue.";
if ($inAjax) {
$ajax = new AjaxResponse();
$ajax->setMessage($message);
echo json_encode($ajax->m);
} else {
echo $message;
}
}
示例5: createFile
$fileId = createFile($data);
$e = new mb_exception("fileid " . $fileId);
if ($fileId == false) {
throw new Exception("Could not create file");
}
$url = "../tmp/{$fileId}";
$result = array('url' => $url);
break;
default:
throw new Exception("method invalid");
}
$ajaxResponse->setSuccess(true);
$ajaxResponse->setResult($result);
} catch (Exception $E) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage($E->getMessage() . " [" . $E->getLine() . "]");
}
$ajaxResponse->send();
} else {
if ($_SERVER['REQUEST_METHOD'] == "GET") {
ob_start();
$fileid = $_GET['file'];
header("Content-Type", "application/x-json");
header("Content-Disposition", "attachment; filename=\"" . $filename . "\"");
$result = file_get_contents(realpath(dirname(__FILE__) . "/../../http/tmp/{$id}"));
print $result;
ob_end_flush();
}
}
function createFile($data)
{
示例6: implode
$resultObj["original_featuretype_keyword"] = implode(", ", $keywords);
}
}
return $resultObj;
}
switch ($ajaxResponse->getMethod()) {
case "getOriginalMetadata":
$wfsId = $ajaxResponse->getParameter("id");
$featuretypeName = $ajaxResponse->getParameter("featuretypeName");
$sql = <<<SQL
\t
SELECT wfs_getcapabilities_doc FROM wfs WHERE wfs_id = {$wfsId};
SQL;
$res = db_query($sql);
$row = db_fetch_array($res);
$wfs_getcapabilities_doc = $row["wfs_getcapabilities_doc"];
if ($featuretypeName != "") {
$resultObj = getFeaturetypeMetadataFromXml($wfs_getcapabilities_doc, $featuretypeName);
} else {
$resultObj = getWfsMetadataFromXml($wfs_getcapabilities_doc);
}
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
default:
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage(_mb("An unknown error occured."));
break;
}
$ajaxResponse->send();
示例7: getWfsConfs
$myLayer = $ajaxResponse->getParameter('layer');
$myWfsConf = $ajaxResponse->getParameter('wfsConf');
try {
switch ($ajaxResponse->getMethod()) {
case "getWfsConfs":
$result = getWfsConfs($myGui);
$ajaxResponse->setSuccess(true);
$ajaxResponse->setResult($result);
break;
case "saveLayerWfsConnection":
$result = saveLayerWfsConnection($myWfsConf, $myGui, $myLayer);
if ($result === true) {
$ajaxResponse->setSuccess(true);
} else {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("An error occured performing UPDATE");
}
break;
default:
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("method invalid");
}
} catch (Exception $E) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("An error occured");
$e = new mb_exception("mod_wfsLayerObj_conf.php: " . $E->getMessage());
}
$ajaxResponse->send();
function getWfsConfs($myGui)
{
$user = new User($_SESSION["mb_user_id"]);
示例8: dirname
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require dirname(__FILE__) . "/mb_validateSession.php";
$epsgObj = array();
$ajaxResponse = new AjaxResponse($_POST);
switch ($ajaxResponse->getMethod()) {
case "changeEpsg":
if (!Mapbender::postgisAvailable()) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage(_mb("PostGIS is not available. Please contact the administrator."));
$ajaxResponse->send();
}
$epsgArray = $ajaxResponse->getParameter("srs");
$newSrs = $ajaxResponse->getParameter("newSrs");
for ($i = 0; $i < count($epsgArray); $i++) {
// check if parameters are valid geometries to
// avoid SQL injections
$currentEpsg = $epsgArray[$i];
$oldEPSG = preg_replace("/EPSG:/", "", $currentEpsg->epsg);
$newEPSG = preg_replace("/EPSG:/", "", $newSrs);
$extArray = explode(",", $currentEpsg->extent);
if (is_numeric($extArray[0]) && is_numeric($extArray[1]) && is_numeric($extArray[2]) && is_numeric($extArray[3]) && is_numeric($oldEPSG) && is_numeric($newEPSG)) {
$con = db_connect($DBSERVER, $OWNER, $PW);
$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(" . $extArray[0] . " " . $extArray[1] . ")'," . $oldEPSG . ")," . $newEPSG . ")) as minx";
$resMinx = db_query($sqlMinx);
示例9: dirname
require_once dirname(__FILE__) . "/../classes/class_administration.php";
$ajaxResponse = new AjaxResponse($_POST);
$json = new Mapbender_JSON();
$currentUser = new User();
$wmc = new wmc();
$resultObj = array();
switch ($ajaxResponse->getMethod()) {
case 'checkConstraints':
$resultObj = Mapbender::session()->get("wmcConstraints");
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
case 'deleteWmc':
if (Mapbender::session()->exists("mb_wmc")) {
Mapbender::session()->delete("mb_wmc");
$ajaxResponse->setMessage(_mb("WMC in session reset."));
$ajaxResponse->setSuccess(true);
} else {
$ajaxResponse->setMessage(_mb("No WMC in session found."));
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(false);
}
break;
case 'updateWmc':
if (!Mapbender::session()->exists("wmcGetApi") || !is_a(Mapbender::session()->get("wmcGetApi"), "wmc")) {
$ajaxResponse->setMessage(_mb("No WMC in session."));
$ajaxResponse->setSuccess(true);
break;
}
$wmc = Mapbender::session()->get("wmcGetApi");
$skipWms = $ajaxResponse->getParameter("wmsIndices");
示例10: dirname
/*
* License:
* Copyright (c) 2009, Open Source Geospatial Foundation
* This program is dual licensed under the GNU General Public License
* and Simplified BSD license.
* http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
*/
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_wmc.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
require_once dirname(__FILE__) . "/../classes/class_lzw_decompress.php";
$ajaxResponse = new AjaxResponse($_POST);
if ($ajaxResponse->getMethod() != "saveWMC") {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("method invalid");
$ajaxResponse->send();
exit;
}
$json = new Mapbender_JSON();
// get data from POST and SESSION
$userId = Mapbender::session()->get("mb_user_id");
$mapObject = $ajaxResponse->getParameter('mapObject');
$lzwCompressed = $ajaxResponse->getParameter('lzwCompressed');
$saveInSession = $ajaxResponse->getParameter('saveInSession');
$extensionData = $json->decode($ajaxResponse->getParameter('extensionData'));
$attributes = $ajaxResponse->getParameter('attributes');
$overwrite = $ajaxResponse->getParameter('overwrite');
$overwrite = $overwrite == "1" ? true : false;
//for debugging, write mapObject to file
if ($lzwCompressed == 'true') {
示例11: dirname
<?php
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_connector.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_stripRequest.php";
require_once dirname(__FILE__) . "/../classes/class_weldMaps2JPEG.php";
$ajaxResponse = new AjaxResponse($_REQUEST);
$wmcId = $ajaxResponse->getParameter("wmcId");
$mapUrls = $ajaxResponse->getParameter("mapUrls");
if (!$wmcId) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage('wmcId not set');
$ajaxResponse->send();
}
if (!$mapUrls) {
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage('mapURLs not set');
$ajaxResponse->send();
}
switch ($ajaxResponse->getMethod()) {
case "saveWmcPreview":
//check if all urls have been send - sometimes only false is send - then delete this entry!
//loop
$mapUrlsNew = array();
$problemUrls = array();
for ($i = 0; $i < count($mapUrls); $i++) {
if ($mapUrls[$i] != 'false') {
$mapUrlsNew[] = $mapUrls[$i];
} else {
$problemUrls[] = $i;
示例12: signInAction
public function signInAction()
{
if (!$this->_request->isXmlHttpRequest()) {
return;
}
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$email = trim($this->_getParam('email'));
$password = trim($this->_getParam('password'));
if (empty($email) || empty($password)) {
$arp->setMessage('E-mail and password can not be empty.');
$this->json($arp);
return;
}
$hashedPassword = hash('sha256', $password);
$user = new Model_User($email);
if (!$user->exists() || $user->get('password') != $hashedPassword) {
$arp->setMessage('Authentication failed, You entered an incorrect username, or password.');
$this->json($arp);
return;
}
$this->setLoginCookie($email, $hashedPassword);
$arp->setStatus(AjaxResponse::STATUS_OK);
$this->json($arp);
}
示例13: tou
$json = new Mapbender_JSON();
$touObject = new tou();
//$currentUser = new User();
//$wmc = new wmc();
$resultObj = array();
//obj structure in session for acceptedTou (see class_tou.php):
//acceptedTou {
// wms [100,101,112],
// wfs [12,34]
// }
switch ($ajaxResponse->getMethod()) {
case 'checkAcceptedTou':
$result = $touObject->check($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId"));
$ajaxResponse->setResult($result['accepted']);
//1 or 0
$ajaxResponse->setMessage(_mb($result['message']));
$ajaxResponse->setSuccess(true);
break;
case 'setAcceptedTou':
$serviceType = $ajaxResponse->getParameter("serviceType");
$serviceId = $ajaxResponse->getParameter("serviceId");
$result = $touObject->set($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId"));
$ajaxResponse->setResult($result['setTou']);
//1 or 0
$ajaxResponse->setMessage(_mb($result['message']));
$ajaxResponse->setSuccess(true);
break;
// Invalid command
// Invalid command
default:
$ajaxResponse->setMessage(_mb("No method specified."));
示例14: createWPSRequest
<?php
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
$ajaxResponse = new AjaxResponse($_POST);
switch ($ajaxResponse->getMethod()) {
case "createWPSRequest":
$templatefilePath = realpath(dirname(__FILE__) . "/../../resources/wps_template.xml");
$parameters = $ajaxResponse->getParameter('attributes');
try {
$result = createWPSRequest($parameters, $templatefilePath);
$ajaxResponse->setSuccess(true);
$ajaxResponse->setResult($result);
} catch (Exception $E) {
$ajaxResponse->setSuccess(true);
$ajaxResponse->setMessage($E->getMessage);
}
break;
default:
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage("method invalid");
}
$ajaxResponse->send();
/*
* @params parameters an assoc array containing parameters with wich to create a WPS request
* @return a WPS XML document
*/
function createWPSRequest($parameters, $templatefilePath)
{
// check and give parameters default values
// need this collection to be subscriptable
示例15: switch
try {
switch ($method) {
case "intersect":
$geometries = $request->getParameter("geometries");
$clickPoint = $request->getparameter("clickPoint");
$resultGeometries = array();
$i = 0;
foreach ($geometries as $geometry) {
$sql = "SELECT ST_Intersects ('{$clickPoint}'::geometry, '{$geometry}'::geometry);";
$dbresult = db_query($sql);
$row = db_fetch_array($dbresult);
$result = $row["st_intersects"] == "f" ? false : true;
if ($result) {
$resultGeometries[$i] = $geometry;
}
$i++;
}
$request->setSuccess(true);
$request->setResult(array("geometries" => $resultGeometries));
break;
default:
$e = new mb_exception(__FILE__ . ": RPC called with invalid Method '{$method}'");
$request->setSuccess(false);
$request->setMessage(__FILE__ . ": RPC called with invalid Method '{$method}'");
}
} catch (Exception $E) {
$e = new mb_exception(__FILE__ . ": RPC failed. Exception: '{$E}'");
$request->setSuccess(false);
$request->setMessage(__FILE__ . ": RPC failed. Exception: '{$E}'");
}
$request->send();