Пример #1
0
 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  */
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     $language = $this->element['language'] ? explode(',', (string) $this->element['language']) : array();
     // Get the menu items.
     $items = \MenusHelper::getMenuLinks($menuType, 0, 0, $published, $language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = Dropdown::option($link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = Dropdown::option($link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
Пример #2
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 protected function _getGroups()
 {
     // Get the attributes
     $menuType = (string) $this->_element->attributes()->menu_type;
     $published = (string) $this->_element->attributes()->published ? explode(',', (string) $this->_element->attributes()->published) : array();
     $disable = (string) $this->_element->attributes()->disable ? explode(',', (string) $this->_element->attributes()->disable) : array();
     // Get the com_menus helper
     require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
     // Get the items
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published);
     // Prepare return value
     $groups = array();
     // If a menu type was set
     if ($menuType) {
         $groups[$menuType] = array();
         // Loop over links
         foreach ($items as $link) {
             // Generate an option disabling it if it's the case
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Loop over types
         foreach ($items as $menu) {
             $groups[$menu->menutype] = array();
             // Loop over links
             foreach ($menu->links as $link) {
                 // Generate an option disabling it if it's the case
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional options in the XML definition.
     $groups = array_merge(parent::_getGroups(), $groups);
     return $groups;
 }
Пример #3
0
 protected function getInput()
 {
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $options = MenusHelper::getMenuLinks();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Пример #4
0
 private function getAssignmentCount($id)
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $assignment_count = 0;
     $menuTypes = MenusHelper::getMenuLinks();
     foreach ($menuTypes as &$type) {
         foreach ($type->links as $link) {
             if ($link->template_style_id == $id) {
                 $assignment_count++;
             }
         }
     }
     return $assignment_count;
 }
Пример #5
0
 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     $language = $this->element['language'] ? explode(',', (string) $this->element['language']) : array();
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published, $language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             /*##mygruz20130718204314 {
             		It was:
             		It became:*/
             $repeate = $link->level - 1;
             if ($repeate > 0) {
                 $link->text = str_repeat('-', $repeate) . ' ' . $link->text;
             }
             /*##mygruz20130718204314 } */
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 /*##mygruz20130718204314 {
                 		It was:
                 		It became:*/
                 $repeate = $link->level - 1;
                 if ($repeate > 0) {
                     $link->text = str_repeat('-', $repeate) . ' ' . $link->text;
                 }
                 /*##mygruz20130718204314 } */
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
Пример #6
0
 public function getMenu()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $data = \MenusHelper::getMenuLinks();
     $userid = \JFactory::getUser()->id;
     $list = [];
     foreach ($data as $menu) {
         $items = [];
         foreach ($menu->links as $link) {
             $items[] = ['name' => 'menu[' . $link->value . ']', 'field' => ['id', 'link' . $link->value], 'value' => $link->template_style_id == $this->style_id, 'disabled' => $link->type != 'component' || $link->checked_out && $link->checked_out != $userid, 'label' => str_repeat('—', max(0, $link->level - 1)) . ' ' . $link->text];
         }
         $group = ['label' => $menu->title ?: $menu->menutype, 'items' => $items];
         $list[] = $group;
     }
     return $list;
 }
Пример #7
0
 public function getGroupedItems()
 {
     $groups = array();
     // Get the menu items.
     $items = \MenusHelper::getMenuLinks();
     // Build the groups arrays.
     foreach ($items as $item) {
         // Initialize the group.
         $groups[$item->menutype] = array();
         // Build the options array.
         foreach ($item->links as $link) {
             $groups[$item->menutype][$link->value] = ['spacing' => str_repeat('  ', $link->level - 1), 'label' => $link->text];
         }
     }
     return $groups;
 }
 function getInput()
 {
     // Initialize variables.
     $groups = array();
     $menus = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     foreach ($groups as $group => $links) {
         $menus[] = JHtml::_('select.optgroup', $group);
         foreach ($links as $link) {
             $menus[] = $link;
         }
         $menus[] = JHtml::_('select.optgroup', $group);
     }
     // Create the 'all menus' listing
     $temp = new stdClass();
     $temp->value = '';
     $temp->text = JText::_('JW_DISQUS_SELECT_ALL_MENUS');
     // Merge the above
     array_unshift($menus, $temp);
     // Output
     $output = JHTML::_('select.genericlist', $menus, $this->name . '[]', 'class="inputbox" style="width:220px;" multiple="multiple" size="12"', 'value', 'text', $this->value);
     return $output;
 }
Пример #9
0
 protected function getInput()
 {
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $options = MenusHelper::getMenuLinks();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     foreach ($options as $i => $option) {
         $options[$i]->value = 'type.' . $option->menutype;
         $options[$i]->text = $option->title;
         $options[$i]->level = 0;
         $options[$i]->class = 'hidechildren';
         $options[$i]->labelclass = 'nav-header';
         unset($option->title);
     }
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Пример #10
0
 function universalfetchElement($name, $value, &$node)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
         $menus = MenusHelper::getMenuLinks();
         foreach ($menus as $menu) {
             $node->addChild('option', array('value' => 'optgroup'))->setData($menu->title);
             foreach ($menu->links as $link) {
                 $node->addChild('option', array('value' => $link->value))->setData('   ' . $link->text);
             }
         }
     } else {
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
         $db =& JFactory::getDBO();
         $query = 'SELECT id, parent, name, menutype, type' . ' FROM #__menu WHERE published = 1' . ' ORDER BY menutype, parent, ordering';
         $db->setQuery($query);
         $menuItems = $db->loadObjectList();
         $children = array();
         if ($menuItems) {
             // first pass - collect children
             foreach ($menuItems as $v) {
                 $pt = $v->parent;
                 $list = @$children[$pt] ? $children[$pt] : array();
                 array_push($list, $v);
                 $children[$pt] = $list;
             }
         }
         $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
         // assemble into menutype groups
         $n = count($list);
         $menus = array();
         foreach ($list as $k => $v) {
             $menus[$v->menutype][] =& $list[$k];
         }
         foreach ($menus as $k => $menu) {
             $node->addChild('option', array('value' => 'optgroup'))->setData($k);
             foreach ($menu as $menuitem) {
                 $node->addChild('option', array('value' => $menuitem->id))->setData('   ' . $menuitem->name);
             }
         }
     }
     return parent::universalfetchElement($name, $value, $node);
 }
Пример #11
0
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// Initiasile related data.
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
$menuTypes = MenusHelper::getMenuLinks();
$user = JFactory::getUser();
?>
<fieldset class="adminform">
	<legend><?php 
echo JText::_('COM_TEMPLATES_MENUS_ASSIGNMENT');
?>
</legend>
		<label id="jform_menuselect-lbl" for="jform_menuselect"><?php 
echo JText::_('JGLOBAL_MENU_SELECTION');
?>
</label>

		<button type="button" class="jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = !el.checked; });">
			<?php 
echo JText::_('JGLOBAL_SELECTION_INVERT_ALL');
?>
		</button>
		<div class="clr"></div>
Пример #12
0
<div id="profile">

	<select><?php 
echo implode("\n", $select);
?>
</select>			

	<a class="add" href="#">Add</a>
	<a class="rename" href="#">Rename</a>
	<a class="remove" href="#">Remove</a>
	<a class="assign" href="#">Assign Pages</a>

	<div class="items">
		<select name="items" size="15" multiple="multiple">
			<?php 
foreach (MenusHelper::getMenuLinks() as $menu) {
    ?>
			<?php 
    if (count($menu->links)) {
        ?>
			<optgroup label="<?php 
        echo $menu->title;
        ?>
">
				<?php 
        foreach ($menu->links as $link) {
            ?>
				<option value="<?php 
            echo (int) $link->value;
            ?>
"><?php 
Пример #13
0
 /**
  * Get a list of the menu item assignment options for modules.
  *
  * @param   int $clientId The client id.
  *
  * @return  array
  */
 public static function getMenuItemAssignmentOptions($clientId)
 {
     $options = array();
     $options[] = JHtml::_('select.option', '0', JText::_('JALL'));
     $options[] = JHtml::_('select.option', '-', JText::_('JNONE'));
     if ($clientId != 0) {
         return $options;
     }
     $options[] = JHtml::_('select.option', '-1', JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT'));
     $options[] = JHtml::_('select.option', '-2', JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY'));
     require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
     $items = MenusHelper::getMenuLinks();
     foreach ($items as $type) {
         $options[] = JHtml::_('select.option', '<OPTGROUP>', $type->title);
         foreach ($type->links as $item) {
             $options[] = JHtml::_('select.option', $item->value, str_repeat('- ', $item->level) . $item->text);
         }
         $options[] = JHtml::_('select.option', '</OPTGROUP>');
     }
     return $options;
 }
Пример #14
0
 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     $menuType = $this->menuType;
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $levelPrefix = str_repeat('- ', max(0, $link->level - 1));
             // Displays language code if not set to All
             if ($link->language !== '*') {
                 $lang = ' (' . $link->language . ')';
             } else {
                 $lang = '';
             }
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $levelPrefix = str_repeat('- ', $link->level - 1);
                 // Displays language code if not set to All
                 if ($link->language !== '*') {
                     $lang = ' (' . $link->language . ')';
                 } else {
                     $lang = '';
                 }
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
Пример #15
0
<?php

/**
* @package   Warp Theme Framework
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
// get menu data
require_once $this['path']->path('admin:/components/com_menus/helpers/menus.php');
$menus = \MenusHelper::getMenuLinks();
// get layout data
$layouts = $config->get('layouts', array('default' => array()));
?>

<div id="layout" data-field-name="<?php 
echo $name;
?>
">

    <p>
        Store your modifications in a layout profile and assign it to different pages. The <em>default</em> layout will be used on pages without an assigned layout.
    </p>

    <p>
        <select data-layout-selector class="uk-form-width-small">
            <?php 
foreach (array_keys($layouts) as $layout) {
    ?>
                <option value="<?php 
    echo $layout;
Пример #16
0
 /**
  * Displays a list of menu forms
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public static function menus($name, $selected, $menus = array())
 {
     require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
     $items = MenusHelper::getMenuLinks();
     // Build the groups arrays.
     foreach ($items as $menu) {
         // Initialize the group.
         $menus[$menu->menutype] = array();
         // Build the options array.
         foreach ($menu->links as $link) {
             $menus[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text);
         }
     }
     $theme = FD::themes();
     $theme->set('name', $name);
     $theme->set('menus', $menus);
     $theme->set('selected', $selected);
     $output = $theme->output('admin/html/form.menus');
     return $output;
 }
Пример #17
0
 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     $menuType = $this->menuType;
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $this->disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $this->disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
Пример #18
0
    function render($type)
    {
        $sliders =& JPane::getInstance('sliders');
        echo $sliders->startPane('params');
        TranslateParams_xml::renderDoublecolumnParams($this->form, 'params', 'com_modules', $sliders);
        echo $sliders->endPane();
        // menu assignments
        // Initiasile related data.
        if (!class_exists('MenusHelper')) {
            JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php', true);
        }
        if (!class_exists('ModulesHelper')) {
            JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php', true);
        }
        $menuTypes = MenusHelper::getMenuLinks();
        ?>
		<script type="text/javascript">
			window.addEvent('domready', function(){
				validate();
				document.getElements('select').addEvent('change', function(e){validate();});
			});
			function validate(){
				var value	= document.id('jform_assignment').value;
				var list	= document.id('menu-assignment');
				if(value == '-' || value == '0'){
					$$('.jform-assignments-button').each(function(el) {el.setProperty('disabled', true); });
					list.getElements('input').each(function(el){
						el.setProperty('disabled', true);
						if (value == '-'){
							el.setProperty('checked', false);
						} else {
							el.setProperty('checked', true);
						}
					});
				} else {
					$$('.jform-assignments-button').each(function(el) {el.setProperty('disabled', false); });
					list.getElements('input').each(function(el){
						el.setProperty('disabled', false);
					});
				}
			}
		</script>
		<div class="width-100 fltlft">
		<fieldset class="adminform">
			<legend><?php 
        echo JText::_('COM_MODULES_MENU_ASSIGNMENT');
        ?>
</legend>
			<label id="jform_menus-lbl" for="jform_menus"><?php 
        echo JText::_('COM_MODULES_MODULE_ASSIGN');
        ?>
</label>

			<fieldset id="jform_menus" class="radio">
				<select name="jform[assignment]" id="jform_assignment">
					<?php 
        echo JHtml::_('select.options', ModulesHelper::getAssignmentOptions($this->item->client_id), 'value', 'text', $this->item->assignment, true);
        ?>
				</select>

			</fieldset>

			<label id="jform_menuselect-lbl" for="jform_menuselect"><?php 
        echo JText::_('JGLOBAL_MENU_SELECTION');
        ?>
</label>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = !el.checked; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_INVERT');
        ?>
			</button>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = false; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_NONE');
        ?>
			</button>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = true; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_ALL');
        ?>
			</button>

			<div class="clr"></div>

			<div id="menu-assignment">

			<?php 
        echo JHtml::_('tabs.start', 'module-menu-assignment-tabs', array('useCookie' => 1));
        ?>

			<?php 
        foreach ($menuTypes as &$type) {
            echo JHtml::_('tabs.panel', $type->title ? $type->title : $type->menutype, $type->menutype . '-details');
            $count = count($type->links);
            $i = 0;
            if ($count) {
                ?>
				<ul class="menu-links">
					<?php 
                foreach ($type->links as $link) {
                    if (trim($this->item->assignment) == '-') {
                        $checked = '';
                    } elseif ($this->item->assignment == 0) {
                        $checked = ' checked="checked"';
                    } elseif ($this->item->assignment < 0) {
                        $checked = in_array(-$link->value, $this->item->assigned) ? ' checked="checked"' : '';
                    } elseif ($this->item->assignment > 0) {
                        $checked = in_array($link->value, $this->item->assigned) ? ' checked="checked"' : '';
                    }
                    ?>
					<li class="menu-link">
						<input type="checkbox" class="chk-menulink" name="jform[assigned][]" value="<?php 
                    echo (int) $link->value;
                    ?>
" id="link<?php 
                    echo (int) $link->value;
                    ?>
"<?php 
                    echo $checked;
                    ?>
/>
						<label for="link<?php 
                    echo (int) $link->value;
                    ?>
">
							<?php 
                    echo $link->text;
                    ?>
						</label>
					</li>
					<?php 
                    if ($count > 20 && ++$i == ceil($count / 2)) {
                        ?>
					</ul><ul class="menu-links">
					<?php 
                    }
                    ?>
					<?php 
                }
                ?>
				</ul>
				<div class="clr"></div>
				<?php 
            }
            ?>
			<?php 
        }
        ?>

			<?php 
        echo JHtml::_('tabs.end');
        ?>

			</div>
		</fieldset>
		</div>
		<?php 
        return;
    }
Пример #19
0
    public function getInput()
    {
        // Initiasile related data.
        require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
        $menuTypes = MenusHelper::getMenuLinks();
        $user = JFactory::getUser();
        ob_start();
        ?>
            <button type="button" class="jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = !el.checked; });">
                <?php 
        echo JText::_('JGLOBAL_SELECTION_INVERT');
        ?>
            </button>
            <div class="clr"></div>
            <div id="menu-assignment">
            <?php 
        foreach ($menuTypes as &$type) {
            ?>
                <ul class="menu-links">
                    <h3><?php 
            echo $type->title ? $type->title : $type->menutype;
            ?>
</h3>
                    <?php 
            foreach ($type->links as $link) {
                ?>
                    <li class="menu-link">
                        <input type="checkbox" name="jform[assigned][]" value="<?php 
                echo (int) $link->value;
                ?>
" id="link<?php 
                echo (int) $link->value;
                ?>
"<?php 
                if ($link->template_style_id == $this->form->getValue('current_id')) {
                    ?>
 checked="checked"<?php 
                }
                if ($link->checked_out && $link->checked_out != $user->id) {
                    ?>
 disabled="disabled"<?php 
                } else {
                    ?>
 class="chk-menulink "<?php 
                }
                ?>
 />
                        <label for="link<?php 
                echo (int) $link->value;
                ?>
" >
                            <?php 
                $text = $link->text;
                preg_match("/^(- )*/", $text, $tmp);
                $text = str_replace($tmp[0], "", $text);
                $counter = strlen(str_replace(" ", "", $tmp[0]));
                echo '<span class="menu-padder" style="width:' . ($counter - 1) * 15 . 'px"></span>' . $text;
                ?>
                        </label>
                    </li>
                    <?php 
            }
            ?>
                </ul>
            <?php 
        }
        ?>
            </div>
        <?php 
        $html = ob_get_clean();
        return $html;
    }
Пример #20
0
 /**
  * TODO Move queries to models
  * Render boolean list
  * @param string           $name
  * @param string|array     $value
  * @param string           $controlName
  * @param SimpleXMLElement $node
  * @param SimpleXMLElement $parent
  * @return mixed
  */
 public function menuItems_j3($name, $value, $controlName, SimpleXMLElement $node, $parent)
 {
     require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
     // Get the menu items.
     $items = MenusHelper::getMenuLinks();
     // Build the groups arrays.
     $options = array();
     foreach ($items as $menu) {
         foreach ($menu->links as $link) {
             $options[$link->value] = $link->text;
         }
     }
     return $this->_renderList($options, $value, $this->_getName($controlName, $name), $node);
 }
Пример #21
0
 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     $menuType = $this->menuType;
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language);
     // Build group for a specific menu type.
     if ($menuType) {
         // If the menutype is empty, group the items by menutype.
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select($db->quoteName('title'))->from($db->quoteName('#__menu_types'))->where($db->quoteName('menutype') . ' = ' . $db->quote($menuType));
         $db->setQuery($query);
         try {
             $menuTitle = $db->loadResult();
         } catch (RuntimeException $e) {
             $menuTitle = $menuType;
         }
         // Initialize the group.
         $groups[$menuTitle] = array();
         // Build the options array.
         foreach ($items as $link) {
             $levelPrefix = str_repeat('- ', max(0, $link->level - 1));
             // Displays language code if not set to All
             if ($link->language !== '*') {
                 $lang = ' (' . $link->language . ')';
             } else {
                 $lang = '';
             }
             $groups[$menuTitle][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->title] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $levelPrefix = str_repeat('- ', $link->level - 1);
                 // Displays language code if not set to All
                 if ($link->language !== '*') {
                     $lang = ' (' . $link->language . ')';
                 } else {
                     $lang = '';
                 }
                 $groups[$menu->title][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }