public function index() { // Get storage services if (!($services = $this->storage_model->scanServices())) { view::setError(__('no_services', 'system_storage')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/storage', 'keyword' => 'storages', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'description' => array('html' => __('description', 'system'), 'class' => 'description'), 'status' => array('html' => __('default', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($services as $service) { $actions = $status = array(); if (isset($service['service_id']) && $service['service_id']) { $status['html'] = $service['default'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : html_helper::anchor('cp/system/storage/setdefault/' . $service['keyword'], __('no', 'system'), array('class' => 'label important small')); $actions['html']['settings'] = html_helper::anchor('cp/system/storage/settings/' . $service['keyword'], __('settings', 'system'), array('class' => 'settings')); $actions['html']['uninstall'] = html_helper::anchor('cp/system/storage/uninstall/' . $service['keyword'], __('uninstall', 'system'), array('data-html' => __('service_uninstall?', 'system_storage'), 'data-role' => 'confirm', 'class' => 'uninstall')); } else { $status['html'] = '<span class="label important small">' . __('no', 'system') . '</span>'; $actions['html']['install'] = html_helper::anchor('cp/system/storage/install/' . $service['keyword'], __('install', 'system'), array('class' => 'install')); } $grid['content'][] = array('name' => array('html' => text_helper::entities($service['name'])), 'description' => array('html' => text_helper::entities($service['description'])), 'status' => $status, 'actions' => $actions); } // Filter hooks hook::filter('cp/system/storage/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('system_storages_manage', 'system_navigation')); // Load view view::load('cp/system/storage/browse'); }
public function browse() { // Get URI vars $groupID = (int) uri::segment(5); // Get group if (!$groupID || !($group = $this->banners_groups_model->getGroup($groupID))) { view::setError(__('no_group', 'banners')); router::redirect('cp/content/banners/groups'); } // Process query string $params = $this->parseQuerystring(); // Get banners if (!($banners = $this->banners_model->getBanners($groupID, $params))) { view::setInfo(__('no_banners', 'banners')); } // Create table grid $grid = array('uri' => 'cp/content/banners/browse/' . $groupID, 'keyword' => 'banners', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'total_views' => array('html' => __('banner_views', 'banners'), 'class' => 'views', 'sortable' => true), 'total_clicks' => array('html' => __('banner_clicks', 'banners'), 'class' => 'clicks', 'sortable' => true), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($banners as $banner) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], text_helper::truncate(text_helper::entities($banner['name']), 64))), 'total_views' => array('html' => $banner['total_views']), 'total_clicks' => array('html' => $banner['total_clicks']), 'status' => array('html' => $banner['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/banners/delete/' . $groupID . '/' . $banner['banner_id'], __('delete', 'system'), array('data-html' => __('banner_delete?', 'banners'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/content/banners/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('banners_manage', 'system_navigation')); // Set trail view::setTrail('cp/content/banners/groups/edit/' . $groupID, __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name'])); view::setTrail('cp/content/banners/browse/' . $groupID, __('banners', 'banners')); // Assign actions view::setAction('cp/content/banners/edit/' . $groupID, __('banner_new', 'banners'), array('class' => 'icon-text icon-banners-new')); // Load view view::load('cp/content/banners/browse'); }
public function index() { // Get gateways if (!($gateways = $this->gateways_model->scanGateways())) { view::setError(__('no_gateways', 'billing_gateways')); router::redirect('cp/billing/transactions'); } // Create table grid $grid = array('uri' => 'cp/billing/gateways/browse', 'keyword' => 'billing_gateways', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($gateways as $gateway) { if (isset($gateway['gateway_id']) && $gateway['gateway_id']) { if ($gateway['settings']) { $actions['settings'] = html_helper::anchor('cp/billing/gateways/settings/' . $gateway['keyword'], __('settings', 'system'), array('class' => 'settings')); } $actions['uninstall'] = html_helper::anchor('cp/billing/gateways/uninstall/' . $gateway['keyword'], __('uninstall', 'system'), array('data-html' => __('gateway_uninstall?', 'billing_gateways'), 'data-role' => 'confirm', 'class' => 'uninstall')); } else { $actions['install'] = html_helper::anchor('cp/billing/gateways/install/' . $gateway['keyword'], __('install', 'system'), array('class' => 'install')); } $grid['content'][] = array('name' => array('html' => text_helper::entities($gateway['name'])), 'status' => array('html' => $gateway['active'] ? '<span class="label success small">' . __('active', 'system') . '</span>' : '<span class="label important small">' . __('inactive', 'system') . '</span>'), 'actions' => array('html' => $actions)); } // Filter hooks hook::filter('cp/billing/gateways/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('billing_gateways_manage', 'system_navigation')); // Load view view::load('cp/billing/gateways/browse'); }
public function browse() { // Parameters $params = array('join_columns' => array(), 'join_items' => array()); // Process filters $params = $this->parseCounters($params); // 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 blogs if (input::post('action') && isset($actions[input::post('action')]) && input::post('blog_id') && is_array(input::post('blog_id'))) { foreach (input::post('blog_id') as $blogID) { $blogID = (int) $blogID; if ($blogID && $blogID > 0) { $this->action(input::post('action'), $blogID); } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get blogs $blogs = array(); if ($params['total']) { $blogs = $this->blogs_model->getBlogs('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']); } // Create table grid $grid = array('uri' => 'cp/plugins/blogs', 'keyword' => 'blogs', 'header' => array('check' => array('html' => 'blog_id', 'class' => 'check'), 'data_title' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($blogs as $blog) { if ($blog['active'] == 1) { $status = html_helper::anchor('cp/plugins/blogs/decline/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('active', 'system'), array('class' => 'label small success')); } else { $status = html_helper::anchor('cp/plugins/blogs/approve/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], $blog['active'] ? __('pending', 'system') : __('inactive', 'system'), array('class' => 'label small ' . ($blog['active'] ? 'info' : 'important'))); } $grid['content'][] = array('check' => array('html' => $blog['blog_id']), 'data_title' => array('html' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], text_helper::truncate($blog['data_title'], 64))), 'user' => array('html' => users_helper::anchor($blog['user'])), 'post_date' => array('html' => date_helper::formatDate($blog['post_date'])), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/blogs/delete/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('blog_delete?', 'blogs'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Set pagination $config = array('base_url' => config::siteURL('cp/plugins/blogs?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->blogsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Filter hooks hook::filter('cp/plugins/blogs/browse/grid', $grid); hook::filter('cp/plugins/blogs/browse/actions', $actions); // Assign vars view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination)); // Set title view::setTitle(__('blogs_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#blogs-search\').toggle();return false;')); // Load view view::load('cp/plugins/blogs/browse'); }
public function browse() { // Parameters $params = array('join_columns' => array(), 'join_items' => array()); // Process filters $params = $this->parseCounters($params); // Process query string $qstring = $this->parseQuerystring($params['total']); // Actions $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system')); // Check form action if (input::post('do_action')) { // Delete selected news if (input::post('action') == 'delete') { if (input::post('news_id') && is_array(input::post('news_id'))) { foreach (input::post('news_id') as $newsID) { $newsID = (int) $newsID; if ($newsID && $newsID > 0) { $this->delete($newsID); } } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get news $news = array(); if ($params['total']) { $news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']); } // Create table grid $grid = array('uri' => 'cp/content/news', 'keyword' => 'news', 'header' => array('check' => array('html' => 'news_id', 'class' => 'check'), 'data_title_' . session::item('language') => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($news as $entry) { $grid['content'][] = array('check' => array('html' => $entry['news_id']), 'data_title_' . session::item('language') => array('html' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], text_helper::truncate($entry['data_title'], 64))), 'post_date' => array('html' => date_helper::formatDate($entry['post_date'])), 'status' => array('html' => $entry['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/news/delete/' . $entry['news_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('entry_delete?', 'news'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Set pagination $config = array('base_url' => config::siteURL('cp/content/news?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->newsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Filter hooks hook::filter('cp/content/news/browse/grid', $grid); hook::filter('cp/content/news/browse/actions', $actions); // Assign vars view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination)); // Set title view::setTitle(__('news_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('cp/content/news/edit/', __('entry_new', 'news'), array('class' => 'icon-text icon-news-new')); view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;')); // Load view view::load('cp/content/news/browse'); }
public function browse() { // Parameters $params = array('join_columns' => array()); // Process filters $params = $this->parseCounters($params); // Process query string $qstring = $this->parseQuerystring($params['total']); // Actions $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system')); // Check form action if (input::post('do_action')) { // Delete selected messages if (input::post('action') == 'delete') { if (input::post('message_id') && is_array(input::post('message_id'))) { foreach (input::post('message_id') as $messageID) { $messageID = (int) $messageID; if ($messageID && $messageID > 0) { $this->delete($messageID); } } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get messages $messages = array(); if ($params['total']) { $messages = $this->messages_model->getMessages($params['join_columns'], $qstring['order'], $qstring['limit']); } // Create table grid $grid = array('uri' => 'cp/plugins/messages', 'keyword' => 'messages', 'header' => array('check' => array('html' => 'message_id', 'class' => 'check'), 'message' => array('html' => __('message', 'messages'), 'class' => 'name'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($messages as $message) { $grid['content'][] = array('check' => array('html' => $message['message_id']), 'message' => array('html' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], text_helper::truncate($message['message'], 64))), 'user' => array('html' => users_helper::anchor($message['user'])), 'post_date' => array('html' => date_helper::formatDate($message['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/messages/delete/' . $message['message_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('message_delete?', 'messages'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Set pagination $config = array('base_url' => config::siteURL('cp/plugins/messages?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->messagesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Filter hooks hook::filter('cp/plugins/messages/browse/grid', $grid); hook::filter('cp/plugins/messages/browse/actions', $actions); // Assign vars view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination)); // Set title view::setTitle(__('messages_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#messages-search\').toggle();return false;')); // Load view view::load('cp/plugins/messages/browse'); }
public function index() { // Get plugins if (!($plugins = $this->plugins_model->scanPlugins())) { view::setError(__('no_plugins', 'system_plugins')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/plugins', 'keyword' => 'plugins', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'description' => array('html' => __('description', 'system'), 'class' => 'text'), 'version' => array('html' => __('plugin_version', 'system_plugins'), 'class' => 'version'), 'author' => array('html' => __('plugin_author', 'system_plugins'), 'class' => 'author'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plugins as $plugin) { $version = $plugin['version'] != '' ? $plugin['version'] : '1.0.0'; if (isset($plugin['plugin_id']) && $plugin['plugin_id'] && version_compare($plugin['version_new'], $plugin['version']) == 1) { $version .= ' ' . html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], '+', array('class' => 'label success small', 'title' => __('plugin_new_version', 'system_plugins', array('%version' => text_helper::entities($plugin['version_new']))))); } $author = ''; if ($plugin['author'] || $plugin['website']) { if ($plugin['author'] && $plugin['website']) { $author = html_helper::anchor($plugin['website'], $plugin['author'], array('target' => '_blank')); } elseif ($plugin['website']) { $author = html_helper::anchor($plugin['website'], text_helper::entities(str_ireplace(array('http://www.', 'http://'), '', $plugin['website'])), array('target' => '_blank')); } elseif ($plugin['author']) { $author = $plugin['author']; } } $actions = array(); if (isset($plugin['plugin_id']) && $plugin['plugin_id']) { if ($plugin['settings']) { $actions['html']['settings'] = html_helper::anchor('cp/system/plugins/settings/' . $plugin['keyword'], __('settings', 'system'), array('class' => 'settings')); } else { $actions['html']['view'] = html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], __('details', 'system'), array('class' => 'details')); } if (!isset($plugin['system']) || !$plugin['system']) { $actions['html']['uninstall'] = html_helper::anchor('cp/system/plugins/uninstall/' . $plugin['keyword'], __('uninstall', 'system'), array('data-html' => __('plugin_uninstall?', 'system_plugins'), 'data-role' => 'confirm', 'class' => 'uninstall')); } } else { $actions['html']['install'] = html_helper::anchor('cp/system/plugins/install/' . $plugin['keyword'], __('install', 'system'), array('class' => 'install')); } $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], $plugin['name'])), 'description' => array('html' => text_helper::truncate($plugin['description'], 64)), 'version' => array('html' => $version), 'author' => array('html' => $author), 'actions' => $actions); } // Filter hooks hook::filter('cp/system/plugins/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('system_plugins_manage', 'system_navigation')); // Load view view::load('cp/system/plugins/browse'); }
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 getNotices($userID, $lastID = 0, $limit = 15, $params = array()) { $columns = array(); // Set last action ID if ($lastID) { $columns[] = '`n`.`notice_id`<' . $lastID; } // Set user ID $columns[] = "`n`.`user_id`=" . $userID; // Get notices $notices = $this->fields_model->getRows('timeline_notice', true, false, $columns, false, '', $limit, $params); // Loop through notices foreach ($notices as $noticeID => $notice) { $keyword = array_search($notice['type_id'], config::item('keywords', 'timeline')); $plugin = config::item('resources', 'core', config::item('resources', 'core', config::item('resources', 'timeline', $notice['type_id'])), 'plugin'); $notices[$noticeID] = hook::filter('timeline/notice/' . $keyword, $notice); } return $notices; }
public function browse() { // 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 templates if (!($templates = $this->emailtemplates_model->getTemplates($plugin))) { view::setInfo(__('no_templates', 'system_templates')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/emailtemplates', 'keyword' => 'emailtemplates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($templates as $template) { if ($template['keyword'] != 'header' && $template['keyword'] != 'footer') { if ($template['active'] == 1) { $status = html_helper::anchor('cp/system/emailtemplates/toggle/' . $template['template_id'], __('active', 'system'), array('class' => 'label small success')); } else { $status = html_helper::anchor('cp/system/emailtemplates/toggle/' . $template['template_id'], __('inactive', 'system'), array('class' => 'label small important')); } } else { $status = '<span class="label small success">' . __('active', 'system') . '</span>'; } $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/emailtemplates/edit/' . $template['template_id'], __($template['keyword'], 'system_email_templates'))), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/system/emailtemplates/edit/' . $template['template_id'], __('edit', 'system'), array('class' => 'edit'))))); } // Filter hooks hook::filter('cp/system/emailtemplates/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('system_email_templates_manage', 'system_navigation')); // Set trail view::setTrail('cp/system/emailtemplates/browse/' . $plugin, text_helper::entities(config::item('plugins', 'core', $plugin, 'name'))); // Load view view::load('cp/system/emailtemplates/browse'); }
public function browse() { // Get user types $types = $this->users_types_model->getTypes(); // Create table grid $grid = array('uri' => 'cp/users/types/browse', 'keyword' => 'userstypes', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($types as $type) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/users/types/edit/' . $type['type_id'], text_helper::truncate($type['name'], 64))), 'actions' => array('html' => array('questions' => html_helper::anchor('cp/system/fields/users/browse/' . $type['type_id'], __('profile_questions', 'users_types'), array('class' => 'questions')), 'edit' => html_helper::anchor('cp/users/types/edit/' . $type['type_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/users/types/delete/' . $type['type_id'], __('delete', 'system'), array('data-html' => __('type_delete?', 'users_types'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/users/types/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('users_types_manage', 'system_navigation')); // Assign actions view::setAction('cp/users/types/edit', __('type_new', 'users_types'), array('class' => 'icon-text icon-users-types-new')); // Load view view::load('cp/users/types/browse'); }
public function browse() { // Did we submit the form? if (input::post('action') == 'reorder' && input::post('ids')) { $this->_reorderPlans(); } // Get plans if (!($plans = $this->plans_model->getPlans(false))) { view::setInfo(__('no_plans', 'billing_plans')); } // Set cycles $cycles = array_map('strtolower', array(1 => __('day', 'date'), 2 => __('week', 'date'), 3 => __('month', 'date'), 4 => __('year', 'date'))); $cyclesMulti = array_map('strtolower', array(1 => __('days', 'date'), 2 => __('weeks', 'date'), 3 => __('months', 'date'), 4 => __('years', 'date'))); // Create table grid $grid = array('uri' => 'cp/billing/plans/browse', 'keyword' => 'billing_plans', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'group' => array('html' => __('plan_group', 'billing_plans'), 'class' => 'group'), 'cycle' => array('html' => __('plan_cycle', 'billing_plans'), 'class' => 'cycle'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'signup' => array('html' => __('plan_signup', 'billing_plans'), 'class' => 'signup'), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plans as $plan) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], $plan['name'])), 'group' => array('html' => config::item('usergroups', 'core', $plan['group_id'])), 'cycle' => array('html' => $plan['duration'] . ' ' . ($plan['duration'] == 1 ? $cycles[$plan['cycle']] : $cyclesMulti[$plan['cycle']])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $plan['price']), 'signup' => array('html' => $plan['signup'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'status' => array('html' => $plan['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/plans/delete/' . $plan['plan_id'], __('delete', 'system'), array('data-html' => __('plan_delete?', 'billing_plans'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/billing/plans/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid, 'plans' => $plans)); // Set title view::setTitle(__('billing_plans_manage', 'system_navigation')); // Assign actions view::setAction('cp/billing/plans/edit', __('plan_new', 'billing_plans'), array('class' => 'icon-text icon-billing-plans-new')); 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/billing/plans/browse_' . (input::post('view') == 'list' ? 'list' : 'grid')); } else { view::load('cp/billing/plans/browse'); } }
protected function browseFields($plugin, $table, $categoryID = 0) { // Did we submit the form? if (input::post('action') == 'reorder' && input::post('ids')) { $this->_reorderFields($plugin, $table, $categoryID); } // Get fields if (!($fields = $this->fields_model->getFields($plugin, $categoryID, 'grid'))) { view::setInfo(__('no_fields', 'system_fields')); } // Field types $types = $this->fieldsdb_model->getTypes(true); // Create table grid $grid = array('uri' => 'cp/usersgroups/browse', 'keyword' => 'usersgroups', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'keyword' => array('html' => __('keyword', 'system'), 'class' => 'keyword'), 'type' => array('html' => __('field_type', 'system_fields'), 'class' => 'type'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($fields as $field) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/fields/' . $plugin . '/edit/' . $field['category_id'] . '/' . $field['field_id'], text_helper::entities($field['name'])), 'class' => $field['type']), 'keyword' => array('html' => $field['keyword']), 'type' => array('html' => '<span>' . $types[$field['type']] . '</span>', 'class' => $field['type']), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/system/fields/' . $plugin . '/edit/' . $field['category_id'] . '/' . $field['field_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/system/fields/' . $plugin . '/delete/' . $field['category_id'] . '/' . $field['field_id'], __('delete', 'system'), array('data-html' => __('delete_field?', 'system_fields'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/usersgroups/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Assign vars view::assign(array('plugin' => $plugin, 'categoryID' => $categoryID, 'fields' => $fields, 'types' => $types)); // Assign actions view::setAction('cp/system/fields/' . $plugin . '/edit' . ($categoryID ? '/' . $categoryID : ''), __('new_field', 'system_fields'), array('class' => 'icon-text icon-system-fields-new')); 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/fields/browse_' . (input::post('view') == 'list' ? 'list' : 'grid')); } else { view::load('cp/system/fields/browse'); } }
public function plugins() { // Get plugins if (!($plugins = $this->metatags_model->getPlugins())) { view::setInfo(__('no_plugins', 'system_plugins')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/metatags', 'keyword' => 'metatags', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plugins as $plugin => $name) { $actions['html']['edit'] = html_helper::anchor('cp/system/metatags/edit/' . $plugin, __('edit', 'system'), array('class' => 'edit')); $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/metatags/edit/' . $plugin, $name)), 'actions' => $actions); } // Filter hooks hook::filter('cp/system/metatags/plugins/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('plugin_select', 'system')); // Load view view::load('cp/system/metatags/plugins'); }
public function browse() { // Get packages if (!($packages = $this->credits_model->getPackages(false))) { view::setInfo(__('no_packages', 'billing_credits')); } // Create table grid $grid = array('uri' => 'cp/billing/credits/browse', 'keyword' => 'billing_credits', 'header' => array('credits' => array('html' => __('credits', 'billing_credits'), 'class' => 'credits'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'active' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($packages as $package) { $grid['content'][] = array('credits' => array('html' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], $package['credits'])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $package['price']), 'active' => array('html' => $package['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/credits/delete/' . $package['package_id'], __('delete', 'system'), array('data-html' => __('package_delete?', 'billing_credits'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/billing/credits/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('billing_credits_manage', 'system_navigation')); // Assign actions view::setAction('cp/billing/credits/edit', __('package_new', 'billing_credits'), array('class' => 'icon-text icon-billing-packages-new')); // Load view view::load('cp/billing/credits/browse'); }
public function browse() { // Get banner groups if (!($groups = $this->banners_groups_model->getGroups())) { view::setInfo(__('no_groups', 'banners')); } // Create table grid $grid = array('uri' => 'cp/content/banners/groups/browse', 'keyword' => 'bannersgroups', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($groups as $group) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/banners/groups/edit/' . $group['group_id'], text_helper::truncate(text_helper::entities($group['name']), 64))), 'actions' => array('html' => array('banners' => html_helper::anchor('cp/content/banners/browse/' . $group['group_id'], __('banners', 'banners'), array('class' => 'banners')), 'edit' => html_helper::anchor('cp/content/banners/groups/edit/' . $group['group_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/banners/groups/delete/' . $group['group_id'], __('delete', 'system'), array('data-html' => __('group_delete?', 'banners'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/content/banners/groups/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('banners_groups_manage', 'system_navigation')); // Set title view::setAction('cp/content/banners/groups/edit', __('group_new', 'banners'), array('class' => 'icon-text icon-banners-groups-new')); // Load view view::load('cp/content/banners/groups/browse'); }
public function plugins() { // Get plugins if (!($plugins = $this->recalculate_model->getPlugins())) { view::setInfo(__('no_plugins', 'system_plugins')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/utilities/counters', 'keyword' => 'counters', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plugins as $plugin => $name) { $actions['html']['update'] = html_helper::anchor('cp/utilities/counters/update/' . $plugin, __('update', 'system'), array('data-html' => __('counters_update?', 'utilities_counters'), 'data-role' => 'confirm', 'class' => 'update')); $grid['content'][] = array('name' => array('html' => $name), 'actions' => $actions); } // Filter hooks hook::filter('cp/utilities/counters/plugins/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('utilities_counters_manage', 'system_navigation')); // Load view view::load('cp/utilities/counters/plugins'); }
public function browse() { // Get templates if (!($templates = $this->messages_templates_model->getTemplates())) { view::setInfo(__('no_templates', 'messages_templates')); } // Create table grid $grid = array('uri' => 'cp/plugins/messages/templates/browse', 'keyword' => 'messages_templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($templates as $template) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/plugins/messages/templates/edit/' . $template['template_id'], text_helper::truncate($template['name'], 64))), 'status' => array('html' => $template['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/messages/templates/edit/' . $template['template_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/messages/templates/delete/' . $template['template_id'], __('delete', 'system'), array('data-html' => __('template_delete?', 'messages_templates'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/plugins/messages/templates/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('messages_templates_manage', 'system_navigation')); // Set action view::setAction('cp/plugins/messages/templates/edit', __('template_new', 'messages_templates'), array('class' => 'icon-text icon-messages-templates-new')); // Load view view::load('cp/plugins/messages/templates/browse'); }
public function browse() { // Get newsletters if (!($newsletters = $this->newsletters_model->getNewsletters())) { view::setInfo(__('no_newsletters', 'newsletters')); } // Create table grid $grid = array('uri' => 'cp/content/newsletters/browse', 'keyword' => 'newsletters', 'header' => array('name' => array('html' => __('newsletter_subject', 'newsletters'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($newsletters as $newsletter) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/newsletters/edit/' . $newsletter['newsletter_id'], text_helper::truncate($newsletter['subject'], 64))), 'status' => array('html' => $newsletter['total_sent'] ? '<span class="label small info">' . __('pending', 'system') . '</span>' : '<span class="label small success">' . __('active', 'system') . '</span>'), 'actions' => array('html' => array('send' => html_helper::anchor('cp/content/newsletters/review/' . $newsletter['newsletter_id'], __('newsletter_review', 'newsletters'), array('class' => 'review')), 'edit' => html_helper::anchor('cp/content/newsletters/edit/' . $newsletter['newsletter_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/newsletters/delete/' . $newsletter['newsletter_id'], __('delete', 'system'), array('data-html' => __('newsletter_delete?', 'newsletters'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/content/newsletters/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('newsletters_manage', 'system_navigation')); // Set action view::setAction('cp/content/newsletters/edit', __('newsletter_new', 'newsletters'), array('class' => 'icon-text icon-newsletters-new')); // Load view view::load('cp/content/newsletters/browse'); }
public function notifications() { // Get URI vars $userID = (int) uri::segment(4); // Get user if (!$userID || !($user = $this->users_model->getUser($userID))) { view::setError(__('no_user', 'users')); router::redirect('cp/users'); } // Create notifications settings $settings = array('general' => array('name' => __('options_general', 'users_privacy'), 'keyword' => 'general', 'type' => 'checkbox', 'items' => array(), 'value' => array())); // Filter hook $settings = hook::filter('users/settings/notifications/options', $settings, $user); // Assign vars view::assign(array('user' => $user, 'settings' => $settings)); // Process form values if (input::post('do_save_notifications')) { $this->_saveNotifications($userID, $settings); } // Set title view::setTitle(__('notifications', 'users')); // Set trail view::setTrail('cp/users/edit/' . $userID, __('user_edit', 'users') . ' - ' . ($user['name1'] ? $user['name'] : $user['email'])); view::setTrail('cp/users/notifications/' . $userID, __('notifications', 'users')); // Assign tabs $this->_userActions($userID, 'notifications'); // Load view view::load('cp/users/notifications'); }
public function plugins() { // Get URI vars $keyword = uri::segment(5); // Is this a system language? if ($keyword == 'system') { $language = array('keyword' => 'system', 'name' => 'System'); } elseif (!($language = $this->languages_model->getLanguage($keyword))) { view::setError(__('no_language', 'system_languages')); router::redirect('cp/system/languages'); } // Create table grid $grid = array('uri' => 'cp/system/languages/plugins/' . $keyword, 'keyword' => 'languages', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'translation' => array('html' => __('language_translation_pct', 'system_languages'), 'class' => 'translation'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach (config::item('plugins', 'core') as $plugin) { // Get default language data if (!($default = $this->languages_model->getLanguageData('system', $plugin['keyword']))) { view::setError(__('no_language', 'system_languages')); router::redirect('cp/system/languages'); } // Get language data if (!($data = $this->languages_model->getLanguageData($keyword, $plugin['keyword']))) { view::setError(__('no_language', 'system_languages')); router::redirect('cp/system/languages'); } // Set language sections $translated = $total = 0; foreach ($data as $section => $groups) { foreach ($groups as $group => $types) { foreach ($types as $type => $items) { foreach ($items as $index => $value) { if (utf8::strcasecmp($default[$section][$group][$type][$index], $value)) { $translated++; } $total++; } } } } $translated = $translated ? round($translated / $total * 100) : 0; $translated = $translated > 100 ? 100 : $translated; $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/languages/translate/' . $plugin['keyword'] . '/' . $language['keyword'], text_helper::entities($plugin['name']))), 'translation' => array('html' => ($language['keyword'] == 'english' ? '100' : $translated) . '%'), 'actions' => array('html' => html_helper::anchor('cp/system/languages/translate/' . $plugin['keyword'] . '/' . $language['keyword'], __('edit', 'system'), array('class' => 'edit')))); } // Filter hooks hook::filter('cp/system/languages/plugins/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('plugin_select', 'system')); // Set trail view::setTrail('cp/system/languages/plugins/' . $keyword, __('language_translate', 'system_languages') . ' - ' . text_helper::entities($language['name'])); // Load view view::load('cp/system/languages/plugins'); }
public function browse() { // Get URI vars $countryID = uri::segment(5); $stateID = uri::segment(6); // Get country if ($countryID && !($country = $this->geo_model->getCountry($countryID, true))) { view::setError(__('no_country', 'system_geo')); router::redirect('cp/system/geo'); } // Get state if ($stateID && !($state = $this->geo_model->getState($stateID, true))) { view::setError(__('no_state', 'system_geo')); router::redirect('cp/system/geo'); } if ($stateID) { // Get cities if ($stateID && !($data = $this->geo_model->getCities($stateID, true))) { view::setError(__('no_cities', 'system_geo')); router::redirect('cp/system/geo/edit/' . $countryID . '/' . $stateID); } } elseif ($countryID) { // Get states if (!($data = $this->geo_model->getStates($countryID, true))) { view::setError(__('no_states', 'system_geo')); router::redirect('cp/system/geo/edit/' . $countryID); } } else { // Get countries if (!($data = $this->geo_model->getCountries(true))) { view::setError(__('no_countries', 'system_geo')); router::redirect('cp/system/config/system'); } } // Create table grid $grid = array('uri' => 'cp/system/geo', 'keyword' => 'countries', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($data as $itemID => $item) { $name['html'] = $stateID ? text_helper::entities($item) : html_helper::anchor('cp/system/geo/browse/' . ($countryID ? $countryID . '/' : '') . $itemID, text_helper::entities($item)); $actions['html']['edit'] = html_helper::anchor('cp/system/geo/edit/' . ($countryID ? $countryID . '/' : '') . ($stateID ? $stateID . '/' : '') . $itemID, __('edit', 'system'), array('class' => 'edit')); $actions['html']['delete'] = html_helper::anchor('cp/system/geo/delete/' . ($countryID ? $countryID . '/' : '') . ($stateID ? $stateID . '/' : '') . $itemID, __('delete', 'system'), array('data-html' => __('item_delete?', 'system_geo'), 'data-role' => 'confirm', 'class' => 'delete')); $grid['content'][] = array('name' => $name, 'actions' => $actions); } // Filter hooks hook::filter('cp/system/geo/countries/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); if ($stateID) { // Set title view::setTitle(__('cities_manage', 'system_geo')); // Set trail view::setTrail('cp/system/geo/browse/' . $countryID, text_helper::entities($country['name'])); view::setTrail('cp/system/geo/browse/' . $countryID . '/' . $stateID, text_helper::entities($state['name'])); // Assign actions view::setAction('cp/system/geo/create/' . $countryID . '/' . $stateID, __('city_new', 'system_geo'), array('class' => 'icon-text icon-system-geo-new')); } elseif ($countryID) { // Set title view::setTitle(__('states_manage', 'system_geo')); // Set trail view::setTrail('cp/system/geo/browse/' . $countryID, text_helper::entities($country['name'])); // Assign actions view::setAction('cp/system/geo/create/' . $countryID, __('state_new', 'system_geo'), array('class' => 'icon-text icon-system-geo-new')); } else { // Set title view::setTitle(__('countries_manage', 'system_geo')); // Assign actions view::setAction('cp/system/geo/create/', __('country_new', 'system_geo'), array('class' => 'icon-text icon-system-geo-new')); } // Load view view::load('cp/system/geo/browse'); }
public function getActions($userID, $privacy = true, $lastID = 0, $limit = 15, $params = array()) { $select = $tables = $columns = array(); // Set resource ID? $columns[] = '`a`.`resource_id`=' . (isset($params['resource_id']) ? $params['resource_id'] : 1); // Set custom ID? $columns[] = '`a`.`custom_id`=' . (isset($params['custom_id']) ? $params['custom_id'] : 0); // Set last action ID if ($lastID) { $columns[] = '`a`.`action_id`<' . $lastID; } // Do we have user ID? if ($userID) { $columns[] = "(`a`.`user_id`=" . $userID . " OR `a`.`poster_id`=" . $userID . ")"; } // Active status if (users_helper::isLoggedin()) { if (!$userID) { $columns[] = "(`a`.`active`=1 OR `a`.`user_id`=" . session::item('user_id') . ")"; } elseif ($userID != session::item('user_id')) { $columns[] = "`a`.`active`=1"; } } else { $columns[] = "`a`.`active`=1"; } // Do we need to validate privacy settings? if ($userID && $privacy) { // Is user logged in? if (users_helper::isLoggedin()) { $friends = $this->users_friends_model->getFriend($userID); // Is this our timeline? if ($userID != session::item('user_id')) { $columns[] = "`a`.`privacy` BETWEEN 1 AND " . ($friends ? '3' : '2'); } } else { $columns[] = '`a`.`privacy`=1'; } $columns[] = "(`a`.`poster_id`!=" . $userID . " OR `a`.`poster_id`=" . $userID . " AND `a`.`poster_privacy`>0)"; } elseif (!$userID && $privacy) { // Is user logged in? if (users_helper::isLoggedin()) { $select[] = "`f`.`post_date` AS `friends`"; $tables[] = "LEFT JOIN `:prefix:users_friends` AS `f` ON (`a`.`user_id`=`f`.`user_id` AND `f`.`friend_id`=" . session::item('user_id') . " OR `a`.`user_id`=`f`.`friend_id` AND `f`.`user_id`=" . session::item('user_id') . ") " . ($privacy == 2 ? "AND `f`.`active`=1" : ""); $columns[] = "(`a`.`privacy`<=2 OR `a`.`privacy`=3 AND (`a`.`user_id`=" . session::item('user_id') . " OR `f`.`active`=1) OR `a`.`privacy`=9 AND `a`.`user_id`=" . session::item('user_id') . ")"; if ($privacy == 2) { $columns[] = "(`f`.`user_id` IS NOT NULL OR `a`.`user_id`=" . session::item('user_id') . ")"; } } else { $columns[] = '`a`.`privacy`=1'; } $columns[] = '`a`.`poster_privacy`>0'; } $attachments = 0; $actions = $stream = $users = array(); // Get actions $result = $this->db->query("SELECT `a`.* " . ($select ? ", " . implode(", ", $select) : '') . " FROM `:prefix:timeline_actions` AS `a` " . implode(" ", $tables) . " WHERE " . implode(" AND ", $columns) . " ORDER BY `a`.`post_date` DESC LIMIT {$limit}")->result(); if (!$result) { return array(); } foreach ($result as $action) { $users[$action['user_id']] = $action['user_id']; if ($action['poster_id']) { $users[$action['poster_id']] = $action['poster_id']; } if (!$action['params'] || !($action['params'] = @json_decode($action['params'], true))) { $action['params'] = array(); } $actions[$action['action_id']] = $action; $stream[$action['type_id']][$action['item_id']][$action['action_id']] = array('user_id' => $action['user_id'], 'poster_id' => $action['poster_id'], 'attachments' => array(), 'params' => $action['params']); $attachments = $attachments + $action['attachments']; } // Get attachments if ($attachments) { $result = $this->db->query("SELECT `action_id`, `attachment_id`, `file_id` FROM `:prefix:timeline_attachments` WHERE `action_id` IN (" . implode(',', array_keys($actions)) . ") LIMIT ?", array($attachments))->result(); foreach ($result as $attachment) { $stream[$actions[$attachment['action_id']]['type_id']][$actions[$attachment['action_id']]['item_id']][$attachment['action_id']]['attachments'][$attachment['file_id']] = $attachment['file_id']; } } // Get users $columns = array('`u`.`user_id` IN (' . implode(',', array_keys($users)) . ')', '`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')) . ')'); $users = $this->users_model->getUsers('in_list', 0, $columns, array(), false, count($users)); // Update friends status foreach ($actions as $action) { if (isset($users[$action['user_id']]) && $users[$action['user_id']]) { $users[$action['user_id']]['friends'] = isset($friends) ? $friends : (isset($action['friends']) ? $action['friends'] : false); } } // Create stream foreach ($stream as $typeID => $items) { $keyword = array_search($typeID, config::item('keywords', 'timeline')); $plugin = config::item('resources', 'core', config::item('resources', 'core', config::item('resources', 'timeline', $typeID)), 'plugin'); $stream[$typeID] = hook::filter('timeline/' . $keyword, $items, $users); } // Combine actions foreach ($actions as $actionID => $action) { if (isset($stream[$action['type_id']][$action['item_id']][$actionID])) { $action['relative_resource'] = config::item('resources', 'core', config::item('resources', 'timeline', $action['type_id'])); $action['relative_resource_id'] = config::item('resources', 'core', $action['relative_resource'], 'resource_id'); $action['rating'] = isset($stream[$action['type_id']][$action['item_id']][$actionID]['rating']) ? $stream[$action['type_id']][$action['item_id']][$actionID]['rating'] : false; $action['comments'] = isset($stream[$action['type_id']][$action['item_id']][$actionID]['comments']) ? $stream[$action['type_id']][$action['item_id']][$actionID]['comments'] : false; $action['html'] = $stream[$action['type_id']][$action['item_id']][$actionID]['html']; $action['user'] = isset($stream[$action['type_id']][$action['item_id']][$actionID]['user']) ? $stream[$action['type_id']][$action['item_id']][$actionID]['user'] : $users[$action['user_id']]; if ($action['poster_id']) { $action['poster'] = isset($stream[$action['type_id']][$action['item_id']][$actionID]['poster']) ? $stream[$action['type_id']][$action['item_id']][$actionID]['poster'] : $users[$action['poster_id']]; } else { $action['poster'] = array(); } $actions[$actionID] = $action; } else { unset($actions[$actionID]); } } return $actions; }
public function notifications() { if (!config::item('notifications_edit', 'users')) { error::show404(); } // Create notifications settings $settings = array('general' => array('name' => __('options_general', 'users_notifications'), 'keyword' => 'general', 'type' => 'checkbox', 'items' => array(), 'value' => array())); // Filter hook $settings = hook::filter('users/settings/notifications/options', $settings); // Assign vars view::assign(array('settings' => $settings)); // Process form values if (input::post('do_save_notifications')) { $this->_saveNotifications($settings); } // Set title view::setTitle(__('notifications', 'users')); // Load view view::load('users/settings/notifications'); }
public function getHooks() { loader::model('system/hooks'); $this->data['hooks'] = $this->hooks_model->getHooks(); if (isset($this->data['hooks']['filter']['initialize/config'])) { hook::addFilters(array('initialize/config' => $this->data['hooks']['filter']['initialize/config'])); unset($this->data['hooks']['filter']['initialize/config']); $this->data = hook::filter('initialize/config', $this->data); } }
public function plugins() { // Get URI vars $ids = trim(uri::segment(5)); $groupIDs = explode(',', $ids); // Do we have valid IDs? if (!$groupIDs) { view::setError(__('no_group', 'users_groups')); router::redirect('cp/users/groups'); } // Get groups foreach ($groupIDs as $groupID) { if (!$groupID || !is_numeric($groupID) || !($group = $this->users_groups_model->getGroup($groupID))) { view::setError(__('no_group', 'users_groups')); router::redirect('cp/users/groups'); } } // Get plugins if (!($plugins = $this->users_groups_model->getPlugins())) { view::setInfo(__('no_plugins', 'system_plugins')); router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/users/groups/plugins/' . $ids, 'keyword' => 'usersgroups', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plugins as $plugin => $name) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/users/groups/permissions/' . $plugin . '/' . $ids, $name)), 'actions' => array('html' => html_helper::anchor('cp/users/groups/permissions/' . $plugin . '/' . $ids, __('edit', 'system'), array('class' => 'edit')))); } // Filter hooks hook::filter('cp/system/languages/plugins/grid', $grid); // Assign vars view::assign(array('grid' => $grid)); // Set title view::setTitle(__('plugin_select', 'system')); // Set trail if (count($groupIDs) == 1) { view::setTrail('cp/users/groups/edit/' . $ids, __('group_edit', 'users_groups') . ' - ' . $group['name']); } view::setTrail('cp/users/groups/plugins/' . $ids, __('permissions', 'users_permissions')); // Load view view::load('cp/users/groups/plugins'); }
public function manage() { // Is user loggedin ? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } // Assign user from session to variable $user = session::section('session'); $user['config'] = session::section('config'); // Get user counters $counters = hook::filter('users/profile/view/counters', array(), $user); // Merge user and counters if ($counters) { $user = array_merge($user, $counters); } // Get fields $fields = $this->fields_model->getFields('users', session::item('type_id'), 'view', 'in_view'); // Delete empty sections $this->fields_model->deleteEmptySections($fields, $user); // Assign vars view::assign(array('user' => $user, 'fields' => $fields)); // Set title view::setMetaTitle(__('my_profile', 'system_navigation')); // Set trail view::setTrail($user['slug'], __('my_profile', 'system_navigation')); if (config::item('user_last_visit', 'users')) { if (!$user['invisible']) { if ($user['online']) { view::setTrail(false, '<span class="users online">' . __('status_online', 'users') . '</span>', array('side' => true)); } else { view::setTrail(false, '<span class="users date">' . __('status_visit_date', 'users', array('%span' => utf8::strtolower(date_helper::humanSpan($user['visit_date'])))) . '</span>', array('side' => true)); } } } // Load view view::load('users/profile/view'); }
public function browse() { // Parameters $params = array('join_columns' => array()); // Process filters $params = $this->parseCounters($params); // Process query string $qstring = $this->parseQuerystring($params['total']); // Create actions $actions = array(0 => __('select', 'system'), 'dismiss' => __('report_dismiss', 'reports')); // Check form action if (input::post('do_action')) { // Delete selected reports if (input::post('action') == 'dismiss') { if (input::post('report_id') && is_array(input::post('report_id'))) { foreach (input::post('report_id') as $reportID) { $reportID = (int) $reportID; if ($reportID && $reportID > 0) { $this->dismiss($reportID); } } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/content/reports?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get reports $reports = array(); if ($params['total']) { $reports = $this->reports_model->getReports('', $params['join_columns'], $qstring['order'], $qstring['limit']); } // Load subjects model loader::model('reports/subjects', array(), 'reports_subjects_model'); // Get subjects $subjects = array(); $data = $this->reports_subjects_model->getSubjects(); foreach ($data as $subject) { $subjects[$subject['subject_id']] = $subject['name']; } // Create table grid $grid = array('uri' => 'cp/content/reports', 'keyword' => 'reports', 'header' => array('check' => array('html' => 'report_id', 'class' => 'check'), 'subject' => array('html' => __('report_subject', 'reports'), 'class' => 'subject'), 'message' => array('html' => __('report_message', 'reports'), 'class' => 'comment'), 'item' => array('html' => __('report_item', 'reports'), 'class' => 'item'), 'user' => array('html' => __('reporter', 'reports'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($reports as $report) { $grid['content'][] = array('check' => array('html' => $report['report_id']), 'subject' => array('html' => isset($subjects[$report['subject_id']]) ? $subjects[$report['subject_id']] : ''), 'message' => array('html' => text_helper::truncate($report['message'], 56) . (utf8::strlen($report['message']) > 56 ? ' ' . html_helper::anchor('', __('view', 'system'), array('data-title' => __('message', 'reports'), 'data-role' => 'modal', 'data-display' => 'html', 'data-html' => text_helper::entities($report['message']))) : '')), 'item' => array('html' => __(config::item('resources', 'core', $report['resource_id']), config::item('resources', 'core', config::item('resources', 'core', $report['resource_id']), 'plugin'))), 'user' => array('html' => users_helper::anchor($report['user'])), 'post_date' => array('html' => date_helper::formatDate($report['post_date'])), 'actions' => array('html' => array('actions' => html_helper::anchor('cp/content/reports/actions/' . $report['report_id'], __('report_actions', 'reports'), array('class' => 'action', 'data-role' => 'modal', 'data-display' => 'iframe', 'data-title' => __('report_action_select', 'reports'))), 'view' => html_helper::anchor('cp/content/reports/view/' . $report['report_id'], __('report_view', 'reports'), array('class' => 'view')), 'dismiss' => html_helper::anchor('cp/content/reports/dismiss/' . $report['report_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('report_dismiss', 'reports'), array('data-html' => __('report_dismiss?', 'reports'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Set pagination $config = array('base_url' => config::siteURL('cp/content/reports?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->reportsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Filter hooks hook::filter('cp/content/reports/browse/grid', $grid); hook::filter('cp/content/reports/browse/actions', $actions); // Assign vars view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination)); // Set title view::setTitle(__('reports_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/content/reports?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#reports-search\').toggle();return false;')); // Load view view::load('cp/content/reports/browse'); }
public function browse() { // Get gateways $gateways = array(); foreach ($this->gateways_model->getGateways(false, false) as $gateway) { $gateways[$gateway['gateway_id']] = $gateway['name']; } // Parameters $params = array('join_columns' => array()); // Process filters $params = $this->parseCounters($params, $gateways); // Process query string $qstring = $this->parseQuerystring($params['total']); // Create actions $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system')); // Check form action if (input::post('do_action')) { // Delete selected transactions if (input::post('action') == 'delete') { if (input::post('transaction_id') && is_array(input::post('transaction_id'))) { foreach (input::post('transaction_id') as $transactionID) { $transactionID = (int) $transactionID; if ($transactionID && $transactionID > 0) { $this->delete($transactionID); } } } } // Success view::setInfo(__('action_applied', 'system')); router::redirect('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page']); } // Get transaction $transactions = array(); if ($params['total']) { $transactions = $this->transactions_model->getTransactions($params['join_columns'], $qstring['order'], $qstring['limit']); } // Create table grid $grid = array('uri' => 'cp/billing/transactions', 'keyword' => 'billing_transactions', 'header' => array('check' => array('html' => 'transaction_id', 'class' => 'check'), 'product' => array('html' => __('product', 'billing'), 'class' => 'product'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'gateway' => array('html' => __('payment_gateway', 'billing'), 'class' => 'gateway'), 'amount' => array('html' => __('price', 'billing'), 'class' => 'price', 'sortable' => true), 'post_date' => array('html' => __('payment_date', 'billing'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($transactions as $transaction) { $grid['content'][] = array('check' => array('html' => $transaction['transaction_id']), 'product' => array('html' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], $transaction['name'])), 'user' => array('html' => users_helper::anchor($transaction['user'])), 'gateway' => array('html' => $gateways[$transaction['gateway_id']]), 'amount' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $transaction['amount']), 'post_date' => array('html' => date_helper::formatDate($transaction['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], __('details', 'system'), array('class' => 'details')), 'delete' => html_helper::anchor('cp/billing/transactions/delete/' . $transaction['transaction_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('transaction_delete?', 'billing_transactions'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Set pagination $config = array('base_url' => config::siteURL('cp/billing/transactions?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->transactionPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Filter hooks hook::filter('cp/billing/transactions/browse/grid', $grid); hook::filter('cp/billing/transactions/browse/actions', $actions); // Assign vars view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination)); // Set title view::setTitle(__('billing_transactions_manage', 'system_navigation')); // Set trail if ($qstring['search_id']) { view::setTrail('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system')); } // Assign actions view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#transactions-search\').toggle();return false;')); // Load view view::load('cp/billing/transactions/browse'); }