/** * Method to get the radio button field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize variables. $html = array(); // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"'; // Start the radio field output. $html[] = '<fieldset id="' . $this->id . '"' . $class . '>'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>'; } // End the radio field output. $html[] = '</fieldset>'; return implode($html); }
protected function getOptions() { $options = array(); for ($i = 5; $i <= 50; $i++) { $option = array('value' => '', 'text' => '', 'disabled' => false, 'class' => '', 'onclick' => ''); if ($i > 0) { $option['value'] = $i . 'px'; $option['text'] = $i . ' px'; } $value = $option['value']; $disabled = (string) $option['disabled']; $disabled = $disabled == 'true' || $disabled == 'disabled' || $disabled == '1'; $disabled = $disabled || $this->readonly && $value != $this->value; // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', $value, JText::alt($option['text'], preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', $disabled); // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $option['onclick']; // Add the option object to the result set. $options[] = $tmp; if ($i == 0) { $i = 5; } } reset($options); return $options; }
/** * Method to get the field list options markup. * * @param integer $project The currently selected project * * @return array $options The list options markup. */ protected function getOptions($project = 0) { $options = array(); $user = JFactory::getUser(); $db = JFactory::getDbo(); $query = $db->getQuery(true); // Construct the query $query->select('a.id AS value, a.path AS text')->from('#__pf_repo_dirs AS a')->where('a.project_id = ' . $project); // Implement View Level Access if (!$user->authorise('core.admin')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } $query->order('a.path'); $db->setQuery((string) $query); $items = (array) $db->loadObjectList(); foreach ($items as $item) { // Create a new option object based on the <option /> element. $opt = JHtml::_('select.option', (string) $item->value, JText::alt(trim((string) $item->text), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text'); // Add the option object to the result set. $options[] = $opt; } reset($options); return $options; }
protected function getInput() { // Initialize variables. $html = array(); $icon = $this->element['icon']; $suffix = $this->element['suffixck']; // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"'; // Start the radio field output. $html[] = $icon ? '<img src="' . $this->getPathToImages() . '/images/' . $icon . '" style="margin-right:5px;" />' : '<div style="float:left;width:15px;margin-right:5px;"> </div>'; $html[] = '<fieldset id="' . $this->id . '-fieldset" class="radio" style="border-left:1px dotted #333;padding-left:0px;"><div style="width:5px;height:0px;border-bottom:1px dotted #333;"></div>'; $html[] = '<input type="hidden" isradio="1" id="' . $this->id . '" class="' . $this->element['class'] . '" value="' . $this->value . '" />'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. //$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $onclick = ' onclick="$(\'' . $this->id . '\').setProperty(\'value\',this.value);"'; // $onclick = ' onclick="alert(this.value);"' ; $html[] = '<div style="clear:both;"><input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . ' style="margin-left:5px;"/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label></div>'; } // End the radio field output. $html[] = '<div style="width:5px;height:0px;border-bottom:1px dotted #333;clear:both"></div></fieldset>'; return implode($html); }
protected function getOptions() { $options = array(); $path = $this->get('folder'); if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Prepend some default options based on field attributes. if (!$this->get('hidenone', 0)) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } if (!$this->get('hidedefault', 0)) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } // Get a list of files in the search path with the given filter. $files = JFolder::files($path, $this->get('filter')); // Build the options list from the list of files. if (is_array($files)) { foreach ($files as $file) { // Check to see if the file is in the exclude mask. if ($this->get('exclude')) { if (preg_match(chr(1) . $this->get('exclude') . chr(1), $file)) { continue; } } // If the extension is to be stripped, do it. if ($this->get('stripext', 1)) { $file = JFile::stripExt($file); } $label = $file; if ($this->get('language_prefix')) { $label = JText::_($this->get('language_prefix') . strtoupper($label)); } $options[] = JHtml::_('select.option', $file, $label); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
/** * Method to get the radio button field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize variables. $html = array(); // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio btn-group ' . (string) $this->element['class'] . '"' : ' class="radio btn-group pull-left"'; $translationCacheType = $this->element['cachetype'] ? (string) $this->element['cachetype'] : ''; // Start the radio field output. $html[] = '<fieldset id="' . $this->id . '"' . $class . '>'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>'; } // End the radio field output. $html[] = '</fieldset>'; if ($this->value) { $html[] = '<span data-content="' . JText::sprintf('COM_JMAP_JOOMLA_' . $translationCacheType . 'CACHE_ENABLED_DESC') . '" class="label label-success hasPopover">' . '<span class="glyphicon glyphicon-ok-sign"></span>' . JText::sprintf('COM_JMAP_JOOMLA_' . $translationCacheType . 'CACHE_ENABLED') . '</span>'; } else { $html[] = '<span data-content="' . JText::sprintf('COM_JMAP_JOOMLA_' . $translationCacheType . 'CACHE_DISABLED_DESC') . '" class="label label-danger hasPopover">' . '<span class="glyphicon glyphicon-warning-sign"></span>' . JText::sprintf('COM_JMAP_JOOMLA_' . $translationCacheType . 'CACHE_DISABLED') . '</span>'; } return implode($html); }
protected function getInput() { $html = array(); // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"'; $icon = $this->element['icon']; // Start the radio field output. $html[] = $icon ? '<div style="display:inline-block;vertical-align:top;margin-top:5px;width:20px;"><img src="' . $this->getPathToElements() . '/images/' . $icon . '" style="margin-right:5px;" /></div>' : '<div style="display:inline-block;width:20px;"></div>'; $html[] = '<fieldset id="' . $this->id . '-fieldset"' . $class . ' style="display:inline-block;">'; $html[] = '<input type="hidden" isradio="1" id="' . $this->id . '" class="' . $this->element['class'] . '" value="' . $this->value . '" />'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { if (stristr($option->text, "img:")) { $option->text = '<img src="' . $this->getPathToElements() . '/images/' . str_replace("img:", "", $option->text) . '" style="margin:0; float:none;" />'; } // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $onclick = ' onclick="$(\'' . $this->id . '\').setProperty(\'value\',this.value);"'; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>'; } // End the radio field output. $html[] = '</fieldset>'; return implode($html); }
protected function getInput() { // Initialize variables. $html = array(); $attr = ''; $db =& JFactory::getDBO(); $currentModId = JRequest::getVar('id'); $queryparams = "SELECT `params` FROM `#__modules` WHERE `id` = {$currentModId}"; $db->setQuery($queryparams); $data = $db->loadResult(); $params = new JParameter($data); $options = array(); $querymodtype = "SELECT DISTINCT `module` FROM `#__modules` WHERE `published` = 1 AND `client_id` = 0 AND `id` <> {$currentModId} ORDER BY `module`"; $db->setQuery($querymodtype); $db->getQuery(); $options = $db->loadObjectList(); $temp_opt = array(); if (count($options)) { foreach ($options as $idx => $option) { $tmp = JHtml::_('select.option', (string) $option->module, JText::alt(trim((string) $option->module), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', false); $temp_opt[] = $tmp; } } array_unshift($temp_opt, JHTML::_('select.option', '', JText::_('MOD_OT_MINI_TABS_SELECT_MODULE_TYPE'), 'value', 'text', false)); // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; // Create a regular list. $html[] = JHtml::_('select.genericlist', $temp_opt, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); return implode($html); }
/** * Method to get the field options. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { // Initialize variables. $options = array(); foreach ($this->element->children() as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text', ((string) $option['disabled']=='true')); // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $option['onclick']; // Add the option object to the result set. $options[] = $tmp; } reset($options); return $options; }
/** * Method to get the radio button field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $html = array(); // Initialize some field attributes. $class = !empty($this->class) ? ' class="radio ' . $this->class . '"' : ' class="radio"'; $required = $this->required ? ' required aria-required="true"' : ''; $autofocus = $this->autofocus ? ' autofocus' : ''; $disabled = $this->disabled ? ' disabled' : ''; $readonly = $this->readonly; // Start the radio field output. $html[] = '<span id="' . $this->id . '"' . $class . $required . $autofocus . $disabled . ' >'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) || $readonly && !$checked; $disabled = $disabled ? ' disabled' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $onchange = !empty($option->onchange) ? ' onchange="' . $option->onchange . '"' : ''; $html[] = '<label for="' . $this->id . $i . '"' . $class . ' >'; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '" value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $required . $onclick . $onchange . $disabled . ' /> '; $html[] = JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)); $html[] = '</label>'; $required = ''; } // End the radio field output. $html[] = '</span>'; return implode($html); }
/** * Method to get the field options. * * @return array The field option objects. * * @since 1.0 */ protected function getOptions() { $options = array(); $path = $this->directory; if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Prepend some default options based on field attributes. if (!$this->hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } if (!$this->hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } // Get a list of folders in the search path with the given filter. $folders = JFolder::listFolderTree($path, $this->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 ($this->exclude) { if (preg_match(chr(1) . $this->exclude . chr(1), $folder['relname'])) { continue; } } // Add the folder $options[] = JHtml::_('select.option', $folder['relname'], $folder['relname']); } } return $options; }
protected function getOptions() { $options = array(); foreach ($this->element->children() as $option) { $disable = false; if ($option->getName() != 'option') { continue; } if ($option['filter'] == true) { if ($option['value'] == "ccomment") { $file = JPATH_ROOT . '/administrator/components/com_comment/comment.php'; } else { $com = 'com_' . $option['value']; $file = JPATH_ROOT . '/administrator/components/' . $com . '/' . $option['value'] . '.php'; } $file = JPath::clean($file); if (!JFile::exists($file)) { $disable = true; } } $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', $disable); $tmp->class = (string) $option['class']; $tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } reset($options); return $options; }
protected function getInput() { $template = basename(dirname(dirname(dirname(__FILE__)))); $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . "/templates/{$template}/XTC/elements/jquery.simpleCombo.js"); $document->addScriptDeclaration("jQuery(document).load(function () {\n\t\t\tjQuery(function() {\n\t\t\t\tjQuery('select.combo').simpleCombo();\n\t\t\t});\n\t\t});"); $options = array(); $custom = true; foreach ($this->element->children() as $option) { if ($option->getName() != 'option') { continue; } $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text'); if ($option['value'] == $this->value) { $custom = false; } $tmp->class = (string) $option['class']; $tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } if ($custom) { $options[] = JHtml::_('select.option', $this->value, $this->value, 'value', 'text'); } $html = JHtml::_('select.genericlist', $options, $this->name, 'class="combo inputbox"', 'value', 'text', $this->value, $this->id); return $html; }
/** * Method to get the field option groups. * * @return array The field option objects as a nested array in groups. * * @since 11.1 * @throws UnexpectedValueException */ protected function getGroups() { $groups = array(); $label = 0; foreach ($this->element->children() as $element) { switch ($element->getName()) { // The element is an <option /> case 'option': // Initialize the group if necessary. if (!isset($groups[$label])) { $groups[$label] = array(); } // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', $element['value'] ? (string) $element['value'] : trim((string) $element), JText::alt(trim((string) $element), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $element['disabled'] == 'true'); // Set some option attributes. $tmp->class = (string) $element['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $element['onclick']; // Add the option. $groups[$label][] = $tmp; break; // The element is a <group /> // The element is a <group /> case 'group': // Get the group label. if ($groupLabel = (string) $element['label']) { $label = JText::_($groupLabel); } // Initialize the group if necessary. if (!isset($groups[$label])) { $groups[$label] = array(); } // Iterate through the children and build an array of options. foreach ($element->children() as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', $option['value'] ? (string) $option['value'] : JText::_(trim((string) $option)), JText::_(trim((string) $option)), 'value', 'text', (string) $option['disabled'] == 'true'); // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $option['onclick']; // Add the option. $groups[$label][] = $tmp; } if ($groupLabel) { $label = count($groups); } break; // Unknown element type. // Unknown element type. default: throw new UnexpectedValueException(sprintf('Unsupported element %s in JFormFieldGroupedList', $element->getName()), 500); } } reset($groups); return $groups; }
/** * Method to get the radio button field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $doc = JFactory::getDocument(); $doc->addScriptDeclaration("\n\t\t\t\twindow.addEvent('domready', function() {\n\n\t\t\t\t\tvar showDescription = " . $this->value . ";\n\t\t\t\t\tvar lblDescriptionWordLimitation \t= document.id('jform_params_description_word_limitation-lbl');\n\t\t\t\t\tvar eleParent \t\t\t\t\t\t= lblDescriptionWordLimitation.getParent();\n\t\t\t\t\tif (showDescription == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\teleParent.getParent().setStyle('display', 'block');\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\teleParent.getParent().setStyle('display', 'none');\n\t\t\t\t\t}\n\t\t\t\t\t\$\$('#jform_params_show_description1').addEvent('click',function(){\n\t\t\t\t\t\t\teleParent.getParent().setStyle('display', 'block');\n\t\t\t\t\t});\n\n\t\t\t\t\t\$\$('#jform_params_show_description0').addEvent('click',function(){\n\t\t\t\t\t\t\teleParent.getParent().setStyle('display', 'none');\n\t\t\t\t\t});\n\n\t\t\t\t});\n\t\t\t"); // Initialize variables. $html = array(); // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"'; // Start the radio field output. $html[] = '<fieldset id="' . $this->id . '"' . $class . '>'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>'; } // End the radio field output. $html[] = '</fieldset>'; return implode($html); }
protected function getOptions() { $app = JFactory::getApplication(); $view = $app->input->getCmd('view', ''); $options = array(); foreach ($this->element->children() as $option) { if ($option->getName() != 'option') { continue; } $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true'); $tmp->class = (string) $option['class']; $tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } JLoader::register('JUDirectoryHelper', JPATH_ADMINISTRATOR . '/components/com_judirectory/helpers/judirectory.php', false); $checkPublished = $this->element['checkpublished'] == 'true' || $this->element['checkpublished'] == '1' ? true : false; $getSelf = $this->element['fetchself'] == 'true' || $this->element['fetchself'] == '1' ? true : false; $parentId = $this->element['parentid'] ? $this->element['parentid'] : 1; $startLevel = $this->element['startlevel'] ? $this->element['startlevel'] : 0; $separation = $this->element['separation'] ? $this->element['separation'] : '|—'; $ignoreaddress = $this->element['ignoreaddress'] ? explode(',', $this->element['ignoreaddress']) : array(); if ($view == 'address') { $addressId = $app->input->get('id', 0); $ignoreaddress = $addressId ? array($addressId) : array(); $_options = JUDirectoryHelper::getAddressOptions($parentId, $getSelf, $checkPublished, $ignoreaddress, $startLevel, $separation); } else { $_options = JUDirectoryHelper::getAddressOptions($parentId, $getSelf, $checkPublished, $ignoreaddress, $startLevel, $separation); } reset($options); $options = array_merge($options, $_options); return $options; }
/** * Get a list of the available content language items. * * @param boolean $all True to include All (*) * @param boolean $translate True to translate All * * @return string * * @since 11.1 * * @see JFormFieldContentLanguage */ public static function existing($all = false, $translate=false) { if (empty(self::$items)) { // Get the database object and a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Build the query. $query->select('a.lang_code AS value, a.title AS text, a.title_native'); $query->from('#__languages AS a'); $query->where('a.published >= 0'); $query->order('a.title'); // Set the query and load the options. $db->setQuery($query); self::$items = $db->loadObjectList(); if ($all) { array_unshift(self::$items, new JObject(array('value'=>'*','text'=>$translate ? JText::alt('JALL','language') : 'JALL_LANGUAGE'))); } // Detect errors if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } } return self::$items; }
protected function getOptions() { $options = array(); $path = $this->directory; if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Prepend some default options based on field attributes. if (!$this->hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } if (is_dir($path)) { // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $this->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 ($this->exclude) { if (preg_match(chr(1) . $this->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; } else { 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 = (string) $this->element['directory']; // Make sure we have absolute filepath if (!substr_count($path, JPATH_ROOT)) { $path = JPATH_ROOT.'/'.$path; } // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $filter, true, true); $path = str_replace('\\', '/', $path); //find start of local url $pos = strpos($path, '/images'); // 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; } } $folder = substr_replace($folder, '', 0, $pos); $folder = str_replace('\\', '/', $folder); $options[] = JHtml::_('select.option', $folder, $folder); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getInput() { global $expose; $html = array(); $options = array(); //get template id $id = JRequest::getInt('id'); // Initialize some field attributes. $filter = '\\.png$|\\.gif$|\\.jpg$|\\.bmp$|\\.jpeg$'; $exclude = (string) $this->element['exclude']; $stripExt = (string) $this->element['stripext']; $hideNone = (string) $this->element['hide_none']; //$hideDefault = (string) $this->element['hide_default']; $class = $this->element['class']; $attr = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : ''; $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : ''; $wrapstart = '<div class="field-wrap patterns clearfix ' . $class . '">'; $wrapend = '</div>'; // Get the path in which to search for file options. $directory = (string) $this->element['directory']; $path = JPATH_ROOT . '/templates/' . getTemplate($id) . '/images/' . $directory; // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } // if (!$hideDefault) { // $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); // } // Get a list of files in the search path with the given filter. $files = JFolder::files($path, $filter); // Build the options list from the list of files. if (is_array($files)) { foreach ($files as $file) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $file)) { continue; } } // If the extension is to be stripped, do it. if ($stripExt) { $file = JFile::stripExt($file); } $options[] = JHtml::_('select.option', $file, $file); } } // Create a read-only list (no name) with a hidden input to store the value. if ((string) $this->element['readonly'] == 'true') { $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>'; } else { $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); } return $wrapstart . $pretext . implode($html) . $posttext . $wrapend; }
/** * Create objects for the options * * @return array The array of option objects */ protected function getOptions() { $options = array(); // Do we have a class and method source for our options? $source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file']; $source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class']; $source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method']; $source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key']; $source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value']; $source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate']; $source_translate = in_array(strtolower($source_translate), array('true', 'yes', '1', 'on')) ? true : false; $source_format = empty($this->element['source_format']) ? '' : (string) $this->element['source_format']; if ($source_class && $source_method) { // Maybe we have to load a file? if (!empty($source_file)) { $source_file = FOFTemplateUtils::parsePath($source_file, true); JLoader::import('joomla.filesystem.file'); if (JFile::exists($source_file)) { include_once $source_file; } } // Make sure the class exists if (class_exists($source_class, true)) { // ...and so does the option if (in_array($source_method, get_class_methods($source_class))) { // Get the data from the class if ($source_format == 'optionsobject') { $options = $source_class::$source_method(); } else { $source_data = $source_class::$source_method(); // Loop through the data and prime the $options array foreach ($source_data as $k => $v) { $key = empty($source_key) || $source_key == '*' ? $k : $v[$source_key]; $value = empty($source_value) || $source_value == '*' ? $v : $v[$source_value]; if ($source_translate) { $value = JText::_($value); } $options[] = JHtml::_('select.option', $key, $value, 'value', 'text'); } } } } } // Get the field $options foreach ($this->element->children() as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } // Create a new option object based on the <option /> element. $options[] = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true'); } reset($options); return $options; }
/** * Method to get the list of files for the field options. * Specify the target directory with a directory attribute * Attributes allow an exclude mask and stripping of extensions from file name. * Default attribute may optionally be set to null (no file) or -1 (use a default). * * @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']; $stripExt = (string) $this->element['stripext']; $hideNone = (string) $this->element['hide_none']; $hideDefault = (string) $this->element['hide_default']; // Get the path in which to search for file options. $path = (string) $this->element['directory']; if (!is_dir($path)) { $path = JPATH_ROOT.'/'.$path; } // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } // Get a list of files in the search path with the given filter. $files = JFolder::files($path, $filter); // Build the options list from the list of files. if (is_array($files)) { foreach($files as $file) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1).$exclude.chr(1), $file)) { continue; } } // If the extension is to be stripped, do it. if ($stripExt) { $file = JFile::stripExt($file); } $options[] = JHtml::_('select.option', $file, $file); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getInput() { $html = array(); // Initialize some field attributes. //$class = $node->element['class'] ? ' class="radio ' . (string) $node->element['class'] . '"' : ' class="radio"'; // Start the radio field output. //$html[] = '<fieldset id="' . $this->id . '"' . $class . '>'; // Initialize variables. $options = array(); foreach ($node->option as $option) { // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', (string) $option->_attributes['value'], trim((string) $option->_data), 'value', 'text'); // Set some option attributes. //$tmp->class = (string) $class; // Set some JavaScript option attributes. //$tmp->onclick = (string) $option['onclick']; // Add the option object to the result set. $options[] = $tmp; } rsort($options); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. if ((string) $option->value == '0') { $option->class .= 'btn btn-success '; } else { $option->class .= 'btn btn-success active '; } if ((string) $option->value == (string) $value) { $checked = ' checked="checked"'; $option->class .= 'selected '; } else { $checked = ''; } $class = !empty($option->class) ? ' class="' . $option->class . ' ' . $node->_attributes['class'] . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $html[] = '<input type="radio" id="id_' . $name . $i . '" name="' . $name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="id_' . $name . $i . '"' . $class . '><span>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</span></label>'; } /* <fieldset id="jform_pago" class="radio btn-group" style="border:0 none;"><input type="radio" name="jform[pago]" id="jform_pago_0" value="0" rel="{"color":"danger"}" class="validate[required]" checked="checked"> <label for="jform_pago_0" class="btn active btn-danger"><i style="margin-right:5px;" class="icomoon-cancel "></i>Não</label> <input type="radio" name="jform[pago]" id="jform_pago_1" value="1" rel="{"color":"success"}" class="validate[required]"> <label for="jform_pago_1" class="btn"><i style="margin-right:5px;" class="icomoon-ok "></i>Sim</label> </fieldset> */ $retorno = "<fieldset class='radio btn-group'>" . implode($html) . "</fieldset>"; // End the radio field output. //$html[] = '</fieldset>'; return $retorno; }
protected function getOptions() { // This only returns 1 option!!! if (empty($this->element->option)) { return array(); } $option = $this->element->option; $fieldname = preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname); $value = (string) $option['value']; $text = trim((string) $option) ? trim((string) $option) : $value; return array(array('value' => $value, 'text' => '- ' . JText::alt($text, $fieldname) . ' -')); }
protected function getLanguages() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('a.lang_code AS value, a.title AS text, a.title_native'); $query->from('#__languages AS a'); $query->where('a.published >= 0'); $query->order('a.title'); $db->setQuery($query); $items = $db->loadObjectList(); array_unshift($items, new JObject(array('value' => '*', 'text' => JText::alt('JALL', 'language')))); return $items; }
protected function getOptions() { $options = array(); require_once dirname(__FILE__) . '/../assets/cdnjs.php'; foreach ($cdnjs as $key => $option) { // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', $option, JText::alt(trim($key), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', false); // Add the option object to the result set. $options[] = $tmp; } reset($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(); for ($i = 0; $i < 32; $i++) { // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', (string) $i, JText::alt(trim((string) $i), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', false); // Add the option object to the result set. $options[] = $tmp; } reset($options); return $options; }
protected function getInput() { global $expose; $html = ''; $fonts = ''; $options = array(); $url = JURI::getInstance(); $id = $url->getVar('id'); // Initialize some field attributes. $class = $this->element['class']; $selectClass = 'class="gfonts"'; $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : ''; $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : ''; $wrapstart = '<div class="field-wrap fonts-list clearfix ' . $class . '">'; $wrapend = '</div>'; //create a google font list file on admin folder to avoid api call and slow down the admin panel $fileName = 'gfonts.txt'; $template = $this->form->getValue('template'); $path = JPATH_ROOT . '/templates/' . $template . '/asset/' . $fileName; if (!JFile::exists($path) or JFile::read($path) == NULL) { $this->createFontList($path); } $fontsPath = JPATH_ROOT . '/templates/' . $template . '/fonts/'; //var_dump( $path);die(); if (JFolder::exists($fontsPath)) { $fontFolders = JFolder::listFolderTree($fontsPath, $filter = '', $maxLevel = 1, $level = 0, $parent = 0); } $data = JFile::read($path); $data = explode(';', $data); //add none $options[] = JHtml::_('select.option', '0', JText::alt('JOPTION_DO_NOT_USE', 'language')); $options[] = JHtml::_('select.option', '-1', JText::alt('---------- General fonts ----------', 'language')); $options[] = JHtml::_('select.option', '\'Arial\', Helvetica, sans-serif', JText::alt('"Arial", Helvetica, sans-serif', 'language')); $options[] = JHtml::_('select.option', '\'Times New Roman\', Times, serif', JText::alt('"Times New Roman", Times, serif', 'language')); $options[] = JHtml::_('select.option', '\'Courier New\', Courier, monospace', JText::alt('"Courier New", Courier, monospace', 'language')); $options[] = JHtml::_('select.option', '\'Georgia\',Times New Roman, Times, serif', JText::alt('"Georgia",Times New Roman, Times, serif', 'language')); $options[] = JHtml::_('select.option', '\'Verdana\', Arial, Helvetica, sans-serif', JText::alt('"Verdana", Arial, Helvetica, sans-serif', 'language')); $options[] = JHtml::_('select.option', '-1', JText::alt('---------- Google fonts ----------', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); foreach ($data as $val) { //var_dump($val); list($fontVal, $fontName) = explode('=', "{$val}="); $fontVal = str_replace(' ', '+', $fontVal); $options[] = JHtml::_('select.option', $fontVal, $fontName); } //pop the last empty array array_pop($options); $html .= '<a class="link-gfont" href="http://www.google.com/webfonts" target="_blank">' . JText::_('GOOGLE_FONT_LINK_LABLE') . '</a>'; $html .= JHtml::_('select.genericlist', $options, $this->name, $selectClass, 'value', 'text', $this->value, $this->id); return $wrapstart . $pretext . $html . $posttext . $wrapend; }
protected function getOptions() { $options = array(); foreach ($this->element->children() as $option) { if ($option->getName() != 'option') { continue; } $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true'); $tmp->class = (string) $option['class']; $options[] = $tmp; } reset($options); return $options; }
protected function getOptions() { $app = JFactory::getApplication(); $view = $app->input->getCmd('view', ''); $parentId = $app->input->getInt('parent_id', 1); $catId = $app->input->getInt('id', 0); $options = array(); $_options = array(); foreach ($this->element->children() as $option) { if ($option->getName() != 'option') { continue; } $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true'); $tmp->class = (string) $option['class']; $tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } JLoader::register('JUDownloadFrontHelperCategory', JPATH_SITE . '/components/com_judownload/helpers/category.php', false); JLoader::register('JUDownloadHelper', JPATH_ADMINISTRATOR . '/components/com_judownload/helpers/judownload.php', false); $checkPublished = $this->element['checkpublished'] == 'true' || $this->element['checkpublished'] == '1' ? true : false; $checkCreatePermission = false; if (isset($this->element['checkcreatepermissiononcat'])) { if ($this->element['checkcreatepermissiononcat'] == 'true' || $this->element['checkcreatepermissiononcat'] == '1') { $checkCreatePermission = 'category'; } } else { if ($this->element['checkcreatepermissionondoc'] == 'true' || $this->element['checkcreatepermissionondoc'] == '1') { $checkCreatePermission = 'document'; } } $getSelf = $this->element['fetchself'] == 'true' || $this->element['fetchself'] == '1' ? true : false; $startLevel = $this->element['startlevel'] ? $this->element['startlevel'] : 0; $separation = $this->element['separation'] ? $this->element['separation'] : '|—'; $ignorecat = $this->element['ignorecat'] ? explode(',', $this->element['ignorecat']) : array(); if ($view == 'category') { if ($catId) { $_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, array($catId), $startLevel, $separation); } elseif ($parentId) { $_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, $ignorecat, $startLevel, $separation); if ($this->value == "") { $this->value = $parentId; } } } else { $_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, $ignorecat, $startLevel, $separation); } reset($options); $options = array_merge($options, $_options); return $options; }