本文整理汇总了PHP中view::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP view::setAction方法的具体用法?PHP view::setAction怎么用?PHP view::setAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// Parameters
$params = array('join_columns' => array('`n`.`active`=1'), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring(config::item('news_per_page', 'news'), $params['max']);
// Get news
$news = array();
if ($params['total']) {
$news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Set pagination
$config = array('base_url' => config::siteURL('news?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('news_per_page', 'news'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('news' => $news, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('news', 'news_index');
// Set title
view::setTitle(__(config::item('news_blog', 'news') ? 'blog' : 'news', 'system_navigation'), false);
// Assign actions
if (session::permission('news_search', 'news') && ($params['total'] || input::post_get('do_search'))) {
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
}
// Load view
view::load('news/index');
}
示例2: results
public function results()
{
if (!input::get('search_id')) {
$this->index();
return;
}
// Parameters
$params = array('join_columns' => array('`u`.`verified`=1', '`u`.`active`=1', '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')', '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')'), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['max']);
// Get users
$users = array();
if ($params['total']) {
$users = $this->users_model->getUsers('in_list', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Get fields
$fields = $this->fields_model->getFields('users', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, 'view', 'in_list');
// Set pagination
$config = array('base_url' => config::siteURL('users/results?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => config::item('max_search_results', 'system'), 'items_per_page' => config::item('users_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('users' => $users, 'fields' => $fields, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('users', 'users_search_results');
// Set title
view::setTitle(__('search_results', 'system'), false);
// Assign actions
view::setAction('users?' . substr($qstring['url'], 0, -1), __('search_modify', 'system'), array('class' => 'icon-text icon-users-search-edit'));
// Load view
view::load('users/index');
}
示例3: 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');
}
示例4: 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');
}
示例5: edit
public function edit()
{
// Get URI vars
$groupID = (int) uri::segment(6);
// Get group
$group = array();
if ($groupID && !($group = $this->banners_groups_model->getGroup($groupID))) {
view::setError(__('no_group', 'banners'));
router::redirect('cp/content/banners/groups');
}
// Assign vars
view::assign(array('groupID' => $groupID, 'group' => $group));
// Process form values
if (input::post('do_save_group')) {
$this->_saveGroup($groupID);
}
// Set title
view::setTitle($groupID ? __('group_edit', 'banners') : __('group_new', 'banners'));
// Set trail
view::setTrail('cp/content/banners/groups/edit/' . ($groupID ? $groupID : ''), $groupID ? __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name']) : __('group_new', 'banners'));
// Assign actions
if ($groupID) {
view::setAction('cp/content/banners/browse/' . $groupID, __('banners', 'banners'), array('class' => 'icon-text icon-banners'));
}
// Load view
view::load('cp/content/banners/groups/edit');
}
示例6: edit
public function edit()
{
// Get URI vars
$subjectID = (int) uri::segment(6);
// Get subject
$subject = array();
if ($subjectID && !($subject = $this->reports_subjects_model->getSubject($subjectID, false))) {
view::setError(__('no_subject', 'reports_subjects'));
router::redirect('cp/content/reports/subjects');
}
// Assign vars
view::assign(array('subjectID' => $subjectID, 'subject' => $subject));
// Process form values
if (input::post('do_save_subject')) {
$this->_saveSubject($subjectID);
}
// Set title
view::setTitle($subjectID ? __('subject_edit', 'reports_subjects') : __('subject_new', 'reports_subjects'));
// Set trail
view::setTrail('cp/content/reports/subjects/edit/' . ($subjectID ? $subjectID : ''), $subjectID ? __('subject_edit', 'reports_subjects') . ' - ' . text_helper::entities($subject['name']) : __('subject_new', 'reports_subjects'));
// Set actions
if (count(config::item('languages', 'core', 'keywords')) > 1) {
view::setAction('translate', '');
}
// Load view
view::load('cp/content/reports/subjects/edit');
}
示例7: 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');
}
示例8: 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');
}
示例9: browse
public function browse($privacy = 1)
{
if ($privacy == 1 && !config::item('timeline_public_feed', 'timeline')) {
if (users_helper::isLoggedin() && config::item('timeline_user_feed', 'timeline')) {
$privacy = 2;
} else {
error::show404();
}
}
// Get last action ID
$lastID = (int) input::post_get('last_id', 0);
// Does user have permission to view this user group/type?
if (!session::permission('users_groups_browse', 'users') || !session::permission('users_types_browse', 'users')) {
view::noAccess();
}
// Get actions
$actions = $this->timeline_model->getActions(0, $privacy, $lastID, 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 = $this->likes_model->getMultiLikes($ratings);
$votes = $this->votes_model->getMultiVotes($ratings);
$ratings = $likes + $votes;
}
// Can we post messages?
$post = session::permission('messages_post', 'timeline') ? true : false;
// Update comments pagination
config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
// Set meta tags
$this->metatags_model->set('timeline', 'timeline_index');
// Set title
view::setTitle(__($privacy == 2 ? 'my_timeline' : 'timeline_feed', 'system_navigation'), false);
// Assign actions
if ($privacy == 1 && config::item('timeline_user_feed', 'timeline') && users_helper::isLoggedin()) {
view::setAction('timeline/manage', __('timeline_user', 'timeline'), array('class' => 'icon-text icon-timeline-public'));
} elseif ($privacy == 2 && config::item('timeline_public_feed', 'timeline')) {
view::setAction('timeline', __('timeline_public', 'timeline'), array('class' => 'icon-text icon-timeline-public'));
}
// Load view
if (input::isAjaxRequest()) {
$output = view::load('timeline/actions', array('actions' => $actions, 'user' => array(), 'post' => $post, 'ratings' => $ratings), true);
view::ajaxResponse($output);
} else {
view::load('timeline/index', array('actions' => $actions, 'user' => array(), 'post' => $post, 'ratings' => $ratings));
}
}
示例10: browse
public function browse()
{
// Get URI vars
$typeID = (int) uri::segment(6);
$typeID = $typeID == 0 || $typeID == 1 ? $typeID : 0;
// Set title
view::setTitle(__('fields', 'system_fields'));
// Set trail
view::setTrail('cp/system/fields/pictures', __('fields', 'system_fields'));
if ($typeID == 1) {
view::setTrail('cp/system/fields/pictures/browse/1', __('pictures_albums', 'system_navigation'));
}
// Assign actions
view::setAction('cp/system/fields/pictures/browse/1', __('album_fields', 'pictures'), array('class' => 'icon-text icon-system-fields'));
// Browse custom fields
$this->browseFields('pictures', 'pictures_' . ($typeID == 1 ? 'albums_' : '') . 'data', $typeID);
}
示例11: browse
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');
}
示例12: view
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');
}
}
示例13: edit
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');
}
示例14: browse
public function browse()
{
// Get templates
if (!($templates = $this->newsletters_templates_model->getTemplates())) {
view::setInfo(__('no_templates', 'newsletters_templates'));
}
// Create table grid
$grid = array('uri' => 'cp/content/newsletters/templates/browse', 'keyword' => 'newsletters_templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), '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/content/newsletters/templates/edit/' . $template['template_id'], text_helper::truncate($template['name'], 64))), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/newsletters/templates/edit/' . $template['template_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/newsletters/templates/delete/' . $template['template_id'], __('delete', 'system'), array('data-html' => __('template_delete?', 'newsletters_templates'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Filter hooks
hook::filter('cp/content/newsletters/templates/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('newsletters_templates_manage', 'system_navigation'));
// Set action
view::setAction('cp/content/newsletters/templates/edit', __('template_new', 'newsletters_templates'), array('class' => 'icon-text icon-newsletters-templates-new'));
// Load view
view::load('cp/content/newsletters/templates/browse');
}
示例15: 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');
}