本文整理汇总了PHP中Message::echoJsonSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::echoJsonSuccess方法的具体用法?PHP Message::echoJsonSuccess怎么用?PHP Message::echoJsonSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::echoJsonSuccess方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: deleteAction
function deleteAction()
{
/* This is from profilegateways
$id = AF::get($_POST, 'id', 0);
$ids = explode('_', $id);
$errors = FALSE;
$model = new ProfileGateway();
$model->profile_id = $ids[0];
$model->method_id = $ids[1];
$model->gateway_id = $ids[2];
$model->delete();
unset($model);
Message::echoJsonSuccess(__('gateway_removed'));
$this->redirect();
*/
$id = AF::get($_POST, 'id', 0);
$errors = FALSE;
$model = new GatewayLimit();
$model->model_uset_id = $this->user->user_id;
if ($model->findByPk($id)) {
$model->delete();
} else {
$errors = TRUE;
}
if ($model->getErrors()) {
$errors = TRUE;
}
unset($model);
Message::echoJsonSuccess(__('limit_removed'));
$this->redirect();
}
示例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());
}
示例4: 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();
}
示例5: 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();
}
示例6: 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);
}
}
示例7: 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();
}
示例8: 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);
}
}
示例9: 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')));
//.........这里部分代码省略.........
示例10: process
public function process()
{
// States list request from sales site
if ($this->wsType == 'st') {
// set headers
AF::setJsonHeaders('json');
// country_id has already been verified as set
$states = State::model()->getStatesByCID($this->post['country_id']);
// return json state list if present
Message::echoJsonSuccess(array('message' => $states));
exit;
}
// CRM Order
if ($this->wsType == 'x1') {
// EXISTING CUSTOMER CHECK
if (!$this->newCustomer) {
$this->customer = Customer::model()->fillFromDbPk($this->post['customer_id']);
$this->shippingAddress = Address::model()->fillFromDbPk($this->post['address_id']);
$this->billingAddress = Address::model()->fillFromDbPk($this->post['billing_address_id']);
}
// if customer already built then check for blacklist
$this->buildCustomer();
// EXISTING ORDER Check - DON'T NEED THIS I THINK
$this->order = new Order();
/*if (!$this->newCustomer && $this->order->fillFromDbPk($this->customer->getCustomerOkOrder($this->campaign->campaign_id)))
$this->apiError('An "OK" order already exists for this customer. Order ID ' . $this->order->order_id);*/
// addresses
if (!isset($this->shippingAddress) || !$this->shippingAddress->getPkvalue()) {
$this->buildAddress();
if ($this->post['billingSameAsShipping']) {
$this->billingAddress = $this->shippingAddress;
} else {
$this->buildAddress('billing');
}
}
// payment before order. if no payment specified allow order to still be built
if ($this->isPayment && isset($this->post['payment_id']) && $this->post['payment_id']) {
$this->payment = Payment::model()->fillFromDbPk($this->post['payment_id']);
}
if ($this->isPayment) {
$this->buildPayment();
}
// order
$this->buildOrder();
// pay or return
if ($this->isPayment) {
$this->webPayment();
} else {
$this->order->status = 'ok';
$this->order->addFlags('paid');
// this needs to be set in order to have the order get sent to fulfillment
$this->order->amount_product = '0.00';
$this->order->amount_shipping = '0.00';
$this->order->save();
}
$this->apiSuccess('Order ' . $this->order->order_id . ' created');
}
// Build prospect, click and customer info
if (in_array($this->wsType, array('p', 'l'))) {
$this->customer = new Customer();
$this->order = new Order();
$this->prospect = new Prospect();
// EXISTING ORDER/CUSTOMER CHECK - make sure there isn't already an order for this campaign and email
if ($this->customer->getCustomerByEmail($this->post['email']) && $this->customer->getCustomerOkOrder($this->campaign->campaign_id) && $this->order->fillFromDbPk($this->customer->getCustomerOkOrder($this->campaign->campaign_id))) {
$this->thankYou(true);
}
// BlueSnap Pending Order Check
// Has an order already been submitted to the gateway and is pending final approval? If so, redirect to the thankyou page
if (isset($this->customer->customer_id) && $this->order->orderPendingAttemptExists($this->campaign->campaign_id, $this->customer->customer_id)) {
$this->thankYou(true);
}
// Existing Prospect check if customer already exists. If no prospect, build click
if ($this->customer->getPkValue()) {
if (!$this->prospect->prospectExists($this->customer->customer_id, $this->campaign->campaign_id)) {
$this->buildClick();
} else {
//prospect already exists. let's update the updated column
$this->prospect->created = 'NOW():sql';
//date("Y-m-d H:i:s");
$this->prospect->save();
// check the click info. if its new then we need to double check it all
$this->buildClick($this->prospect->click_id);
}
} else {
$this->buildClick();
}
$this->buildCustomer();
$this->buildAddress();
$this->buildProspect();
// if this is not a lastchance request, then redirect the user to the order page
if ($this->wsType != 'l') {
// build return object. SET TO HTTPS WHEN TESTING IS COMPLETE
$url = $this->campaign->order_url . '?tempOrderId=' . $this->prospect->getPkValue();
$this->apiSuccess($url);
}
}
// Build Order
if (in_array($this->wsType, array('o', 'l'))) {
if ($this->wsType == 'o') {
// load objects
//.........这里部分代码省略.........
示例11: getCustomersAction
function getCustomersAction()
{
$this->checkLogin();
$searchText = AF::get($_POST, 'search_text', false);
$customerID = AF::get($_POST, 'customer_id', false);
if ($searchText) {
$customers = $searchText ? Customers::searchByEmail($searchText) : array();
Message::echoJsonSuccess(array('data' => $customers));
} elseif ($customerID) {
$customerModel = Customer::model()->findByPk($customerID);
$addressModel = Address::model()->findByCustomerId($customerModel);
}
die;
}
示例12: 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'));
}
}
}
示例13: 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));
}