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


PHP Message::echoJsonError方法代码示例

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


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

示例1: apiError

 private function apiError($msg)
 {
     // log the error
     $dump = '';
     $r = array();
     $r[] = "EVENT: " . $msg;
     $r[] = date('Y/m/d H:i:s');
     $r[] = 'WS_TYPE = ' . $this->wsType;
     $r[] = isset($this->prospect) ? 'PROSPECT: ' . json_encode($this->prospect->getDataArray()) : '';
     $r[] = isset($this->payment) ? 'PAYMENT: ' . json_encode($this->payment->getDataArray()) : '';
     $r[] = isset($this->order) ? 'ORDER: ' . json_encode($this->order->getDataArray()) : '';
     $pst = isset($this->post) ? json_encode($this->post) : json_encode($_POST);
     $r[] = 'POST: ' . $pst;
     foreach ($r as $q) {
         if ($q) {
             $dump .= $q . PHP_EOL;
         }
     }
     error_log($dump . PHP_EOL, 3, getcwd() . "/api_error_log.log");
     // what return type?
     if ($this->wsType == 'x1') {
         Message::echoJsonError($msg);
     } elseif ($this->wsType == 'salvage') {
         echo $msg . '<br>';
     } else {
         exit(json_encode(array('status' => 0, 'msg' => $msg)));
     }
 }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: resetAction

 function resetAction()
 {
     $userID = AF::get($this->params, 'idUser');
     $activKey = AF::get($this->params, 'activkey');
     $reset = AF::get($this->params, 'reset');
     if (!$userID || !$activKey || !$reset) {
         throw new AFHttpException(0, 'bad_request', 404);
     }
     $userModel = User::model()->findByPk($userID);
     if (!$userModel || $userModel->activkey != $activKey || $reset != 'true') {
         throw new AFHttpException(0, 'bad_request', 404);
     }
     if (isset($_POST['reset_password']) && isset($_POST['ajax'])) {
         $password = trim(AF::get($_POST, 'password'));
         if (strlen($password) < 4) {
             Message::echoJsonError(__('small_password'));
         }
         $userModel->password = $password;
         $userModel->activkey = '';
         if ($userModel->save()) {
             Message::echoJsonSuccess(__('your_password_changed'));
         } else {
             Message::echoJsonError(__('your_password_not_changed'));
         }
     }
     $this->addToPageTitle(__('reset_your_password'));
     Assets::cleanJs();
     Assets::js('jquery.min');
     Assets::js('jquery.form');
     $this->render('reset', array());
 }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例3: languageAction

 function languageAction()
 {
     if (isset($_POST['UserSettings'])) {
         $this->user->settings->attributes = $_POST['UserSettings'];
         if ($this->user->save()) {
             Message::echoJsonSuccess(__('user_settings_updated'));
         } else {
             Message::echoJsonError(__('user_settings_not_updated'));
         }
     }
     $this->addToPageTitle(__('language') . ' ' . __('settings'));
     Assets::js('jquery.form');
     $this->render('language', array());
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: createAction

 public function createAction()
 {
     $model = new GatewayLimit();
     if (isset($_POST['model'])) {
         // Add gatewaylimit to gateway
         if ($_POST['model'] == 'gateway_limit') {
             $this->performAjaxValidation($model);
             // Uncomment the line if AJAX validation is needed
             if (!empty($_POST['limit_id'])) {
                 $model->setIsNewRecord(FALSE);
             }
             $model->fillFromArray($_POST, TRUE);
             if ($model->save()) {
                 $link = AF::link(array('gateways' => 'update'), array('id' => $model->gateway_id));
                 Message::echoJson('success', array('redirect' => $link));
             } else {
                 Message::echoJsonError(__('gateway_limit_not_created') . ' ' . $model->errors2string);
             }
         }
     }
 }
开发者ID:,项目名称:,代码行数:21,代码来源:

示例5: removeAction

 function removeAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Event();
         $t = explode('-', $id);
         if (isset($t[0]) && isset($t[1])) {
             $model->removeEventProduct($t[0], $t[1]);
         } else {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('events_not_deleted'));
         } else {
             Message::echoJsonSuccess(__('events_deleted'));
         }
     }
     $this->redirect();
 }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例6: removeemailAction

 function removeemailAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = false;
     foreach ($modelsID as $id) {
         $idsArray = explode('-', $id);
         if (count($idsArray) != 3) {
             $errors = true;
         }
         $model = new CampaignEmail();
         if ($model->findByPk(array('campaign_id' => $idsArray[0], 'day' => $idsArray[1], 'template_id' => $idsArray[2]))) {
             $model->model_uset_id = $this->user->user_id;
             $model->delete();
         } else {
             $errors = true;
         }
         if ($model->getErrors()) {
             $errors = true;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('campaign_email_no_deleted'));
         } else {
             Message::echoJsonSuccess(__('campaign_email_deleted'));
         }
     }
     $this->redirect();
 }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例7: cloneAction

 function cloneAction()
 {
     if (isset($_POST['clone'])) {
         $campaigns = Campaign::model()->cache()->findAllInArray();
         AF::setJsonHeaders('json');
         echo json_encode(array('campaigns' => $campaigns));
         die;
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         $campaign_id = AF::get($_POST, 'campaign_id', 0);
         $campprod_ids = AF::get($_POST, 'campship_id', 0);
         if (!$campprod_ids && !$campaign_id) {
             Message::echoJsonError(__('campship_id_not_found'));
         }
         $campprods = explode(',', $campprod_ids);
         $message = array();
         $newIDs = array();
         $isMany = count($campprods) > 1 ? true : false;
         $isThisCampaign = true;
         foreach ($campprods as $id) {
             $model = new CampaignShipping();
             if (!$model->findByPk($id)) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError(__('campship_not_found'));
             }
             if ($model->campaign_id != $campaign_id) {
                 $model->campaign_id = $campaign_id;
                 $isThisCampaign = false;
             }
             if (!$model->cloneModel()) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError($model->errors2string);
             }
             $newID = $newIDs[] = $model->getPkValue();
             $message[] = __('campship_cloned') . ' <a href="' . $this->controller . '/view/campaign_id=' . $campaign_id . '">' . __('view_campaign') . ' (ID: ' . $newID . ')</a><br>';
             unset($model);
         }
         if (!$message) {
             Message::echoJsonError(__('campship_not_cloned'));
         }
         $message = implode($message);
         $newIDs = implode(',', $newIDs);
         $v = array('message' => $message);
         if ($isThisCampaign) {
             $v['newid'] = $newIDs;
         }
         Message::echoJsonSuccess($v);
     }
 }
