当前位置: 首页>>代码示例>>PHP>>正文


PHP JHTMLMenu类代码示例

本文整理汇总了PHP中JHTMLMenu的典型用法代码示例。如果您正苦于以下问题:PHP JHTMLMenu类的具体用法?PHP JHTMLMenu怎么用?PHP JHTMLMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JHTMLMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_zoo' . DS . 'zoo.php')) {
         return 'ZOO files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "zoo_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'ZOO category table not found in database...';
     }
     $multiple = $node->attributes('multiple');
     $size = $this->def($node->attributes('size'), 0);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $sql = "SELECT id, name FROM #__zoo_application";
     $db->setQuery($sql);
     $apps = $db->loadObjectList();
     $options = array();
     foreach ($apps as $i => $app) {
         $sql = "SELECT id, parent, name FROM #__zoo_category WHERE published = 1 AND application_id = " . (int) $app->id;
         $db->setQuery($sql);
         $menuItems = $db->loadObjectList();
         if ($i) {
             $options[] = JHTML::_('select.option', '-', ' ', 'value', 'text', 1);
         }
         // establish the hierarchy of the menu
         // TODO: use node model
         $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;
             }
         }
         // second pass - get an indent list of the items
         require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
         $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
         // assemble items to the array
         $options[] = JHTML::_('select.option', 'app' . $app->id, '[' . $app->name . ']', 'value', 'text', 0);
         foreach ($list as $item) {
             $options[] = JHTML::_('select.option', $item->id, '   ' . $item->treename, 'value', 'text', 0);
         }
     }
     $attribs = 'class="inputbox"';
     if ($size) {
         $attribs .= ' size="' . $size . '"';
     } else {
         $attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
     }
     if ($multiple) {
         $attribs .= ' multiple="multiple"';
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . '][]', $attribs, 'value', 'text', $value, $control_name . $name);
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:60,代码来源:categorieszoo.php

示例2: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_zoo/zoo.php')) {
         return 'ZOO files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "zoo_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'ZOO category table not found in database...';
     }
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $sql = "SELECT id, name FROM #__zoo_application";
     $db->setQuery($sql);
     $apps = $db->loadObjectList();
     $options = array();
     foreach ($apps as $i => $app) {
         if ($j15) {
             $sql = "SELECT id, parent, name FROM #__zoo_category WHERE published = 1 AND application_id = " . (int) $app->id;
         } else {
             $sql = "SELECT id, parent, parent as parent_id, name as title FROM #__zoo_category WHERE published = 1 AND application_id = " . (int) $app->id;
         }
         $db->setQuery($sql);
         $menuItems = $db->loadObjectList();
         if ($i) {
             $options[] = JHTML::_('select.option', '-', ' ', 'value', 'text', 1);
         }
         // establish the hierarchy of the menu
         // TODO: use node model
         $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;
             }
         }
         // second pass - get an indent list of the items
         require_once JPATH_LIBRARIES . '/joomla/html/html/menu.php';
         $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
         // assemble items to the array
         $options[] = JHTML::_('select.option', 'app' . $app->id, '[' . $app->name . ']', 'value', 'text', 0);
         foreach ($list as $item) {
             $item_name = '  ' . preg_replace('#^(( )*)- #', '\\1', str_replace(' ', ' ', $item->treename));
             $options[] = JHTML::_('select.option', $item->id, $item_name, 'value', 'text', 0);
         }
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:58,代码来源:categorieszoo.php

示例3: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'admin.k2.php')) {
         return 'K2 files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "k2_categories'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'K2 category table not found in database...';
     }
     $multiple = $this->def('multiple');
     $get_categories = $this->def('getcategories', 1);
     $size = $this->def('size', 0);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $where = 'published = 1';
     if (!$get_categories) {
         $where .= ' AND parent = 0';
     }
     $sql = "SELECT id, parent, name FROM #__k2_categories WHERE " . $where;
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
     }
     $attribs = 'class="inputbox"';
     if ($size) {
         $attribs .= ' size="' . $size . '"';
     } else {
         $attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
     }
     if ($multiple) {
         $attribs .= ' multiple="multiple"';
     }
     return JHTML::_('select.genericlist', $options, '' . $name . '[]', $attribs, 'value', 'text', $value, $id);
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:57,代码来源:categoriesk2.php

示例4: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_resource/resource.php')) {
         return 'Mighty Resource files not found...';
     }
     $db = JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "js_res_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'Mighty Resource category table not found in database...';
     }
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     $get_categories = $this->def('getcategories', 1);
     $show_ignore = $this->def('show_ignore');
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $where = 'published = 1';
     if (!$get_categories) {
         $where .= ' AND parent = 0';
     }
     $sql = "SELECT id, parent, name FROM #__js_res_category WHERE " . $where;
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . '/joomla/html/html/menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     if ($show_ignore) {
         if (in_array('-1', $value)) {
             $value = array('-1');
         }
         $options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_IGNORE') . ' -', 'value', 'text', 0);
     }
     foreach ($list as $item) {
         $item_name = preg_replace('#^(( )*)- #', '\\1', str_replace(' ', ' ', $item->treename));
         $options[] = JHtml::_('select.option', $item->id, $item_name, 'value', 'text', 0);
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, '', $j15);
 }
开发者ID:naka211,项目名称:designcreations1,代码行数:57,代码来源:categoriesmr.php

示例5: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $multiple = $this->def('multiple');
     $show_uncategorized = $this->def('show_uncategorized');
     $auto_select_cats = $this->def('auto_select_cats', 1);
     $db =& JFactory::getDBO();
     if (is_array($value)) {
         $value = implode(',', $value);
     }
     $value = str_replace('.', ':', $value);
     $value = explode(',', $value);
     $query = 'SELECT id, 0 as parent, title as name FROM #__sections WHERE published = 1 AND scope = "content" ORDER BY ordering';
     $db->setQuery($query);
     $sections = $db->loadObjectList();
     for ($i = 0; $i < count($sections); $i++) {
         $sec_name = explode("\n", wordwrap($sections[$i]->name, 86, "\n"));
         $sec_name = $sec_name['0'];
         $sec_name = $sec_name != $sections[$i]->name ? $sec_name . '...' : $sec_name;
         $sections[$i]->title = $sec_name;
     }
     $children = array();
     $children[] = $sections;
     foreach ($sections as $section) {
         $query = 'SELECT CONCAT( ' . $section->id . ', ":", id ) as id, section as parent, title as name' . ' FROM #__categories' . ' WHERE published = 1' . ' AND section = ' . $section->id . ' ORDER BY ordering';
         $db->setQuery($query);
         $categories = $db->loadObjectList();
         for ($i = 0; $i < count($categories); $i++) {
             $cat_name = explode("\n", wordwrap($categories[$i]->name, 86, "\n"));
             $cat_name = $cat_name['0'];
             $cat_name = $cat_name != $categories[$i]->name ? $cat_name . '...' : $cat_name;
             $categories[$i]->name = $cat_name;
             if ($auto_select_cats && in_array($section->id, $value)) {
                 $value[] = $categories[$i]->id;
             }
         }
         $children[$section->id] = $categories;
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     if ($show_uncategorized) {
         $options[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'value', 'text', 0);
     }
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
     }
     $attribs = 'class="inputbox"';
     $attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
     if ($multiple) {
         $attribs .= ' multiple="multiple"';
     }
     return JHTML::_('select.genericlist', $options, '' . $name . '[]', $attribs, 'value', 'text', $value, $id);
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:56,代码来源:secscats.php

