/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Merge any additional options in the XML definition. global $gantry; $options = parent::getOptions(); $unique = $this->getBool('unique', false); if ($unique) { $positions = $gantry->getUniquePositions(); } else { $positions = $gantry->getPositions(); } $hide_mobile = $this->getBool('hide_mobile', false); $options = array(); foreach ($positions as $position) { $positionInfo = $gantry->getPositionInfo($position); if ($hide_mobile && $positionInfo->mobile) { continue; } $val = $position; $text = $position; $tmp = GantryHtmlSelect::option($val, $text, 'value', 'text', false); $options[] = $tmp; } return $options; }
protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); $hide_mobile = false; $positions = $gantry->getUniquePositions(); foreach ($positions as $position) { $positionInfo = $gantry->getPositionInfo($position); if ($hide_mobile && $positionInfo->mobile) { continue; } if (1 == (int) $positionInfo->max_positions) { $split_postions[] = $positionInfo->id; continue; } for ($i = 1; $i <= (int) $positionInfo->max_positions; $i++) { $split_postions[] = $positionInfo->id . '-' . chr(96 + $i); } } foreach ($split_postions as $position) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($position, $position, 'value', 'text', false); $options[] = $tmp; } return $options; }
public function getInput() { global $gantry; $buffer = ''; // get the sets just below foreach ($this->fields as $field) { if ($field->type == 'set') { $this->sets[] = $field; } } $buffer .= "<div class='wrapper'>\n"; foreach ($this->fields as $field) { if ((string) $field->type != 'set') { $selector = false; $enabler = false; if ($field->element['enabler'] && strtolower((string) $field->element['enabler']) == 'true') { $this->enabler = $field; $enabler = true; } if ($field->element['selector'] && (string) $field->element['selector'] == true) { $field->detached = false; $selector = true; if ($field != $this->enabler && isset($this->enabler) && (int) $this->enabler->value == 0) { $field->detached = true; } foreach ($this->sets as $set) { //Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option((string) $set->element['name'], JText::_(trim((string) $set->element['label'])), 'value', 'text', (string) $set->element['disabled'] == 'true'); // Set some option attributes. $tmp->class = (string) $set->element['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $set->element['onclick']; // Add the option object to the result set. //$options[] = $tmp; $field->addOption($tmp); } } $this->activeSet[$field->type] = $field->value; //array_push(array($field->type => $field->value), $this->activeSet); $itemName = $this->fieldname . "-" . $field->fieldname; $buffer .= '<div class="chain ' . $itemName . ' chain-' . strtolower($field->type) . '">' . "\n"; if (strlen($field->getLabel())) { $buffer .= '<span class="chain-label">' . JText::_($field->getLabel()) . '</span>' . "\n"; } if ($selector) { $buffer .= '<div class="selectedset-switcher">' . "\n"; } if ($enabler) { $buffer .= '<div class="selectedset-enabler">' . "\n"; } $buffer .= $field->getInput(); if ($selector || $enabler) { $buffer .= '</div>' . "\n"; } $buffer .= "</div>" . "\n"; } } $buffer .= "</div>" . "\n"; return $buffer; }
/** * Method to get the field option groups. * * @return array The field option objects as a nested array in groups. * @since 1.6 */ protected function getOptions() { // Initialize variables. $options = array(); // Initialize some field attributes. $menuType = (string) $this->element['menu_type']; $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array(); $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array(); // Get the menu items. $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published); // Build group for a specific menu type. if ($menuType) { // Build the options array. foreach ($items as $link) { $options[$menuType][] = GantryHtmlSelect::option($link->value, $link->text, 'value', 'text', in_array($link->type, $disable)); } } else { // Build the groups arrays. foreach ($items as $menu) { // Initialize the group. $options[] = GantryHtmlSelect::option($menu->menutype, $menu->title, 'value', 'text', true); // Build the options array. foreach ($menu->links as $link) { $options[] = GantryHtmlSelect::option($link->value, $link->text, 'value', 'text', in_array($link->type, $disable)); } } } // Merge any additional groups in the XML definition. //$groups = array_merge(parent::getGroups(), $groups); return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); foreach (GantryWidgetMenu::$themes as $theme) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($theme['name'], $theme['fullname'], 'value', 'text', false); $options[] = $tmp; } return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); $choices = array("linear", "Quad.easeOut", "Quad.easeIn", "Quad.easeInOut", "Cubic.easeOut", "Cubic.easeIn", "Cubic.easeInOut", "Quart.easeOut", "Quart.easeIn", "Quart.easeInOut", "Quint.easeOut", "Quint.easeIn", "Quint.easeInOut", "Expo.easeOut", "Expo.easeIn", "Expo.easeInOut", "Circ.easeOut", "Circ.easeIn", "Circ.easeInOut", "Sine.easeOut", "Sine.easeIn", "Sine.easeInOut", "Back.easeOut", "Back.easeIn", "Back.easeInOut", "Bounce.easeOut", "Bounce.easeIn", "Bounce.easeInOut", "Elastic.easeOut", "Elastic.easeIn", "Elastic.easeInOut"); foreach ($choices as $choice) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($choice, $choice, 'value', 'text', false); $options[] = $tmp; } return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); $menus = wp_get_nav_menus(); foreach ($menus as $menu) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($menu->slug, $menu->name, 'value', 'text', false); $options[] = $tmp; } return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Merge any additional options in the XML definition. global $gantry; $options = parent::getOptions(); $menus = JHtml::_('menu.menus'); foreach ($menus as $menu) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($menu->value, $menu->text, 'value', 'text', false); $options[] = $tmp; } return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); $cats = get_terms('category'); foreach ($cats as $cat) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($cat->slug, $cat->name, 'value', 'text', false); $options[] = $tmp; } return $options; }
public function getInput() { /** @var $gantry Gantry */ global $gantry; $name = (string) $this->element['name']; $class = $this->element['class'] ? 'class="' . $this->element['class'] . '"' : 'class="inputbox"'; $mode = $this->element['mode']; if (!isset($mode)) { $mode = 'dropdown'; } $options = array(); if (!array_key_exists($name, $gantry->presets)) { return 'Unable to find the preset information'; } foreach ($gantry->presets[$name] as $preset_name => $preset_value) { $val = $preset_name; $text = $preset_value['name']; if (!array_key_exists('disabled', $preset_value)) { $preset_value['disabled'] = 'false'; } $options[] = GantryHtmlSelect::option((string) $val, JText::_(trim((string) $text)), 'value', 'text', (string) $preset_value['disabled'] == 'true'); } if (!defined('GANTRY_PRESET')) { gantry_import('core.gantryjson'); $template_path_parts = explode('/', $gantry->templatePath); $this->template = end($template_path_parts); $gantry->addScript($gantry->gantryUrl . '/admin/widgets/preset/js/preset.js'); $gantry->addScript($gantry->gantryUrl . '/admin/widgets/preset/js/preset-saver.js'); $gantry->addInlineScript('var Presets = {};var PresetsKeys = {};'); if (isset($gantry->customPresets[$name])) { $gantry->addInlineScript('var CustomPresets = ' . GantryJSON::encode($gantry->customPresets[$name]) . ';'); } else { $gantry->addInlineScript('var CustomPresets = {};'); } define('GANTRY_PRESET', 1); } $this->presets = $gantry->originalPresets[$name]; $gantry->addInlineScript($this->populatePresets((string) $this->element['name'])); if ($mode == 'dropdown') { include_once 'selectbox.php'; $gantry->addDomReadyScript("PresetDropdown.init('" . $name . "');"); $selectbox = new JElementSelectBox(); $node->addAttribute('preset', true); return $selectbox->fetchElement($name, $value, $node, $control_name, $options); } else { $gantry->addDomReadyScript("Scroller.init('" . $name . "');"); return $this->scrollerLayout($this->element); } }
protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); if ($this->position_info != null) { if ($this->position_info->max_positions < (int) $this->value) { $gantry->set($this->id, $this->position_info->max_positions); $this->value = $this->position_info->max_positions; } for ($i = 1; $i <= $this->position_info->max_positions; $i++) { // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option($i, $i, 'value', 'text', false); $options[] = $tmp; } } return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ public 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[] = GantryHtmlSelect::option('-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = GantryHtmlSelect::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[] = GantryHtmlSelect::option($file, $file); } } // 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() { // 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 = GantryHtmlSelect::option((string) $option['value'], _r(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 object to the result set. $options[] = $tmp; } reset($options); return $options; }
protected function getOptions() { global $gantry; $options = array(); $options = parent::getOptions(); if (!defined("GANTRY_FONTS")) { $gantry->addScript($gantry->gantryUrl . '/admin/widgets/fonts/js/fonts.js'); $gantry->addDomReadyScript("GantryFonts.init('webfonts_enabled', 'webfonts_source', 'font_family');"); define("GANTRY_FONTS", 1); } // only google right now if ($gantry->get('webfonts-source') == 'google') { $webfonts = $this->_google_fonts; } if ($gantry->get('webfonts-enabled')) { $disabled = false; } else { $disabled = true; } foreach ($webfonts as $webfont) { $webfontsData = $webfont; $webfontsValue = $webfont; $text = $webfontsData; // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option((string) $webfontsValue, JText::_(trim((string) $text)), 'value', 'text', $disabled); // adding reference source class if (in_array($webfont, $this->_google_fonts)) { $option['class'] = 'google'; } else { $option['class'] = 'native'; } // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = isset($option['onclick']) ? (string) $option['onclick'] : ''; // Add the option object to the result set. $options[] = $tmp; } return $options; }
function getInput() { JHTML::_('behavior.modal'); /** @var $gantry Gantry */ global $gantry; $layout = $link = $dropdown = ""; $options = $choices = array(); $nomargin = false; $rokgallery = self::checkForRokGallery(); //$rokgallery = false; // debug $value = str_replace("'", '"', $this->value); $data = json_decode($value); if (!$data && strlen($value)) { $nomargin = true; $data = json_decode('{"path":"' . $value . '"}'); } $preview = ""; $preview_width = 'width="100"'; $preview_height = 'height="70"'; if (!$data && (!isset($data->preview) || !isset($data->path))) { $preview = $gantry->gantryUrl . '/admin/widgets/imagepicker/images/no-image.png'; } else { if (isset($data->preview)) { $preview = $data->preview; } else { $preview = JURI::root(true) . '/' . $data->path; $preview_height = ""; } } if (!defined('ELEMENT_RTIMAGEPICKER')) { $gantry->addStyle($gantry->gantryUrl . '/admin/widgets/imagepicker/css/imagepicker.css'); gantry_addInlineScript("\n\t\t\tif (typeof jInsertEditorText == 'undefined'){\n\t\t\t\tfunction jInsertEditorText(text, editor) {\n\t\t\t\t\tvar source = text.match(/(src)=(\"[^\"]*\")/i), img;\n\t\t\t\t\ttext = source[2].replace(/\\\"/g, '');\n\t\t\t\t\timg = '" . JURI::root(true) . "/' + text;\n\n\t\t\t\t\tdocument.getElementById(editor + '-img').src = img;\n\t\t\t\t\tdocument.getElementById(editor + '-img').removeProperty('height');\n\t\t\t\t\tdocument.getElementById(editor).value = JSON.encode({path: text});\n\t\t\t\t};\n\t\t\t};\n\t\t\t"); gantry_addInlineScript("\n\t\t\t\tvar AdminURI = '" . JURI::base(true) . "/';\n\t\t\t\tvar GalleryPickerInsertText = function(input, string, size, minithumb){\n\t\t\t\t\tvar data = {\n\t\t\t\t\t\tpath: string,\n\t\t\t\t\t\twidth: size.width,\n\t\t\t\t\t\theight: size.height,\n\t\t\t\t\t\tpreview: minithumb\n\t\t\t\t\t};\n\n\t\t\t\t\tdocument.getElementById(input + '-img').src = minithumb;\n\t\t\t\t\tdocument.getElementById(input + '-infos').innerHTML = data.width + ' x ' + data.height;\n\t\t\t\t\tdocument.getElementById(input).value = JSON.encode(data);\n\n\t\t\t\t};\n\n\t\t\t\tvar empty_background_img = '" . $gantry->gantryUrl . "/admin/widgets/imagepicker/images/no-image.png';\n\n\t\t\t"); define('ELEMENT_RTIMAGEPICKER', true); } gantry_addInlineScript("\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tdocument.id('" . $this->id . "').addEvent('keyup', function(value){\n\t\t\t\t\tdocument.id('" . $this->id . "-infos').innerHTML = '';\n\t\t\t\t\tif (!value || !value.length) document.id('" . $this->id . "-img').set('src', empty_background_img);\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar data = JSON.decode(value);\n\t\t\t\t\t\tdocument.id('" . $this->id . "-img').set('src', (data.preview ? data.preview : '" . JURI::root(true) . "/' + data.path));\n\t\t\t\t\t\tif (!data.preview){\n\t\t\t\t\t\t\tdocument.id('" . $this->id . "-img').removeProperty('height');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.id('" . $this->id . "-img').set('height', '50');\n\t\t\t\t\t\t\tif (data.width && data.height) document.id('" . $this->id . "-infos').innerHTML = data.width + ' x ' + data.height;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.setProperty('value', value);\n\t\t\t\t});\n\n\t\t\t\tdocument.id('" . $this->id . "-clear').addEvent('click', function(e){\n\t\t\t\t\te.stop();\n\t\t\t\t\tdocument.id('" . $this->id . "').set('value', '').fireEvent('set', '');\n\t\t\t\t\tdocument.id('" . $this->id . "-img').src = empty_background_img;\n\t\t\t\t\tdocument.id('" . $this->id . "-infos').innerHTML = '';\n\t\t\t\t});\n\n\t\t\t\tvar dropdown = document.id('" . $this->id . "mediatype');\n\t\t\t\tif (dropdown){\n\t\t\t\t\tdropdown.addEvent('change', function(){\n\t\t\t\t\t\tdocument.id('" . $this->id . "-link').set('href', this.value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t"); if ($rokgallery) { $link = 'index.php?option=com_rokgallery&view=gallerypicker&tmpl=component&show_menuitems=0&inputfield=' . $this->id; } else { $link = "index.php?option=com_media&view=images&layout=default&tmpl=component&e_name=" . $this->id; } if ($rokgallery) { $choices = array(array('RokGallery', 'index.php?option=com_rokgallery&view=gallerypicker&tmpl=component&show_menuitems=0&inputfield=' . $this->id), array('MediaManager', 'index.php?option=com_media&view=images&layout=default&tmpl=component&e_name=' . $this->id)); foreach ($choices as $option) { $options[] = GantryHtmlSelect::option($option[1], $option[0], 'value', 'text'); } include_once $gantry->gantryPath . '/' . 'admin' . '/' . 'forms' . '/' . 'fields' . '/' . 'selectbox.php'; $selectbox = new GantryFormFieldSelectBox(); $selectbox->id = $this->id . 'mediatype'; $selectbox->value = $link; $selectbox->addOptions($options); $dropdown = '<div id="' . $this->id . '-mediadropdown" class="mediadropdown">' . $selectbox->getInput() . "</div>"; } $value = str_replace('"', "'", $value); $layout .= ' <div class="wrapper">' . "\n" . ' <div id="' . $this->id . '-wrapper" class="backgroundpicker">' . "\n" . ' <img id="' . $this->id . '-img" class="backgroundpicker-img" ' . $preview_width . ' ' . $preview_height . ' alt="" src="' . $preview . '" /> <div id="' . $this->id . '-infos" class="backgroundpicker-infos" ' . ($rokgallery && !$nomargin ? 'style="display:inline-block;"' : 'style="display:none;"') . ' >' . (isset($data->width) && isset($data->height) ? $data->width . ' x ' . $data->height : '') . '</div> <a id="' . $this->id . '-link" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 675, y: 450}}" class="rok-button modal">' . "\n" . ' Select </a>' . "\n" . ' <a id="' . $this->id . '-clear" href="#" class="rok-button bg-button-clear">' . "\n" . ' Reset </a>' . "\n" . ' ' . $dropdown . ' <input class="background-picker" type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $value . '" />' . "\n" . ' <div class="clr"></div> </div>' . "\n" . ' </div>' . "\n" . ' '; return $layout; }
protected function getOptions() { /** @var $gantry Gantry */ global $gantry; if (isset($this->element->option)) { foreach ($this->element->option as $option) { if ($option->getName() != 'option') { continue; } $label = $this->translate_options ? JText::_(trim((string) $option)) : trim((string) $option); $tmp = GantryHtmlSelect::option('s:' . (string) $option['value'], $label, 'value', 'text', $this->getBool('disabled', false, $option)); $tmp->class = (string) $option['class']; $tmp->onclick = (string) $option['onclick']; $this->options[] = $tmp; } } reset($this->options); return $this->options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { if (isset($this->element->option)) { foreach ($this->element->option as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } $label = $this->translate_options ? _g(trim((string) $option)) : trim((string) $option); // Create a new option object based on the <option /> element. $tmp = GantryHtmlSelect::option((string) $option['value'], $label, 'value', 'text', $this->getBool('disabled', false, $option)); // 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. $this->options[] = $tmp; } } reset($this->options); return $this->options; }