本文整理汇总了PHP中View::setPageInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP View::setPageInfo方法的具体用法?PHP View::setPageInfo怎么用?PHP View::setPageInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::setPageInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.search.display');
if (User::get()->g_search == '0') {
throw new Error(__('No search permission'), 403);
}
// Figure out what to do :-)
if (Input::query('action') || Input::query('search_id')) {
$search = $this->model->get_search_results();
// We have results to display
if (!is_object($search) && isset($search['is_result'])) {
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Search results')), 'active_page' => 'search', 'search' => $search, 'footer' => $search));
$display = $this->model->display_search_results($search);
View::setPageInfo(array('display' => $display));
View::addTemplate('search/header.php', 1);
if ($search['show_as'] == 'posts') {
View::addTemplate('search/posts.php', 5);
} else {
View::addTemplate('search/topics.php', 5);
}
View::addTemplate('search/footer.php', 10)->display();
} else {
return Router::redirect(Router::pathFor('search'), __('No hits'));
}
} else {
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Search')), 'active_page' => 'search', 'focus_element' => array('search', 'keywords'), 'is_indexed' => true, 'forums' => $this->model->get_list_forums()))->addTemplate('search/form.php')->display();
}
}
示例2: __construct
public function __construct($container)
{
$pendingPlugins = ORM::for_table('market_plugins')->where('status', 0)->count();
$pendingThemes = ORM::for_table('market_themes')->where('status', 0)->count();
$stats = ['pendingPlugins' => $pendingPlugins, 'pendingThemes' => $pendingThemes];
View::setPageInfo($stats);
}
示例3: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.maintenance.display');
$action = '';
if (Input::post('action')) {
$action = Input::post('action');
} elseif (Input::query('action')) {
$action = Input::query('action');
}
if ($action == 'rebuild') {
$this->model->rebuild();
View::setPageInfo(array('page_title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Rebuilding search index')), 'query_str' => $this->model->get_query_str()))->addTemplate('admin/maintenance/rebuild.php')->display();
}
if ($action == 'prune') {
$prune_from = Utils::trim(Input::post('prune_from'));
$prune_sticky = intval(Input::post('prune_sticky'));
AdminUtils::generateAdminMenu('maintenance');
if (Input::post('prune_comply')) {
$this->model->prune_comply($prune_from, $prune_sticky);
}
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Prune')), 'active_page' => 'admin', 'admin_console' => true, 'prune_sticky' => $prune_sticky, 'prune_from' => $prune_from, 'prune' => $this->model->get_info_prune($prune_sticky, $prune_from)))->addTemplate('admin/maintenance/prune.php')->display();
}
AdminUtils::generateAdminMenu('maintenance');
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Maintenance')), 'active_page' => 'admin', 'admin_console' => true, 'first_id' => $this->model->get_first_id(), 'categories' => $this->model->get_categories()))->addTemplate('admin/maintenance/admin_maintenance.php')->display();
}
示例4: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.userlist.display');
if (User::get()->g_view_users == '0') {
throw new Error(__('No permission'), 403);
}
// Determine if we are allowed to view post counts
$show_post_count = ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod ? true : false;
$username = Input::query('username') && User::get()->g_search_users == '1' ? Utils::trim(Input::query('username')) : '';
$show_group = Input::query('show_group') ? intval(Input::query('show_group')) : -1;
$sort_by = Input::query('sort_by') && (in_array(Input::query('sort_by'), array('username', 'registered')) || Input::query('sort_by') == 'num_posts' && $show_post_count) ? Input::query('sort_by') : 'username';
$sort_dir = Input::query('sort_dir') && Input::query('sort_dir') == 'DESC' ? 'DESC' : 'ASC';
$num_users = $this->model->fetch_user_count($username, $show_group);
// Determine the user offset (based on $page)
$num_pages = ceil($num_users / 50);
$p = !Input::query('p') || $page <= 1 || $page > $num_pages ? 1 : intval($page);
$start_from = 50 * ($p - 1);
if (User::get()->g_search_users == '1') {
$focus_element = array('userlist', 'username');
} else {
$focus_element = array();
}
// Generate paging links
$paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?username=' . urlencode($username) . '&show_group=' . $show_group . '&sort_by=' . $sort_by . '&sort_dir=' . $sort_dir);
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('User list')), 'active_page' => 'userlist', 'page_number' => $p, 'paging_links' => $paging_links, 'focus_element' => $focus_element, 'is_indexed' => true, 'username' => $username, 'show_group' => $show_group, 'sort_by' => $sort_by, 'sort_dir' => $sort_dir, 'show_post_count' => $show_post_count, 'dropdown_menu' => $this->model->generate_dropdown_menu($show_group), 'userlist_data' => $this->model->print_users($username, $start_from, $sort_by, $sort_dir, $show_group)))->addTemplate('userlist.php')->display();
}
示例5: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.statistics.display');
AdminUtils::generateAdminMenu('index');
$total = $this->model->get_total_size();
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Server statistics')), 'active_page' => 'admin', 'admin_console' => true, 'server_load' => $this->model->get_server_load(), 'num_online' => $this->model->get_num_online(), 'total_size' => $total['size'], 'total_records' => $total['records'], 'php_accelerator' => $this->model->get_php_accelerator()))->addTemplate('admin/statistics.php')->display();
}
示例6: login
function login($req, $res, $args)
{
if ($req->isPost()) {
$form_username = Input::post('req_username');
$form_password = Input::post('req_password');
$save_pass = (bool) Input::post('save_pass');
// If form was correctly filled
if ($form_username && $form_password) {
$user = AuthModel::get_user_from_name($form_username);
// Compare user pass with form data
$form_password_hash = Random::hash($form_password);
// Will result in a SHA-1 hash
if ($user->password == $form_password_hash) {
$expire = $save_pass ? time() + 1209600 : time() + 1800;
$jwt = AuthModel::generate_jwt($user);
AuthModel::feather_setcookie('Bearer ' . $jwt, $expire);
return Router::redirect(Router::pathFor('home'), 'Welcome ' . $user->username . '!');
} else {
throw new \Exception('Wrong user/pass', 403);
}
} else {
throw new \Exception("Username and password are required fields.", 1);
}
} elseif ($req->isGet()) {
return View::setPageInfo(['title' => 'Login', 'active_nav' => 'login'])->addTemplate('login.php')->display();
}
}
示例7: rules
public function rules()
{
Container::get('hooks')->fire('controller.index.rules');
if (ForumSettings::get('o_rules') == '0' || User::get()->is_guest && User::get()->g_read_board == '0' && ForumSettings::get('o_regs_allow') == '0') {
throw new Error(__('Bad request'), 404);
}
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Forum rules')), 'active_page' => 'rules'))->addTemplate('misc/rules.php')->display();
}
示例8: edit
public function edit($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.bans.edit');
if (Input::post('add_edit_ban')) {
return $this->model->insert_ban();
}
AdminUtils::generateAdminMenu('bans');
View::setPageInfo(array('admin_console' => true, 'focus_element' => array('bans2', 'ban_user'), 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Bans')), 'ban' => $this->model->edit_ban_info($args['id'])))->addTemplate('admin/bans/add_ban.php')->display();
}
示例9: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.options.display');
if (Request::isPost()) {
return $this->model->update_options();
}
AdminUtils::generateAdminMenu('options');
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Options')), 'active_page' => 'admin', 'admin_console' => true, 'languages' => $this->model->get_langs(), 'styles' => $this->model->get_styles(), 'times' => $this->model->get_times()))->addTemplate('admin/options.php')->display();
}
示例10: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.permissions.display');
// Update permissions
if (Request::isPost()) {
return $this->model->update_permissions();
}
AdminUtils::generateAdminMenu('permissions');
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Permissions')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/permissions.php')->display();
}
示例11: index
public function index($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.plugins.index');
View::addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
$availablePlugins = Lister::getPlugins();
$activePlugins = Container::get('cache')->isCached('activePlugins') ? Container::get('cache')->retrieve('activePlugins') : array();
$officialPlugins = Lister::getOfficialPlugins();
AdminUtils::generateAdminMenu('plugins');
View::setPageInfo(array('admin_console' => true, 'active_page' => 'admin', 'availablePlugins' => $availablePlugins, 'activePlugins' => $activePlugins, 'officialPlugins' => $officialPlugins, 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Extension'))))->addTemplate('admin/plugins.php')->display();
}
示例12: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.reports.display');
// Zap a report
if (Request::isPost()) {
$zap_id = intval(key(Input::post('zap_id')));
$this->model->zap_report($zap_id);
return Router::redirect(Router::pathFor('adminReports'), __('Report zapped redirect'));
}
AdminUtils::generateAdminMenu('reports');
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Reports')), 'active_page' => 'admin', 'admin_console' => true, 'report_data' => $this->model->get_reports(), 'report_zapped_data' => $this->model->get_zapped_reports()))->addTemplate('admin/reports.php')->display();
}
示例13: addedit
public function addedit($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.groups.addedit');
$groups = $this->model->fetch_groups();
// Add/edit a group (stage 2)
if (Input::post('add_edit_group')) {
return $this->model->add_edit_group($groups);
} elseif (Input::post('add_group') || isset($args['id'])) {
AdminUtils::generateAdminMenu('groups');
$group = $this->model->info_add_group($groups, $args['id']);
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('User groups')), 'active_page' => 'admin', 'admin_console' => true, 'focus_element' => array('groups2', 'req_title'), 'required_fields' => array('req_title' => __('Group title label')), 'group' => $group, 'groups' => $groups, 'id' => $args['id'], 'group_list' => $this->model->get_group_list($groups, $group)))->addTemplate('admin/groups/add_edit_group.php')->display();
}
}
示例14: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.censoring.display');
// Add a censor word
if (Input::post('add_word')) {
return $this->model->add_word();
} elseif (Input::post('update')) {
return $this->model->update_word();
} elseif (Input::post('remove')) {
return $this->model->remove_word();
}
AdminUtils::generateAdminMenu('censoring');
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Censoring')), 'focus_element' => array('censoring', 'new_search_for'), 'active_page' => 'admin', 'admin_console' => true, 'word_data' => $this->model->get_words()))->addTemplate('admin/censoring.php')->display();
}
示例15: rules
public function rules($req, $res, $args)
{
Container::get('hooks')->fire('controller.register.rules');
// If we are logged in, we shouldn't be here
if (!User::get()->is_guest) {
return Router::redirect(Router::pathFor('home'));
}
// Display an error message if new registrations are disabled
if (ForumSettings::get('o_regs_allow') == '0') {
throw new Error(__('No new regs'), 403);
}
if (ForumSettings::get('o_rules') != '1') {
return Router::redirect(Router::pathFor('register'));
}
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Register'), __('Forum rules')), 'active_page' => 'register'))->addTemplate('register/rules.php')->display();
}