示例6: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     $show_uncategorized = $this->def('show_uncategorized');
     $auto_select_cats = $this->def('auto_select_cats', 1);
     $db =& JFactory::getDBO();
     if (is_array($value)) {
         $value = implode(',', $value);
     }
     $value = str_replace('.', ':', $value);
     $value = explode(',', $value);
     $query = 'SELECT id, 0 as parent, title as name FROM #__sections WHERE published = 1 AND scope = "content" ORDER BY ordering';
     $db->setQuery($query);
     $sections = $db->loadObjectList();
     for ($i = 0; $i < count($sections); $i++) {
         $sec_name = explode("\n", wordwrap($sections[$i]->name, 86, "\n"));
         $sec_name = $sec_name['0'];
         $sec_name = $sec_name != $sections[$i]->name ? $sec_name . '...' : $sec_name;
         $sections[$i]->title = $sec_name;
     }
     $children = array();
     $children[] = $sections;
     foreach ($sections as $section) {
         $query = 'SELECT CONCAT( ' . $section->id . ', ":", id ) as id, section as parent, title as name' . ' FROM #__categories' . ' WHERE published = 1' . ' AND section = ' . $section->id . ' ORDER BY ordering';
         $db->setQuery($query);
         $categories = $db->loadObjectList();
         for ($i = 0; $i < count($categories); $i++) {
             $cat_name = explode("\n", wordwrap($categories[$i]->name, 86, "\n"));
             $cat_name = $cat_name['0'];
             $cat_name = $cat_name != $categories[$i]->name ? $cat_name . '...' : $cat_name;
             $categories[$i]->name = $cat_name;
             if ($auto_select_cats && in_array($section->id, $value)) {
                 $value[] = $categories[$i]->id;
             }
         }
         $children[$section->id] = $categories;
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . '/joomla/html/html/menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     if ($show_uncategorized) {
         $options[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'value', 'text', 0);
     }
     foreach ($list as $item) {
         $item_name = preg_replace('#^((&nbsp;)*)- #', '\\1', str_replace('&#160;', '&nbsp;', $item->treename));
         $options[] = JHTML::_('select.option', $item->id, $item_name, 'value', 'text', 0);
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:54,代码来源:secscats.php

示例7: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_resource' . DS . 'models' . DS . 'record.php')) {
         return 'JoomSuite Resources files not found...';
     }
     $conf =& JFactory::getConfig();
     $dbprefix = $conf->getValue('config.dbprefix');
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $dbprefix . "js_res_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'JoomSuite Resources category table not found in database...';
     }
     $multiple = $node->attributes('multiple');
     $get_categories = $this->def($node->attributes('getcategories'), 1);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $where = 'published = 1';
     if (!$get_categories) {
         $where .= ' AND parent = 0';
     }
     $sql = "SELECT id, parent, name FROM #__js_res_category WHERE " . $where;
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
     }
     $attribs = 'class="inputbox"';
     $attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
     if ($multiple) {
         $attribs .= ' multiple';
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . '][]', $attribs, 'value', 'text', $value, $control_name . $name);
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:53,代码来源:jssection.php

示例8: getInput

 function getInput()
 {
     $db =& JFactory::getDBO();
     $version = new JVersion();
     $odering = ", m.ordering";
     if ($version->RELEASE >= '3.0') {
         $odering = "";
     }
     $query = 'SELECT m.id, m.parent_id, m.title, m.menutype' . ' FROM #__menu AS m' . ' WHERE m.published = 1' . ' ORDER BY m.menutype, m.parent_id ' . $odering;
     $db->setQuery($query);
     $mitems = $db->loadObjectList();
     $mitems_temp = $mitems;
     $children = array();
     foreach ($mitems as $v) {
         $id = $v->id;
         $pt = $v->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         array_push($list, $v);
         $children[$pt] = $list;
     }
     $list = JHTMLMenu::TreeRecurse(intval($mitems[0]->parent_id), '', array(), $children, 9999, 0, 0);
     $mitems_spacer = $mitems_temp[0]->menutype;
     $mitems = array();
     if (@$all | @$unassigned) {
         $mitems[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('Menus'));
         if ($all) {
             $mitems[] = JHTML::_('select.option', 0, JText::_('All'));
         }
         if ($unassigned) {
             $mitems[] = JHTML::_('select.option', -1, JText::_('Unassigned'));
         }
         $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
     }
     $lastMenuType = null;
     $tmpMenuType = null;
     foreach ($list as $list_a) {
         if ($list_a->menutype != $lastMenuType) {
             if ($tmpMenuType) {
                 $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
             }
             $mitems[] = JHTML::_('select.option', '<OPTGROUP>', $list_a->title);
             $lastMenuType = $list_a->menutype;
             $tmpMenuType = $list_a->menutype;
         }
         $mitems[] = JHTML::_('select.option', $list_a->id, $list_a->treename);
     }
     if ($lastMenuType !== null) {
         $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
     }
     $result = JHTML::_('select.genericlist', $mitems, $this->name . '[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $this->value);
     return $result;
 }
开发者ID:ChrisUmmen,项目名称:joomladesign,代码行数:52,代码来源:menuitems.php

示例9: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_resource' . DS . 'models' . DS . 'record.php')) {
         return 'JoomSuite Resources files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "js_res_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'JoomSuite Resources category table not found in database...';
     }
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     $get_categories = $this->def('getcategories', 1);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $where = 'published = 1';
     if (!$get_categories) {
         $where .= ' AND parent = 0';
     }
     $sql = "SELECT id, parent, name FROM #__js_res_category WHERE " . $where;
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
     }
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'html.php';
     return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:49,代码来源:jssection.php

