本文整理汇总了PHP中nnHTML::selectlist方法的典型用法代码示例。如果您正苦于以下问题:PHP nnHTML::selectlist方法的具体用法?PHP nnHTML::selectlist怎么用?PHP nnHTML::selectlist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnHTML
的用法示例。
在下文中一共展示了nnHTML::selectlist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$frontend = $this->def('frontend', 1);
$admin = $this->def('admin', 1);
$show_content = $this->def('show_content', 0);
$size = (int) $this->def('size');
$components = $this->getComponents($frontend, $admin, $show_content, $j15);
$options = array();
$comps = array();
$lang = JFactory::getLanguage();
foreach ($components as $component) {
if (!$j15) {
if (!empty($component->option)) {
// Load the core file then
// Load extension-local file.
$lang->load($component->option . '.sys', JPATH_BASE, null, false, false) || $lang->load($component->option . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->option, null, false, false) || $lang->load($component->option . '.sys', JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($component->option . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->option, $lang->getDefault(), false, false);
}
$component->name = JText::_(strtoupper($component->name));
}
$comps[preg_replace('#[^a-z0-9_]#i', '', $component->name . '_' . $component->option)] = $component;
}
ksort($comps);
foreach ($comps as $component) {
$options[] = JHtml::_('select.option', $component->option, $component->name, 'value', 'text');
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, 1, '', $j15);
}
示例2: 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');
if (!is_array($value)) {
$value = explode(',', $value);
}
$sql = 'SELECT id, name FROM #__flexicontent_types WHERE published = 1';
$db->setQuery($sql);
$list = $db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item_name = preg_replace('#^(( )*)- #', '\\1', str_replace(' ', ' ', $item->name));
$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);
}
示例3: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
$show_ignore = $this->def('show_ignore');
$auto_select_cats = $this->def('auto_select_cats', 1);
$db = JFactory::getDBO();
if (!is_array($value)) {
$value = explode(',', $value);
}
// 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);
}
$items = JHtml::_('category.options', 'com_content');
foreach ($items as $item) {
$item->text = str_replace('- ', ' ', str_replace(' ', ' ', $item->text));
$options[] = $item;
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, '', $j15);
}
示例4: 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);
}
示例5: 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);
}
示例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 . 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) {
$item_name = preg_replace('#^(( )*)- #', '\\1', str_replace(' ', ' ', $item->treename));
$options[] = JHTML::_('select.option', $item->id, $item_name, '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);
}
示例7: 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);
}
示例8: 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('#^(( )*)- #', '\\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);
}
示例9: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
$client = $this->def('client', 'SITE');
jimport('joomla.language.helper');
$options = JLanguageHelper::createLanguageList($value, constant('JPATH_' . strtoupper($client)), true);
foreach ($options as $i => $option) {
if ($option['value']) {
$options[$i]['text'] = $option['text'] . ' [' . $option['value'] . ']';
}
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, '', $j15);
}
示例10: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$frontend = $this->def('frontend', 1);
$admin = $this->def('admin', 1);
$show_content = $this->def('show_content', 0);
$size = (int) $this->def('size');
if (!$frontend && !$admin) {
return '';
}
$components = $this->getComponents($frontend, $admin, $show_content, $j15);
$options = array();
foreach ($components as $component) {
$options[] = JHtml::_('select.option', $component->element, $component->name, 'value', 'text');
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, 1, '', $j15);
}
示例11: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
$subtemplates = $this->def('subtemplates', 1);
$show_system = $this->def('show_system', 1);
if ($j15) {
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/template.php';
$rows = TemplatesHelper::parseXMLTemplateFiles(JPATH_ROOT . '/templates');
$options = $this->createList15($rows, JPATH_ROOT . '/templates', $subtemplates, $show_system);
} else {
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
$rows = TemplatesHelper::getTemplateOptions('0');
$options = $this->createList($rows, JPATH_ROOT . '/templates', $subtemplates, $show_system);
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
}
示例12: 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();
// assemble items to the array
$options = array();
if ($show_uncategorized) {
$options[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'value', 'text', 0);
}
$options = JHtml::_('category.options', 'com_content');
foreach ($options as $i => $item) {
$item->text = str_replace('- ', ' ', str_replace(' ', ' ', $item->text));
$options[$i] = $item;
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 0, $j15);
}
示例13: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
$size = (int) $this->def('size');
if (!is_array($value)) {
$value = explode(',', $value);
}
$browsers = array('Chrome' => 'Chrome', '- Chrome 1' => 'Chrome/1.', '- Chrome 2' => 'Chrome/2.', '- Chrome 3' => 'Chrome/3.', '- Chrome 4' => 'Chrome/4.', '- Chrome 5' => 'Chrome/5.', '- Chrome 6' => 'Chrome/6.', '- Chrome 8' => 'Chrome/8.', '- Chrome 9' => 'Chrome/9.', '- Chrome 10' => 'Chrome/10.', '- Chrome 11' => 'Chrome/11.', '- Chrome 12' => 'Chrome/12.', '- Chrome 13' => 'Chrome/13.', '@1' => '', 'Firefox' => 'Firefox', '- Firefox 2.0' => 'Firefox/2.0', '- Firefox 3.0' => 'Firefox/3.0', '- Firefox 3.5' => 'Firefox/3.5', '- Firefox 3.6' => 'Firefox/3.6', '- Firefox 4.0' => 'Firefox/4.0', '- Firefox 5.0' => 'Firefox/5.0', '@2' => '', 'Internet Explorer' => 'MSIE', '- Internet Explorer 6' => 'MSIE 6', '- Internet Explorer 7' => 'MSIE 7', '- Internet Explorer 8' => 'MSIE 8', '- Internet Explorer 9' => 'MSIE 9', '@4' => '', 'Opera' => 'Opera', '- Opera 8.0' => 'Opera/8.0', '- Opera 9.0' => 'Opera/9.0', '- Opera 9.5' => 'Opera/9.5', '- Opera 10.0' => 'Opera/10.0', '- Opera 10.5' => 'Opera/10.5', '- Opera 11.0' => 'Opera/11.0', '- Opera 11.5' => 'Opera/11.5', '@5' => '', 'Safari' => 'Safari', '- Safari 2' => 'Safari/41', '- Safari 3' => 'Safari/52', '- Safari 4' => 'Safari/531', '- Safari 5' => 'Safari/533', '@6' => '', 'Others' => '', 'Amaya' => 'amaya', '- Amaya 9.0' => 'amaya/9.0', '- Amaya 10.0' => 'amaya/10.0', '- Amaya 11.0' => 'amaya/11.0', 'AOL Explorer' => 'AOL Explorer', 'Avant' => 'Avant', 'Camino' => 'Camino', '- Camino 1' => 'Camino/1', '- Camino 2' => 'Camino/2', 'Epiphany' => 'Epiphany', 'Flock' => 'Flock', '- Flock 1' => 'Flock/1', '- Flock 2' => 'Flock/2', 'Konqueror' => 'Konqueror', 'Netscape' => 'Netscape', '- Netscape 8' => 'Netscape/8', '- Netscape 9' => 'Netscape/9', 'SeaMonkey' => 'SeaMonkey', '- SeaMonkey 1' => 'SeaMonkey/1', '- SeaMonkey 2' => 'SeaMonkey/2', 'Shiira' => 'Shiira', '@7' => '', 'Web crawlers' => '', '- Alexa' => 'ia_archiver-web.archive.org', '- Bing' => 'bingbot', '- Google' => 'GoogleBot', '- Yahoo' => 'Yahoo! Slurp');
$options = array();
foreach ($browsers as $key => $val) {
if (substr($key, 0, 1) == '@') {
$options[] = JHTML::_('select.option', '-', ' ', 'value', 'text', true);
} else {
if (!$val) {
$options[] = JHTML::_('select.option', '-', $key, 'value', 'text', true);
} else {
$item_name = str_replace('- ', ' ', $key);
$options[] = JHTML::_('select.option', $val, $item_name, 'value', 'text');
}
}
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, 1, 0, $j15);
}
示例14: 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');
$showtype = $this->def('showtype');
$showid = $this->def('showid');
$showinput = $this->def('showinput');
$db =& JFactory::getDBO();
// load the list of modules
$query = 'SELECT id, title, position, module, published' . ' FROM #__modules' . ' WHERE client_id = 0' . ' ORDER BY position, ordering, id';
$db->setQuery($query);
$modules = $db->loadObjectList();
// assemble menu items to the array
$options = array();
$p = '';
foreach ($modules as $item) {
if ($p != $item->position) {
$options[] = JHTML::_('select.option', '-', '[ ' . $item->position . ' ]', 'value', 'text', true);
}
$p = $item->position;
$item_id = $item->id;
$item_name = ' ' . $item->title;
if ($showtype) {
$item_name .= ' [' . $item->module . ']';
}
if ($showinput || $showid) {
$item_name .= ' [' . $item->id . ']';
}
if ($item->published == 0) {
$item_name = '[[:font-style:italic;:]]*' . $item_name . ' (' . JText::_($j15 ? 'Unpublished' : 'JUNPUBLISHED') . ')';
}
$options[] = JHTML::_('select.option', $item_id, $item_name, 'value', 'text');
}
if ($showinput) {
array_unshift($options, JHTML::_('select.option', '-', ' ', '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( /^((&|&| )nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
}
$attribs = 'class="inputbox" onchange="' . $onchange . '"';
$html = '<table cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">' . "\n";
if (!$multiple) {
$val_name = $value;
if ($value) {
foreach ($modules as $item) {
if ($item->id == $value) {
$val_name = $item->title;
if ($showtype) {
$val_name .= ' [' . $item->module . ']';
}
$val_name .= ' [' . $value . ']';
break;
}
}
}
$html .= '<input type="text" id="' . $id . '_text" value="' . $val_name . '" class="inputbox" size="' . $size . '" disabled="disabled" />';
$html .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $value . '" />';
} else {
$html .= '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" class="inputbox" size="' . $size . '" />';
}
$html .= '</td><td style="padding: 0px;"padding-left: 5px;>' . "\n";
$html .= JHTML::_('select.genericlist', $options, '', $attribs, 'value', 'text', '', '');
$html .= '</td></tr></table>' . "\n";
return $html;
} else {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHTML::selectlist($options, $name, $value, $id, $size, $multiple, 'style="max-width:360px"', $j15);
}
}
示例15: getInput
//.........这里部分代码省略.........
}
}
// 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', '-', ' ', '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_types, $item->type ) !== false ? true : false;
$item_id = $item->id;
$item_name = ' '.preg_replace( '#^(( )*)- #', '\1', str_replace( ' ', ' ', $item->treename ) );
if ( $item->home ) {
$item_name .= ' ['.JText::_( $j15 ? 'Default' : 'JDEFAULT' ).']';
}
if ( $item->type == 'separator' ) {
$item_name = '[[:font-weight:normal;font-style:italic;color:grey;:]]'.$item_name;
if ( !$item->children ) {
$disable = 1;
}
} else if ( $item->published == 0 && !( $state === 0 ) ) {
$item_name = '[[:font-style:italic;color:grey;:]]*'.$item_name.' ('.JText::_( $j15 ? 'Unpublished' : 'JUNPUBLISHED' ).')';
}
if ( $showinput ) {
$item_name .= ' ['.$item->id.']';
}
$options[] = JHtml::_( 'select.option', $item_id, $item_name, 'value', 'text', $disable );
}
}
}
if ( $showinput ) {
array_unshift( $options, JHtml::_( 'select.option', '-', ' ', '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( /^((&|&| )nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
}
$attribs = 'class="inputbox" 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;
}
}
}
$html .= '<input type="text" id="'.$id.'_text" value="'.$val_name.'" class="inputbox" size="'.$size.'" disabled="disabled" />';
$html .= '<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.$value.'" />';
} else {
$html .= '<input type="text" name="'.$name.'" id="'.$id.'" value="'.$value.'" class="inputbox" size="'.$size.'" />';
}
$html .= '</td><td style="padding: 0px;"padding-left: 5px;>'."\n";
$html .= JHtml::_( 'select.genericlist', $options, '', $attribs, 'value', 'text', '', '' );
$html .= '</td></tr></table>'."\n";
return $html;
} else {
require_once JPATH_PLUGINS.'/system/nnframework/helpers/html.php';
return nnHTML::selectlist( $options, $name, $value, $id, $size, $multiple, '', $j15 );
}
}