开发者ID:,项目名称:,代码行数:54,代码来源:

示例8: 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,代码来源:

示例9: deleteAction

 function deleteAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Domain();
         //$model->model_uset_id = $this->user->user_id;
         if ($model->findByPk($id)) {
             // if beforeDelete() returns an error, indicate this to the user
             if (!$model->delete($id)) {
                 $errors = TRUE;
             }
         } else {
             $errors = TRUE;
         }
         if ($model->getErrors()) {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('domain_not_deleted'));
         } else {
             Message::echoJsonSuccess(__('domain_deleted'));
         }
     }
     $this->redirect();
 }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例10: cloneModel

 protected function cloneModel($modelName)
 {
     $modelNameS = strtolower($modelName);
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         $idTemp = AF::get($_POST, 'id', 0);
         // added handling of possible addlData array passed over via the clone model function in all.js
         $addlData = AF::get($_POST, 'addlData', 0);
         if (!$idTemp) {
             Message::echoJsonError(__($modelNameS . '_id_not_found'));
         }
         $ids = explode(',', $idTemp);
         $message = array();
         $newIDs = array();
         $isMany = count($ids) > 1 ? true : false;
         foreach ($ids as $id) {
             $model = new $modelName();
             if (!$model->fillFromDbPk($id)) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError(__($modelNameS . '_not_found'));
             }
             // added pass of addl to model function
             if (!$model->cloneModel($id, $addlData)) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError(__($modelNameS . '_not_cone'));
             }
             $newID = $newIDs[] = $model->getPkValue();
             $message[] = __($modelNameS . '_cloned') . ' <a href="' . $this->controller . '/update/id=' . $newID . '">' . __('edit') . ' (ID: ' . $newID . ')</a><br>';
             unset($model);
         }
         if (!$message) {
             Message::echoJsonError(__($modelNameS . '_not_cloned'));
         }
         $message = implode($message);
         $newIDs = implode(',', $newIDs);
         $v = array('message' => $message, 'newid' => $newIDs);
         Message::echoJsonSuccess($v);
     }
 }
