当前位置: 首页>>代码示例>>PHP>>正文


PHP AjaxResponse::setResult方法代码示例

本文整理汇总了PHP中AjaxResponse::setResult方法的典型用法代码示例。如果您正苦于以下问题:PHP AjaxResponse::setResult方法的具体用法?PHP AjaxResponse::setResult怎么用?PHP AjaxResponse::setResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AjaxResponse的用法示例。


在下文中一共展示了AjaxResponse::setResult方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

    if (is_object($tree)) {
        foreach ($tree as $key => $value) {
            $tree->{$key} = translateTree($value);
        }
    } else {
        if (is_array($tree)) {
            // strings with arguments, like 'Found %d results'
            $tree = call_user_func_array("_mb", $tree);
        } else {
            if (is_string($tree)) {
                $tree = _mb($tree);
            }
        }
    }
    return $tree;
}
$ajaxResponse = new AjaxResponse($_POST);
switch ($ajaxResponse->getMethod()) {
    case "translate":
        $localeObj = new Mb_locale($ajaxResponse->getParameter("locale"));
        $msg_obj = $ajaxResponse->getParameter("data");
        $translated_obj = translateTree($msg_obj);
        $ajaxResponse->setSuccess(true);
        $ajaxResponse->setResult(array("data" => $translated_obj, "locale" => $localeObj->name));
        break;
    default:
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("An unknown error occured."));
        break;
}
$ajaxResponse->send();
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mb_i18n_server.php

示例2: IN

        $sql = <<<SQL
\t
SELECT mb_user_wmc.wmc_serial_id as wmc_id, mb_user_wmc.wmc_title, mb_user_wmc.wmc_timestamp, wmc_load_count.load_count FROM mb_user_wmc 
LEFT JOIN wmc_load_count ON wmc_load_count.fkey_wmc_serial_id = mb_user_wmc.wmc_serial_id WHERE wmc_serial_id IN ({$wmcList});

SQL;
        $res = db_query($sql);
        $resultObj = array("header" => array("WMC ID", "Titel", "Timestamp", "Load Count", ""), "data" => array());
        while ($row = db_fetch_row($res)) {
            // convert NULL to '', NULL values cause datatables to crash
            $walk = array_walk($row, create_function('&$s', '$s=strval($s);'));
            $link = "<a class='cancelClickEvent' target='_blank' href='../php/mod_showMetadata.php?" . "languageCode=" . Mapbender::session()->get("mb_lang") . "&resource=wmc&id=" . $row[0] . "'>" . _mb("Metadata") . "</a>";
            array_push($row, $link);
            $resultObj["data"][] = $row;
        }
        $ajaxResponse->setResult($resultObj);
        $ajaxResponse->setSuccess(true);
        break;
    case "getWmcMetadata":
        $wmcId = $ajaxResponse->getParameter("id");
        $sql = <<<SQL
\t
SELECT wmc_serial_id as wmc_id, abstract, wmc_title, 
wmc_timestamp, wmc_timestamp_create, wmc_public 
FROM mb_user_wmc WHERE wmc_serial_id = {$wmcId};

SQL;
        $res = db_query($sql);
        $row = db_fetch_assoc($res);
        $resultObj = array();
        $resultObj['wmc_id'] = $row['wmc_id'];
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mb_metadata_wmc_server.php

示例3: trim

     if (!$wfsConfIdString) {
         $ajaxResponse->setSuccess($false);
         $ajaxResponse->setMessage("missing wfsConfIdString");
         $ajaxResponse->send();
         break;
     }
     $wfsConfIdString = trim($wfsConfIdString, ',');
     $wfsConfIds = explode(',', $wfsConfIdString);
     $result = array();
     foreach ($wfsConfIds as $wfsId) {
         $currentWfsConf = WfsConfiguration::createFromDb($wfsId);
         if ($currentWfsConf !== null) {
             $result[] = $currentWfsConf;
         }
     }
     $ajaxResponse->setResult($result);
     $ajaxResponse->send();
     break;
 case "getWfsConfs":
     $currentUser = new User(Mapbender::session()->get("mb_user_id"));
     $wfsConfIds = $currentUser->getWfsConfByWfsOwner();
     if ($wfsConfIds === null) {
         $wfsConfIds = array();
     }
     $result = array();
     foreach ($wfsConfIds as $id) {
         $currentWfsConf = WfsConfiguration::createFromDb($id);
         if ($currentWfsConf !== null) {
             $result[] = $currentWfsConf;
         }
     }
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_wfs_conf_server.php

示例4: dirname

# and Simplified BSD license.
# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_wfs_conf.php";
$ajaxResponse = new AjaxResponse($_POST);
$myGui = $ajaxResponse->getParameter('gui');
$myWms = $ajaxResponse->getParameter('wms');
$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) {
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_wfsLayerObj_conf.php

示例5: foreach

    if (is_object($tree)) {
        foreach ($tree as $key => $value) {
            $tree->{$key} = translateTree($value);
        }
    } else {
        if (is_array($tree)) {
            foreach ($tree as $key => $value) {
                $tree[$key] = translateTree($value);
            }
        } else {
            if (is_string($tree)) {
                $tree = _mb($tree);
            }
        }
    }
    return $tree;
}
$ajaxResponse = new AjaxResponse($_POST);
switch ($ajaxResponse->getMethod()) {
    case "translateServiceData":
        $msg_obj = $ajaxResponse->getParameter("data");
        $translated_obj = translateTree($msg_obj);
        $ajaxResponse->setSuccess(true);
        $ajaxResponse->setResult($translated_obj);
        break;
    default:
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("An unknown error occured."));
        break;
}
$ajaxResponse->send();
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_wfs_gazetteer_l10n.php

