本文整理汇总了PHP中view::load方法的典型用法代码示例。如果您正苦于以下问题:PHP view::load方法的具体用法?PHP view::load怎么用?PHP view::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
// Get URI vars
$newsID = (int) uri::segment(3);
// Get news entry
if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
error::show404();
}
// Do we have views enabled?
if (config::item('news_views', 'news')) {
// Update views counter
$this->news_model->updateViews($newsID);
}
// Load ratings
if (config::item('news_rating', 'news') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$news['user_vote'] = $this->votes_model->getVote('news', $newsID);
} elseif (config::item('news_rating', 'news') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$news['user_vote'] = $this->likes_model->getLike('news', $newsID);
}
// Assign vars
view::assign(array('newsID' => $newsID, 'news' => $news));
// Set title
view::setTitle($news['data_title']);
// Set meta tags
view::setMetaDescription($news['data_meta_description']);
view::setMetaKeywords($news['data_meta_keywords']);
// Load view
view::load('news/view');
}
示例2: getTimeline
public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline')
{
loader::model('timeline/timeline');
// Get actions
$actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline'));
$ratings = array();
// Do we have actions and are we logged in?
if ($actions && users_helper::isLoggedin()) {
foreach ($actions as $action) {
if ($action['rating']) {
$ratings[$action['relative_resource']][] = $action['item_id'];
} else {
$ratings['timeline'][] = $action['action_id'];
}
}
// Load votes and like models
loader::model('comments/votes');
loader::model('comments/likes');
// Get likes and votes
$likes = codebreeder::instance()->likes_model->getMultiLikes($ratings);
$votes = codebreeder::instance()->votes_model->getMultiVotes($ratings);
$ratings = $likes + $votes;
}
// Can we post messages?
$post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false;
view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template);
// Update comments pagination
config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
return view::load($template, array(), 1);
}
示例3: manage
public function manage()
{
// 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' => $user['total_blocked'], 'profiles' => true);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Get blocked users
$users = array();
if ($params['total']) {
$users = $this->users_blocked_model->getUsers(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
} else {
view::setInfo(__('no_blocked_users', 'users_blocked'));
}
// Set pagination
$config = array('base_url' => config::siteURL('users/blocked/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('blocked_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('user' => $user, 'users' => $users, 'fields' => $fields, 'pagination' => $pagination));
// Set title
view::setTitle(__('blacklist', 'users'));
// Load view
view::load('users/blocked/manage');
}
示例4: results
public function results()
{
if (!input::get('search_id')) {
$this->index();
return;
}
// Parameters
$params = array('join_columns' => array('`u`.`verified`=1', '`u`.`active`=1', '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')', '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')'), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['max']);
// Get users
$users = array();
if ($params['total']) {
$users = $this->users_model->getUsers('in_list', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Get fields
$fields = $this->fields_model->getFields('users', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, 'view', 'in_list');
// Set pagination
$config = array('base_url' => config::siteURL('users/results?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => config::item('max_search_results', 'system'), 'items_per_page' => config::item('users_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('users' => $users, 'fields' => $fields, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('users', 'users_search_results');
// Set title
view::setTitle(__('search_results', 'system'), false);
// Assign actions
view::setAction('users?' . substr($qstring['url'], 0, -1), __('search_modify', 'system'), array('class' => 'icon-text icon-users-search-edit'));
// Load view
view::load('users/index');
}
示例5: edit
public function edit()
{
// Get URI vars
$subjectID = (int) uri::segment(6);
// Get subject
$subject = array();
if ($subjectID && !($subject = $this->reports_subjects_model->getSubject($subjectID, false))) {
view::setError(__('no_subject', 'reports_subjects'));
router::redirect('cp/content/reports/subjects');
}
// Assign vars
view::assign(array('subjectID' => $subjectID, 'subject' => $subject));
// Process form values
if (input::post('do_save_subject')) {
$this->_saveSubject($subjectID);
}
// Set title
view::setTitle($subjectID ? __('subject_edit', 'reports_subjects') : __('subject_new', 'reports_subjects'));
// Set trail
view::setTrail('cp/content/reports/subjects/edit/' . ($subjectID ? $subjectID : ''), $subjectID ? __('subject_edit', 'reports_subjects') . ' - ' . text_helper::entities($subject['name']) : __('subject_new', 'reports_subjects'));
// Set actions
if (count(config::item('languages', 'core', 'keywords')) > 1) {
view::setAction('translate', '');
}
// Load view
view::load('cp/content/reports/subjects/edit');
}
示例6: edit
public function edit()
{
// Get URI vars
$templateID = (int) uri::segment(6);
// Get template
$template = array();
if ($templateID && !($template = $this->messages_templates_model->getTemplate($templateID, false))) {
view::setError(__('no_template', 'messages_templates'));
router::redirect('cp/plugins/messages/templates');
}
// Assign vars
view::assign(array('templateID' => $templateID, 'template' => $template));
// Process form values
if (input::post('do_save_template')) {
$this->_saveTemplate($templateID);
}
// Set title
view::setTitle($templateID ? __('template_edit', 'messages_templates') : __('template_new', 'messages_templates'));
// Set trail
view::setTrail('cp/plugins/messages/templates/edit/' . ($templateID ? $templateID : ''), $templateID ? __('template_edit', 'messages_templates') . ' - ' . text_helper::entities($template['name']) : __('template_new', 'messages_templates'));
// Set actions
if (count(config::item('languages', 'core', 'keywords')) > 1) {
view::setAction('translate', '');
}
// Load view
view::load('cp/plugins/messages/templates/edit');
}
示例7: 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');
}
示例8: edit
public function edit()
{
// Get URI vars
$groupID = (int) uri::segment(6);
// Get group
$group = array();
if ($groupID && !($group = $this->banners_groups_model->getGroup($groupID))) {
view::setError(__('no_group', 'banners'));
router::redirect('cp/content/banners/groups');
}
// Assign vars
view::assign(array('groupID' => $groupID, 'group' => $group));
// Process form values
if (input::post('do_save_group')) {
$this->_saveGroup($groupID);
}
// Set title
view::setTitle($groupID ? __('group_edit', 'banners') : __('group_new', 'banners'));
// Set trail
view::setTrail('cp/content/banners/groups/edit/' . ($groupID ? $groupID : ''), $groupID ? __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name']) : __('group_new', 'banners'));
// Assign actions
if ($groupID) {
view::setAction('cp/content/banners/browse/' . $groupID, __('banners', 'banners'), array('class' => 'icon-text icon-banners'));
}
// Load view
view::load('cp/content/banners/groups/edit');
}
示例9: getPictures
public static function getPictures($params = array())
{
if (!session::permission('users_groups_browse', 'users') && !session::permission('users_types_browse', 'users')) {
return '';
}
loader::model('pictures/pictures');
$template = isset($params['template']) ? $params['template'] : 'pictures/helpers/pictures';
$user = isset($params['user']) && $params['user'] ? $params['user'] : array();
$userID = $user ? $user['user_id'] : (isset($params['user_id']) ? $params['user_id'] : 0);
$params['albums'] = true;
if ($userID) {
$params['join_columns'][] = '`p`.`user_id`=' . $userID;
}
if (!$userID || $userID != session::item('user_id')) {
if ($userID) {
$params['privacy'] = $userID;
} else {
$params['join_columns'][] = '`a`.`public`=1';
$params['join_columns'][] = '`u`.`verified`=1';
$params['join_columns'][] = '`u`.`active`=1';
$params['join_columns'][] = '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')';
$params['join_columns'][] = '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')';
}
}
$params['limit'] = isset($params['limit']) ? $params['limit'] : 10;
$params['order'] = isset($params['order']) ? $params['order'] : '';
$pictures = codebreeder::instance()->pictures_model->getPictures('in_list', $params['join_columns'], array(), $params['order'], $params['limit'], $params);
view::assign(array('pictures' => $pictures, 'user' => $user, 'params' => $params), '', $template);
return view::load($template, array(), 1);
}
示例10: payment
public function payment()
{
// Get URI vars
$planID = (int) uri::segment(4);
// Get plan
if (!$planID || !($plan = $this->plans_model->getPlan($planID)) || !$plan['active']) {
view::setError(__('no_plan', 'billing_plans'));
router::redirect('billing/plans');
}
// Get gateways
if (!($gateways = $this->gateways_model->getGateways())) {
view::setError(__('no_gateways_user', 'billing_gateways'));
router::redirect('billing/plans');
}
// Product
$plan['product_id'] = $planID;
$plan['type'] = 'plans';
// Assign vars
view::assign(array('product' => $plan, 'gateways' => $gateways, 'location' => 'billing/plans/payment/' . $planID));
// Set title
view::setTitle(__('payment', 'billing_transactions'));
// Set trail
view::setTrail('billing/plans', __('plans', 'billing_plans'));
// Load view
view::load('billing/payment');
}
示例11: payment
public function payment()
{
// Get URI vars
$packageID = (int) uri::segment(4);
// Get package
if (!$packageID || !($package = $this->credits_model->getPackage($packageID)) || !$package['active']) {
view::setError(__('no_package', 'billing_credits'));
router::redirect('billing/credits');
}
// Get gateways
if (!($gateways = $this->gateways_model->getGateways())) {
view::setError(__('no_gateways_user', 'billing_gateways'));
router::redirect('billing/credits');
}
// Product
$package['product_id'] = $packageID;
$package['name'] = __('credits_info', 'billing_credits', array('%s' => $package['credits']));
$package['type'] = 'credits';
// Assign vars
view::assign(array('product' => $package, 'gateways' => $gateways, 'location' => 'billing/credits/payment/' . $packageID));
// Set title
view::setTitle(__('payment', 'billing_transactions'));
// Set trail
view::setTrail('billing/credits', __('credits', 'billing_credits'));
// Load view
view::load('billing/payment');
}
示例12: postBlog
public function postBlog($items, $users)
{
$stream = array();
loader::model('blogs/blogs');
$params = array('select_users' => false);
// Get blogs
$columns = array('`b`.`blog_id` IN (' . implode(',', array_keys($items)) . ')');
$blogs = codebreeder::instance()->blogs_model->getBlogs('in_list', $columns, array(), false, count($items), $params);
foreach ($items as $itemID => $data) {
if (isset($blogs[$itemID]) && isset($users[$blogs[$itemID]['user_id']])) {
foreach ($data as $actionID => $item) {
$stream[$itemID][$actionID]['html'] = view::load('blogs/timeline/blog', array('user' => $users[$blogs[$itemID]['user_id']], 'blog' => $blogs[$itemID], 'params' => $item['params']), true);
$stream[$itemID][$actionID]['rating']['total_votes'] = $blogs[$itemID]['total_votes'];
$stream[$itemID][$actionID]['rating']['total_score'] = $blogs[$itemID]['total_score'];
$stream[$itemID][$actionID]['rating']['total_rating'] = $blogs[$itemID]['total_rating'];
$stream[$itemID][$actionID]['rating']['total_likes'] = $blogs[$itemID]['total_likes'];
$stream[$itemID][$actionID]['rating']['type'] = config::item('blog_rating', 'blogs');
$stream[$itemID][$actionID]['comments']['total_comments'] = $blogs[$itemID]['total_comments'];
$stream[$itemID][$actionID]['comments']['privacy'] = $blogs[$itemID]['comments'];
$stream[$itemID][$actionID]['comments']['post'] = $blogs[$itemID]['comments'] && codebreeder::instance()->users_model->getPrivacyAccess($blogs[$itemID]['user_id'], $blogs[$itemID]['comments'], false, $users[$blogs[$itemID]['user_id']]['friends'] ? 1 : 0) ? true : false;
}
}
}
return $stream;
}
示例13: game
public static function game($id = null, $action = null)
{
if ($id === null || $id === '') {
$array['title'] = 'test';
view::load('head', $array);
view::load('nav');
view::load('game_search');
view::load('footer');
//w::script('jquery');
//view::script('select2');
//view::script('sel2_gamesearch.js');
view::load('end');
} else {
$userId = 7;
$array = mysql::get('games', array('appid' => $id))[0];
$array['title'] = $array['name'];
$array['own'] = !empty(mysql::get('userlibrarys', array('userid' => $userId, 'appid' => $id)));
view::load('head', $array);
view::load('nav');
view::load('game', $array);
//view::load('game_search');
view::load('footer');
view::script('jquery');
view::script('select2');
view::script('sel2_gamesearch.js');
view::load('end');
}
}
示例14: edit
public function edit()
{
// Get URI vars
$templateID = (int) uri::segment(6);
// Get template
$template = array();
if ($templateID && !($template = $this->newsletters_templates_model->getTemplate($templateID, false))) {
view::setError(__('no_template', 'newsletters_templates'));
router::redirect('cp/content/newsletters/templates');
}
// Assign vars
view::assign(array('templateID' => $templateID, 'template' => $template));
// Process form values
if (input::post('do_save_template')) {
$this->_saveTemplate($templateID);
}
// Set title
view::setTitle($templateID ? __('template_edit', 'newsletters_templates') : __('template_new', 'newsletters_templates'));
// Set trail
view::setTrail('cp/content/newsletters/templates/edit/' . ($templateID ? $templateID : ''), $templateID ? __('template_edit', 'newsletters_templates') . ' - ' . text_helper::entities($template['name']) : __('template_new', 'newsletters_templates'));
// Load ckeditor
view::includeJavascript('externals/ckeditor/ckeditor.js');
// Load view
view::load('cp/content/newsletters/templates/edit');
}
示例15: settings
public function settings()
{
// Get URI vars
$keyword = uri::segment(5);
// Get service
if (!$keyword || !($service = $this->users_authentication_model->getService($keyword))) {
view::setError(__('no_service', 'users_authentication'));
router::redirect('cp/users/authentication');
}
// Get manifest
$manifest = $this->users_authentication_model->getManifest($keyword);
// Is demo mode enabled?
if (input::demo(0)) {
foreach ($service['settings'] as $k => $v) {
if ($v) {
$service['settings'][$k] = 'hidden in this demo';
}
}
}
// Assign vars
view::assign(array('manifest' => $manifest, 'service' => $service));
// Process form values
if (input::post('do_save_settings')) {
$this->_saveSettings($keyword, $manifest, $service);
}
// Set title
view::setTitle(__('settings', 'system'));
// Set trail
view::setTrail('cp/users/authentication/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($service['name']));
// Load view
view::load('cp/users/authentication/settings');
}