Ejemplo n.º 1
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  *
  * @since   11.4
  */
 protected function getOptions()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select('c.id, c.country, c.country_jtext');
     $query->from('`#__tj_country` AS c');
     $query->where('c.com_quick2cart = 1');
     $query->order($db->escape('c.ordering ASC'));
     $db->setQuery($query);
     // Get all countries.
     $countries = $db->loadObjectList();
     $options = array();
     // Load lang file for countries
     $lang = JFactory::getLanguage();
     $lang->load('tjgeo.countries', JPATH_SITE, null, false, true);
     foreach ($countries as $c) {
         if ($lang->hasKey(strtoupper($c->country_jtext))) {
             $c->country = JText::_($c->country_jtext);
         }
         $options[] = JHtml::_('select.option', $c->id, $c->country);
     }
     if (!$this->loadExternally) {
         // Merge any additional options in the XML definition.
         $options = array_merge(parent::getOptions(), $options);
     }
     return $options;
 }
Ejemplo n.º 2
0
 /**
  * Method to get the list of siblings in a menu.
  * The method requires that parent be set.
  *
  * @return	array	The field option objects or false if the parent field has not been set
  * @since	1.7
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Get the parent
     $parent_id = $this->form->getValue('parent_id', 0);
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__menu AS a');
     $query->where('a.published >= 0');
     $query->where('a.parent_id =' . (int) $parent_id);
     $query->where('a.client_id = 1');
     $query->where('a.menutype = ' . $db->quote('admin'));
     $query->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     // Translate the items
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->text = JText::_($options[$i]->text);
     }
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseWarning(500, $db->getErrorMsg());
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 3
0
 /**
  * Method to get the field options.
  *
  * @since 2.0
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $options = parent::getOptions();
     if (!empty($options)) {
         return $options;
     }
     // If no custom options were defined let's figure out which ones of the
     // defaults we shall use...
     $config = array('published' => 1, 'unpublished' => 1, 'archived' => 0, 'trash' => 0, 'all' => 0);
     $stack = array();
     // We are no longer using jgrid.publishedOptions as it's returning
     // untranslated strings, unsuitable for our purposes.
     if ($this->element['show_published'] == 'false') {
         $stack[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
     }
     if ($this->element['show_unpublished'] == 'false') {
         $stack[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
     }
     if ($this->element['show_archived'] == 'true') {
         $stack[] = JHtml::_('select.option', '2', JText::_('JARCHIVED'));
     }
     if ($this->element['show_trash'] == 'true') {
         $stack[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
     }
     if ($this->element['show_all'] == 'true') {
         $stack[] = JHtml::_('select.option', '*', JText::_('JALL'));
     }
     return $stack;
 }
Ejemplo n.º 4
0
 /**
  * Method to get the custom field options.
  * Use the query attribute to supply a query to generate the list.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Check for an error.
     if ($db->getErrorNum()) {
         JError::raiseWarning(500, $db->getErrorMsg());
         return $options;
     }
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 5
0
 public function getOptions()
 {
     # The options available are based on what type was selected
     $options = array();
     $type = $this->form->getField('entity_type')->value;
     return array_merge(parent::getOptions(), JFormFieldParentEntity::getParents($type));
 }
Ejemplo n.º 6
0
	/**
	 * Method to get the field options for the list of installed editors.
	 *
	 * @return  array  The field option objects.
	 * @since   11.1
	 */
	protected function getOptions()
	{
		// Get the database object and a new query object.
		$db		= JFactory::getDBO();
		$query	= $db->getQuery(true);

		// Build the query.
		$query->select('element AS value, name AS text');
		$query->from('#__extensions');
		$query->where('folder = '.$db->quote('editors'));
		$query->where('enabled = 1');
		$query->order('ordering, name');

		// Set the query and load the options.
		$db->setQuery($query);
		$options = $db->loadObjectList();
		$lang = JFactory::getLanguage();
		foreach ($options as $i=>$option) {
				$lang->load('plg_editors_'.$option->value, JPATH_ADMINISTRATOR, null, false, false)
			||	$lang->load('plg_editors_'.$option->value, JPATH_PLUGINS .'/editors/'.$option->value, null, false, false)
			||	$lang->load('plg_editors_'.$option->value, JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
			||	$lang->load('plg_editors_'.$option->value, JPATH_PLUGINS .'/editors/'.$option->value, $lang->getDefault(), false, false);
			$options[$i]->text = JText::_($option->text);
		}

		// Check for a database error.
		if ($db->getErrorNum()) {
			JError::raiseWarning(500, $db->getErrorMsg());
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
Ejemplo n.º 7
0
 protected function getOptions()
 {
     $session = JFactory::getSession();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     // To avoid user's confusion, readonly="true" should imply disabled="true".
     if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
         $attr .= ' disabled="disabled"';
     }
     //
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     $db = JFactory::getDBO();
     $db->setQuery("SELECT t.name AS name, t.id AS id FROM #__k2_tags AS t WHERE published = 1 ORDER BY t.name ASC");
     $results = $db->loadObjectList();
     $tags = array();
     if (count($results)) {
         foreach ($results as $tag) {
             $tags[] = JHtml::_('select.option', $tag->id, $tag->name);
         }
         $tags = array_merge(parent::getOptions(), $tags);
         return $tags;
     } else {
         $tags = array();
         return $tags;
     }
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  * @since   1.6
  */
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('a.id AS value, a.title AS text, a.level')->from('#__menu AS a')->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     if ($menuType = $this->form->getValue('menutype')) {
         $query->where('a.menutype = ' . $db->quote($menuType));
     } else {
         $query->where('a.menutype != ' . $db->quote(''));
     }
     // Prevent parenting to children of this item.
     if ($id = $this->form->getValue('id')) {
         $query->join('LEFT', $db->quoteName('#__menu') . ' AS p ON p.id = ' . (int) $id)->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
     }
     $query->where('a.published != -2')->group('a.id, a.title, a.level, a.lft, a.rgt, a.menutype, a.parent_id, a.published')->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 9
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  * @since   1.6
  */
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('a.id AS value, a.name AS text, a.level')->from('#__jdeveloper_forms AS a')->join('LEFT', $db->quoteName('#__jdeveloper_forms') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt')->where('a.parent_id > 0');
     // Prevent parenting to children of this item.
     if ($id = $this->form->getValue('id')) {
         $query->join('LEFT', $db->quoteName('#__jdeveloper_forms') . ' AS p ON p.id = ' . (int) $id)->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
     }
     $query->group('a.id, a.name, a.level, a.lft, a.rgt, a.parent_id');
     $query->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $root = new JObject(array("value" => 1, "text" => JText::_("JGLOBAL_ROOT_PARENT"), "level" => 0));
         $options = array_merge(array($root), $db->loadObjectList());
     } catch (RuntimeException $e) {
         throw new Exception($e->getMessage());
     }
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 10
0
 /**
  * Method to get the options to populate list
  *
  * @return  array  The field option objects.
  *
  * @since   3.2
  */
 protected function getOptions()
 {
     // Hash for caching
     $hash = md5($this->element);
     if (!isset(static::$options[$hash])) {
         static::$options[$hash] = parent::getOptions();
         $options = array();
         $db = JFactory::getDbo();
         $user = JFactory::getUser();
         $query = $db->getQuery(true)->select('a.id AS value')->select('a.title AS text')->select('COUNT(DISTINCT b.id) AS level')->from('#__categories as a')->where('a.extension = "' . $this->extension . '"')->join('LEFT', '#__categories AS b ON a.lft > b.lft AND a.rgt < b.rgt')->group('a.id, a.title, a.lft, a.rgt')->order('a.lft ASC');
         $isRoot = $user->authorise('core.admin');
         if (!$isRoot) {
             require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/imc.php';
             $allowed_catids = ImcHelper::getCategoriesByUserGroups();
             $allowed_catids = implode(',', $allowed_catids);
             if (!empty($allowed_catids)) {
                 $query->where('a.id IN (' . $allowed_catids . ')');
             }
         }
         $db->setQuery($query);
         if ($options = $db->loadObjectList()) {
             foreach ($options as &$option) {
                 $option->text = str_repeat('- ', $option->level) . $option->text;
             }
             static::$options[$hash] = array_merge(static::$options[$hash], $options);
         }
     }
     return static::$options[$hash];
 }
Ejemplo n.º 11
0
 function getOptions()
 {
     // Base name of the HTML control.
     //    $ctrl  = $control_name .'['. $name .']';
     $courses = JoomdleHelperContent::getCourseList(0);
     // Construct an array of the HTML OPTION statements.
     $options = array();
     $c = array();
     foreach ($courses as $course) {
         $val = $course['remoteid'];
         $text = $course['fullname'];
         $options[] = JHtml::_('select.option', $val, $text);
         //		$op->id = $course['remoteid'];
         //		$op->text = $course['fullname'];
         //		$c[] = $op;
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
     // Construct the various argument calls that are supported.
     $attribs = ' ';
     if ($v = $node->attributes('size')) {
         $attribs .= 'size="' . $v . '"';
     }
     if ($v = $node->attributes('class')) {
         $attribs .= 'class="' . $v . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($m = $node->attributes('multiple')) {
         $attribs .= ' multiple="multiple"';
         $ctrl .= '[]';
     }
     // Render the HTML SELECT list.
     return JHTML::_('select.genericlist', $options, $ctrl, $attribs, 'value', 'text', $value, $control_name . $name);
 }
Ejemplo n.º 12
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('code As value, title As `text`, print_title')->from('#__sibdiet_countries')->order('title')->where('published = 1');
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     $lang_tag = JFactory::getLanguage()->get('tag');
     foreach ($options as $option) {
         // Convert the print_title field to an array.
         $registry = new JRegistry();
         $registry->loadString($option->print_title);
         $print_title = $registry->toArray();
         if (array_key_exists($lang_tag, $print_title)) {
             $option->text = $print_title[$lang_tag];
         }
     }
     // Sort Options
     usort($options, function ($a, $b) {
         return strcmp($a->text, $b->text);
     });
     return array_merge(parent::getOptions(), $options);
 }
Ejemplo n.º 13
0
 /**
 * Method to get the field options.
 *
 * @return	array	The field option objects.
 * @since	1.6
 */
 protected function getOptions()
 {
     // Get the database object and a new query object.
     $path = str_replace('administrator', '', JPATH_BASE);
     $path = $path . 'components' . DS . 'com_awdwall' . DS . 'images' . DS;
     $ldirs = listdirs($path);
     //print_r($ldirs);
     foreach ($ldirs as $ldir) {
         $folders[] = str_replace($path . '/', '', $ldir);
     }
     $dir = str_replace('administrator', '', JPATH_BASE);
     $dir = $dir . 'components' . DS . 'com_awdwall' . DS . 'css';
     $needle = 'style_';
     $length = strlen($needle);
     $dh = opendir($dir);
     while (false !== ($filename = readdir($dh))) {
         if ($filename != "." && $filename != "..") {
             if (substr($filename, 0, $length) === $needle) {
                 $order = '';
                 $newstr = '';
                 $order = array("style_", ".css");
                 $replace = '';
                 $newstr = str_replace($order, $replace, $filename);
                 if (in_array($newstr, $folders)) {
                     $files[] = $newstr;
                     $options[] = array('value' => $newstr, 'text' => $newstr);
                 }
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     //echo 'this->element<br /><pre>~' . print_r($this->element,true) . '~</pre><br />';
     $varname = (string) $this->element['varname'];
     $vartable = (string) $this->element['targettable'];
     $select_id = JRequest::getVar($varname);
     if (is_array($select_id)) {
         $select_id = $select_id[0];
     }
     if ($select_id) {
         $db =& JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('t.id AS value, t.name AS text');
         $query->from('#__joomleague_associations AS t');
         $query->join('inner', '#__joomleague_' . $vartable . ' AS wt ON wt.country = t.country ');
         $query->where('wt.id = ' . $select_id);
         $query->order('t.name');
         $db->setQuery($query);
         $options = $db->loadObjectList();
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 15
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return      array           An array of JHtml options.
  */
 protected function getOptions()
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($db->quoteName('car.id') . ', ' . $db->quoteName('car.name'));
     $query->from($db->quoteName('#__agendadirigentes_cargos', 'car'));
     if ($this->getAttribute('includecategory', false) == true) {
         $query->select($db->quoteName('cat.title', 'category_name'));
         $query->join('INNER', $db->quoteName('#__categories', 'cat') . ' ON ' . $db->quoteName('car.catid') . ' = ' . $db->quoteName('cat.id'));
         $query->order($db->quoteName('cat.title') . 'ASC, ' . $db->quoteName('car.name') . ' ASC');
     } else {
         $query->order($db->quoteName('car.name') . ' ASC');
     }
     $db->setQuery((string) $query);
     $cargos = $db->loadObjectList();
     $options = array();
     $options[] = JHtml::_('select.option', '', JText::_('COM_AGENDADIRIGENTES_SELECT_CARGO'));
     if ($cargos) {
         foreach ($cargos as $cargo) {
             if ($this->getAttribute('includecategory', false)) {
                 $options[] = JHtml::_('select.option', $cargo->id, $cargo->category_name . ' - ' . $cargo->name);
             } else {
                 $options[] = JHtml::_('select.option', $cargo->id, $cargo->name);
             }
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 16
0
 /**
  * Method to get the list of siblings in a menu.
  * The method requires that parent be set.
  *
  * @return  array  The field option objects or false if the parent field has not been set
  * @since   1.7
  */
 protected function getOptions()
 {
     $options = array();
     // Get the parent
     $parent_id = $this->form->getValue('parent_id', 0);
     if (empty($parent_id) && $parent_id != 1) {
         return false;
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('a.id AS value, a.title AS text')->from('#__mapfrance_areas AS a')->where('a.parent_id =' . (int) $parent_id);
     if ($map = $this->form->getValue('map')) {
         $query->where('a.map = ' . $db->quote($map));
     } else {
         $query->where('a.map != ' . $db->quote(''));
     }
     $query->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     $options = array_merge(array(array('value' => '-1', 'text' => JText::_('COM_MAPFRANCE_AREA_FIELD_ORDERING_VALUE_FIRST'))), $options, array(array('value' => '-2', 'text' => JText::_('COM_MAPFRANCE_AREA_FIELD_ORDERING_VALUE_LAST'))));
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $hideNone = (string) $this->element['hide_none'];
     $hideDefault = (string) $this->element['hide_default'];
     // Get the path in which to search for file options.
     $path = JPATH_ROOT . '/components/com_joomleague/extensions';
     if (!is_dir($path)) {
         $path = JPATH_ROOT . '/' . $path;
     }
     // Get a list of folders in the search path with the given filter.
     $folders = JFolder::folders($path, $filter);
     // Build the options list from the list of folders.
     if (is_array($folders)) {
         foreach ($folders as $folder) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                     continue;
                 }
             }
             $options[] = JHtml::_('select.option', $folder, $folder);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 18
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 protected function getOptions()
 {
     $app = JFactory::getApplication();
     // Detect the native language.
     $native = JLanguageHelper::detectLanguage();
     if (empty($native)) {
         $native = 'en-GB';
     }
     // Get a forced language if it exists.
     $forced = $app->getLocalise();
     if (!empty($forced['language'])) {
         $native = $forced['language'];
     }
     // If a language is already set in the session, use this instead
     $model = new InstallationModelSetup();
     $options = $model->getOptions();
     if (isset($options['language'])) {
         $native = $options['language'];
     }
     // Get the list of available languages.
     $options = JLanguageHelper::createLanguageList($native);
     if (!$options || $options instanceof Exception) {
         $options = array();
     } else {
         usort($options, array($this, '_sortLanguages'));
     }
     // Set the default value from the native language.
     $this->value = $native;
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 19
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return array An array of JHtml options.
  */
 protected function getOptions()
 {
     $current_category_id = JRequest::getInt('id', '0');
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('`id`, `categoryname`, `parentid`');
     $query->from('#__youtubegallery_categories');
     $db->setQuery((string) $query);
     $messages = $db->loadObjectList();
     if (!$db->query()) {
         die($db->stderr());
     }
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('COM_YOUTUBEGALLERY_SELECT_CATEGORYROOT'));
     $children = $this->getAllChildren($current_category_id);
     if ($messages) {
         foreach ($messages as $message) {
             if ($current_category_id == 0) {
                 $options[] = JHtml::_('select.option', $message->id, $message->categoryname);
             } else {
                 if ($message->id != $current_category_id and $message->parentid != $current_category_id and !in_array($message->id, $children)) {
                     $options[] = JHtml::_('select.option', $message->id, $message->categoryname);
                 }
             }
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 20
0
	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return  array  An array of JHtml options.
	 */
	protected function getOptions()
	{
		$db    = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('#__helloworld.id as id,greeting,#__categories.title as category,catid');
		$query->from('#__helloworld');
		$query->leftJoin('#__categories on catid=#__categories.id');
		// Retrieve only published items
		$query->where('#__helloworld.published = 1');
		$db->setQuery((string) $query);
		$messages = $db->loadObjectList();
		$options  = array();

		if ($messages)
		{
			foreach ($messages as $message)
			{
				$options[] = JHtml::_('select.option', $message->id, $message->greeting .
				                      ($message->catid ? ' (' . $message->category . ')' : ''));
			}
		}

		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
Ejemplo n.º 21
0
 /**
  * Method to get the list of siblings in a menu.
  * The method requires that parent be set.
  *
  * @return	array	The field option objects or false if the parent field has not been set
  * @since	1.7
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Get the parent
     $parent_id = $this->form->getValue('parent_id', 0);
     if (empty($parent_id)) {
         return false;
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__menu AS a');
     $query->where('a.published >= 0');
     $query->where('a.parent_id =' . (int) $parent_id);
     if ($menuType = $this->form->getValue('menutype')) {
         $query->where('a.menutype = ' . $db->quote($menuType));
     } else {
         $query->where('a.menutype != ' . $db->quote(''));
     }
     $query->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseWarning(500, $db->getErrorMsg());
     }
     $options = array_merge(array(array('value' => '-1', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST'))), $options, array(array('value' => '-2', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_LAST'))));
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 22
0
    protected function getOptions()
    {
        $options = array();
        if (!class_exists('tsmartModelVendor')) {
            require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
        }
        $vendor_id = tsmartModelVendor::getLoggedVendor();
        // set currency_id to logged vendor
        if (empty($this->value)) {
            $currency = tsmartModelVendor::getVendorCurrency($vendor_id);
            $this->value = $currency->tsmart_currency_id;
        }
        // why not logged vendor? shared is missing
        $db = JFactory::getDBO();
        $query = 'SELECT `tsmart_currency_id` AS value, `currency_name` AS text
			FROM `#__tsmart_currencies`
			WHERE `tsmart_vendor_id` = "1"  AND `published` = "1" ORDER BY `currency_name` ASC ';
        // default value should be vendor currency
        $db->setQuery($query);
        $values = $db->loadObjectList();
        foreach ($values as $v) {
            $options[] = JHtml::_('select.option', $v->value, $v->text);
        }
        // Merge any additional options in the XML definition.
        $options = array_merge(parent::getOptions(), $options);
        return $options;
    }
Ejemplo n.º 23
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     // Initialize some field attributes.
     $client = (string) $this->element['client'];
     if ($client != 'site' && $client != 'administrator') {
         $client = 'site';
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true, true));
     // Set the default value active language
     if ($langParams = JComponentHelper::getParams('com_languages')) {
         switch ((string) $this->value) {
             case 'site':
             case 'frontend':
             case '0':
                 $this->value = $langParams->get('site', 'en-GB');
                 break;
             case 'admin':
             case 'administrator':
             case 'backend':
             case '1':
                 $this->value = $langParams->get('administrator', 'en-GB');
                 break;
             case 'active':
             case 'auto':
                 $lang = JFactory::getLanguage();
                 $this->value = $lang->getTag();
                 break;
             default:
                 break;
         }
     }
     return $options;
 }
Ejemplo n.º 24
0
 /**
  * Method to get a list of content types
  *
  * @return  array  The field option objects.
  *
  * @since   3.1
  */
 protected function getOptions()
 {
     $lang = JFactory::getLanguage();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('a.type_id AS value, a.type_title AS text, a.type_alias AS alias')->from('#__content_types AS a')->order('a.type_title ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         return false;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     foreach ($options as $option) {
         // Make up the string from the component sys.ini file
         $parts = explode('.', $option->alias);
         $comp = array_shift($parts);
         // Make sure the component sys.ini is loaded
         $lang->load($comp . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($comp . '.sys', JPATH_ADMINISTRATOR . '/components/' . $comp, null, false, true);
         $option->string = implode('_', $parts);
         $option->string = $comp . '_CONTENT_TYPE_' . $option->string;
         if ($lang->hasKey($option->string)) {
             $option->text = JText::_($option->string);
         }
     }
     return $options;
 }
Ejemplo n.º 25
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 public function getOptions()
 {
     $app = JFactory::getApplication();
     $clientId = $app->getUserStateFromRequest('com_templates.styles.filter.client_id', 'filter_client_id', null);
     $options = TemplatesHelper::getTemplateOptions($clientId);
     return array_merge(parent::getOptions(), $options);
 }
Ejemplo n.º 26
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $first = (int) $this->element['first'];
     $last = (int) $this->element['last'];
     $step = (int) $this->element['step'];
     // Sanity checks.
     if ($step == 0) {
         // Step of 0 will create an endless loop.
         return $options;
     } elseif ($first < $last && $step < 0) {
         // A negative step will never reach the last number.
         return $options;
     } elseif ($first > $last && $step > 0) {
         // A position step will never reach the last number.
         return $options;
     }
     // Build the options array.
     for ($i = $first; $i <= $last; $i += $step) {
         $options[] = JHtml::_('select.option', $i);
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 27
0
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query = '
     SELECT
         ct.id AS id,
         c.locale_key AS container_name,
         ct.liters AS liters
     FROM #__reomi_container_types AS ct
     INNER JOIN #__reomi_containers AS c ON ct.container_id = c.id
     ORDER BY
         c.name ASC,
         ct.liters ASC
     ';
     $db->setQuery($query);
     $containers = $db->loadObjectList();
     $options = array();
     if ($containers) {
         foreach ($containers as $item) {
             $options[] = JHtml::_('select.option', $item->id, JText::_($item->container_name) . " " . $item->liters . "L");
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 28
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     $options[] = JHtml::_('select.option', 'id', JText::_('COM_VISFORMS_ID'), 'value', 'text', false);
     $options[] = JHtml::_('select.option', 'created', JText::_('COM_VISFORMS_SUBMISSIONDATE'), 'value', 'text', false);
     $options[] = JHtml::_('select.option', 'ismfd', JText::_('COM_VISFORMS_MODIFIED'), 'value', 'text', false);
     $id = 0;
     //extract form id
     $form = $this->form;
     $link = $form->getValue('link');
     if (isset($link) && $link != "") {
         $parts = array();
         parse_str($link, $parts);
         if (isset($parts['id']) && is_numeric($parts['id'])) {
             $id = $parts['id'];
         }
     }
     // Create options according to visfield settings
     $db = JFactory::getDbo();
     $query = ' SELECT c.id , c.label from #__visfields as c where c.fid=' . $id . ' AND c.published = 1 AND (c.frontdisplay is null or c.frontdisplay = 1 or c.frontdisplay = 2) ' . "and !(c.typefield = 'reset') and !(c.typefield = 'submit') and !(c.typefield = 'image') and !(c.typefield = 'fieldsep') and !(c.typefield = 'hidden')";
     $db->setQuery($query);
     $fields = $db->loadObjectList();
     if ($fields) {
         foreach ($fields as $field) {
             $tmp = JHtml::_('select.option', $field->id, $field->label, 'value', 'text', false);
             // Add the option object to the result set.
             $options[] = $tmp;
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  * @since   1.6
  */
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $query = $db->getQuery(true)->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level')->from('#__users_groups AS a')->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     // Prevent parenting to children of this item.
     if ($id = $this->form->getValue('id')) {
         $query->join('LEFT', $db->quoteName('#__users_groups') . ' AS p ON p.id = ' . (int) $id)->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
     }
     $query->group('a.id, a.title, a.lft, a.rgt')->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         // Show groups only if user is super admin or group is not super admin
         if ($user->authorise('core.admin') || !JAccess::checkGroup($options[$i]->value, 'core.admin')) {
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         } else {
             unset($options[$i]);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Ejemplo n.º 30
-3
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  *
  * @since   11.4
  */
 protected function getOptions()
 {
     // Initialise variables
     $folder = $this->element['folder'];
     if (!empty($folder)) {
         // Get list of plugins
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('element AS value, name AS text');
         $query->from('#__extensions');
         $query->where('folder = ' . $db->q($folder));
         $query->where('enabled = 1');
         $query->order('ordering, name');
         $db->setQuery($query);
         $options = $db->loadObjectList();
         $lang = JFactory::getLanguage();
         foreach ($options as $i => $item) {
             $source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value;
             $extension = 'plg_' . $folder . '_' . $item->value;
             $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false) || $lang->load($extension . '.sys', $source, null, false, false) || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false);
             $options[$i]->text = JText::_($item->text);
         }
         if ($db->getErrorMsg()) {
             JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
             return '';
         }
     } else {
         JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }