本文整理匯總了PHP中MenusHelper::getActions方法的典型用法代碼示例。如果您正苦於以下問題:PHP MenusHelper::getActions方法的具體用法?PHP MenusHelper::getActions怎麽用?PHP MenusHelper::getActions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MenusHelper
的用法示例。
在下文中一共展示了MenusHelper::getActions方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolBarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'menu.png');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $canDo->get('core.create')) {
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('menu.apply');
}
JToolBarHelper::save('menu.save');
}
// If user can edit, can save the item.
if (!$isNew && $canDo->get('core.edit')) {
JToolBarHelper::apply('menu.apply');
JToolBarHelper::save('menu.save');
}
// If the user can create new items, allow them to see Save & New
if ($canDo->get('core.create')) {
JToolBarHelper::save2new('menu.save2new');
}
if ($isNew) {
JToolBarHelper::cancel('menu.cancel');
} else {
JToolBarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT');
}
示例2: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolBarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'menu-add');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $canDo->get('core.create')) {
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('adminitem.apply');
}
JToolBarHelper::save('adminitem.save');
}
// If not checked out, can save the item.
if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
JToolBarHelper::apply('adminitem.apply');
JToolBarHelper::save('adminitem.save');
}
// If the user can create new items, allow them to see Save & New
if ($canDo->get('core.create')) {
JToolBarHelper::save2new('adminitem.save2new');
}
// If an existing item, can save to a copy only if we have create rights.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('adminitem.save2copy');
}
if ($isNew) {
JToolBarHelper::cancel('adminitem.cancel');
} else {
JToolBarHelper::cancel('adminitem.cancel', 'JTOOLBAR_CLOSE');
}
}
示例3: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'menu-add');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $canDo->get('core.create')) {
if ($canDo->get('core.edit')) {
JToolbarHelper::apply('item.apply');
}
JToolbarHelper::save('item.save');
}
// If not checked out, can save the item.
if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
JToolbarHelper::apply('item.apply');
JToolbarHelper::save('item.save');
}
// If the user can create new items, allow them to see Save & New
if ($canDo->get('core.create')) {
JToolbarHelper::save2new('item.save2new');
}
// If an existing item, can save to a copy only if we have create rights.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('item.save2copy');
}
if ($isNew) {
JToolbarHelper::cancel('item.cancel');
} else {
JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
// Get the help information for the menu item.
$lang = JFactory::getLanguage();
$help = $this->get('Help');
if ($lang->hasKey($help->url)) {
$debug = $lang->setDebug(false);
$url = JText::_($help->url);
$lang->setDebug($debug);
} else {
$url = $help->url;
}
JToolbarHelper::help($help->key, $help->local, $url);
}
示例4: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolBarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'menu-add');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $canDo->get('core.create')) {
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('item.apply', 'JTOOLBAR_APPLY');
}
JToolBarHelper::save('item.save', 'JTOOLBAR_SAVE');
}
// If not checked out, can save the item.
if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
JToolBarHelper::apply('item.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('item.save', 'JTOOLBAR_SAVE');
}
// If the user can create new items, allow them to see Save & New
if ($canDo->get('core.create')) {
JToolBarHelper::custom('item.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy only if we have create rights.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('item.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('item.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
// Get the help information for the menu item.
$help = $this->get('Help');
JToolBarHelper::help($help->key, $help->local, $help->url);
}
示例5: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/menus.php';
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolbarHelper::title(JText::_('COM_MENUS_VIEW_MENUS_TITLE'), 'list menumgr');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('menu.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('menu.edit');
}
if ($canDo->get('core.delete')) {
JToolbarHelper::divider();
JToolbarHelper::deleteList('', 'menus.delete');
}
JToolbarHelper::custom('menus.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false);
if ($canDo->get('core.admin')) {
JToolbarHelper::divider();
JToolbarHelper::preferences('com_menus');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER');
}
示例6: defined
/**
* @package Joomla.Administrator
* @subpackage Templates.hathor
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 1.6
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Load the tooltip behavior.
JHtml::_('behavior.framework');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.modal');
$canDo = MenusHelper::getActions();
?>
<script type="text/javascript">
Joomla.submitbutton = function(task, type)
{
if (task == 'item.setType' || task == 'item.setMenuType') {
if(task == 'item.setType') {
document.id('item-form').elements['jform[type]'].value = type;
document.id('fieldtype').value = 'type';
} else {
document.id('item-form').elements['jform[menutype]'].value = type;
}
Joomla.submitform('item.setType', document.id('item-form'));
} else if (task == 'item.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
Joomla.submitform(task, document.id('item-form'));
示例7: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/menus.php';
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolBarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_TITLE'), 'menumgr.png');
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('item.add');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('item.edit');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if (JFactory::getUser()->authorise('core.admin')) {
JToolBarHelper::divider();
JToolBarHelper::checkin('items.checkin', 'JTOOLBAR_CHECKIN', true);
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('items.trash');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::makeDefault('items.setDefault', 'COM_MENUS_TOOLBAR_SET_HOME');
JToolBarHelper::divider();
}
if (JFactory::getUser()->authorise('core.admin')) {
JToolBarHelper::custom('items.rebuild', 'refresh.png', 'refresh_f2.png', 'JToolbar_Rebuild', false);
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_MENUS_MENU_ITEM_MANAGER');
}
示例8: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/menus.php';
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_TITLE'), 'menumgr.png');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('item.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('item.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if (JFactory::getUser()->authorise('core.admin')) {
JToolbarHelper::checkin('items.checkin', 'JTOOLBAR_CHECKIN', true);
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'items.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('items.trash');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::makeDefault('items.setDefault', 'COM_MENUS_TOOLBAR_SET_HOME');
}
if (JFactory::getUser()->authorise('core.admin')) {
JToolbarHelper::custom('items.rebuild', 'refresh.png', 'refresh_f2.png', 'JToolbar_Rebuild', false);
}
// Add a batch button
if ($user->authorise('core.create', 'com_menus') && $user->authorise('core.edit', 'com_menus') && $user->authorise('core.edit.state', 'com_menus')) {
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
JToolbarHelper::help('JHELP_MENUS_MENU_ITEM_MANAGER');
JHtmlSidebar::setAction('index.php?option=com_menus&view=items');
JHtmlSidebar::addFilter('', 'menutype', JHtml::_('select.options', JHtml::_('menu.menus'), 'value', 'text', $this->state->get('filter.menutype')), false);
JHtmlSidebar::addFilter(JText::_('COM_MENUS_OPTION_SELECT_LEVEL'), 'filter_level', JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => false)), 'value', 'text', $this->state->get('filter.published'), true));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
}