本文整理汇总了PHP中nnText::prepareSelectItem方法的典型用法代码示例。如果您正苦于以下问题:PHP nnText::prepareSelectItem方法的具体用法?PHP nnText::prepareSelectItem怎么用?PHP nnText::prepareSelectItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnText
的用法示例。
在下文中一共展示了nnText::prepareSelectItem方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$show_all = $this->get('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->value;
$option->text = $group->text;
$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);
}
示例3: 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;
}
示例4: 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;
}
示例5: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)->select('COUNT(*)')->from('#__redshop_product AS p')->where('p.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, 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('behavior.modal', 'a.modal');
$size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
$multiple = $this->get('multiple');
$showtype = $this->get('showtype');
$showid = $this->get('showid');
$showinput = $this->get('showinput');
// load the list of modules
$query = $this->db->getQuery(true)->select('m.id, m.title, m.position, m.module, m.published, m.language')->from('#__modules AS m')->where('m.client_id = 0')->where('m.published > -2')->order('m.position, m.title, m.ordering, m.id');
$this->db->setQuery($query);
$modules = $this->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 . ']';
}
if ($item->language && $item->language != '*') {
$item->title .= ' (' . $item->language . ')';
}
$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 . ' 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 . ' />';
}
$html .= '</td><td style="padding: 0px;"padding-left: 5px;>' . "\n";
$html .= JHtml::_('select.genericlist', $options, '', $attribs, 'value', 'text', '', '');
$html .= '</td></tr></table>' . "\n";
} else {
$attr = $size;
$attr .= $multiple ? ' multiple="multiple"' : '';
$attr .= ' class="input-xxlarge"';
$html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
$html = '<div class="input-maximize">' . $html . '</div>';
}
return preg_replace('#>\\[\\[\\:(.*?)\\:\\]\\]#si', ' style="\\1">', $html);
}
示例9: getItems
function getItems()
{
$query = $this->db->getQuery(true)->select('COUNT(*)')->from('#__zoo_item AS i')->where('i.state > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count) {
return -1;
}
$query->clear()->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;
}
示例10: getInput
//.........这里部分代码省略.........
$agents[] = array('- - Mac OSX Jaguar', 'Mac OS X 10.2');
$agents[] = array('- - Mac OSX Puma', 'Mac OS X 10.1');
$agents[] = array('- - Mac OSX Cheetah', 'Mac OS X 10.0');
$agents[] = array('- Mac OS (classic)', '#(Mac_PowerPC|Macintosh)#');
$agents[] = '';
$agents[] = array('Linux', '#(Linux|X11)#');
$agents[] = '';
$agents[] = JText::_('NN_OTHERS');
$agents[] = array('Open BSD', 'OpenBSD');
$agents[] = array('Sun OS', 'SunOS');
$agents[] = array('QNX', 'QNX');
$agents[] = array('BeOS', 'BeOS');
$agents[] = array('OS/2', 'OS/2');
}
/* Browsers */
if (empty($groups)) {
$agents[] = '';
$agents[] = '';
$agents[] = JText::_('NN_BROWSERS');
}
if (empty($groups) || in_array('browsers', $groups)) {
$agents[] = array('Chrome', 'Chrome');
$agents[] = array('- Chrome 30', 'Chrome/30.');
$agents[] = array('- Chrome 41-50', '#Chrome/(4[1-9]|50)\\.#');
$agents[] = array('- Chrome 31-40', '#Chrome/(3[1-9]|40)\\.#');
$agents[] = array('- Chrome 21-30', '#Chrome/(2[1-9]|30)\\.#');
$agents[] = array('- Chrome 11-20', '#Chrome/(1[1-9]|20)\\.#');
$agents[] = array('- Chrome 1-10', '#Chrome/([1-9]|10)\\.#');
$agents[] = '';
$agents[] = array('Firefox', 'Firefox');
$agents[] = array('- Firefox 31-40', '#Firefox/(3[1-9]|40)\\.#');
$agents[] = array('- Firefox 21-30', '#Firefox/(2[1-9]|30)\\.#');
$agents[] = array('- Firefox 11-20', '#Firefox/(1[1-9]|20)\\.#');
$agents[] = array('- Firefox 1-10', '#Firefox/([1-9]|10)\\.#');
$agents[] = '';
$agents[] = array('Internet Explorer', 'MSIE');
$agents[] = array('- Internet Explorer 11', 'MSIE 11');
// missing MSIE is added to agent string in assingnments/agents.php
$agents[] = array('- Internet Explorer 10.6', 'MSIE 10.6');
$agents[] = array('- Internet Explorer 10.0', 'MSIE 10.0');
$agents[] = array('- Internet Explorer 10', 'MSIE 10');
$agents[] = array('- Internet Explorer 9', 'MSIE 9.');
$agents[] = array('- Internet Explorer 8', 'MSIE 8.');
$agents[] = array('- Internet Explorer 7', 'MSIE 7.');
$agents[] = array('- Internet Explorer 1-6', '#MSIE [1-6]\\.#');
$agents[] = '';
$agents[] = array('Opera', 'Opera');
$agents[] = array('- Opera 26', 'Opera/26.');
$agents[] = array('- Opera 25', 'Opera/25.');
$agents[] = array('- Opera 24', 'Opera/24.');
$agents[] = array('- Opera 23', 'Opera/23.');
$agents[] = array('- Opera 22', 'Opera/22.');
$agents[] = array('- Opera 21', 'Opera/21.');
$agents[] = array('- Opera 11-20', '#Opera/(1[1-9]|20)\\.#');
$agents[] = array('- Opera 1-10', '#Opera/([1-9]|10)\\.#');
$agents[] = '';
$agents[] = array('Safari', 'Safari');
//$agents[] = array('- Safari 8', '#Version/8\..*Safari/#');
//$agents[] = array('- Safari 7', '#Version/7\..*Safari/#');
$agents[] = array('- Safari 6', '#Version/6\\..*Safari/#');
$agents[] = array('- Safari 5', '#Version/5\\..*Safari/#');
$agents[] = array('- Safari 4', '#Version/4\\..*Safari/#');
$agents[] = array('- Safari 1-3', '#Version/[1-3]\\..*Safari/#');
}
/* Mobile browsers */
if (empty($groups)) {
$agents[] = '';
$agents[] = '';
$agents[] = JText::_('NN_MOBILE_BROWSERS');
}
if (empty($groups) || in_array('mobile', $groups)) {
$agents[] = array(JText::_('JALL'), 'mobile');
$agents[] = array('- Android', 'Android');
$agents[] = array('- Blackberry', 'Blackberry');
$agents[] = array('- IE Mobile', 'IEMobile');
$agents[] = array('- iPad', 'iPad');
$agents[] = array('- iPhone', 'iPhone');
$agents[] = array('- iPod Touch', 'iPod');
$agents[] = array('- NetFront', 'NetFront');
$agents[] = array('- Nokia', 'NokiaBrowser');
$agents[] = array('- Opera Mini', 'Opera Mini');
$agents[] = array('- Opera Mobile', 'Opera Mobi');
$agents[] = array('- UC Browser', 'UC Browser');
}
$options = array();
foreach ($agents as $agent) {
if (!$agent) {
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true);
} else {
if (!is_array($agent)) {
$options[] = JHtml::_('select.option', '-', $agent, 'value', 'text', true);
} else {
$agent_name = nnText::prepareSelectItem($agent['0']);
$options[] = JHtml::_('select.option', $agent['1'], $agent_name);
}
}
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, 1);
}
示例11: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('behavior.modal', 'a.modal');
$size = (int) $this->get('size');
$multiple = $this->get('multiple', 1);
$showinput = $this->get('showinput');
$parents = (int) $this->get('parents', 1);
$disable_types = $this->get('disable');
$db = JFactory::getDBO();
// load the list of menu types
$query = $db->getQuery(true)->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->clear()->select('m.id, m.parent_id, m.title, m.alias, m.menutype, m.type, m.published, m.home, m.language')->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 . ']';
}
if ($v->language && $v->language != '*') {
$v->title .= ' (' . $v->language . ')';
}
}
$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.' . $type->menutype, '[ ' . $type->title . ' ]', 'value', 'text', !$parents);
$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, $parents ? 1 : 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;
//.........这里部分代码省略.........
示例12: getProducts
function getProducts()
{
$query = $this->db->getQuery(true)->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;
}
示例13: 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;
}
示例14: 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;
}