示例6: array

                $relation_bbox_x = $extentx / $extenty;
                if ($relation_bbox_x <= $relation_px_x) {
                    $centerx = $minx + $extentx / 2;
                    $minx = $centerx - $relation_px_x * $extenty / 2;
                    $maxx = $centerx + $relation_px_x * $extenty / 2;
                }
                if ($relation_bbox_x > $relation_px_x) {
                    $centery = $miny + $extenty / 2;
                    $miny = $centery - $relation_px_y * $extentx / 2;
                    $maxy = $centery + $relation_px_y * $extentx / 2;
                }
                if ($currentEpsg->frameName) {
                    $epsgObj[$i] = array("frameName" => $currentEpsg->frameName, "newSrs" => $newSrs, "minx" => $minx, "miny" => $miny, "maxx" => $maxx, "maxy" => $maxy);
                } else {
                    $epsgObj[$i] = array("wms" => $currentEpsg->wms, "newSrs" => $newSrs, "minx" => $minx, "miny" => $miny, "maxx" => $maxx, "maxy" => $maxy);
                }
            } else {
                $ajaxResponse->setSuccess(false);
                $ajaxResponse->setMessage(_mb("An unknown error occured."));
                $ajaxResponse->send();
            }
        }
        $ajaxResponse->setSuccess(true);
        $ajaxResponse->setResult($epsgObj);
        break;
    default:
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("An unknown error occured."));
        break;
}
$ajaxResponse->send();
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_changeEPSG_server.php

示例7: 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();
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:intersection.php

示例8: trim

    //Mapbender::session()->set("mb_wmc",$wmc->xml);
    //$epsgTest=$wmc->mainMap->extent->toJavaScript();
    $epsgString = $wmc->mainMap->extentToJavascript();
    // get epsg code from jquery string
    preg_match('/EPSG:\\d{4,5}/', $epsgString, $matches);
    $epsgString = $matches[0];
    if (preg_match('/EPSG:\\d{4,5}/', $epsgString, $matches)) {
        $epsgString = $matches[0];
        $e = new mb_notice("epsg: " . $epsgString);
        $epsg = str_replace("EPSG:", "", $epsgString);
        Mapbender::session()->set("epsg", $epsg);
    }
    Mapbender::session()->set("previous_gui", Mapbender::session()->get("mb_user_gui"));
    $e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
    $ajaxResponse->setSuccess(true);
    $ajaxResponse->setResult(_mb("saved wmc document to session"));
} else {
    // insert WMC into database
    if (isset($attributes->title)) {
        $attributes->title = trim($attributes->title);
        if ($attributes->title == "") {
            $ajaxResponse->setSuccess(false);
            $ajaxResponse->setMessage(_mb("WMC document must have a title."));
            $ajaxResponse->send();
            exit;
        }
    } else {
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("WMC document must have a title."));
        $ajaxResponse->send();
        exit;
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_savewmc_server.php

示例9: Copyright

#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
# Copyright (C) 2002 CCGIS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# 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__) . "/../php/mb_validateSession.php";
$buttonObj = array();
$sql = "SELECT e_id, gettext(\$1, e_title) AS e_title FROM gui_element WHERE fkey_gui_id = \$2 AND e_element = 'img'";
$v = array(Mapbender::session()->get("mb_lang"), Mapbender::session()->get("mb_user_gui"));
$t = array("s", "s");
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
    array_push($buttonObj, array("id" => $row["e_id"], "title" => $row["e_title"]));
}
$ajaxResponse = new AjaxResponse($_REQUEST);
$ajaxResponse->setResult($buttonObj);
$ajaxResponse->send();
//$output = $json->encode($buttonObj);
//header("Content-type:text/plain; charset=utf-8");
//echo $output;
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_button_tooltips.php

示例10: AjaxResponse

//ajax wrapper for class_tou.php
$ajaxResponse = new AjaxResponse($_POST);
$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
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_acceptedTou_server.php

示例11: dirname

# 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 "translateServiceData":
        $msg_obj = $ajaxResponse->getParameter("data");
        $newMsgObj = array();
        if (is_array($msg_obj)) {
            foreach ($msg_obj as $wmsId => $wmsObj) {
                $newMsgObj[$wmsId] = array("title" => _mb($wmsObj->title), "layer" => array());
                if (is_array($msg_obj->layer)) {
                    foreach ($wmsObj->layer as $layerId => $layerObj) {
                        $newMsgObj[$wmsId]["layer"][$layerId] = array("title" => _mb($layerObj->title));
                    }
                }
            }
        }
        $ajaxResponse->setSuccess(true);
        $ajaxResponse->setResult($newMsgObj);
        break;
    default:
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("An unknown error occured."));
        break;
}
$ajaxResponse->send();
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mod_treefolder2_l10n.php


注:本文中的AjaxResponse::setResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。