Esempio n. 1
2
 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
     $attr = '';
     $attr .= ' size="' . (int) $size . '"';
     $attr .= $multiple ? ' multiple="multiple"' : '';
     return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
 }
Esempio n. 2
0
 protected function getInput()
 {
     if (!nnFrameworkFunctions::extensionInstalled('akeebasubs')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'akeebasubs_' . $group, $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
     }
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     switch ($group) {
         case 'categories':
             return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
         default:
             return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
 }
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $group = $this->def('group', 'categories');
     $this->db = JFactory::getDBO();
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $query = $this->db->getQuery(true);
     $query->select('config')->from('#__virtuemart_configs')->where('virtuemart_config_id = 1');
     $this->db->setQuery($query);
     $config = $this->db->loadResult();
     $lang = substr($config, strpos($config, 'vmlang='));
     $lang = substr($lang, 0, strpos($lang, '|'));
     if (preg_match('#"([^"]*_[^"]*)"#', $lang, $lang)) {
         $this->lang = $lang['1'];
     } else {
         $this->lang = 'en_gb';
     }
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('hikashop')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'hikashop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</fieldset>';
     }
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     switch ($group) {
         case 'categories':
             return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
         default:
             return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
 }
Esempio n. 6
0
 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', '-', '&nbsp;', '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->def('size');
     $multiple = $this->def('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 7
0
	protected function getInput()
	{
		$this->params = $this->element->attributes();
		$this->db = JFactory::getDBO();

		$frontend = $this->get('frontend', 1);
		$admin = $this->get('admin', 1);
		$size = (int) $this->get('size');

		if (!$frontend && !$admin)
		{
			return '';
		}

		$components = $this->getComponents($frontend, $admin);

		$options = array();

		foreach ($components as $component)
		{
			$options[] = JHtml::_('select.option', $component->element, $component->name);
		}

		require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';

		return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, 1);
	}
Esempio n. 8
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     $attribs = 'class="inputbox"';
     $options = array();
     $templates = $this->getTemplates();
     foreach ($templates as $styles) {
         $level = 0;
         foreach ($styles as $style) {
             $style->level = $level;
             $options[] = $style;
             if (count($styles) <= 2) {
                 $level = 0;
                 break;
             }
             $level = 1;
         }
     }
     // fix old '::' separator and change it to '--'
     $value = json_encode($this->value);
     $value = str_replace('::', '--', $value);
     $value = (array) json_decode($value, true);
     return nnHtml::selectlist($options, $this->name, $value, $this->id, $size, $multiple, $attribs);
 }
Esempio n. 9
0
 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('mijoshop')) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $group = $this->def('group', 'categories');
     $this->db = JFactory::getDBO();
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'mijoshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     require_once JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php';
     $this->store_id = (int) MijoShop::get('opencart')->get('config')->get('config_store_id');
     $this->language_id = (int) MijoShop::get('opencart')->get('config')->get('config_language_id');
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     } else {
         $attr = '';
         $attr .= ' size="' . (int) $size . '"';
         $attr .= $multiple ? ' multiple="multiple"' : '';
         return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
     }
 }
Esempio n. 10
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     if (!NNFrameworkFunctions::extensionInstalled('flexicontent')) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
     }
     $group = $this->def('group', 'categories');
     $this->db = JFactory::getDBO();
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables)) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
     }
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     } else {
         $attr = '';
         $attr .= ' size="' . (int) $size . '"';
         $attr .= $multiple ? ' multiple="multiple"' : '';
         return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
     }
 }
Esempio n. 11
0
	protected function getInput()
	{
		if (!nnFrameworkFunctions::extensionInstalled('flexicontent'))
		{
			return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>';
		}

		$this->params = $this->element->attributes();
		$this->db = JFactory::getDBO();

		$group = $this->get('group', 'categories');

		$tables = $this->db->getTableList();
		if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables))
		{
			return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>';
		}

		if (!is_array($this->value))
		{
			$this->value = explode(',', $this->value);
		}

		$options = $this->{'get' . $group}();

		$size = (int) $this->get('size');
		$multiple = $this->get('multiple');

		require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';

		return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
	}
Esempio n. 12
0
	protected function getInput()
	{
		$this->params = $this->element->attributes();

		$size = (int) $this->get('size');
		$multiple = $this->get('multiple');
		$client = $this->get('client', 'SITE');

		jimport('joomla.language.helper');
		$langs = JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true);
		$options = array();
		foreach ($langs as $lang)
		{
			if ($lang['value'])
			{
				$option = new stdClass;
				$option->value = $lang['value'];
				$option->text = $lang['text'] . ' [' . $lang['value'] . ']';
				$options[] = $option;
			}
		}

		require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';

		return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
	}
Esempio n. 13
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->def('size');
     $attribs = 'class="inputbox"';
     $options = $this->getTags();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, 1, $attribs);
 }
Esempio n. 14
0
 protected function getInput()
 {
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $options = MenusHelper::getMenuLinks();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 15
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple', 0);
     JFactory::getLanguage()->load('com_menus', JPATH_ADMINISTRATOR);
     $options = $this->getMenuItems();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     $subtemplates = $this->def('subtemplates', 1);
     $show_system = $this->def('show_system', 1);
     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, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 17
0
 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', 'categories');
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 18
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     foreach ($this->element->children() as $item) {
         $item_value = (string) $item['value'];
         $item_name = JText::_(trim((string) $item));
         $item_disabled = (int) $item['disabled'];
         $options[] = JHtml::_('select.option', $item_value, $item_name, 'value', 'text', $item_disabled);
     }
     $size = (int) $this->get('size');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, 1);
 }
