本文整理汇总了PHP中waAppSettingsModel类的典型用法代码示例。如果您正苦于以下问题:PHP waAppSettingsModel类的具体用法?PHP waAppSettingsModel怎么用?PHP waAppSettingsModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了waAppSettingsModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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_restore', $order_id);
$order_model = new shopOrderModel();
$app_settings_model = new waAppSettingsModel();
if ($this->state_id != 'refunded') {
// for logging changes in stocks
shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was restored', array('order_id' => $order_id));
$update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
if ($update_on_create) {
$order_model->reduceProductsFromStocks($order_id);
} else {
if (!$update_on_create && $this->state_id != 'new') {
$order_model->reduceProductsFromStocks($order_id);
}
}
shopProductStocksLogModel::clearContext();
}
$order = $order_model->getById($order_id);
if ($order && $order['paid_date']) {
shopAffiliate::applyBonus($order_id);
shopCustomers::recalculateTotalSpent($order['contact_id']);
}
}
return $data;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:29,代码来源:shopWorkflowRestoreAction.class.php
示例17: execute
public function execute()
{
$app_settings_model = new waAppSettingsModel();
$settings = $app_settings_model->get(shopPricePlugin::$plugin_id);
$ccm = new waContactCategoryModel();
$categories = array(array('id' => 0, 'name' => 'Все покупатели'));
foreach ($ccm->getAll() as $c) {
if ($c['app_id'] == 'shop') {
$categories[$c['id']] = $c;
}
}
$price_model = new shopPricePluginModel();
$prices = $price_model->getAll();
$_prices = array();
foreach ($prices as $price) {
$_prices[$price['domain_hash']][] = $price;
}
$domain_routes = wa()->getRouting()->getByApp('shop');
$domains_settings = shopPrice::getDomainsSettings();
$this->view->assign('prices', $_prices);
$this->view->assign('domain_routes', $domain_routes);
$this->view->assign('categories', $categories);
$this->view->assign('settings', $settings);
$this->view->assign('domain_settings', $domains_settings);
}
开发者ID:klxqz,项目名称:price,代码行数:25,代码来源:shopPricePluginSettings.action.php
示例18: __construct
/**
* @param array $options
*/
public function __construct($options = array())
{
if (is_array($options)) {
foreach ($options as $k => $v) {
$this->options[$k] = $v;
}
}
if (!isset($this->options['login'])) {
$this->options['login'] = wa()->getEnv() == 'backend' ? 'login' : 'email';
}
if (!isset($this->options['is_user'])) {
// only contacts with is_user = 1 can auth
$this->options['is_user'] = wa()->getEnv() == 'backend';
}
if (!isset($this->options['remember_enabled'])) {
if (wa()->getEnv() == 'backend') {
try {
$app_settings_model = new waAppSettingsModel();
$this->options['remember_enabled'] = $app_settings_model->get('webasyst', 'rememberme', true);
} catch (waException $e) {
$this->options['remember_enabled'] = true;
}
} else {
$this->options['remember_enabled'] = true;
}
}
}
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:30,代码来源:waAuth.class.php
示例19: execute
public function execute()
{
if (waRequest::post()) {
$app_settings_model = new waAppSettingsModel();
$app_settings_model->del('shop', 'checkout_flow_changed');
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:shopReportsCheckoutflowDismiss.controller.php
示例20: execute
public function execute()
{
list($start_date, $end_date, $group_by) = shopReportsSalesAction::getTimeframeParams();
$checkout_flow = new shopCheckoutFlowModel();
$stat = $checkout_flow->getStat($start_date, $end_date);
$app_settings_model = new waAppSettingsModel();
$this->view->assign(array('stat' => $stat, 'checkout_flow_changed' => $app_settings_model->get('shop', 'checkout_flow_changed', 0)));
}
开发者ID:Lazary,项目名称:webasyst,代码行数:8,代码来源:shopReportsCheckoutflow.action.php
注:本文中的waAppSettingsModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论