本文整理汇总了PHP中waRequest类的典型用法代码示例。如果您正苦于以下问题:PHP waRequest类的具体用法?PHP waRequest怎么用?PHP waRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了waRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$plugin_id = waRequest::get('id', null);
$plugins_count = 0;
if ($plugin_id) {
$plugins = $this->getConfig()->getPlugins();
$plugins_count = count($plugins);
if (isset($plugins[$plugin_id])) {
/**
* @var photosPlugin $plugin
*/
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
waSystem::pushActivePlugin($plugin_id, 'photos');
$namespace = 'photos_' . $plugin_id;
$params = array();
$params['id'] = $plugin_id;
$params['namespace'] = $namespace;
$params['title_wrapper'] = '%s';
$params['description_wrapper'] = '<br><span class="hint">%s</span>';
$params['control_wrapper'] = '<div class="name">%s</div><div class="value">%s %s</div>';
$settings_controls = $plugin->getControls($params);
$this->getResponse()->setTitle(_w(sprintf('Plugin %s settings', $plugin->getName())));
$this->view->assign('plugin_info', $plugins[$plugin_id]);
$this->view->assign('plugin_id', $plugin_id);
$this->view->assign('settings_controls', $settings_controls);
waSystem::popActivePlugin();
}
}
$this->view->assign('plugins_count', $plugins_count);
}
开发者ID:Lazary,项目名称:webasyst,代码行数:30,代码来源:photosPluginsSettings.action.php
示例2: 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
示例3: execute
public function execute()
{
$photo_id = waRequest::get('photo_id', null, waRequest::TYPE_INT);
$size = waRequest::get('size', null, waRequest::TYPE_STRING);
$album = null;
$photo_model = new photosPhotoModel();
$photo = $photo_model->getById($photo_id);
if (!$photo) {
throw new waException(_w("Unknown photo"));
}
$photo['frontend_link'] = photosFrontendPhoto::getLink($photo, $album);
$sizes = $this->getConfig()->getSizes();
$contexts = array();
foreach ($sizes as $sz) {
$contexts[$sz]['html'] = photosPhoto::getEmbedImgHtml($photo, $sz);
$contexts[$sz]['url'] = photosPhoto::getPhotoUrl($photo, $sz, true);
}
if (!$size || !isset($contexts[$size])) {
$size = $sizes[0];
}
$domains = photosPhoto::getDomains(null, $photo);
if (count($domains) <= 1) {
$domains = array();
}
$this->view->assign('photo', $photo);
$this->view->assign('sizes', $sizes);
$this->view->assign('size', $size);
$this->view->assign('contexts', $contexts);
$this->view->assign('original_domain', wa()->getRootUrl(true));
$this->view->assign('domains', $domains);
}
开发者ID:Lazary,项目名称:webasyst,代码行数:31,代码来源:photosDialogEmbedPhoto.action.php
示例4: execute
public function execute()
{
$name = basename(waRequest::get('file', 'export.csv'));
$profile = waRequest::get('profile', 0, waRequest::TYPE_INT);
$file = wa()->getTempPath('csv/download/' . $profile . '/' . $name);
waFiles::readFile($file, $name);
}
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:shopCsvProductdownload.controller.php
示例5: execute
public function execute()
{
$query = trim(waRequest::post('q'), ' /');
$hash = '/search/' . $query;
$collection = new photosCollection($hash);
if ($query == 'rate>0') {
$collection->orderBy('p.rate DESC, p.id');
}
$this->template = 'templates/actions/photo/PhotoList.html';
$count = $this->getConfig()->getOption('photos_per_page');
$photos = $collection->getPhotos("*,thumb,thumb_crop,thumb_middle,thumb_big,tags,edit_rights", 0, $count);
$photos = photosCollection::extendPhotos($photos);
$frontend_link = $query == 'rate>0' ? photosCollection::getFrontendLink('favorites', false) : photosCollection::getFrontendLink($hash, false);
/**
* @event search_frontend_link
* @param string $query
* @return array of bool|string if false - default frontend_link isn't overridden, if string - override default frontend link
*/
$res = wa()->event('search_frontend_link', $query);
foreach ($res as $r) {
if (is_string($r)) {
$frontend_link = $r;
break;
}
}
$config = $this->getConfig();
$this->view->assign('sidebar_width', $config->getSidebarWidth());
$this->view->assign('big_size', $config->getSize('big'));
$this->view->assign('frontend_link', $frontend_link);
$this->view->assign('photos', $photos);
$this->view->assign('title', $query == 'rate>0' ? _w('Rated') : $collection->getTitle());
$this->view->assign('total_count', $collection->count());
$this->view->assign('sort_method', $query == 'rate>0' ? 'rate' : 'upload_datetime');
$this->view->assign('hash', $hash);
}
开发者ID:Lazary,项目名称:webasyst,代码行数:35,代码来源:photosSearchPhotos.action.php
示例6: execute
public function execute()
{
parent::execute();
$this->view->assign('my_nav_selected', 'profile');
$user = wa()->getUser();
$user_info = array();
foreach ($this->form->fields as $id => $field) {
if (!in_array($id, array('password', 'password_confirm'))) {
if ($id === 'photo') {
$user_info[$id] = array('name' => _ws('Photo'), 'value' => '<img src="' . $user->getPhoto() . '">');
} else {
$user_info[$id] = array('name' => $this->form->fields[$id]->getName(null, true), 'value' => $user->get($id, 'html'));
}
}
}
$this->view->assign('user_info', $user_info);
// Set up layout and template from theme
$this->setThemeTemplate('my.profile.html');
if (!waRequest::isXMLHttpRequest()) {
$this->setLayout(new photosDefaultFrontendLayout());
$this->getResponse()->setTitle(_w('My account') . ' — ' . _w('My profile'));
$this->layout->assign('breadcrumbs', $this->getBreadcrumbs());
$this->layout->assign('nofollow', true);
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:25,代码来源:photosFrontendMy.action.php
示例7: execute
public function execute()
{
try {
$discountcard = waRequest::post('discountcard', array());
$model = new shopDiscountcardsPluginModel();
if (!empty($discountcard['id'])) {
$model->updateById($discountcard['id'], $discountcard);
$discountcard = $model->getById($discountcard['id']);
} elseif (empty($discountcard['discountcard'])) {
throw new waException('Ошибка: Не указан номер дисконтной карты');
} else {
if ($model->getByField('discountcard', $discountcard['discountcard'])) {
throw new waException('Ошибка: Номер дисконтной карты не уникален');
}
$id = $model->insert($discountcard);
$discountcard = $model->getById($id);
}
if (!empty($discountcard['contact_id'])) {
$contact = new waContact($discountcard['contact_id']);
$discountcard['contact_name'] = $contact->get('name');
}
$discountcard['amount'] = shop_currency($discountcard['amount']);
$this->response = $discountcard;
} catch (Exception $ex) {
$this->setError($ex->getMessage());
}
}
开发者ID:klxqz,项目名称:discountcards,代码行数:27,代码来源:shopDiscountcardsPluginBackendSaveDiscountcard.controller.php
示例8: getHash
public function getHash()
{
$order_ids = waRequest::post('order_id', null, waRequest::TYPE_ARRAY_INT);
if ($order_ids !== null) {
if ($order_ids) {
return 'id/' . implode(',', $order_ids);
} else {
return null;
}
}
$filter_params = waRequest::post('filter_params', null);
if ($filter_params === null) {
return null;
}
$hash = '';
if ($filter_params) {
if (count($filter_params) == 1) {
$k = key($filter_params);
$v = $filter_params[$k];
if (is_array($v)) {
$v = implode("||", $v);
}
if ($k == 'storefront') {
$k = 'params.' . $k;
if (substr($v, -1) == '*') {
$v = substr($v, 0, -1);
}
}
$hash = "search/{$k}={$v}";
}
}
return $hash;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:33,代码来源:shopOrdersPerformAction.controller.php
示例9: saveAction
public function saveAction()
{
$plugin_id = waRequest::get('id');
if (!$plugin_id) {
throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
}
$namespace = $this->getAppId() . '_' . $plugin_id;
/**
* @var shopPlugin $plugin
*/
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
$settings = (array) $this->getRequest()->post($namespace);
$files = waRequest::file($namespace);
$settings_defenitions = $plugin->getSettings();
foreach ($files as $name => $file) {
if (isset($settings_defenitions[$name])) {
$settings[$name] = $file;
}
}
try {
$response = $plugin->saveSettings($settings);
$response['message'] = _w('Saved');
$this->displayJson($response);
} catch (Exception $e) {
$this->setError($e->getMessage());
$this->displayJson(array(), $e->getMessage());
}
}
开发者ID:Rupreht,项目名称:webasyst-framework,代码行数:28,代码来源:waPlugins.actions.php
示例10: execute
public function execute()
{
$this->init();
$type = waRequest::param('type');
$this->hash = waRequest::param('hash');
if ($type == 'tag') {
$this->view->assign('criteria', 'by-tag');
$this->view->assign('tag', waRequest::param('tag'));
} else {
if ($type == 'favorites') {
$this->view->assign('criteria', 'favorites');
}
}
if (in_array($type, array('author', 'search', 'tag', 'favorites', 'id'))) {
waRequest::setParam('disable_sidebar', true);
$template = 'search.html';
} else {
$template = 'home.html';
if (!file_exists($this->getTheme()->getPath() . '/' . $template)) {
$template = 'view-thumbs.html';
// for backward compatibility reason
}
}
if ($type != 'all' && $type != 'favorites') {
waRequest::setParam('nofollow', true);
}
$layout = $this->getLayout();
if ($layout) {
$layout->assign('hash', $this->hash);
}
$this->setThemeTemplate($template);
$this->finite();
}
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:33,代码来源:photosFrontend.action.php
示例11: execute
public function execute()
{
$lazy = !is_null(waRequest::get('lazy'));
if (!$lazy) {
$this->setLayout(new photosDefaultFrontendLayout());
} else {
$this->setTemplate('FrontendPhotos');
}
$photos_per_page = wa('photos')->getConfig()->getOption('photos_per_page');
$limit = $photos_per_page;
$page = 1;
if ($lazy) {
$offset = max(0, waRequest::get('offset', 0, waRequest::TYPE_INT));
} else {
$page = max(1, waRequest::get('page', 1, waRequest::TYPE_INT));
$offset = ($page - 1) * $photos_per_page;
}
$c = new photosCollection('publicgallery/myphotos');
$photos = $c->getPhotos('*', $offset, $limit);
$photos = photosCollection::extendPhotos($photos);
$v = wa()->getVersion();
wa('photos')->getResponse()->addJs('js/lazy.load.js?v=' . $v, true);
wa('photos')->getResponse()->addJs('js/frontend.photos.js?v=' . $v, true);
$storage = wa()->getStorage();
$current_auth = $storage->read('auth_user_data');
$current_auth_source = $current_auth ? $current_auth['source'] : null;
$this->view->assign('current_auth', $current_auth, true);
$adapters = wa()->getAuthAdapters();
$total_count = $c->count();
$this->view->assign(array('photos' => $photos, 'page' => $page, 'offset' => $offset, 'photos_per_page' => $photos_per_page, 'total_photos_count' => $total_count, 'lazy_load' => $lazy, 'image_upload_url' => wa()->getRouteUrl('photos/frontend/imageUpload'), 'pages_count' => floor($total_count / $photos_per_page) + 1, 'current_auth_source' => $current_auth_source, 'adapters' => $adapters));
}
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:31,代码来源:photosPublicgalleryPluginFrontendMyphotos.action.php
示例12: execute
public function execute()
{
$name = rtrim(waRequest::post('name'), '/');
$domain_model = new siteDomainModel();
$data = array();
if (!preg_match('!^[a-z0-9/\\._-]+$!i', $name)) {
$data['title'] = $name;
$idna = new waIdna();
$name = $idna->encode($name);
}
$data['name'] = $name;
$this->response['id'] = $domain_model->insert($data);
$this->log('site_add');
// add default routing
$path = $this->getConfig()->getPath('config', 'routing');
if (file_exists($path)) {
$routes = (include $path);
} else {
$routes = array();
}
if (!isset($routes[$name])) {
$routes[$name]['site'] = array('url' => '*', 'app' => 'site');
waUtils::varExportToFile($routes, $path);
}
}
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:25,代码来源:siteDomainsSave.controller.php
示例13: execute
public function execute()
{
// only allowed to global admin
if (!wa()->getUser()->getRights('webasyst', 'backend')) {
throw new waRightsException('Access denied.');
}
$collection = new contactsCollection('users/all');
$group = null;
$memberIds = array();
if ($id = waRequest::get('id')) {
$group_model = new waGroupModel();
$group = $group_model->getById($id);
}
if ($group) {
$user_groups_model = new waUserGroupsModel();
$memberIds = $user_groups_model->getContactIds($id);
}
$users = $collection->getContacts('id,name');
// array(id => array(id=>...,name=>...))
$members = array();
foreach ($memberIds as $mid) {
if (isset($users[$mid])) {
$members[$mid] = $users[$mid];
unset($users[$mid]);
}
}
usort($members, array($this, '_cmp'));
usort($users, array($this, '_cmp'));
$this->view->assign('group', $group);
$this->view->assign('notIncluded', $users);
$this->view->assign('members', $members);
}
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:32,代码来源:contactsGroupsEditor.action.php
示例14: execute
public function execute()
{
$photo_id = $this->post('id', true);
if (!is_array($photo_id)) {
if (strpos($photo_id, ',') !== false) {
$photo_id = array_map('intval', explode(',', $photo_id));
} else {
$photo_id = array($photo_id);
}
}
$album_id = waRequest::post('album_id', '');
if (!$album_id) {
$album_id = array();
}
if (!is_array($album_id)) {
if (strpos($album_id, ',') !== false) {
$album_id = explode(',', $album_id);
} else {
$album_id = array($album_id);
}
}
$album_id = array_map('trim', $album_id);
$album_photos_model = new photosAlbumPhotosModel();
$photo_rights_model = new photosPhotoRightsModel();
$allowed_photo_id = $photo_rights_model->filterAllowedPhotoIds($photo_id, true);
if ($allowed_photo_id) {
$album_photos_model->deletePhotos($album_id, $allowed_photo_id);
$this->response = true;
} else {
throw new waAPIException('access_denied', 403);
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:32,代码来源:photos.photo.removeFromAlbums.method.php
示例15: execute
public function execute()
{
$this->setLayout(new shopBackendLayout());
$status = waRequest::get('status');
$tab = waRequest::get('tab');
$model = new waModel();
$cities = $model->query("SELECT * FROM shop_deliveryshop_city ORDER BY city ASC")->fetchAll();
$city['data'] = $cities;
$city['new'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_city WHERE status='new'")->fetchField();
$city['completed'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_city WHERE status='completed'")->fetchField();
$city['flag-white'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_city WHERE status='flag-white'")->fetchField();
$city['refunded'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_city WHERE status='refunded'")->fetchField();
$city['all'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_city")->fetchField();
foreach ($city['data'] as $key => &$c) {
if (is_numeric($c['region'])) {
$c['region'] = $model->query("SELECT name FROM wa_region WHERE code='" . $c['region'] . "' AND country_iso3='rus'")->fetchField();
}
if ($status && $status != $c['status'] && $tab == 'shop') {
unset($city['data'][$key]);
}
}
$pvz['data'] = $model->query("SELECT * FROM shop_deliveryshop_pvz ORDER BY city ASC")->fetchAll();
$pvz['new'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_pvz WHERE status='new'")->fetchField();
$pvz['completed'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_pvz WHERE status='completed'")->fetchField();
$pvz['flag-white'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_pvz WHERE status='flag-white'")->fetchField();
$pvz['refunded'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_pvz WHERE status='refunded'")->fetchField();
$pvz['all'] = $model->query("SELECT COUNT(*) FROM shop_deliveryshop_pvz")->fetchField();
$this->view->assign('cities', $city);
$this->view->assign('pvz', $pvz);
}
开发者ID:quadrodesign,项目名称:deliveryshop,代码行数:30,代码来源:shopDeliveryshopPluginBackendDisplay.action.php
示例16: execute
public function execute()
{
$order_id = waRequest::request('order_id', 0, 'int');
$id = waRequest::request('id', 0, 'int');
$to = waRequest::request('to');
$nm = new shopNotificationModel();
$n = $nm->getById($id);
if (!$n) {
$this->errors = sprintf_wp('%s entry not found', _w('Notification'));
return;
}
$om = new shopOrderModel();
$o = $om->getById($order_id);
if (!$o) {
$this->errors = _w('Order not found');
return;
}
shopHelper::workupOrders($o, true);
$opm = new shopOrderParamsModel();
$o['params'] = $opm->get($order_id);
try {
$contact = $o['contact_id'] ? new shopCustomer($o['contact_id']) : wa()->getUser();
$contact->getName();
} catch (Exception $e) {
$contact = new shopCustomer(wa()->getUser()->getId());
}
$cm = new shopCustomerModel();
$customer = $cm->getById($contact->getId());
if (!$customer) {
$customer = $cm->getEmptyRow();
}
$workflow = new shopWorkflow();
// send notifications
shopNotifications::sendOne($id, array('order' => $o, 'customer' => $contact, 'status' => $workflow->getStateById($o['state_id'])->getName()), $to);
}
开发者ID:Lazary,项目名称:webasyst,代码行数:35,代码来源:shopSettingsNotificationsTest.controller.php
示例17: execute
public function execute()
{
$cache = null;
if ($cache_time = $this->getConfig()->getOption('cache_time')) {
//$cache = new waSerializeCache('pages/'.$domain.$url.'page');
}
$page = array();
if ($cache && $cache->isCached()) {
$page = $cache->get();
} else {
$site = new siteFrontend();
if (waRequest::param('error')) {
$page = array();
} else {
$page = $site->getPage(waRequest::param('url', ''));
}
if ($page && $cache) {
$cache->set($page);
}
}
if (!waRequest::isXMLHttpRequest()) {
$this->setLayout(new siteFrontendLayout());
}
try {
$this->executeAction(new siteFrontendAction($page));
} catch (Exception $e) {
if (waSystemConfig::isDebug()) {
echo $e;
} else {
waSystem::setActive('site');
$this->executeAction(new siteFrontendAction($e));
}
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:siteFrontend.controller.php
示例18: execute
public function execute()
{
$settings = waRequest::post('settings', array(), waRequest::TYPE_ARRAY);
if (strlen($error = logsHelper::setPhpLogSetting(ifset($settings['php_log'], false)))) {
$this->errors[] = $error;
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:logsBackendSettingsSave.controller.php
示例19: step
protected function step()
{
$image_model = new shopProductImagesModel();
$create_thumbnails = waRequest::post('create_thumbnails');
$chunk_size = 50;
if ($create_thumbnails) {
$chunk_size = 10;
}
$sizes = wa('shop')->getConfig()->getImageSizes();
$images = $image_model->getAvailableImages($this->data['offset'], $chunk_size);
foreach ($images as $i) {
if ($this->data['product_id'] != $i['product_id']) {
sleep(0.2);
$this->data['product_id'] = $i['product_id'];
$this->data['product_count'] += 1;
}
try {
$path = shopImage::getThumbsPath($i);
if (!waFiles::delete($path)) {
throw new waException(sprintf(_w('Error when delete thumbnails for image %d'), $i['id']));
}
if ($create_thumbnails) {
shopImage::generateThumbs($i, $sizes);
}
$this->data['image_count'] += 1;
// image count - count of successful progessed images
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->data['offset'] += 1;
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:32,代码来源:shopSettingsImagesRegenerate.controller.php
示例20: execute
public function execute()
{
$this->getResponse()->addJs("js/jquery.pageless2.js?v=" . wa()->getVersion(), true);
$this->view->assign('site_theme_url', wa()->getDataUrl('themes', true, 'site') . '/' . waRequest::param('theme', 'default') . '/');
$this->view->assign('action', $action = waRequest::param('action', 'default'));
waRequest::setParam('action', $action);
$params = waRequest::param();
/**
* @event frontend_action_default
* @event frontend_action_post
* @event frontend_action_page
* @event frontend_action_error
* @param array[string]mixed $params request params
* @return array[string][string]string $return['%plugin_id%']
* @return array[string][string]string $return['%plugin_id%'][nav_before]
* @return array[string][string]string $return['%plugin_id%'][footer]
* @return array[string][string]string $return['%plugin_id%'][head]
* @return array[string][string]string $return['%plugin_id%'][sidebar]
*/
$this->view->assign('settlement_one_blog', isset($params['blog_id']) && $params['blog_url_type'] == $params['blog_id']);
$this->view->assign('frontend_action', $res = wa()->event('frontend_action_' . $action, $params));
if (!$this->view->getVars('links')) {
$this->view->assign('links', array());
}
$this->setThemeTemplate('index.html');
}
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:26,代码来源:blogFrontend.layout.php
注:本文中的waRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论