开发者ID:,项目名称:,代码行数:43,代码来源:

示例11: upsellAction

 function upsellAction()
 {
     $model = new Upsell();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['model']) && $_POST['model'] == 'upsells' && isset($_POST['ajax'])) {
         $upsellID = AF::get($_POST, 'upsell_id');
         $parent_upsell_id = AF::get($_POST, 'parent_upsell_id');
         $answer = AF::get($_POST, 'answer');
         $productID = AF::get($_POST, 'product_id');
         $shippingID = AF::get($_POST, 'shipping_id');
         $campaign_id = AF::get($_POST, "campaign_id");
         $main_parent_product_id = AF::get($_POST, "main_parent_product_id");
         $product_replace = AF::get($_POST, "product_replace") ? AF::get($_POST, "product_replace") : 0;
         $url = AF::get($_POST, 'url');
         if (!$answer) {
             Message::echoJsonError(__('upsell_not_upsell_answer'));
         }
         //if(!$shippingID)
         //Message::echoJsonError(__('upsell_select_shipping'));
         if (!$parent_upsell_id) {
             if ($upsellID) {
                 $model->findByPk($upsellID);
                 if ($productID) {
                     $model->product_id = $productID;
                     $model->shipping_id = $shippingID;
                     $model->product_replace = $product_replace;
                     $model->url = $url;
                     if ($model->save()) {
                         Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
                     } else {
                         Message::echoJsonError(__('upsell_not_updated'));
                     }
                 } else {
                     $campProdModel = new CampaignProduct();
                     $campProdModel->findByPk($answer);
                     $campProdModel->upsell_id = null;
                     if ($campProdModel->save()) {
                         $model->delete();
                         Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
                     } else {
                         Message::echoJsonError(__('upsell_not_updated'));
                     }
                 }
             } else {
                 if (!$productID) {
                     Message::echoJsonError(__('upsell_select_product'));
                 }
                 $model->product_id = $productID;
                 $model->shipping_id = $shippingID;
                 $model->product_replace = $product_replace;
                 $model->url = $url;
                 if ($model->save()) {
                     $campProdModel = new CampaignProduct();
                     $campProdModel->findByPk($answer);
                     $campProdModel->upsell_id = $model->upsell_id;
                     if ($campProdModel->save()) {
                         Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_created')));
                     } else {
                         Message::echoJsonError(__('upsell_not_updated'));
                     }
                 } else {
                     Message::echoJsonError(__('upsell_not_updated'));
                 }
             }
         } elseif ($upsellID) {
             $model->findByPk($upsellID);
             if (!$productID) {
                 if ($model->delete()) {
                     $parentUpsellModel = new Upsell();
                     $parentUpsellModel->findByPk($parent_upsell_id);
                     $parentUpsellModel->setAnswer($answer, null);
                     $parentUpsellModel->save();
                     Message::echoJsonSuccess(__('upsell_not_deleted'));
                 } else {
                     Message::echoJsonError(__('upsell_not_updated'));
                 }
             } else {
                 $model->product_id = $productID;
                 $model->shipping_id = $shippingID;
                 $model->product_replace = $product_replace;
                 $model->url = $url;
                 if ($model->save()) {
                     Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
                 } else {
                     Message::echoJsonError(__('upsell_not_updated'));
                 }
             }
         } else {
             // parent_upsell_id = 119, upsell_id = 0
             if (!$productID) {
                 Message::echoJsonError(__('upsell_select_product'));
             }
             $model->fillFromArray($_POST);
             if ($model->save()) {
                 $upsellModel = new Upsell();
                 $upsellModel->findByPk($parent_upsell_id);
                 $upsellModel->setAnswer($answer, $model->upsell_id);
                 if ($upsellModel->save()) {
                     Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_created')));
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: getpaymentAction

 function getpaymentAction()
 {
     $this->checkLogin();
     AF::setJsonHeaders('json');
     $payment_id = AF::get($_POST, 'payment_id', false);
     if (!$payment_id) {
         Message::echoJsonError(__('incorrect_payment_id'));
     }
     $model = new Payment();
     if (!$model->fillFromDbPk($payment_id)) {
         Message::echoJsonError(__('incorrect_campaign_id'));
     }
     $result['cc_number'] = $model->cc_number_formatted;
     $result['cc_type'] = isset($model->num2) && strlen($model->num2) == 6 ? strtoupper(Bin::getCardType($this->num2)) : PaymentSystem::getCardType($model->cc_number);
     $result['exp_date'] = strlen($model->exp_date) == 3 ? '0' . $model->exp_date : $model->exp_date;
     $result['fields_expmonth'] = substr($result['exp_date'], 0, 2);
     $result['fields_expyear'] = '20' . substr($result['exp_date'], 2, 2);
     $result['cc_cvv'] = 'xxx';
     Message::echoJsonSuccess(array('message' => array('data' => $result)));
 }
开发者ID:,项目名称:,代码行数:20,代码来源:

示例13: setRMA

 public function setRMA($user = null)
 {
     if (!$this->order_id) {
         Message::echoJsonError(__('incorrect_order_id'));
     }
     if (!isset(self::$rmaCodes[$this->rma_code])) {
         Message::echoJsonError(__('choose_rma_code'));
     }
     $sql = "SELECT UNIX_TIMESTAMP(`created`) as date, `created`, `rma_code`\n                FROM ?n\n                WHERE `order_id` = ?i";
     $result = self::$_msql->getRow($sql, $this->tableName(), $this->order_id);
     if (!$result['date']) {
         Message::echoJsonError(__('incorrect_order_id'));
     }
     $this->created = $result['created'];
     if ($this->rma_code == 0) {
         $this->rma_code = null;
     }
     $objects = array('rma_code' => $this->rma_code);
     $sql = "UPDATE ?n SET ?u WHERE `order_id` = ?i";
     self::$_msql->query($sql, $this->tableName(), $objects, $this->order_id);
     // need to set rma_code back to 0 so the log can have a valid RMA code to pull from
     if ($this->rma_code == null) {
         $this->rma_code = 0;
     }
     // the following IF statement originally had !$result['rma_code'].  removed to allow for canceled rmas to have log entry
     if ($user) {
         //  && !$result['rma_code']
         OrderLog::createLog($user, $this->order_id, 9, __(self::$rmaCodes[$this->rma_code]));
     }
     if (!$result['rma_code']) {
         Event::setEvents($this->order_id, 4);
     }
 }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例14: connectionAction

 function connectionAction()
 {
     $smtpModel = new Smtp();
     if (isset($_POST['ajax'])) {
         $_POST['smtp_password'] = str_replace(' ', '+', $_POST['smtp_password']);
         $smtpModel->fillFromArray($_POST);
         if ($smtpModel->testConnection()) {
             Message::echoJsonSuccess(__('smtp_test_connection_ok'));
         } else {
             Message::echoJsonError(__('smtp_test_connection_error'));
         }
     }
 }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例15: updateAction

 /**
  * Update customer 
  */
 function updateAction()
 {
     $model = new Customer();
     $id = AF::get($this->params, 'id', FALSE);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['ajax'])) {
         $customer_id = AF::get($_POST, 'customer_id', false);
         $flags = AF::get($_POST, 'flags', false);
         unset($_POST['flags']);
         if (!$flags) {
             $flags = array();
         }
         $model->fillFromArray($_POST, FALSE);
         $model->removeFlags($model->_flagFields['flags']);
         $model->addFlags($flags);
         $model->user_id_updated = $this->user->user_id;
         $model->updated = 'NOW():sql';
         if ($model->save()) {
             Message::echoJsonSuccess(__('customer_updated'));
         } else {
             Message::echoJsonError(__('customer_no_updated'));
         }
         die;
     }
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->findByPk($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     Assets::js('jquery.form');
     /* I don't think I need this now
     		$shippingAddress=new Address();
             $shippingAddress->fillFromDbPk($model->address_id);
     
             $billingAddress=new Address();
             $billingAddress->fillFromDbPk($model->billing_address_id);
     		
     		$countryModel = new Country();
             $countries = $countryModel->getCountries();
             $shippingStates=($shippingAddress->country_id)?$countryModel->getStatesByCID($shippingAddress->country_id):array();
             $billingStates=($billingAddress->country_id)?$countryModel->getStatesByCID($billingAddress->country_id):array();
     		*/
     $this->addToPageTitle('Update customer');
     $this->render('update', array('model' => $model));
 }
开发者ID:,项目名称:,代码行数:50,代码来源:


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