Esempio n. 19
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     $show_all = $this->get('show_all');
     $options = $this->getUserGroups();
     if ($show_all) {
         $option = new stdClass();
         $option->value = -1;
         $option->text = '- ' . JText::_('JALL') . ' -';
         $option->disable = '';
         array_unshift($options, $option);
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 20
0
 protected function getInput()
 {
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
     $options = MenusHelper::getMenuLinks();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     foreach ($options as $i => $option) {
         $options[$i]->value = 'type.' . $option->menutype;
         $options[$i]->text = $option->title;
         $options[$i]->level = 0;
         $options[$i]->class = 'hidechildren';
         $options[$i]->labelclass = 'nav-header';
         unset($option->title);
     }
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 21
0
 public function getSelectList($group = '')
 {
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     $group = $group ?: $this->getGroup();
     $options = $this->getOptions();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     switch ($group) {
         case 'categories':
             return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
         default:
             return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
 }
Esempio n. 22
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     // 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', '-', '&nbsp;', 'value', 'text', 1);
     }
     $options += $this->getTags();
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, 1);
 }
Esempio n. 23
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     if (!NNFrameworkFunctions::extensionInstalled('redshop')) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_REDSHOP')) . '</fieldset>';
     }
     $group = $this->def('group', 'categories');
     $this->db = JFactory::getDBO();
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'redshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
         return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_REDSHOP')) . '</fieldset>';
     }
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
Esempio n. 24
0
 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', 'categories');
     $options = $this->{'get' . $group}();
     $size = (int) $this->def('size');
     $multiple = $this->def('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     } else {
         $attr = '';
         $attr .= ' size="' . (int) $size . '"';
         $attr .= $multiple ? ' multiple="multiple"' : '';
         return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
     }
 }
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     $attribs = 'class="inputbox"';
     $options = array();
     $templates = $this->getTemplates();
     foreach ($templates as $styles) {
         $level = 0;
         foreach ($styles as $style) {
             $style->level = $level;
             $options[] = $style;
             if (count($styles) <= 2) {
                 $level = 0;
                 break;
             }
             $level = 1;
         }
     }
     return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple, $attribs);
 }
Esempio n. 26
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDbo();
     $parameters = nnParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $group = $this->get('group', 'categories');
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
     switch ($group) {
         case 'categories':
             return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
         default:
             return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
 }
Esempio n. 27
0
	protected function getInput()
	{
		if (!NNFrameworkFunctions::extensionInstalled('zoo'))
		{
			return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_ZOO')) . '</label></fieldset>';
		}

		$this->params = $this->element->attributes();
		$this->db = JFactory::getDBO();

		$group = $this->get('group', 'categories');

		$tables = $this->db->getTableList();
		if (!in_array($this->db->getPrefix() . 'zoo_' . ($group == 'applications' ? 'application' : 'category'), $tables))
		{
			return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_ZOO')) . '</label></fieldset>';
		}

		$parameters = NNParameters::getInstance();
		$params = $parameters->getPluginParams('nnframework');
		$this->max_list_count = $params->max_list_count;

		if (!is_array($this->value))
		{
			$this->value = explode(',', $this->value);
		}

		$options = $this->{'get' . $group}();

		$size = (int) $this->get('size');
		$multiple = $this->get('multiple');

		require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';

		return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
	}
Esempio n. 28
0
 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', '-', '&nbsp;', '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', '-', '&nbsp;', '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( /^((&|&amp;|&#160;)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;
                     }
                 }
             }
             $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 $html;
     } else {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
 }
Esempio n. 29
0
 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 = '&nbsp;&nbsp;' . $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', '-', '&nbsp;', '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( /^((&|&amp;|&#160;)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"');
     }
 }
Esempio n. 30
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $groups = $this->get('groups');
     $groups = $groups ? explode(',', $groups) : array();
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $agents = array();
     /* OS */
     if (empty($groups)) {
         $agents[] = JText::_('NN_OS');
     }
     if (empty($groups) || in_array('os', $groups)) {
         $agents[] = array('Windows', 'Windows');
         $agents[] = array('- Windows 8', 'Windows nt 6.2');
         $agents[] = array('- Windows 7', 'Windows nt 6.1');
         $agents[] = array('- Windows Vista', 'Windows nt 6.0');
         $agents[] = array('- Windows Server 2003', 'Windows nt 5.2');
         $agents[] = array('- Windows XP', 'Windows nt 5.1');
         $agents[] = array('- Windows 2000 sp1', 'Windows nt 5.01');
         $agents[] = array('- Windows 2000', 'Windows nt 5.0');
         $agents[] = array('- Windows NT 4.0', 'Windows nt 4.0');
         $agents[] = array('- Windows Me', 'Win 9x 4.9');
         $agents[] = array('- Windows 98', 'Windows 98');
         $agents[] = array('- Windows 95', 'Windows 95');
         $agents[] = array('- Windows CE', 'Windows ce');
         $agents[] = '';
         $agents[] = array('Mac OS', '#(Mac OS|Mac_PowerPC|Macintosh)#');
         $agents[] = array('- Mac OSX', 'Mac OS X');
         $agents[] = array('- - Mac OSX Mountain Lion', 'Mac OS X 10.8');
         $agents[] = array('- - Mac OSX Lion', 'Mac OS X 10.7');
         $agents[] = array('- - Mac OSX Snow Leopard', 'Mac OS X 10.6');
         $agents[] = array('- - Mac OSX Leopard', 'Mac OS X 10.5');
         $agents[] = array('- - Mac OSX Tiger', 'Mac OS X 10.4');
         $agents[] = array('- - Mac OSX Panther', 'Mac OS X 10.3');
         $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', '-', '&nbsp;', '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);
 }