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


PHP waAppSettingsModel类代码示例

本文整理汇总了PHP中waAppSettingsModel的典型用法代码示例。如果您正苦于以下问题:PHP waAppSettingsModel类的具体用法?PHP waAppSettingsModel怎么用?PHP waAppSettingsModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: execute

 public function execute()
 {
     try {
         $app_settings_model = new waAppSettingsModel();
         if (waRequest::post('cancel')) {
             wa()->getStorage()->set('shop/discountcard', '');
         } else {
             if ($discountcard_number = waRequest::post('discountcard')) {
                 $model = new shopDiscountcardsPluginModel();
                 if ($app_settings_model->get(shopDiscountcardsPlugin::$plugin_id, 'binding_customer')) {
                     $contact_id = wa()->getUser()->getId();
                     $discountcard = $model->getByField(array('contact_id' => $contact_id, 'discountcard' => $discountcard_number));
                     if (empty($discountcard)) {
                         $discountcard = $model->getByField(array('contact_id' => 0, 'discountcard' => $discountcard_number));
                     }
                 } else {
                     $discountcard = $model->getByField('discountcard', $discountcard_number);
                 }
                 if ($discountcard) {
                     wa()->getStorage()->set('shop/discountcard', $discountcard['discountcard']);
                 } else {
                     throw new waException('Дисконтная карта не найдена');
                 }
             } else {
                 throw new waException('Укажите номер дисконтной карты');
             }
         }
     } catch (Exception $ex) {
         $this->setError($ex->getMessage());
     }
 }
开发者ID:klxqz,项目名称:discountcards,代码行数:31,代码来源:shopDiscountcardsPluginFrontendDiscountcard.controller.php

示例2: prepareSkus

 public static function prepareSkus($skus = array(), $contact_id = null, $currency = null)
 {
     $app_settings_model = new waAppSettingsModel();
     if ($app_settings_model->get(self::$plugin_id, 'status') && shopPrice::getDomainSetting('status')) {
         $category_ids = self::getUserCategoryId($contact_id);
         $domain_hash = shopPrice::getRouteHash();
         $params = array('domain_hash' => $domain_hash, 'category_id' => $category_ids);
         $price_model = new shopPricePluginModel();
         $prices = $price_model->getPriceByParams($params, true);
         if ($prices) {
             foreach ($skus as &$sku) {
                 foreach ($prices as $price) {
                     $price_field = "price_plugin_{$price['id']}";
                     if (!empty($sku[$price_field]) && $sku[$price_field] > 0) {
                         //if (!empty($sku['unconverted_currency']) && !empty($sku['currency'])) {
                         //    $sku['price'] = shop_currency($sku[$price_field], $sku['unconverted_currency'], $sku['currency'], false);
                         //} else {
                         if (!$currency) {
                             $sku['price'] = $sku[$price_field];
                         } else {
                             $product_model = new shopProductModel();
                             $product = $product_model->getById($sku['product_id']);
                             $sku['price'] = shop_currency($sku[$price_field], $product['currency'], $currency, false);
                         }
                         //}
                         break;
                     }
                 }
             }
             unset($sku);
         }
     }
     return $skus;
 }
开发者ID:klxqz,项目名称:price,代码行数:34,代码来源:shopPrice.plugin.php

示例3: getPayment

 /**
  *  Получение и обработка данных оп платежах из кабинета WA
  *  Получение и обработка идет до тех пор, пока не будут обраотаны либо все страницы
  *  либо пока не будет найден платеж который уже есть в БД в таблице wacab_payments
  *  @param object wacabWaauth
  */
 public function getPayment($auth)
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     $model = new wacabPaymentModel();
     $count = 0;
     while (true) {
         if (!isset($url)) {
             $url = 'https://www.webasyst.ru/my/?action=checkingaccountInfo&id=' . $settings['account'];
         }
         $pays = wacabPaymentparseController::getPayments($url, $auth);
         $url = $pays[0];
         unset($pays[0]);
         foreach ($pays as $pay) {
             $check_pay = array('date' => $pay['date'], 'order' => $pay['order'], 'description' => $pay['description']);
             $exist_pay = $model->getByField($check_pay);
             if (count($exist_pay) > 0) {
                 break 2;
             }
             /* Привязываем платеж к плагину/приложению */
             $pay['type'] = self::checkType($pay);
             if ($pay['type'] == 'payin') {
                 $pay['apps_id'] = self::checkApps($pay);
             }
             /* EOF Привязываем платеж к плагину/приложению */
             $model->insert($pay);
             $count++;
         }
         if ($url == 'false') {
             break;
         }
     }
     return $count;
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:40,代码来源:wacabGetpayment.class.php

