本文整理汇总了PHP中MenusHelper::getMenuTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP MenusHelper::getMenuTypes方法的具体用法?PHP MenusHelper::getMenuTypes怎么用?PHP MenusHelper::getMenuTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenusHelper
的用法示例。
在下文中一共展示了MenusHelper::getMenuTypes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenus
/**
* Return list of menus.
*
* @return array
* @throws \RuntimeException
*/
public function getMenus()
{
static $items;
if ($items === null) {
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
$items = (array) \MenusHelper::getMenuTypes();
}
return $items;
}
示例2: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'menus.php';
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menutype) {
$options[] = JHtml::_('select.option', $menutype, $menutype);
}
array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_MENU')));
return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => $control_name . $name, 'list.attr' => 'class="inputbox"', 'list.select' => $value));
}
示例3: fetchElement
/**
* Fetch a calendar element
*
* @param string $name Element name
* @param string $value Element value
* @param object &$node XMLElement node object containing the settings for the element
* @param string $control_name Control name
* @return string
*/
public function fetchElement($name, $value, &$node, $control_name)
{
require_once PATH_CORE . '/components/com_menus/admin/helpers/menus.php';
$menuTypes = \MenusHelper::getMenuTypes();
foreach ($menuTypes as $menutype) {
$options[] = Builder\Select::option($menutype, $menutype);
}
array_unshift($options, Builder\Select::option(\App::get('language')->txt('JOPTION_SELECT_MENU')));
return Builder\Select::genericlist($options, $control_name . '[' . $name . ']', array('id' => $control_name . $name, 'list.attr' => 'class="inputbox"', 'list.select' => $value));
}
示例4: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$db =& JFactory::getDBO();
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menutype) {
$options[] = JHTML::_('select.option', $menutype, $menutype);
}
array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Select Menu') . ' -'));
return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
}
示例5: fetchElement
/**
* Fetch a html for a list of menus
*
* @param string $name Element name
* @param string $value Element value
* @param JXMLElement &$node JXMLElement node object containing the settings for the element
* @param string $control_name Control name
*
* @return string
*
* @deprecated 12.1 Use JFormFieldMenu::getOptions instead
* @since 11.1
*/
public function fetchElement($name, $value, &$node, $control_name)
{
// Deprecation warning.
JLog::add('JElementMenu::fetchElement() is deprecated.', JLog::WARNING, 'deprecated');
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menutype) {
$options[] = JHtml::_('select.option', $menutype, $menutype);
}
array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_MENU')));
return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => $control_name . $name, 'list.attr' => 'class="inputbox"', 'list.select' => $value));
}
示例6: universalfetchElement
function universalfetchElement($name, $value, &$node)
{
if (version_compare(JVERSION, '1.6.0', 'ge')) {
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
} else {
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
}
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menutype) {
$node->addChild('option', array('value' => $menutype))->setData(ucfirst($menutype));
}
return parent::universalfetchElement($name, $value, $node);
}
示例7: fetchElement
function fetchElement()
{
if (version_compare(JVERSION, '1.6.0', 'ge')) {
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
} else {
require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_menus' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php';
}
$options = MenusHelper::getMenuTypes();
for ($i = 0; $i < count($options); $i++) {
$this->_xml->addChild('option', htmlspecialchars(ucfirst($options[$i])))->addAttribute('value', $options[$i]);
}
$this->_value = $this->_form->get($this->_name, $this->_default);
$html = parent::fetchElement();
return $html;
}
示例8: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
$db =& JFactory::getDBO();
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
$menuTypes = MenusHelper::getMenuTypes();
if (null == $value || !isset($value) || !in_array($value, $menuTypes)) {
$value = $menuTypes[0];
}
foreach ($menuTypes as $menutype) {
$options[] = JHTML::_('select.option', $menutype, $menutype);
}
array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Select Menu') . ' -'));
include_once 'selectbox.php';
$selectbox = new JElementSelectBox();
return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
}
示例9: _getOptions
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function _getOptions()
{
require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$menuTypes = MenusHelper::getMenuTypes();
// Prepare return value
$options = array();
// Add basic option
// TODO: would be better to put this basic option in the xml file ?
$options[] = JHtml::_('select.option', '', JText::_('JOption_Select_Menu'));
// Iterate over menus
foreach ($menuTypes as $menutype) {
$options[] = JHtml::_('select.option', $menutype, $menutype);
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::_getOptions(), $options);
return $options;
}
示例10: moveForm
function moveForm($tpl = null)
{
global $mainframe;
$this->_layout = 'move';
/*
* Set toolbar items for the page
*/
JToolBarHelper::title(JText::_('Menu Items') . ': <small><small>[ ' . JText::_('Move') . ' ]</small></small>');
JToolBarHelper::custom('doMove', 'move.png', 'move_f2.png', 'Move', false);
JToolBarHelper::cancel('cancelItem');
JToolBarHelper::help('screen.menus');
$document =& JFactory::getDocument();
$document->setTitle(JText::_('Move Menu Items'));
$menutype = $mainframe->getUserStateFromRequest('com_menus.menutype', 'menutype', 'mainmenu', 'menutype');
// Build the menutypes select list
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menuType) {
$menu[] = JHTML::_('select.option', $menuType, $menuType);
}
$MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
$items =& $this->get('ItemsFromRequest');
$this->assignRef('menutype', $menutype);
$this->assignRef('items', $items);
$this->assignRef('menutypes', $menuTypes);
$this->assignRef('MenuList', $MenuList);
parent::display($tpl);
}
示例11: moveForm
function moveForm($tpl = null)
{
global $mainframe;
$this->_layout = 'move';
/*
* Set toolbar items for the page
*/
JToolBarHelper::title(JText::_('Move') . ' ' . JText::_('Menu Items'));
JToolBarHelper::custom('doMove', 'move.png', 'move_f2.png', 'Move', false);
JToolBarHelper::cancel('cancelItem');
JSubMenuHelper::addEntry(JText::_('Items'), 'index.php?option=com_menus&task=view', true);
JSubMenuHelper::addEntry(JText::_('Menus'), 'index.php?option=com_menus');
if (JFactory::getUser()->authorize('com_trash', 'manage')) {
JSubMenuHelper::addEntry(JText::_('Trash'), 'index.php?option=com_trash&task=viewMenu');
}
$document =& JFactory::getDocument();
$document->setTitle(JText::_('Move Menu Items'));
$menutype = $mainframe->getUserStateFromRequest('com_menus.menutype', 'menutype', 'mainmenu', 'menutype');
// Build the menutypes select list
$menuTypes = MenusHelper::getMenuTypes();
foreach ($menuTypes as $menuType) {
$menu[] = JHTML::_('select.option', $menuType, $menuType);
}
$MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
$items =& $this->get('ItemsFromRequest');
$this->assignRef('menutype', $menutype);
$this->assignRef('items', $items);
$this->assignRef('menutypes', $menuTypes);
$this->assignRef('MenuList', $MenuList);
parent::display($tpl);
}