本文整理汇总了PHP中waRequest类的典型用法代码示例。如果您正苦于以下问题:PHP waRequest类的具体用法?PHP waRequest怎么用?PHP waRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了waRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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());
}
}
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}