本文整理汇总了PHP中NNText::prepareSelectItem方法的典型用法代码示例。如果您正苦于以下问题:PHP NNText::prepareSelectItem方法的具体用法?PHP NNText::prepareSelectItem怎么用?PHP NNText::prepareSelectItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NNText
的用法示例。
在下文中一共展示了NNText::prepareSelectItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$root = $this->def('root', 'USERS');
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
$show_all = $this->def('show_all');
$attribs = 'class="inputbox"';
$groups = $this->getUserGroups();
$options = array();
if ($show_all) {
$option = new stdClass();
$option->value = -1;
$option->text = '- ' . JText::_('JALL') . ' -';
$option->disable = '';
$options[] = $option;
}
foreach ($groups as $group) {
$option = new stdClass();
$option->value = $group->id;
$option->text = $group->title;
$repeat = $show_all ? $group->level + 1 : $group->level;
$option->text = str_repeat('- ', $repeat) . $option->text;
$option->text = NNText::prepareSelectItem($option->text);
$option->disable = '';
$options[] = $option;
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple, $attribs);
}
示例2: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$group = $this->get('group', 'countries');
$options = array();
foreach ($this->{$group} as $key => $val) {
if (!$val) {
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true);
} else {
if ($key['0'] == '-') {
$options[] = JHtml::_('select.option', '-', $val, 'value', 'text', true);
} else {
$val = NNText::prepareSelectItem($val);
$options[] = JHtml::_('select.option', $key, $val);
}
}
}
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return NNHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
示例3: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$this->db = JFactory::getDbo();
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$group = $this->def('group', 'countries');
$options = array();
foreach ($this->{$group} as $key => $val) {
if (!$val) {
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true);
} else {
if ($key['0'] == '-') {
$options[] = JHtml::_('select.option', '-', $val, 'value', 'text', true);
} else {
$val = NNText::prepareSelectItem($val);
$options[] = JHtml::_('select.option', $key, $val);
}
}
}
$attr = '';
$attr .= $this->def('size') ? ' size="' . (int) $this->def('size') . '"' : '';
$attr .= $this->def('multiple') ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
}
示例4: getCategories
function getCategories()
{
$query = $this->db->getQuery(true)->select('COUNT(*)')->from('#__zoo_category AS c')->where('c.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count) {
return -1;
}
$options = array();
if ($this->get('show_ignore')) {
if (in_array('-1', $this->value)) {
$this->value = array('-1');
}
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_IGNORE') . ' -', 'value', 'text', 0);
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
$query->clear()->select('a.id, a.name')->from('#__zoo_application AS a')->order('a.name, a.id');
$this->db->setQuery($query);
$apps = $this->db->loadObjectList();
foreach ($apps as $i => $app) {
$query->clear()->select('c.id, c.parent AS parent_id, c.name AS title, c.published')->from('#__zoo_category AS c')->where('c.application_id = ' . (int) $app->id)->where('c.published > -1')->order('c.ordering, c.name');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
if ($i) {
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
// establish the hierarchy of the menu
// TODO: use node model
$children = array();
if ($items) {
// first pass - collect children
foreach ($items as $v) {
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
// second pass - get an indent list of the items
$list = JHtml::_('menu.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->treename = ' ' . str_replace('  - ', ' ', $item->treename);
$item->treename = NNText::prepareSelectItem($item->treename, $item->published);
$option = JHtml::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
$option->level = 1;
$options[] = $option;
}
}
return $options;
}
示例5: getLevels
function getLevels()
{
$query = $this->db->getQuery(true)->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')->from('#__akeebasubs_levels AS l')->where('l.enabled > -1')->order('l.title, l.akeebasubs_level_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例6: getItems
function getItems()
{
$query = $this->db->getQuery(true)->select('i.id, i.title as name, c.title as cat, i.access as published')->from('#__content AS i')->join('LEFT', '#__categories AS c ON c.id = i.catid')->where('i.access > -1')->order('i.title, i.ordering, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = $item->name . ' [' . $item->id . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例7: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)->select('COUNT(*)')->from('#__virtuemart_products AS p')->where('p.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count) {
return -1;
}
$lang = $this->getActiveLanguage();
$query->clear()->select('p.virtuemart_product_id as id, l.product_name AS name, p.product_sku as sku, cl.category_name AS cat, p.published')->from('#__virtuemart_products AS p')->join('LEFT', '#__virtuemart_products_' . $lang . ' AS l ON l.virtuemart_product_id = p.virtuemart_product_id')->join('LEFT', '#__virtuemart_product_categories AS x ON x.virtuemart_product_id = p.virtuemart_product_id')->join('LEFT', '#__virtuemart_categories AS c ON c.virtuemart_category_id = x.virtuemart_category_id')->join('LEFT', '#__virtuemart_categories_' . $lang . ' AS cl ON cl.virtuemart_category_id = c.virtuemart_category_id')->where('p.published > -1')->order('l.product_name, p.product_sku');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = $item->name . ' [' . $item->sku . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例8: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)->select('p.product_id as id, p.product_name AS name, p.product_number as number, c.category_name AS cat, p.published')->from('#__redshop_product AS p')->join('LEFT', '#__redshop_product_category_xref AS x ON x.product_id = p.product_id')->join('LEFT', '#__redshop_category AS c ON c.category_id = x.category_id')->where('p.published > -1')->order('p.product_name, p.product_number');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = $item->name . ' [' . $item->number . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例9: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
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 = $db->getQuery(true);
$query->select('m.id, m.title, m.position, m.module, m.published')->from('#__modules AS m')->where('m.client_id = 0')->order('m.position, m.title, m.ordering, m.id');
$db->setQuery($query);
$modules = $db->loadObjectList();
// assemble menu items to the array
$options = array();
$p = 0;
foreach ($modules as $item) {
if ($p !== $item->position) {
$pos = $item->position;
if ($pos == '') {
$pos = ':: ' . JText::_('JNONE') . ' ::';
}
$options[] = JHtml::_('select.option', '-', '[ ' . $pos . ' ]', 'value', 'text', true);
}
$p = $item->position;
$item->title = ' ' . $item->title;
if ($showtype) {
$item->title .= ' [' . $item->module . ']';
}
if ($showinput || $showid) {
$item->title .= ' [' . $item->id . ']';
}
$item->title = NNText::prepareSelectItem($item->title, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->title);
}
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 ( ' . $this->id . '.value ) { ' . $this->id . '.value+=\',\'; } ' . $this->id . '.value+=this.value; } this.value=\'\';';
} else {
$onchange = 'if ( this.value ) { ' . $this->id . '.value=this.value;' . $this->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 = $this->value;
if ($this->value) {
foreach ($modules as $item) {
if ($item->id == $this->value) {
$val_name = $item->title;
if ($showtype) {
$val_name .= ' [' . $item->module . ']';
}
$val_name .= ' [' . $this->value . ']';
break;
}
}
}
$html .= '<input type="text" id="' . $this->id . '_text" value="' . $val_name . '" class="inputbox" size="' . $size . '" disabled="disabled" />';
$html .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '" />';
} else {
$html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->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 preg_replace('#>\\[\\[\\:(.*?)\\:\\]\\]#si', ' style="\\1">', $html);
} else {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple, 'style="max-width:360px"');
}
}
示例10: getItems
function getItems()
{
$query = $this->db->getQuery(true)->select('i.id, i.name, a.name as app, i.state as published')->from('#__zoo_item AS i')->join('LEFT', '#__zoo_application AS a ON a.id = i.application_id')->where('i.state > -1')->order('i.name, i.priority, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = $item->name . ' [' . $item->id . '] [' . $item->app . ']';
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例11: getOptionsTreeByList
function getOptionsTreeByList($items = array(), $root = 0)
{
// establish the hierarchy of the menu
// TODO: use node model
$children = array();
if (!empty($items)) {
// first pass - collect children
foreach ($items as $v) {
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
// second pass - get an indent list of the items
$list = JHtml::_('menu.treerecurse', $root, '', array(), $children, 9999, 0, 0);
// assemble items to the array
$options = array();
if ($this->get('show_ignore')) {
if (in_array('-1', $this->value)) {
$this->value = array('-1');
}
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_IGNORE') . ' -', 'value', 'text', 0);
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
foreach ($list as $item) {
$item->treename = NNText::prepareSelectItem($item->treename, $item->published, '', 1);
$options[] = JHtml::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
}
return $options;
}
示例12: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)->select('p.product_id as id, pd.name, p.model as number, cd.name AS cat, p.status AS published')->from('#__mijoshop_product AS p')->join('INNER', '#__mijoshop_product_description AS pd ON p.product_id = pd.product_id')->join('INNER', '#__mijoshop_product_to_store AS pts ON p.product_id = pts.product_id')->join('LEFT', '#__mijoshop_product_to_category AS ptc ON p.product_id = ptc.product_id')->join('LEFT', '#__mijoshop_category_description AS cd ON ptc.category_id = cd.category_id')->join('LEFT', '#__mijoshop_category_to_store AS cts ON ptc.category_id = cts.category_id')->where('p.status = 1')->where('p.date_available <= NOW()')->where('pd.language_id = ' . $this->language_id)->where('cts.store_id = ' . $this->store_id)->where('cd.language_id = ' . $this->language_id)->where('cts.store_id = ' . $this->store_id)->order('pd.name, p.model');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item) {
$item->name = $item->name . ' [' . $item->id . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例13: getItems
function getItems()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__k2_items AS i')
->where('i.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear()
->select('i.id, i.title as name, c.name as cat, i.published')
->from('#__k2_items AS i')
->join('LEFT', '#__k2_categories AS c ON c.id = i.catid')
->where('i.published > -1')
->order('i.title, i.ordering, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = $item->name . ' [' . $item->id . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
示例14: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('behavior.modal', 'a.modal');
$size = (int) $this->def('size');
$multiple = $this->def('multiple', 1);
$showinput = $this->def('showinput');
$disable_types = $this->def('disable');
$db = JFactory::getDBO();
// load the list of menu types
$query = $db->getQuery(true);
$query->select('m.menutype, m.title')->from('#__menu_types AS m')->order('m.title');
$db->setQuery($query);
$menuTypes = $db->loadObjectList();
// load the list of menu items
$query = $db->getQuery(true);
$query->select('m.id, m.parent_id, m.title, m.alias, m.menutype, m.type, m.published, m.home')->select('m.title AS name')->from('#__menu AS m')->where('m.published != -2')->order('m.menutype, m.parent_id, m.lft, m.id');
$db->setQuery($query);
$items = $db->loadObjectList();
// establish the hierarchy of the menu
$children = array();
if ($items) {
// first pass - collect children
foreach ($items as $v) {
if ($v->type != 'separator') {
if (preg_replace('#[^a-z0-9]#', '', strtolower($v->title)) !== preg_replace('#[^a-z0-9]#', '', $v->alias)) {
$v->title .= ' [' . $v->alias . ']';
}
}
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
// second pass - get an indent list of the items
$list = JHtml::_('menu.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 (JFactory::getApplication()->input->getString('option', '') == 'com_menus') {
$cid = JFactory::getApplication()->input->get('cid', array(0), 'array');
JArrayHelper::toInteger($cid);
$currentItemId = $cid['0'];
$currentItemType = JFactory::getApplication()->input->getString('type', $item->type);
if ($currentItemId == $item->id && $currentItemType != $item->type) {
$item->type = $currentItemType;
}
}
if ($showinput) {
$item->treename .= ' [' . $item->id . ']';
}
if ($item->home) {
$item->treename .= ' [' . JText::_('JDEFAULT') . ']';
}
$item->treename = NNText::prepareSelectItem($item->treename, $item->published, $item->type, 2);
if ($type == 'separator' && !$item->children) {
$disable = 1;
} else {
$disable = $disable_types && !(strpos($disable_types, $item->type) === false);
}
$options[] = JHtml::_('select.option', $item->id, $item->treename, '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 ( ' . $this->id . '.value ) { ' . $this->id . '.value+=\',\'; } ' . $this->id . '.value+=this.value; } this.value=\'\';';
} else {
$onchange = 'if ( this.value ) { ' . $this->id . '.value=this.value;' . $this->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 = $this->value;
if ($this->value) {
foreach ($items as $item) {
if ($item->id == $this->value) {
$val_name = $item->name . ' [' . $this->value . ']';
break;
}
}
//.........这里部分代码省略.........
示例15: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__hikashop_product AS p')
->where('p.product_published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear()
->select('p.product_id as id, p.product_name AS name, c.category_name AS cat, p.product_published AS published')
->from('#__hikashop_product AS p')
->join('LEFT', '#__hikashop_product_category AS x ON x.product_id = p.product_id')
->join('LEFT', '#__hikashop_category AS c ON c.category_id = x.category_id')
->where('p.product_published > -1')
->order('p.product_name, p.product_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = $item->name . ' [' . $item->id . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = NNText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}