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


PHP xajaxResponse::loadCommands方法代码示例

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


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

示例1: showOutput

function showOutput()
{
    $testResponse = new xajaxResponse();
    $testResponse->alert("Hello");
    $testResponse2 = new xajaxResponse();
    $testResponse2->loadCommands($testResponse);
    $testResponse2->replace("this", "is", "a", "replacement]]>");
    $testResponseOutput = htmlspecialchars($testResponse2->getOutput());
    $objResponse = new xajaxResponse();
    $objResponse->assign("submittedDiv", "innerHTML", $testResponseOutput);
    $aValues = array();
    $aValues[] = "Yippie";
    $objResponse->setReturnValue($aValues);
    return $objResponse;
}
开发者ID:silvia-valdez,项目名称:SignalsViewer,代码行数:15,代码来源:xajaxResponseTest.php

示例2: xajaxDispatch

 function xajaxDispatch()
 {
     # MVC initalization script
     if (!defined('MVC_FRAMEWORK')) {
         require dirname(dirname(__FILE__)) . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
     }
     $objResponse = new xajaxResponse();
     # Debug
     if (S2_DEBUG == 0) {
         error_reporting(0);
     }
     # Function parameters
     $args = func_get_args();
     $controllerName = (string) array_shift($args);
     $action = (string) array_shift($args);
     $app = isset($args[0]) && is_string($args[0]) ? array_shift($args) : 'jreviews';
     App::import('Controller', $controllerName, $app);
     # remove admin path from controller name
     $controllerClass = inflector::camelize(str_replace(MVC_ADMIN . _DS, '', $controllerName)) . 'Controller';
     $controller = new $controllerClass($app);
     $controller->app = $app;
     $controller->passedArgs = array();
     if (isset($args[0])) {
         $post = S2Dispatcher::parseParamsAjax($args[0]);
         if (isset($post['data'])) {
             // pass form inputs to controller variable
             $rawData = $post['data'];
             $data = Sanitize::clean($post['data']);
             $data['__raw'] = $rawData;
             $controller->data = $data;
         }
         $controller->passedArgs = $post;
         $controller->params = $post;
     }
     $controller->name = $controllerName;
     $controller->action = $action;
     $controller->autoLayout = false;
     $controller->autoRender = false;
     $controller->xajaxRequest = true;
     $controller->__initComponents();
     if (method_exists($controller, 'beforeFilter')) {
         $controller->beforeFilter();
     }
     $objResponse->loadCommands($controller->{$action}($args));
     return $objResponse;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:46,代码来源:xajax.jreviews.php

示例3: xajaxResponse

 function _delete($params)
 {
     // For compat with xajax
     if ($this->xajaxRequest) {
         $xajax = new xajaxResponse();
         $xajax->loadCommands($this->{$this->action . 'Xajax'}($params));
         return $xajax;
     }
     $this->autoRender = false;
     $this->autoLayout = false;
     $response = array();
     $listing_id = $this->data['Listing']['id'] = Sanitize::getInt($this->params, 'id');
     # Check if listing_id is valid
     if ($listing_id == 0) {
         return $this->ajaxError(s2Messages::accessDenied());
     }
     # Load current listing author id
     $query = "SELECT Listing.created_by, Listing.images FROM #__content AS Listing WHERE Listing.id = " . $listing_id;
     $this->_db->setQuery($query);
     $row = end($this->_db->loadAssocList());
     # Check access
     if (!$this->Access->canDeleteListing($row['created_by'])) {
         return $this->ajaxError(s2Messages::accessDenied());
     }
     $this->data['Listing']['images'] = $row['images'];
     # Delete listing and all associated records and images
     if ($this->Listing->delete($this->data)) {
         $msg = __t("The listing has been removed.", true);
         $response[] = "jQuery('#jr_listing_manager{$listing_id}').hide('fast').html('{$msg}').fadeIn(1000).effect('highlight',{},5000);";
         return $this->ajaxResponse($response);
     }
     return $this->ajaxError(s2Messages::submitErrorDb());
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:33,代码来源:listings_controller.php

示例4: VotesController

 function _vote()
 {
     App::import('Controller', 'votes', 'jreviews');
     $Votes = new VotesController('jreviews');
     $data = array('Vote' => array('review_id' => $this->data['review_id'], 'vote_yes' => $this->data['action'] ? 1 : 0, 'vote_no' => $this->data['action'] ? 0 : 1));
     $Votes->data = $data;
     $xajax = new xajaxResponse();
     $xajax->loadCommands($Votes->_save());
     return $xajax;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:reviews_controller.php

示例5: xajaxResponse

 function _favoritesDelete()
 {
     // For compat with xajax
     if ($this->xajaxRequest) {
         $xajax = new xajaxResponse();
         $xajax->loadCommands($this->{$this->action . 'Xajax'}());
         return $xajax;
     }
     $this->autoRender = false;
     $this->autoLayout = false;
     $response = array();
     if (!$this->_user->id) {
         return $this->ajaxError(s2Messages::accessDenied());
     }
     $listing_id = Sanitize::getInt($this->data, 'listing_id');
     $user_id = $this->_user->id;
     // Get favored count
     $favored = $this->Favorite->getCount($listing_id);
     if ($favored > 0) {
         // Force plugin loading on Review model
         $this->_initPlugins('Favorite');
         $this->Favorite->data = $this->data;
         // Delete favorite
         $deleted = $this->Favorite->delete($listing_id, $user_id);
         if ($deleted) {
             $favored--;
             $response[] = "jQuery('#jr_favoriteCount{$listing_id}').html('{$favored}');";
             $response[] = "jQuery('#jr_favoriteImg{$listing_id}').fadeOut('slow');";
             return $this->ajaxResponse($response);
         }
     }
     return $this->ajaxError(s2Messages::submitErrorDb());
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:33,代码来源:listings_controller.php

示例6: xajaxDispatch

 function xajaxDispatch()
 {
     $objResponse = new xajaxResponse();
     # Debug
     if (Configure::read('System.debug', 0) === 0) {
         error_reporting(0);
     }
     # Function parameters
     $args = func_get_args();
     $controllerName = (string) array_shift($args);
     $action = (string) array_shift($args);
     $app = isset($args[0]) && is_string($args[0]) ? array_shift($args) : 'jreviews';
     $Router =& S2Router::getInstance();
     $Router->app = $app;
     App::import('Controller', $controllerName, $app);
     # remove admin path from controller name
     $controllerClass = inflector::camelize(str_replace(MVC_ADMIN . _DS, '', $controllerName)) . 'Controller';
     $controller = new $controllerClass($app);
     $controller->passedArgs = array();
     $controller->params = array();
     if (isset($args[0])) {
         $post = S2Dispatcher::parseParamsAjax($args[0]);
         if (isset($post['data'])) {
             // pass form inputs to controller variable
             $rawData = $post['data'];
             $data = Sanitize::clean($post['data']);
             $data['__raw'] = $rawData;
             $controller->data = $data;
         }
         $controller->passedArgs = $post;
         $controller->params = $post;
     }
     $controller->name = $controllerName;
     $controller->action = $action;
     $controller->autoLayout = false;
     $controller->autoRender = false;
     $controller->xajaxRequest = true;
     $controller->__initComponents();
     $controller->beforeFilter();
     $objResponse->loadCommands($controller->{$action}($args));
     return $objResponse;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:42,代码来源:dispatcher.php


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