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'); }
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); }
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'); }
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'); }
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'); }
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'); }
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'); }
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'); }
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); }
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'); }
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'); }
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; }
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'); } }
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'); }
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'); }
public static function show($heading, $message) { if (ENV === 'production') { exit; } $array['heading'] = $heading; $array['message'] = $message; view::load('errors/generic', $array); }
function request($event, $data) { $qurl = $data['uri']; if (url($qurl)->like('/^\\/ldwp-webxml\\//')) { view::load('base:/dist/ldwp/dynamic/manager.php'); return true; } return false; }
public static function getNews($params = array()) { loader::model('news/news'); $template = isset($params['template']) ? $params['template'] : 'news/helpers/news'; $params['join_columns'][] = '`n`.`active`=1'; $params['limit'] = isset($params['limit']) ? $params['limit'] : 10; $params['order'] = isset($params['order']) ? $params['order'] : ''; $entries = codebreeder::instance()->news_model->getEntries('in_list', $params['join_columns'], array(), $params['order'], $params['limit'], $params); view::assign(array('entries' => $entries, 'params' => $params), '', $template); return view::load($template, array(), 1); }
public function index() { if (session::permission('users_manage', 'users')) { loader::controller('cp/users'); $this->users->browse(); } else { view::noAccess(false); // Load view view::load('cp/home'); } }
public function changeUserPicture($items, $users) { $stream = array(); foreach ($items as $itemID => $data) { if (isset($users[$itemID])) { foreach ($data as $actionID => $item) { $stream[$itemID][$actionID]['html'] = view::load('users/timeline/picture', array('user' => $users[$itemID]), true); } } } return $stream; }
public function index() { // Process form values if (input::post('do_send_feedback')) { $this->_sendFeedback(); } // Set meta tags $this->metatags_model->set('feedback', 'feedback_index'); // Set title view::setTitle(__('feedback_contact', 'system_navigation'), false); // Load view view::load('feedback/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'); }
public function recent() { // Load view if (input::isAjaxRequest()) { // Get notices $notices = $this->timeline_notices_model->getNotices(session::item('user_id'), 0, 5); $output = view::load('timeline/notices/recent', array('notices' => $notices), true); // Dow we have new notifications? if (session::item('total_notices_new')) { // Reset new notifications counter $this->timeline_notices_model->resetCounter(); } view::ajaxResponse($output); } }
public function browse() { // Parameters $params = array('join_columns' => array("`u`.`picture_id`!=0"), 'join_items' => array()); // Process filters $params = $this->parseCounters($params, 0); // Process query string $qstring = $this->parseQuerystring($params['total']); // Actions $actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system')); // Check form action if (input::post('do_action')) { // Delete selected albums if (input::post('action') && isset($actions[input::post('action')]) && input::post('user_id') && is_array(input::post('user_id'))) { foreach (input::post('user_id') as $userID) { $userID = (int) $userID; if ($userID && $userID > 0) { $this->action(input::post('action'), $userID); } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get pictures $users = array(); if ($params['total']) { $users = $this->users_model->getUsers('in_list', isset($params['values']['type']) ? $params['values']['type'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']); } // Set pagination $config = array('base_url' => config::siteURL('cp/users/pictures/browse?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->picturesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Assign vars view::assign(array('users' => $users, 'pagination' => $pagination, 'actions' => $actions)); // Set title view::setTitle(__('users_pictures_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#pictures-search\').toggle();return false;')); // Load view view::load('cp/users/pictures/browse'); }
public function postPicture($items, $users) { $stream = array(); loader::model('pictures/pictures'); loader::model('pictures/albums', array(), 'pictures_albums_model'); $params = array('select_users' => false); // Get file IDs $files = array(); foreach ($items as $itemID => $data) { foreach ($data as $actionID => $item) { foreach ($item['attachments'] as $fileID) { $files[$fileID] = $actionID; } } } if (!$files) { return array(); } // Get albums $columns = array('`a`.`album_id` IN (' . implode(',', array_keys($items)) . ')'); $albums = codebreeder::instance()->pictures_albums_model->getAlbums('in_list', $columns, array(), false, count($items), $params); // Get pictures $columns = array('`p`.`file_id` IN (' . implode(',', array_keys($files)) . ')'); $pictures = codebreeder::instance()->pictures_model->getPictures('in_list', $columns, array(), false, count($files), $params); foreach ($items as $itemID => $data) { if (isset($albums[$itemID]) && isset($users[$albums[$itemID]['user_id']])) { foreach ($data as $actionID => $item) { foreach ($pictures as $pictureID => $picture) { if (isset($item['attachments'][$picture['file_id']])) { $item['attachments'][$picture['file_id']] = $picture; unset($picture[$pictureID]); } } $stream[$itemID][$actionID]['html'] = view::load('pictures/timeline/pictures', array('user' => $users[$albums[$itemID]['user_id']], 'album' => $albums[$itemID], 'pictures' => $item['attachments'], 'params' => $item['params']), true); $stream[$itemID][$actionID]['rating']['total_votes'] = $albums[$itemID]['total_votes']; $stream[$itemID][$actionID]['rating']['total_score'] = $albums[$itemID]['total_score']; $stream[$itemID][$actionID]['rating']['total_rating'] = $albums[$itemID]['total_rating']; $stream[$itemID][$actionID]['rating']['total_likes'] = $albums[$itemID]['total_likes']; $stream[$itemID][$actionID]['rating']['type'] = config::item('album_rating', 'pictures'); } } } return $stream; }
public function view() { // Get URI vars $listID = uri::segment(6); // Get list if (!$listID || !($list = $this->lists_model->getList($listID))) { router::redirect('cp/system/config/system'); } // Did we submit the form? if (input::post('action') == 'reorder' && input::post('ids')) { $this->_reorderItems(); } // Get items if (!($items = $this->lists_model->getItems($listID))) { router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/templates/navigation', 'keyword' => 'templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'active' => array('html' => __('active', 'system'), 'class' => 'status')), 'content' => array()); // Create grid content foreach ($items as $item) { $grid['content'][] = array('name' => array('html' => $item['name']), 'status' => array('html' => html_helper::anchor('cp/system/templates/navigation/togglestatus/' . $item['item_id'], $item['active'] ? __('yes', 'system') : __('no', 'system'), array('class' => $item['active'] ? 'label success small' : 'label important small')))); } // Filter hooks hook::filter('cp/system/templates/navigation/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid, 'items' => $items, 'listID' => $listID)); // Set title view::setTitle(__('system_templates_navigation_manage', 'system_navigation')); // Set trail view::setTrail('cp/system/templates/navigation/view/' . $listID, $list['name']); // Set actions view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save')); view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel')); view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder')); // Include sortable vendor files view::includeJavascript('externals/html5sortable/html5sortable.js'); view::includeStylesheet('externals/html5sortable/style.css'); // Load view if (input::isAjaxRequest()) { view::load('cp/system/templates/navigation/items/browse_' . (input::post('view') == 'list' ? 'list' : 'grid')); } else { view::load('cp/system/templates/navigation/items/browse'); } }
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'); }
public function edit() { // Get URI vars $typeID = (int) uri::segment(5); // Get type $type = array(); if ($typeID && !($type = $this->users_types_model->getType($typeID, false))) { view::setError(__('no_type', 'users_types')); router::redirect('cp/users/types'); } $fields = array(); // Do we have an existing type? if ($typeID) { // Get text fields $fields = array('' => __('none', 'system')); foreach ($this->fields_model->getFields('users', $typeID) as $field) { if ($field['type'] == 'text') { $fields[$field['keyword']] = $field['name']; } } } // Assign vars view::assign(array('typeID' => $typeID, 'type' => $type, 'fields' => $fields)); // Process form values if (input::post('do_save_type')) { $this->_saveType($typeID, $type, $fields); } // Set title view::setTitle($typeID ? __('type_edit', 'users_types') : __('type_new', 'users_types')); // Set trail view::setTrail('cp/users/types/edit/' . ($typeID ? $typeID : ''), $typeID ? __('type_edit', 'users_types') . ' - ' . text_helper::entities($type['name']) : __('type_new', 'users_types')); // Set trail if ($typeID) { // Assign actions view::setAction('cp/system/fields/users/browse/' . $typeID, __('profile_questions', 'users_types'), array('class' => 'icon-text icon-system-fields')); } if (count(config::item('languages', 'core', 'keywords')) > 1) { view::setAction('translate', ''); } // Load view view::load('cp/users/types/edit'); }
public function view() { // Get URI vars $keyword = uri::segment(5); // Get plugin if (!$keyword || !($plugin = $this->plugins_model->getPlugin($keyword))) { view::setError(__('no_plugin', 'system_plugins')); router::redirect('cp/system/plugins'); } // Get manifest $manifest = $this->plugins_model->getManifest($keyword); // Assign vars view::assign(array('manifest' => $manifest, 'plugin' => $plugin)); // Set title view::setTitle(__('plugin_view', 'system_plugins')); // Set trail view::setTrail('cp/system/plugins/view/' . $keyword, __('plugin_view', 'system_plugins') . ' - ' . $plugin['name']); // Load view view::load('cp/system/plugins/view'); }
public static function getAds($params = array()) { loader::model('classifieds/classifieds'); $template = isset($params['template']) ? $params['template'] : 'classifieds/helpers/classifieds'; $user = isset($params['user']) && $params['user'] ? $params['user'] : array(); $userID = $user ? $user['user_id'] : (isset($params['user_id']) ? $params['user_id'] : 0); if ($userID) { $params['join_columns'][] = '`a`.`user_id`=' . $userID; } if (!$userID || $userID != session::item('user_id')) { if ($userID) { $params['join_columns'][] = '`a`.`post_date`>' . (date_helper::now() - config::item('ad_expiration', 'classifieds') * 60 * 60 * 24); } else { $params['join_columns'][] = '`u`.`active`=1'; } } $params['limit'] = isset($params['limit']) ? $params['limit'] : 10; $params['order'] = isset($params['order']) ? $params['order'] : ''; $ads = codebreeder::instance()->classifieds_model->getAds('in_list', $params['join_columns'], array(), $params['order'], $params['limit'], $params); view::assign(array('ads' => $ads, 'user' => $user, 'params' => $params), '', $template); return view::load($template, array(), 1); }