示例10: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_flexicontent/admin.flexicontent.php')) {
         return 'Flexicontent files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "flexicontent_cats_item_relations'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'Flexicontent category-item relations table not found in database...';
     }
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     $get_categories = $this->def('getcategories', 1);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $flexicomp_params =& JComponentHelper::getParams('com_flexicontent');
     $flexi_section = $flexicomp_params->get('flexi_section');
     $sql = 'SELECT  id, parent_id as parent, title as name' . ' FROM #__categories' . ' WHERE published = 1' . ' AND section = ' . $flexi_section . ' ORDER BY ordering';
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . '/joomla/html/html/menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 1);
     // assemble items to the array
     $options = array();
     foreach ($list as $item) {
         $item_name = preg_replace('#^((&nbsp;)*)- #', '\\1', str_replace('&#160;', '&nbsp;', $item->treename));
         $options[] = JHTML::_('select.option', $item->id, $item_name, 'value', 'text', 0);
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:48,代码来源:categoriesfc.php

示例11: getInput

	function getInput( $name, $id, $value, $params, $children, $j15 = 0 )
	{
		$this->params = $params;

		JHtml::_( 'behavior.modal', 'a.modal' );

		$size = (int) $this->def( 'size' );
		$multiple = $this->def( 'multiple', 1 );
		$showinput = $this->def( 'showinput' );
		$state = $this->def( 'state' );
		$disable_types = $this->def( 'disable' );

		$db = JFactory::getDBO();

		// load the list of menu types
		$query = 'SELECT menutype, title'
			.' FROM #__menu_types'
			.' ORDER BY title';
		$db->setQuery( $query );
		$menuTypes = $db->loadObjectList();

		// load the list of menu items
		if ( $state != '' ) {
			$where = 'WHERE published = '.(int) $state;
		} else {
			$where = 'WHERE published != -2';
		}
		if ( $j15 ) {
			$query = 'SELECT id, parent, name, alias, menutype, type, published, home'
				.' FROM #__menu'
				.' '.$where
				.' ORDER BY menutype, parent, ordering';
		} else {
			$query = 'SELECT id, parent_id, title, alias, menutype, type, published, home'
				.', parent_id as parent, title as name'
				.' FROM #__menu'
				.' '.$where
				.' ORDER BY menutype, parent, ordering';
		}
		$db->setQuery( $query );
		$menuItems = $db->loadObjectList();

		// establish the hierarchy of the menu
		$children = array();

		if ( $menuItems ) {
			// first pass - collect children
			foreach ( $menuItems as $v ) {
				if ( $v->type != 'separator' ) {
					if ( $j15 ) {
						if ( preg_replace( '#[^a-z0-9]#', '', strtolower( $v->name ) ) !== preg_replace( '#[^a-z0-9]#', '', $v->alias ) ) {
							$v->name .= ' ['.$v->alias.']';
						}
					} else {
						if ( preg_replace( '#[^a-z0-9]#', '', strtolower( $v->title ) ) !== preg_replace( '#[^a-z0-9]#', '', $v->alias ) ) {
							$v->title .= ' ['.$v->alias.']';
						}
					}
				}
				$pt = $v->parent;
				$list = @$children[$pt] ? $children[$pt] : array();
				array_push( $list, $v );
				$children[$pt] = $list;
			}
		}

		// second pass - get an indent list of the items
		require_once JPATH_LIBRARIES.'/joomla/html/html/menu.php';
		$list = JHTMLMenu::treerecurse( 0, '', array(), $children, 9999, 0, 0 );

		// assemble into menutype groups
		$groupedList = array();
		foreach ( $list as $k => $v ) {
			$groupedList[$v->menutype][] =& $list[$k];
		}

		// assemble menu items to the array
		$options = array();

		$count = 0;
		foreach ( $menuTypes as $type ) {
			if ( isset( $groupedList[$type->menutype] ) ) {
				if ( $count > 0 ) {
					$options[] = JHtml::_( 'select.option', '-', '&nbsp;', 'value', 'text', true );
				}
				$count++;
				$options[] = JHtml::_( 'select.option', $type->menutype, '[ '.$type->title.' ]', 'value', 'text', true );
				$n = count( $groupedList[$type->menutype] );
				for ( $i = 0; $i < $n; $i++ )
				{
					$item =& $groupedList[$type->menutype][$i];

					//If menutype is changed but item is not saved yet, use the new type in the list
					if ( JRequest::getString( 'option', '', 'get' ) == 'com_menus' ) {
						$currentItemArray = JRequest::getVar( 'cid', array( 0 ), '', 'array' );
						$currentItemId = (int) $currentItemArray['0'];
						$currentItemType = JRequest::getString( 'type', $item->type, 'get' );
						if ( $currentItemId == $item->id && $currentItemType != $item->type ) {
							$item->type = $currentItemType;
						}
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:menuitems.php

示例12: getListsAdmin

 function getListsAdmin($filters)
 {
     $db =& JFactory::getDBO();
     $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     // get list of Positions for dropdown filter
     $query = 'SELECT m.position AS value, m.position AS text' . ' FROM #__modules as m' . ' WHERE m.client_id = ' . (int) $client->id . ' GROUP BY m.position' . ' ORDER BY m.position';
     $db->setQuery($query);
     $options[] = JHTML::_('select.option', '0', '- ' . JText::_('Position') . ' -');
     $options = array_merge($options, $db->loadObjectList());
     $lists['position'] = JHTML::_('select.genericlist', $options, 'filter_position', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "{$filters->position}");
     // get list of Types for dropdown filter
     $query = 'SELECT module AS value, module AS text' . ' FROM #__modules' . ' WHERE client_id = ' . (int) $client->id . ' GROUP BY module' . ' ORDER BY module';
     $db->setQuery($query);
     $options = array(JHTML::_('select.option', '0', '- ' . JText::_('Type') . ' -'));
     $options = array_merge($options, $db->loadObjectList());
     $lists['type'] = JHTML::_('select.genericlist', $options, 'filter_type', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "{$filters->type}");
     // state filter
     $lists['state'] = JHTML::_('grid.state', $filters->state);
     // state access
     if (true || $client->id == 1) {
         // Administrator modules
         $query = 'SELECT id AS value, name AS text' . ' FROM #__groups' . ' ORDER BY id';
         $db->setQuery($query);
         $options = array(JHTML::_('select.option', '', '- ' . JText::_('AMM_ACCESS_LEVEL') . ' -'));
         $options = array_merge($options, $db->loadObjectList());
         $lists['access'] = JHTML::_('select.genericlist', $options, 'filter_access', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $filters->access);
     } else {
         // TODO: ... still have to think about this!
         // Site modules
         $options = array();
         $options[] = JHTML::_('select.option', '', '- ' . JText::_('AMM_ACCESS_LEVEL') . ' -');
         $options[] = JHTML::_('select.option', '0', JText::_('NN_NOT_REGISTERED') . ' / ' . JText::_('NN_LOGGED_IN'));
         $acl =& JFactory::getACL();
         $options = array_merge($options, $acl->get_group_children_tree(null, 'USERS', 0));
         $lists['access'] = JHTML::_('select.genericlist', $options, 'filter_access_adv', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $filters->access_adv);
     }
     // template assignment filter
     if (true || $client->id == 1) {
         // Administrator modules
         $query = 'SELECT DISTINCT( template ) AS text, template AS value' . ' FROM #__templates_menu' . ' WHERE client_id = ' . (int) $client->id;
         $db->setQuery($query);
         $options = array();
         $options[] = JHTML::_('select.option', '0', '- ' . JText::_('Template') . ' -');
         $options = array_merge($options, $db->loadObjectList());
         $lists['template'] = JHTML::_('select.genericlist', $options, 'filter_template', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "{$filters->template}");
     } else {
         // TODO: ... still have to think about this!
         // Site modules
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_templates' . DS . 'helpers' . DS . 'template.php';
         $templates = array();
         $templates = TemplatesHelper::parseXMLTemplateFiles(JPATH_ROOT . DS . 'templates');
         $options = array();
         $options[] = JHTML::_('select.option', '0', '- ' . JText::_('Template') . ' -');
         foreach ($templates as $template) {
             $options[] = JHTML::_('select.option', $template->directory, $template->name);
         }
         $lists['template'] = JHTML::_('select.genericlist', $options, 'filter_template', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "{$filters->template}");
     }
     // template assignment filter
     $query = 'SELECT DISTINCT( template ) AS text, template AS value' . ' FROM #__templates_menu' . ' WHERE client_id = ' . (int) $client->id;
     $db->setQuery($query);
     // get list of Menu Item Assignments for dropdown filter
     // load the list of menu types
     $query = 'SELECT menutype, title' . ' FROM #__menu_types' . ' ORDER BY title';
     $db->setQuery($query);
     $menuTypes = $db->loadObjectList();
     $query = 'SELECT m.id, m.parent, m.name, m.menutype, m.type, m.published, mm.moduleid as assignment' . ' FROM #__menu as m' . ' LEFT JOIN #__modules_menu AS mm ON mm.menuid = m.id' . ' WHERE m.published != -2' . ' GROUP BY m.id' . ' ORDER BY m.menutype, m.parent, m.ordering';
     $db->setQuery($query);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble into menutype groups
     $n = count($list);
     $groupedList = array();
     foreach ($list as $k => $v) {
         $groupedList[$v->menutype][] =& $list[$k];
     }
     // assemble menu items to the array
     $options = array();
     $options[] = JHTML::_('select.option', '', '- ' . JText::_('AMM_MENU_ITEM_ASSIGNMENT') . ' -');
     $options[] = JHTML::_('select.option', 'all', JText::_('All'));
     $options[] = JHTML::_('select.option', 'none', JText::_('None'));
     $options[] = JHTML::_('select.option', 'varies', JText::_('Varies'));
     $options[] = JHTML::_('select.option', '-', '----------------------------------------', 'value', 'text', true);
     $count = 0;
     foreach ($menuTypes as $type) {
         if (isset($groupedList[$type->menutype])) {
             if ($count > 0) {
//.........这里部分代码省略.........
开发者ID:jtresca,项目名称:nysurveyor,代码行数:101,代码来源:controller.php

示例13: treerecurse

 function treerecurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1)
 {
     if (@$children[$id] && $level <= $maxlevel) {
         foreach ($children[$id] as $v) {
             $id = $v->id;
             if ($type) {
                 $pre = '<sup>|_</sup>&nbsp;';
                 $spacer = '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
             } else {
                 $pre = '- ';
                 $spacer = '&nbsp;&nbsp;';
             }
             if ($v->parent == 0) {
                 $txt = $v->name;
             } else {
                 $txt = $pre . $v->name;
             }
             $pt = $v->parent;
             $list[$id] = $v;
             $list[$id]->treename = "{$indent}{$txt}";
             $list[$id]->children = count(@$children[$id]);
             $list = JHTMLMenu::TreeRecurse($id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type);
         }
     }
     return $list;
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:26,代码来源:menu.php

示例14: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_resource' . DS . 'resource.php')) {
         return 'Mighty Resource files not found...';
     }
     $db =& JFactory::getDBO();
     $sql = "SHOW tables like '" . $db->getPrefix() . "js_res_category'";
     $db->setQuery($sql);
     $tables = $db->loadObjectList();
     if (!count($tables)) {
         return 'Mighty Resource category table not found in database...';
     }
     $multiple = $this->def('multiple');
     $get_categories = $this->def('getcategories', 1);
     $size = $this->def('size', 0);
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     $where = 'published = 1';
     if (!$get_categories) {
         $where .= ' AND parent = 0';
     }
     $sql = "SELECT id, parent, name FROM #__js_res_category WHERE " . $where;
     $db->setQuery($sql);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     // TODO: use node model
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble items to the array
     $options = array();
     foreach ($list as $item) {
         $item_name = $item->treename;
         $padding = 0;
         while (strpos($item_name, '&nbsp;&nbsp;') === 0) {
             $padding++;
             $item_name = substr($item_name, 12);
         }
         $item_name = preg_replace('#^- #', '', $item_name);
         $style = 'padding-left:' . $padding . 'em;';
         if ($style) {
             $item_name = '[[:' . $style . ':]]' . $item_name;
         }
         $options[] = JHTML::_('select.option', $item->id, $item_name, 'value', 'text', 0);
     }
     $attribs = 'class="inputbox"';
     if ($size) {
         $attribs .= ' size="' . $size . '"';
     } else {
         $attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
     }
     if ($multiple) {
         $attribs .= ' multiple="multiple"';
     }
     $html = JHTML::_('select.genericlist', $options, '' . $name . '[]', $attribs, 'value', 'text', $value, $id);
     $html = preg_replace('#>\\[\\[\\:(.*?)\\:\\]\\]#si', ' style="\\1">', $html);
     return $html;
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:70,代码来源:categoriesmr.php

示例15: getInput

 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     JHTML::_('behavior.modal', 'a.modal');
     $size = $this->def('size');
     $multiple = $this->def('multiple', 1);
     $showinput = $this->def('showinput');
     $state = $this->def('state');
     $disable = $this->def('disable');
     $db =& JFactory::getDBO();
     // load the list of menu types
     $query = 'SELECT menutype, title' . ' FROM #__menu_types' . ' ORDER BY title';
     $db->setQuery($query);
     $menuTypes = $db->loadObjectList();
     // load the list of menu items
     if ($state != '') {
         $where = 'WHERE published = ' . (int) $state;
     } else {
         $where = 'WHERE published != -2';
     }
     $query = 'SELECT id, parent, name, menutype, type, published' . ' FROM #__menu' . ' ' . $where . ' ORDER BY menutype, parent, ordering';
     $db->setQuery($query);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     $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;
         }
     }
     // second pass - get an indent list of the items
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'menu.php';
     $list = JHTMLMenu::treerecurse(0, '', array(), $children, 9999, 0, 0);
     // assemble into menutype groups
     $groupedList = array();
     foreach ($list as $k => $v) {
         $groupedList[$v->menutype][] =& $list[$k];
     }
     // assemble menu items to the array
     $options = array();
     $count = 0;
     foreach ($menuTypes as $type) {
         if (isset($groupedList[$type->menutype])) {
             if ($count > 0) {
                 $options[] = JHTML::_('select.option', '-', '&nbsp;', 'value', 'text', true);
             }
             $count++;
             $options[] = JHTML::_('select.option', $type->menutype, '[ ' . $type->title . ' ]', 'value', 'text', true);
             $n = count($groupedList[$type->menutype]);
             for ($i = 0; $i < $n; $i++) {
                 $item =& $groupedList[$type->menutype][$i];
                 //If menutype is changed but item is not saved yet, use the new type in the list
                 if (JRequest::getString('option', '', 'get') == 'com_menus') {
                     $currentItemArray = JRequest::getVar('cid', array(0), '', 'array');
                     $currentItemId = (int) $currentItemArray['0'];
                     $currentItemType = JRequest::getString('type', $item->type, 'get');
                     if ($currentItemId == $item->id && $currentItemType != $item->type) {
                         $item->type = $currentItemType;
                     }
                 }
                 $disable = strpos($disable, $item->type) !== false ? true : false;
                 $item_name = $item->treename;
                 $item_id = $item->id;
                 $style = 'padding-left:1em;';
                 if ($item->published == 0 && !($state === 0)) {
                     $item_name = '*' . $item_name . ' (' . JText::_('Unpublished') . ')';
                     $style .= 'font-style:italic;';
                 }
                 if ($showinput) {
                     $item_name .= ' [' . $item->id . ']';
                 }
                 if ($style) {
                     $item_name = '[[:' . $style . ':]]' . $item_name;
                 }
                 $options[] = JHTML::_('select.option', $item_id, $item_name, 'value', 'text', $disable);
             }
         }
     }
     $attribs = 'class="inputbox"';
     if ($showinput) {
         array_unshift($options, JHTML::_('select.option', '-', '&nbsp;', 'value', 'text', true));
         array_unshift($options, JHTML::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));
         if ($multiple) {
             $onchange = 'if ( this.value ) { if ( ' . $id . '.value ) { ' . $id . '.value+=\',\'; } ' . $id . '.value+=this.value; } this.value=\'\';';
         } else {
             $onchange = 'if ( this.value ) { ' . $id . '.value=this.value;' . $id . '_text.value=this.options[this.selectedIndex].innerHTML.replace( /^((&|&amp;|&#160;)nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
         }
         $attribs .= ' onchange="' . $onchange . '"';
         $html = '<table cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">' . "\n";
         if (!$multiple) {
             $val_name = $value;
             if ($value) {
                 foreach ($menuItems as $item) {
                     if ($item->id == $value) {
                         $val_name = $item->name . ' [' . $value . ']';
                         break;
//.........这里部分代码省略.........
开发者ID:jtresca,项目名称:nysurveyor,代码行数:101,代码来源:menuitems.php


注:本文中的JHTMLMenu类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。