示例4: execute

 public function execute()
 {
     $model = new shopStockModel();
     foreach ($this->getEditData() as $id => $item) {
         $model->updateById($id, $item);
     }
     $inventory_stock_id = null;
     foreach ($this->getAddData() as $before_id => $data) {
         foreach ($data as $item) {
             $id = $model->add($item, $before_id);
             if (!empty($item['inventory'])) {
                 $inventory_stock_id = $id;
             }
         }
     }
     if ($inventory_stock_id) {
         // Assign all inventory to this stock
         $product_stocks_model = new shopProductStocksModel();
         $product_stocks_model->insertFromSkus($inventory_stock_id);
     }
     $app_id = $this->getAppId();
     $app_settings_model = new waAppSettingsModel();
     if (waRequest::post('ignore_stock_count')) {
         $app_settings_model->set($app_id, 'ignore_stock_count', 1);
     } else {
         $app_settings_model->set($app_id, 'ignore_stock_count', 0);
     }
     if (waRequest::post('update_stock_count_on_create_order')) {
         $app_settings_model->set($app_id, 'update_stock_count_on_create_order', 1);
     } else {
         $app_settings_model->set($app_id, 'update_stock_count_on_create_order', 0);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:33,代码来源:shopSettingsSaveStock.controller.php

示例5: execute

 public function execute()
 {
     ob_start();
     $app = $this->getApp();
     $app_settings_model = new waAppSettingsModel();
     $app_settings_model->set($app, 'cron_schedule', time());
     waFiles::create($this->getConfig()->getPath('log') . '/' . $app . '/');
     $log_file = "{$app}/cron.txt";
     $post_model = new blogPostModel();
     $params = array('datetime' => date("Y-m-d H:i:s"), 'status' => blogPostModel::STATUS_SCHEDULED);
     $posts_schedule = $post_model->select("id,blog_id,contact_id,status,datetime")->where('datetime <= s:datetime AND status=s:status', $params)->fetchAll();
     if ($posts_schedule) {
         foreach ($posts_schedule as $post) {
             try {
                 waLog::log("Attempt publishing post with id [{$post['id']}]", $log_file);
                 $data = array("status" => blogPostModel::STATUS_PUBLISHED);
                 waLog::log($post_model->updateItem($post['id'], $data, $post) ? "success" : "fail", $log_file);
             } catch (Exception $ex) {
                 waLog::log($ex->getMessage(), $log_file);
                 waLog::log($ex->getTraceAsString(), $log_file);
             }
         }
     }
     $action = __FUNCTION__;
     /**
      * @event cron_action
      * @param string $action
      * @return void
      */
     wa()->event('cron_action', $action);
     if ($log = ob_get_clean()) {
         waLog::log($log, $log_file);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:34,代码来源:blogCronSchedule.cli.php

示例6: initRouting

 private function initRouting()
 {
     $routing = wa()->getRouting();
     $app_id = $this->getAppId();
     $domain_routes = $routing->getByApp($app_id);
     $success = false;
     foreach ($domain_routes as $domain => $routes) {
         foreach ($routes as $route) {
             if ($domain . '/' . $route['url'] == $this->data['domain']) {
                 $routing->setRoute($route, $domain);
                 $this->data['type_id'] = ifempty($route['type_id'], array());
                 if ($this->data['type_id']) {
                     $this->data['type_id'] = array_map('intval', $this->data['type_id']);
                 }
                 waRequest::setParam($route);
                 $this->data['base_url'] = parse_url('http://' . preg_replace('@https?://@', '', $domain), PHP_URL_HOST);
                 $success = true;
                 break;
             }
         }
     }
     if (!$success) {
         throw new waException('Error while select routing');
     }
     $app_settings_model = new waAppSettingsModel();
     $this->data['app_settings'] = array('ignore_stock_count' => $app_settings_model->get($app_id, 'ignore_stock_count', 0));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:_shopYandexmarketPluginRun.controller.php

示例7: execute

 public function execute()
 {
     $model_settings = new waAppSettingsModel();
     $settings = $model_settings->get($key = array('shop', 'deliveryshop'));
     $model = new waModel();
     $domains = $model->query("SELECT * FROM site_domain")->fetchAll();
     $prices = $model->query("SELECT * FROM shop_deliveryshop_delivery")->fetchAll('domain');
     foreach ($domains as $d) {
         $tab = explode('.', $d['name']);
         $info[$d['name']]['tab_name'] = $tab[0];
         $template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka' . $d['id'] . '.html', false, 'shop', true);
         $change_tpl[$d['name']] = true;
         if (!file_exists($template_path)) {
             $template_path = wa()->getAppPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', 'shop');
             $change_tpl[$d['name']] = false;
         }
         $template_content[$d['name']] = file_get_contents($template_path);
         unset($template_path);
     }
     $this->view->assign('info', $info);
     $this->view->assign('prices', $prices);
     $this->view->assign('change_tpl', $change_tpl);
     $this->view->assign('template', $template_content);
     $this->view->assign('settings', $settings);
 }
开发者ID:quadrodesign,项目名称:deliveryshop,代码行数:25,代码来源:shopDeliveryshopPluginSettings.action.php

示例8: getReviews

 /**
  *  Получение и обработка данных об отзывах из кабинета WA
  *  Получение и обработка идет до тех пор, пока не будут обраотаны либо все страницы
  *  либо пока не будет найден отзыв который уже есть в БД в таблице wacab_reviews
  */
 public function getReviews()
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     $model = new wacabReviewModel();
     $auth = new wacabWaauth();
     $count = 0;
     while (true) {
         if (!isset($url)) {
             $url = 'https://www.webasyst.ru/my/?action=developerReviews';
         }
         $rvs = wacabReviewsparseController::getReviews($url, $auth);
         $url = $rvs[0];
         unset($rvs[0]);
         foreach ($rvs as $rv) {
             $check_rv = array('rv_id' => $rv['rv_id']);
             $exist_rv = $model->getByField($check_rv);
             if (count($exist_rv) > 0) {
                 if ($rv['date'] == $exist_rv['date'] && $rv['text'] == $exist_rv['text']) {
                     break 2;
                 } else {
                     $model->updateById($exist_rv['id'], $rv);
                     $count++;
                     continue;
                 }
             }
             $model->insert($rv);
             $count++;
         }
         if ($url == 'false') {
             break;
         }
     }
     return $count;
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:40,代码来源:wacabGetreviews.class.php

示例9: execute

 public function execute()
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     $this->view->assign('settings', $settings);
     $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/settings/Settings_page.html');
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:7,代码来源:wacabSettings.action.php

示例10: postExecute

 public function postExecute($order_id = null, $result = null)
 {
     $data = parent::postExecute($order_id, $result);
     $log_model = new waLogModel();
     $log_model->add('order_complete', $order_id);
     $order_model = new shopOrderModel();
     if (is_array($order_id)) {
         $order = $order_id;
         $order_id = $order['id'];
     } else {
         $order = $order_model->getById($order_id);
     }
     shopCustomers::recalculateTotalSpent($order['contact_id']);
     if ($order !== null) {
         $log_model = new shopOrderLogModel();
         $state_id = $log_model->getPreviousState($order_id);
         $app_settings_model = new waAppSettingsModel();
         $update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
         if (!$update_on_create && $state_id == 'new') {
             // jump through 'processing' state - reduce
             // for logging changes in stocks
             shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was completed', array('order_id' => $order_id));
             $order_model = new shopOrderModel();
             $order_model->reduceProductsFromStocks($order_id);
             shopProductStocksLogModel::clearContext();
         }
         $order_model->recalculateProductsTotalSales($order_id);
     }
     return $data;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:30,代码来源:shopWorkflowCompleteAction.class.php

示例11: onCount

 public function onCount()
 {
     return;
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     if (!isset($settings['count']) || $settings['count'] == 0) {
         return null;
     }
     if (!isset($settings['count_ts'])) {
         $settings_model->set('wacab', 'count_ts', time());
         return null;
     }
     if (!isset($settings['timeout'])) {
         $settings['timeout'] = 60;
     }
     if (time() - $settings['count_ts'] < $settings['timeout'] * 60) {
         return null;
     }
     $auth = new wacabWaauth();
     $new = new wacabGetpayment();
     $ps = $new->getPayment($auth);
     if (isset($settings['new_count'])) {
         $newcount = $settings['new_count'] + $ps;
     } else {
         $newcount = 0;
     }
     $settings_model->set('wacab', 'new_count', $newcount);
     $settings['count_ts'] = time();
     unset($auth);
     if ($newcount == 0) {
         return null;
     } else {
         return array('count' => $newcount, 'url' => wa()->getUrl(true) . 'wacab/#/transactions/');
     }
 }
开发者ID:Alexkurd,项目名称:wacab,代码行数:35,代码来源:wacabConfig.class.php

示例12: execute

 public function execute()
 {
     $app_settings_model = new waAppSettingsModel();
     $settings = $app_settings_model->get(shopDiscountcardsPlugin::$plugin_id);
     if (!empty($settings['amounts'])) {
         $settings['amounts'] = json_decode($settings['amounts'], true);
     } else {
         $settings['amounts'] = array();
     }
     $this->view->assign('settings', $settings);
     $templates = array();
     foreach ($this->templates as $template_id => $template) {
         $tpl_full_path = $template['tpl_path'] . $template['tpl_name'] . '.' . $template['tpl_ext'];
         $template_path = wa()->getDataPath($tpl_full_path, $template['public'], 'shop', true);
         if (file_exists($template_path)) {
             $template['template'] = file_get_contents($template_path);
             $template['change_tpl'] = 1;
         } else {
             $template_path = wa()->getAppPath($tpl_full_path, 'shop');
             $template['template'] = file_get_contents($template_path);
             $template['change_tpl'] = 0;
         }
         $templates[$template_id] = $template;
     }
     $this->view->assign('templates', $templates);
 }
开发者ID:klxqz,项目名称:discountcards,代码行数:26,代码来源:shopDiscountcardsPluginSettings.action.php

示例13: execute

 public function execute()
 {
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     installerHelper::checkUpdates($messages);
     if ($m = $this->view->getVars('messages')) {
         $messages = array_merge($m, $messages);
     }
     $this->view->assign('messages', $messages);
     $plugins = 'wa-plugins/payment';
     $apps = wa()->getApps();
     if (isset($apps['shop'])) {
         $plugins = 'shop';
     } else {
         ksort($apps);
         foreach ($apps as $app => $info) {
             if (!empty($info['plugins'])) {
                 $plugins = $app;
                 break;
             }
         }
     }
     $model = new waAppSettingsModel();
     $this->view->assign('update_counter', $model->get($this->getApp(), 'update_counter'));
     $this->view->assign('module', waRequest::get('module', 'backend'));
     $this->view->assign('default_query', array('plugins' => $plugins));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:26,代码来源:installerBackend.layout.php

示例14: postExecute

 public function postExecute($order_id = null, $result = null)
 {
     $data = parent::postExecute($order_id, $result);
     if ($order_id != null) {
         $log_model = new waLogModel();
         $log_model->add('order_delete', $order_id);
         $order_model = new shopOrderModel();
         $app_settings_model = new waAppSettingsModel();
         if ($data['before_state_id'] != 'refunded') {
             $update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
             // for logging changes in stocks
             shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was deleted', array('order_id' => $order_id));
             if ($update_on_create) {
                 $order_model->returnProductsToStocks($order_id);
             } else {
                 if (!$update_on_create && $data['before_state_id'] != 'new') {
                     $order_model->returnProductsToStocks($order_id);
                 }
             }
             shopProductStocksLogModel::clearContext();
         }
         $order = $order_model->getById($order_id);
         if ($order && $order['paid_date']) {
             // Remember paid_date in log params for Restore action
             $olpm = new shopOrderLogParamsModel();
             $olpm->insert(array('name' => 'paid_date', 'value' => $order['paid_date'], 'order_id' => $order_id, 'log_id' => $data['id']));
             // Empty paid_date and update stats so that deleted orders do not affect reports
             $order_model->updateById($order_id, array('paid_date' => null, 'paid_year' => null, 'paid_month' => null, 'paid_quarter' => null));
             $order_model->recalculateProductsTotalSales($order_id);
             shopCustomers::recalculateTotalSpent($order['contact_id']);
         }
     }
     return $data;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:shopWorkflowDeleteAction.class.php

示例15: execute

 function execute()
 {
     try {
         $message = array();
         $settings = waRequest::get('setting');
         if ($settings) {
             $model = new waAppSettingsModel();
             $changed = false;
             foreach ((array) $settings as $setting) {
                 if (in_array($setting, array('auth_form_background'))) {
                     if ($value = $model->get('webasyst', $setting)) {
                         waFiles::delete(wa()->getDataPath($value, true, 'webasyst'));
                         $message[] = _w('Image deleted');
                     }
                 } else {
                     $changed = true;
                 }
                 $model->set('webasyst', $setting, false);
             }
             if ($changed) {
                 $message[] = _w('Settings saved');
             }
         }
         $params = array('module' => 'settings', 'msg' => installerMessage::getInstance()->raiseMessage(implode(', ', $message)));
         $this->redirect($params);
     } catch (waException $ex) {
         $msg = installerMessage::getInstance()->raiseMessage($ex->getMessage(), installerMessage::R_FAIL);
         $params = array('module' => 'settings', 'msg' => $msg);
         $this->redirect($params);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:31,代码来源:installerSettingsRemove.action.php


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