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


PHP Message::echoJson方法代码示例

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


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

示例1: createAction

 public function createAction()
 {
     $model = new Field();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['model']) && $_POST['model'] == 'Field') {
         if (isset($_POST['ajax'])) {
             $model->fillFromArray($_POST);
             if ($model->save()) {
                 $link = AF::link(array('fields' => 'update'), array('id' => $model->PkValue));
                 Message::echoJson('success', array('redirect' => $link));
             } else {
                 Message::echoJsonError(__('field_not_created'));
             }
             die;
         }
         $model->save();
         $this->redirect();
         die;
     }
     $fieldCode = AF::get($this->params, 'field_code', false);
     /*
     if(!$fieldCode)
         throw new AFHttpException(0, 'no_field_code');
     */
     $model->field_code = $fieldCode;
     Assets::js('jquery.form');
     $this->addToPageTitle('Create field');
     $this->render('create', array('model' => $model, 'fieldCode' => $fieldCode));
 }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: updateAction

 function updateAction()
 {
     $model = new IpAccess();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['ajax'])) {
         $id = AF::get($_POST, 'id');
         $model->findByPk($id);
         $model->ip = $_POST['ip'];
         $model->note = $_POST['note'];
         if ($model->save()) {
             $link = $_SERVER['HTTP_REFERER'];
             Message::echoJson('success', array('redirect' => $link));
             Message::echoJsonSuccess(__('access_updated'));
         } else {
             Message::echoJsonError(__('access_not_updated') . ' ' . $model->errors2string);
         }
         die;
     }
     $id = AF::get($this->params, 'id', FALSE);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->findByPk($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
     Assets::js('jquery.form');
     $this->addToPageTitle('Update affiliate');
     $this->render('update', array('model' => $model, 'pagination' => $pagination));
 }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例3: ajaxAction

 function ajaxAction()
 {
     if (!isset($_POST['ajax'])) {
         throw new AFHttpException(404, 'page_not_found');
     }
     if ($this->access->actionAccess('update')) {
         /*
         DEPRECATED BECAUSE ITS UPDATED ON SPECIFIC PAGES
         
         if(isset($_POST['update_customer_information']))
                     {
                         if(isset($_POST['CustomerModel']))
                         {
                             $customerModel=new Customer();
                             $customerModel->fillFromArray($_POST['CustomerModel'], false);
                             $customerModel->model_uset_id = $this->user->user_id;
                             $customerModel->save(false);
                         }
         
                         if(isset($_POST['ShippingAddress']))
                         {
                             $sAddressModel=new Address();
                             $sAddressModel->fillFromArray($_POST['ShippingAddress'], false);
                             $sAddressModel->model_uset_id = $this->user->user_id;
                             $sAddressModel->save(false);
                         }
         
                         if(isset($_POST['BillingAddress']) && $_POST['ShippingAddress']['address_id']!=$_POST['BillingAddress']['address_id'])
                         {
                             $bAddressModel=new Address();
                             $bAddressModel->fillFromArray($_POST['BillingAddress'], false);
                             $bAddressModel->model_uset_id = $this->user->user_id;
                             $bAddressModel->save(false);
                         }
         
                         OrderLog::createLog($this->user->user_id, $_POST['order_id'], 2);
                         Message::echoJsonSuccess(__('customer_information_updated'));
                     }
         */
         if (isset($_POST['order_set_chargeback_amount'])) {
             $orderID = (int) AF::get($_POST, 'order_id', 0);
             $amount = AF::get($_POST, 'amount', 0);
             $type = (int) AF::get($_POST, 'type', 0);
             $modelOrder = Order::model()->findByPk($orderID);
             $new_amount = $modelOrder->chargeBackSet($amount, $type, $this->user->user_id);
             if ($new_amount) {
                 Message::echoJsonSuccess(array('answer' => __('order_chargeback_amount_updated'), 'new_amount' => $new_amount));
             } else {
                 $msg = $amount > $modelOrder->maxAmountChargeback ? __('order_chargeback_amount_exceeded') : __('order_chargeback_amount_no_updated');
                 Message::echoJsonError($msg);
             }
             die;
             /*// we need to make sure the chargeback flag is set.  if not, set flag and log it
             				if(!$modelOrder->isFlag('chargeback')) {
             					$modelOrder->addFlags('chargeback');
             					$modelOrder->save(false);
             
             					$orderProducts=OrderProducts::getProductsByOrderID($orderID);
             	
             					foreach($orderProducts as $orderProduct) {
             						$orderProduct->removeFlags('recurring');
             						$orderProduct->save();
             					}
             		
             					OrderLog::createLog($this->user->user_id, $orderID, 11, 'chargeback');	
             				}
             
             
                             if( $modelOrder && in_array($type, array(29, 30)) && $amount <= $modelOrder->maxAmountChargeback && $orderID)
                             {
             					$notes = ($amount) ? $amount : null;
                                 OrderLog::createLog($this->user->user_id, $orderID, $type, $notes, $amount);
                                 Message::echoJsonSuccess(array('answer'=>__('order_chargeback_amount_updated'), 'new_amount'=>$modelOrder->maxAmountChargeback));
                             }
                             else { 
             					$msg = ($amount > $modelOrder->maxAmountChargeback) ? __('order_chargeback_amount_exceeded') :__('order_chargeback_amount_no_updated') ;
             					Message::echoJsonError($msg);
             				}
             
                             die;*/
         }
         if (isset($_POST['rma_code'])) {
             $orderModel = new Order();
             $orderModel->order_id = (int) AF::get($_POST, 'order_id', 0);
             $orderModel->rma_code = (int) AF::get($_POST, 'rma_code', 0);
             $orderModel->setRMA($this->user->user_id);
             Message::echoJsonSuccess($orderModel->rma_number);
             die;
         }
         if (isset($_POST['order_refund']) && $this->access->actionAccess('order_refund')) {
             $orderID = AF::get($_POST, 'order_id');
             $amountRefunded = AF::get($_POST, 'amount_refunded', 0);
             $model = Order::model()->findByPk($orderID);
             $model->refunded($amountRefunded);
             if (!$model->errors) {
                 $paymentAPI = new PaymentAPI();
                 $response = $paymentAPI->refundOrder($model, $amountRefunded);
                 if ($response->status == 'success') {
                     if ($amountRefunded == $model->max_refund) {
                         $op = OrderProduct::model();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: addeventAction

 function addeventAction()
 {
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         $eventType = (int) AF::get($_POST, 'event_type', 0);
         $eventID = (int) AF::get($_POST, 'event_id', 0);
         $productID = (int) AF::get($_POST, 'product_id', 0);
         if (isset($_POST['model']) && $_POST['model'] == 'Product') {
             $errors = array();
             if (!$eventID) {
                 $errors['event_id'] = 'Required';
             }
             if (!$eventType) {
                 $errors['event_type'] = 'Required';
             }
             if (!$productID) {
                 $errors['product_id'] = 'Required';
             }
             if ($errors) {
                 $answer['errors'] = $errors;
                 Message::echoJson('error', $answer);
             }
             $eventModel = new Event();
             $eventModel->addProductByID($eventID, $productID);
             $link = AF::link(array('products' => 'update'), array('id' => $productID));
             Message::echoJson('success', array('redirect' => $link));
         }
         if ($eventType) {
             //Events type list
             $eventModel = new Event();
             $eventsTypes = $eventModel->getEventsByTypeID($eventType);
             if ($eventsTypes) {
                 Message::echoJsonSuccess(array('message' => $eventsTypes));
             } else {
                 Message::echoJsonError(__('unknown_error'));
             }
             die;
         }
     }
     $this->redirect();
 }
开发者ID:,项目名称:,代码行数:41,代码来源:


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