本文整理汇总了PHP中view::setInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP view::setInfo方法的具体用法?PHP view::setInfo怎么用?PHP view::setInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view::setInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoices
public function invoices()
{
// Get page
$page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1;
// Parameters
$params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id')));
// Process query string
$qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions'));
// Get invoices
$invoices = array();
if (session::item('total_transactions')) {
$invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']);
} else {
view::setInfo(__('no_invoices_user', 'billing_transactions'));
}
// Set pagination
$config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('invoices' => $invoices, 'pagination' => $pagination));
// Set title
view::setTitle(__('invoices', 'billing_transactions'));
// Load view
view::load('billing/invoices');
}
示例2: _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');
}
示例3: __construct
public function __construct()
{
parent::__construct();
$authID = session::item('auth_id');
$userID = session::item('user_id');
$ipaddress = substr(input::ipaddress(), 0, 15);
$useragent = substr(input::useragent(), 0, 255);
$user = array();
if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) {
if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) {
$this->saveSession($authID, $userID, $ipaddress, $useragent);
if (isset($user['user_id']) && $user['user_id']) {
$this->saveLastvisit($user['user_id']);
}
}
} else {
$cookie = cookie::item('sessdata');
$cookie = $cookie ? @json_decode($cookie, true) : array();
if ($cookie && is_array($cookie)) {
$userID = isset($cookie['user_id']) ? $cookie['user_id'] : '';
$email = isset($cookie['email']) ? $cookie['email'] : '';
$passhash = isset($cookie['passhash']) ? $cookie['passhash'] : '';
if ($userID && is_numeric($userID) && $userID > 0) {
if ($user = $this->getUser($userID, false, false)) {
$newPasshash = $this->generatePasshash($email, $user['password']);
if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) {
$authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent);
$this->saveLastvisit($user['user_id']);
} else {
$user = array();
}
}
}
}
}
if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) {
$userID = 0;
if (!$user) {
$authID = $this->saveSession(0, $userID, $ipaddress, $useragent);
}
$this->createGuestSession();
}
session::set('auth_id', $authID);
session::set('user_id', $userID);
// Is the site offline?
if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') {
router::redirect('site/offline');
} elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) {
router::redirect('cp/users/login');
}
if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) {
$this->logout();
view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.');
router::redirect();
}
}
示例4: plans
public function plans()
{
// Get plans
if (!($plans = $this->plans_model->getPlans())) {
view::setInfo(__('no_plans_user', 'billing_plans'));
}
// Assign vars
view::assign(array('plans' => $plans));
// Set title
view::setTitle(__('plans', 'billing_plans'));
// Load view
view::load('billing/plans');
}
示例5: credits
public function credits()
{
// Get packages
if (!($packages = $this->credits_model->getPackages())) {
view::setInfo(__('no_packages_user', 'billing_credits'));
}
// Assign vars
view::assign(array('packages' => $packages));
// Set title
view::setTitle(__('credits', 'billing_credits'));
// Load view
view::load('billing/credits');
}
示例6: manage
public function manage()
{
// Does user have permission to view visitors?
if (!session::permission('users_visitors_browse', 'users')) {
view::noAccess();
}
// Assign user from session to variable
$user = session::section('session');
// Get fields
$fields = array();
foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
$fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
}
// Parameters
$params = array('total' => session::permission('users_visitors_limit', 'users') && session::permission('users_visitors_limit', 'users') < $user['total_visitors'] ? session::permission('users_visitors_limit', 'users') : $user['total_visitors'], 'profiles' => true);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Get visitors
$visitors = array();
if ($params['total']) {
$visitors = $this->users_visitors_model->getVisitors(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
} else {
view::setInfo(__('no_visitors', 'users_visitors'));
}
// Set pagination
$config = array('base_url' => config::siteURL('users/visitors/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('visitors_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('user' => $user, 'visitors' => $visitors, 'fields' => $fields, 'pagination' => $pagination));
// Dow we have new visitors?
if (session::item('total_visitors_new')) {
// Reset new visitors counter
$this->users_visitors_model->resetCounter();
}
// Set title
view::setTitle(__('my_visitors', 'system_navigation'));
// Set trail
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('users/visitors/manage', __('users_visitors', 'system_navigation'));
// Load view
view::load('users/visitors/manage');
}
示例7: 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');
}
示例8: 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']);
}
示例9: parseCounters
protected function parseCounters($params)
{
// Do we have any conversations?
if (!$params['total']) {
view::setInfo(__('no_messages_self', 'messages'));
}
$params['max'] = $params['total'];
return $params;
}
示例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');
}
示例11: _saveMetaTags
protected function _saveMetaTags($plugin, $tags)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
$rules = array();
foreach ($tags as $keyword => $group) {
foreach (config::item('languages', 'core', 'keywords') as $language) {
$rules[$keyword . '_title_' . $language] = $rules[$keyword . '_description_' . $language] = $rules[$keyword . '_keywords_' . $language] = array('label' => '', 'rules' => array('is_string', 'trim', 'max_length' => 255));
}
}
validate::setRules($rules);
if (!validate::run()) {
return false;
}
foreach ($tags as $keyword => $group) {
$data = array();
foreach (config::item('languages', 'core', 'keywords') as $language) {
$data['meta_title_' . $language] = input::post($keyword . '_title_' . $language);
$data['meta_description_' . $language] = input::post($keyword . '_description_' . $language);
$data['meta_keywords_' . $language] = input::post($keyword . '_keywords_' . $language);
}
$this->metatags_model->saveMetaTags($plugin, $keyword, $data);
}
view::setInfo(__('meta_tags_saved', 'system_metatags'));
router::redirect('cp/system/metatags/edit/' . $plugin);
}
示例12: _saveLanguageData
protected function _saveLanguageData($plugin, $language, $default)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Create rules
$rules = array();
foreach ($default as $section => $groups) {
foreach ($groups as $group => $types) {
foreach ($types as $type => $lang) {
foreach ($lang as $keyword => $name) {
$rules[$group . '_' . $keyword] = array('label' => '', 'rules' => array('trim', 'required'));
}
}
}
}
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get language data
$languageData = array();
foreach ($default as $section => $groups) {
foreach ($groups as $group => $types) {
foreach ($types as $type => $lang) {
foreach ($lang as $keyword => $name) {
$cp = $type == 'cp' ? 1 : 0;
// Set language data
$data = array('value_' . $language => input::post($group . '_' . $keyword));
// Save language string
$this->languages_model->saveLanguageData($plugin, $section, $group, $keyword, $data);
}
}
}
}
// Recompile language pack
$this->languages_model->compile($language);
// Success
view::setInfo(__('language_saved', 'system_languages'));
router::redirect('cp/system/languages/translate/' . $plugin . '/' . $language);
}
示例13: 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;
}
示例14: parseCounters
protected function parseCounters($params = array(), $type = 'index')
{
// Assign vars
view::assign(array('filters' => array(), 'values' => array()));
// Do we have permission to search?
if (session::permission('albums_search', 'pictures')) {
// Get fields
$filters = $this->fields_model->getFields('pictures', 1, '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('albums_search', 'pictures')) {
$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, 'a', array('data_title', 'data_description'));
$values['q'] = $keyword;
}
// Search albums
$searchID = $this->search_model->searchData('picture_album', $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'));
return $params;
} else {
switch ($type) {
case 'user':
router::redirect('pictures/user/' . uri::segment(4) . '?search_id=' . $searchID);
break;
case 'manage':
router::redirect('pictures/manage?search_id=' . $searchID);
break;
default:
router::redirect('pictures?search_id=' . $searchID);
break;
}
}
}
// 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'));
switch ($type) {
case 'user':
router::redirect('pictures/user/' . uri::segment(4));
break;
case 'manage':
router::redirect('pictures/manage');
break;
default:
router::redirect('pictures');
break;
}
}
// 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 albums
if ($type == 'manage' && !$params['total'] || $type != 'manage' && !($params['total'] = $this->counters_model->countData('picture_album', 0, 0, $params['join_columns'], $params['join_items'], $params))) {
if ($type == 'manage') {
view::setInfo(__('no_albums_self', 'pictures'));
} else {
view::setInfo(__('no_albums', 'pictures'));
}
}
$params['max'] = $params['total'];
}
return $params;
}
示例15: delete
public function delete()
{
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(4)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
} elseif ($user['user_id'] == session::item('user_id')) {
router::redirect($user['slug']);
}
// Does user exist?
if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) {
view::setError(__('no_blocked_user', 'users_blocked'));
router::redirect('users/blocked');
}
// Delete blocked user
$this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']);
// Success
view::setInfo(__('user_unblocked', 'users_blocked'));
router::redirect(input::get('page') ? 'users/blocked' : $user['slug']);
}