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


PHP view::setError方法代码示例

本文整理汇总了PHP中view::setError方法的典型用法代码示例。如果您正苦于以下问题:PHP view::setError方法的具体用法?PHP view::setError怎么用?PHP view::setError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在view的用法示例。


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

示例1: _sendFeedback

 protected function _sendFeedback()
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Extra rules
     $rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
     if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
         $rules['captcha'] = array('rules' => array('is_captcha'));
     }
     validate::setRules($rules);
     // Validate form values
     if (!validate::run($rules)) {
         return false;
     }
     // Get values
     $email = input::post('email');
     $subject = input::post('subject');
     $message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
     // Send feedback
     if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
         if (!validate::getTotalErrors()) {
             view::setError(__('send_error', 'system'));
         }
         return false;
     }
     // Success
     view::setInfo(__('message_sent', 'feedback'));
     router::redirect('feedback');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:31,代码来源:feedback.php

示例2: delete

 public function delete()
 {
     // Get URI vars
     $typeID = (int) uri::segment(6);
     $fieldID = (int) uri::segment(7);
     // Get user type
     if (!$typeID || !($type = $this->users_types_model->getType($typeID))) {
         view::setError(__('no_type', 'users_types'));
         router::redirect('cp/userstypes');
     }
     // Delete profile question
     $this->deleteField('users', 'users_data_' . $type['keyword'], $typeID, $fieldID);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:13,代码来源:users.php

示例3: index

 public function index()
 {
     // Get license details
     if (!($license = $this->license_model->getLicense())) {
         view::setError(__('no_license', 'system_license'));
         router::redirect('cp/help/license/change');
     }
     // Assign vars
     view::assign(array('license' => $license));
     // Set title
     view::setTitle(__('help_license', 'system_navigation'));
     // Load view
     view::load('cp/help/license/view');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:14,代码来源:license.php

示例4: checkout

 public function checkout()
 {
     // Get URI vars
     $planID = (int) uri::segment(4);
     $gatewayID = uri::segment(5);
     // Get plan
     if (!$planID || !($plan = $this->plans_model->getPlan($planID, false)) || !$plan['active']) {
         view::setError(__('no_plan', 'billing_plans'));
         router::redirect('billing/plans');
     }
     $retval = $this->process($gatewayID, session::item('user_id'), 'plans', $planID, $plan['name'], $plan['price'], '', 'billing/plans');
     if (!$retval) {
         router::redirect('billing/plans/payment/' . $planID);
     }
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:15,代码来源:plans.php

示例5: checkout

 public function checkout()
 {
     // Get URI vars
     $packageID = (int) uri::segment(4);
     $gatewayID = uri::segment(5);
     // Get package
     if (!$packageID || !($package = $this->credits_model->getPackage($packageID)) || !$package['active']) {
         view::setError(__('no_package', 'billing_credits'));
         router::redirect('billing/credits');
     }
     // Set package name
     $name = __('credits_info', 'billing_credits', array('%s' => $package['credits']));
     $retval = $this->process($gatewayID, session::item('user_id'), 'credits', $packageID, $name, $package['price'], '', 'billing/credits');
     if (!$retval) {
         router::redirect('billing/credits/payment/' . $packageID);
     }
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:17,代码来源:credits.php

示例6: _submitReport

 protected function _submitReport($resource, $resourceID, $userID, $itemID, $subjects)
 {
     // Extra rules
     $rules = array('subject' => array('rules' => $subjects ? array('required', 'callback__is_valid_subject' => array($subjects)) : array('callback__is_valid_subject' => array($subjects))), 'message' => array('rules' => array('is_string', 'trim', 'max_length' => 255)));
     validate::setRules($rules);
     // Validate form values
     if (!validate::run($rules)) {
         return false;
     }
     // Get values
     $subject = $subjects ? (int) input::post('subject') : 0;
     $message = input::post('message');
     // Send feedback
     if (!$this->reports_model->saveReport($resourceID, $userID, $itemID, $subject, $message)) {
         if (!validate::getTotalErrors()) {
             view::setError(__('save_error', 'system'));
         }
         return false;
     }
     // Success
     router::redirect('report/sent' . (input::get('modal') ? '?modal=1' : ''));
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:22,代码来源:report.php

示例7: process

 protected function process($gatewayID, $userID, $type, $productID, $name, $amount, $params = '', $cancel = '', $success = '')
 {
     // Set return URLs
     $cancel = $cancel ? $cancel : 'users/settings';
     $success = $success ? $success : 'billing/invoices';
     // Get payment type
     if (!($type = $this->payments_model->getPaymentType($type))) {
         return false;
     }
     // Get gateway
     if (!$gatewayID || !($gateway = $this->gateways_model->getGateway($gatewayID)) || !$gateway['active']) {
         view::setError(__('no_gateway', 'billing_gateways'));
         return false;
     }
     // Create invoice
     if (!($invoiceID = $this->transactions_model->saveInvoice(0, $userID, $type['type_id'], $productID, $name, $amount, $params))) {
         view::setError(__('invoice_error', 'billing_transactions'));
         return false;
     }
     // Get invoice
     if (!($invoice = $this->transactions_model->getInvoice($invoiceID))) {
         view::setError(__('no_invoice', 'billing_transactions'));
         return false;
     }
     // Load payment library
     $payment = loader::library('payments/' . $gateway['keyword'], $gateway['settings'], null);
     // Get payment method
     $form = $payment->getForm($invoiceID, $name, $amount, $cancel, $success);
     // Is this a URL?
     if (preg_match('|^\\w+://|i', $form)) {
         router::redirect($form);
     } elseif (preg_match('|^<form|i', $form)) {
         view::load('billing/redirect', array('form' => $form));
         return true;
     }
     view::setError(__('payment_invalid', 'billing_transactions'));
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:37,代码来源:payments.php

示例8: edit

 public function edit()
 {
     // Get URI vars
     $plugin = uri::segment(5, 'system');
     // Assign vars
     view::assign(array('plugin' => $plugin));
     // Does plugin exist?
     if (!config::item('plugins', 'core', $plugin)) {
         view::setError(__('no_config_plugin', 'system_config'));
         router::redirect('cp/system/config/' . $plugin);
     }
     // Get meta tags
     if (!($tags = $this->metatags_model->getMetaTags($plugin))) {
         view::setError(__('no_meta_tags', 'system_metatags'));
         router::redirect('cp/system/config/' . $plugin);
     }
     // Process form values
     if (input::post('do_save_meta_tags')) {
         $this->_saveMetaTags($plugin, $tags);
     }
     // Assign vars
     view::assign(array('tags' => $tags));
     // Set title
     view::setTitle(__('system_meta_tags_manage', 'system_navigation'));
     // Set trail
     view::setTrail('cp/system/metatags/edit/' . $plugin, text_helper::entities(config::item('plugins', 'core', $plugin, 'name')));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Set tabs
     foreach ($tags as $keyword => $group) {
         view::setTab('#' . $keyword, __($keyword, $plugin . '_metatags'), array('class' => 'group_' . $keyword));
     }
     // Load view
     view::load('cp/system/metatags/edit');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:37,代码来源:metatags.php

示例9: update

 public function update()
 {
     // Get URI vars
     $plugin = uri::segment(5);
     // Get plugins
     if (!($plugins = $this->recalculate_model->getPlugins())) {
         view::setInfo(__('no_plugins', 'system_plugins'));
         router::redirect('cp/system/config/system');
     }
     // Get captcha
     if (!$plugin || !isset($plugins[$plugin])) {
         view::setError(__('no_plugin', 'utilities_counters'));
         router::redirect('cp/utilities/counters');
     }
     // Load plugin model
     $model = loader::model($plugin . '/' . $plugin, array(), null);
     // Update counters
     $result = $model->updateDbCounters();
     // Do we have redirect uri?
     if (isset($result['output']) && isset($result['redirect'])) {
         $result['redirect'] = $result['redirect'] ? 'update/' . $plugin . '/' . $result['redirect'] : '';
         $result['output'] .= '<br/>' . __('progress_redirect', 'utilities_counters', array(), array('%' => html_helper::anchor('cp/utilities/counters/' . $result['redirect'], '\\1')));
         if (!$result['redirect']) {
             view::setInfo(__('progress_done', 'utilities_counters', array('%1' => $plugins[$plugin])));
         }
         // Assign vars
         view::assign(array('output' => $result['output'], 'redirect' => $result['redirect']));
         if (input::isAjaxRequest()) {
             view::ajaxResponse(array('output' => $result['output'], 'redirect' => $result['redirect']));
         }
     }
     // Set title
     view::setTitle(__('utilities_counters_manage', 'system_navigation') . ' - ' . $plugins[$plugin]);
     // Load view
     view::load('cp/utilities/counters/update');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:36,代码来源:counters.php

示例10: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/content/banners')) {
         return false;
     }
     // Get URI vars
     $groupID = (int) uri::segment(6);
     // Get banner group
     if (!$groupID || !($group = $this->banners_groups_model->getGroup($groupID))) {
         view::setError(__('no_group', 'banners'));
         router::redirect('cp/content/banners/groups');
     }
     // Delete banner group
     $this->banners_groups_model->deleteGroup($groupID, $group);
     // Success
     view::setInfo(__('group_deleted', 'banners'));
     router::redirect('cp/content/banners/groups');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:19,代码来源:groups.php

示例11: toggle

 public function toggle()
 {
     // Get URI vars
     $templateID = (int) uri::segment(5);
     // Get template
     if (!$templateID || !($template = $this->emailtemplates_model->getTemplate($templateID))) {
         view::setError(__('no_template', 'system_email_templates'));
         router::redirect('cp/system/config/system');
     }
     $this->emailtemplates_model->toggleStatus($templateID, $template);
     router::redirect('cp/system/emailtemplates/browse/' . text_helper::entities(config::item('plugins', 'core', $template['plugin'], 'keyword')));
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:12,代码来源:emailtemplates.php

示例12: parseCounters

 protected function parseCounters($params, $gateways)
 {
     // Set filter fields
     $filters = array(array('name' => __('receipt_id', 'billing_transactions'), 'type' => 'text', 'keyword' => 'receipt_id'), array('name' => __('product', 'billing'), 'type' => 'text', 'keyword' => 'product'), array('name' => __('payment_gateway', 'billing'), 'type' => 'select', 'items' => $gateways, 'keyword' => 'gateway_id'), array('name' => __('user', 'system'), 'type' => 'text', 'keyword' => 'user'));
     // Assign vars
     view::assign(array('filters' => $filters, 'values' => array()));
     // Did user submit the filter form?
     if (input::post_get('do_search')) {
         $values = array();
         // Check extra product field
         $product = input::post_get('product');
         if ($product != '') {
             $params['join_columns'][] = "`i`.`name` LIKE '" . trim($this->db->escape($product, true), "'") . "'";
             $values['product'] = $product;
         }
         // Check extra receipt field
         $receipt_id = input::post_get('receipt_id');
         if ($receipt_id != '') {
             $params['join_columns'][] = "`t`.`receipt_id`=" . $this->db->escape($receipt_id);
             $values['receipt_id'] = $receipt_id;
         }
         // Check extra gateway field
         $gateway_id = input::post_get('gateway_id');
         if ($gateway_id && isset($gateways[$gateway_id])) {
             $params['join_columns'][] = "`t`.`gateway_id`=" . $gateway_id;
             $values['gateway_id'] = $gateway_id;
         }
         // Check extra user field
         $user = utf8::trim(input::post_get('user'));
         if ($user) {
             $params['join_columns'][] = $this->search_model->prepareValue($user, 'u', 'user');
             $values['user'] = $user;
         }
         // Search transactions
         $searchID = $this->search_model->searchData('billing_transaction', $filters, $params['join_columns'], $values);
         // Do we have any search terms?
         if ($searchID == 'no_terms') {
             view::setError(__('search_no_terms', 'system'));
         } elseif ($searchID == 'no_results') {
             view::setError(__('search_no_results', 'system'));
             $params['total'] = 0;
             return $params;
         } else {
             router::redirect('cp/billing/transactions?search_id=' . $searchID);
         }
     }
     // Do we have a search ID?
     if (!input::post_get('do_search') && input::get('search_id')) {
         // Get search
         if (!($search = $this->search_model->getSearch(input::get('search_id')))) {
             view::setError(__('search_expired', 'system'));
             router::redirect('cp/billing/transactions');
         }
         // Combine results
         $params['join_columns'] = $search['conditions']['columns'];
         $params['values'] = $search['values'];
         $params['total'] = $search['results'];
         // Assign vars
         view::assign(array('values' => $search['values']));
     } else {
         // Count transactions
         if (!($params['total'] = $this->counters_model->countData('billing_transaction', 0, 0, $params['join_columns'], array(), $params))) {
             view::setInfo(__('no_transactions', 'billing_transactions'));
         }
     }
     return $params;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:67,代码来源:transactions.php

示例13: delete

 public function delete($parentID = false, $actionID = false)
 {
     // Get URI vars
     $parentID = $parentID ? $parentID : (int) uri::segment(5);
     $pageID = $actionID ? $actionID : (int) uri::segment(6);
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/content/pages/browse/' . $parentID)) {
         return false;
     }
     // Get parent
     if ($parentID && !($parent = $this->pages_model->getPage($parentID))) {
         view::setError(__('no_parent', 'pages'));
         router::redirect('cp/content/pages/browse/' . $parentID);
     }
     // Get page
     if (!$pageID || !($page = $this->pages_model->getPage($pageID)) || $page['parent_id'] != $parentID) {
         view::setError(__('no_page', 'pages'));
         router::redirect('cp/content/pages/browse/' . $parentID);
     } elseif ($page['system']) {
         view::setError(__('page_system_delete', 'pages'));
         router::redirect('cp/content/pages/browse/' . $parentID);
     }
     // Delete page
     $this->pages_model->deletePage($pageID, $page);
     // Is this an action call?
     if ($actionID) {
         return;
     }
     // Process query string
     $qstring = $this->parseQuerystring();
     // Success
     view::setInfo(__('page_deleted', 'pages'));
     router::redirect('cp/content/pages/browse/' . $parentID . '?' . $qstring['url']);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:34,代码来源:pages.php

示例14: parseCounters

 protected function parseCounters($params = array())
 {
     // Assign vars
     view::assign(array('filters' => array(), 'values' => array()));
     // Do we have permission to search?
     if (session::permission('news_search', 'news')) {
         // Get fields
         $filters = $this->fields_model->getFields('news', 0, 'edit', 'in_search', true);
         // Set extra fields
         $filters[] = array('name' => __('search_keyword', 'system'), 'type' => 'text', 'keyword' => 'q');
         // Assign vars
         view::assign(array('filters' => $filters));
         // Did user submit the filter form?
         if (input::post_get('do_search') && session::permission('news_search', 'news')) {
             $values = array();
             $params['total'] = $params['max'] = 0;
             // Check extra keyword
             $keyword = utf8::trim(input::post_get('q'));
             if ($keyword) {
                 $params['join_columns'][] = $this->search_model->prepareValue($keyword, 'n', array('data_title_' . session::item('language'), 'data_body_' . session::item('language')));
                 $values['q'] = $keyword;
             }
             // Search news
             $searchID = $this->search_model->searchData('news', $filters, $params['join_columns'], $values, array('multilang' => true));
             // Do we have any search terms?
             if ($searchID == 'no_terms') {
                 view::setError(__('search_no_terms', 'system'));
             } elseif ($searchID == 'no_results') {
                 view::setError(__('search_no_results', 'system'));
                 return $params;
             } else {
                 router::redirect('news?search_id=' . $searchID);
             }
         }
         // Do we have a search ID?
         if (!input::post_get('do_search') && input::get('search_id')) {
             // Get search
             if (!($search = $this->search_model->getSearch(input::get('search_id')))) {
                 view::setError(__('search_expired', 'system'));
                 router::redirect('news');
             }
             // Set results
             $params['join_columns'] = $search['conditions']['columns'];
             $params['join_items'] = $search['conditions']['items'];
             $params['values'] = $search['values'];
             $params['total'] = $search['results'];
             $params['max'] = config::item('max_search_results', 'system') && config::item('max_search_results', 'system') < $params['total'] ? config::item('max_search_results', 'system') : $params['total'];
             // Assign vars
             view::assign(array('values' => $search['values']));
         }
     }
     if (!input::get('search_id')) {
         // Count news
         if (!($params['total'] = $this->counters_model->countData('news', 0, 0, $params['join_columns'], $params['join_items'], $params))) {
             view::setInfo(__('no_entries', 'news'));
         }
         $params['max'] = $params['total'];
     }
     return $params;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:60,代码来源:news.php

示例15: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/content/newsletters')) {
         return false;
     }
     // Get URI vars
     $newsletterID = (int) uri::segment(5);
     // Get newsletter
     if (!$newsletterID || !($newsletter = $this->newsletters_model->getNewsletter($newsletterID))) {
         view::setError(__('no_newsletter', 'newsletters'));
         router::redirect('cp/content/newsletters');
     }
     // Delete newsletter
     $this->newsletters_model->deleteNewsletter($newsletterID, $newsletter);
     // Success
     view::setInfo(__('newsletter_deleted', 'newsletters'));
     router::redirect('cp/content/newsletters');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:19,代码来源:newsletters.php


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