function fetchElement($name, $value, &$node, $control_name) { global $gantry; $final_ordered_features = array(); if (!defined('GANTRY_FEATURES')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl . '/admin/widgets/features/js/features.js'); define('GANTRY_FEATURES', 1); } $features_ordered_initial = explode(",", $value); foreach ($features_ordered_initial as $ordered_feature) { if (array_key_exists($ordered_feature, $gantry->_features)) { $final_ordered_features[] = $ordered_feature; } } foreach ($gantry->_features as $feature => $value) { if (!in_array($feature, $final_ordered_features)) { $final_ordered_features[] = $feature; } } $output = '<div class="wrapper">'; $output .= '<div id="features-sort">'; $output .= '<ul>'; foreach ($final_ordered_features as $feature) { $feature_instance = $gantry->_getFeature($feature); if ($feature_instance->isOrderable()) { $output .= '<li>' . $feature . '</li>'; } } $output .= '</ul></div>'; $output .= '<input type="hidden" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . implode(",", $final_ordered_features) . '"/>'; $output .= "</div>"; return $output; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; if (!defined("MENUITEM_HEADER")) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl . '/admin/widgets/menuitemhead/js/menuitemhead.js'); define("MENUITEM_HEADER", 1); } if (JFile::exists(dirname(__FILE__) . DS . "menuitem.php")) { require_once dirname(__FILE__) . DS . "menuitem.php"; } else { require_once JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'html' . DS . 'parameter' . DS . 'element' . DS . "menuitem.php"; } if (JFile::exists(dirname(__FILE__) . DS . "toggle.php")) { require_once dirname(__FILE__) . DS . "toggle.php"; } else { require_once JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'html' . DS . 'parameter' . DS . 'element' . DS . "toggle.php"; } $instance = new JElementMenuItem(); $toggle = new JElementToggle(); $output = '<div id="master-bar">'; $output .= ' <span id="master-defaults" class="button active">' . JText::_('DEFAULTS') . '</span>'; $output .= ' <span id="master-items" class="button">' . JText::_('MENU_ITEMS') . '</span>'; $output .= ' <div class="master-items">' . $instance->fetchElement($name, $value, $node, $control_name) . '</div>'; $output .= '</div>'; $output .= '<div id="master-bar-desc">'; $output .= ' <span class="notice_defaults">' . JText::_('DEFAULTS_NOTICE') . '</span>'; $output .= ' <span class="notice_menuitems"><a id="erase-custom" href="#">Remove Custom Settings for this Menu Item</a><br /><br /></span>'; $output .= ' <span class="notice_menuitems">' . JText::_('MENUITEMS_NOTICE') . '</span>'; $output .= "</div>"; return $output; }
function fetchElement($name, $value, &$node, $control_name, $options = false, $translation = true) { global $gantry; if (!defined('GANTRY_SELECTBOX')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl . '/admin/widgets/selectbox/js/selectbox.js'); define('GANTRY_SELECTBOX', 1); } $lis = $activeElement = ""; $xml = false; if (!$options) { $options = $node->children(); $xml = true; } $isPreset = $node->attributes('preset') ? $node->attributes('preset') : false; foreach ($options as $option) { if ($xml) { $optionData = $option->data(); $optionValue = $option->attributes('value'); $optionDisabled = $option->attributes('disable'); } else { $optionData = $option->text; $optionValue = $option->value; $optionDisabled = $option->disable; } $disabled = $optionDisabled == 'disable' ? "disabled='disabled'" : ""; $selected = $value == $optionValue ? "selected='selected'" : ""; $active = $value == $optionValue ? "class='active'" : ""; if (strlen($active)) { $activeElement = $optionData; } if (strlen($disabled)) { $active = "class='disabled'"; } $imapreset = $isPreset ? "im-a-preset" : ""; $text = $translation ? JTEXT::_($optionData) : $optionData; $options .= "<option value='{$optionValue}' {$selected} {$disabled}>" . $text . "</option>\n"; $lis .= "<li " . $active . ">" . $text . "</li>"; } $activeElement = $translation ? JTEXT::_($activeElement) : $activeElement; $html = "<div class='wrapper'>"; $html .= "<div class='selectbox-wrapper'>"; $html .= "\t<div class='selectbox'>"; $html .= "\t\t<div class='selectbox-top'>"; $html .= "\t\t\t<div class='selected'><span>" . $activeElement . "</span></div>"; $html .= "\t\t\t<div class='arrow'></div>"; $html .= "\t\t</div>"; $html .= "\t\t<div class='selectbox-dropdown'>"; $html .= "\t\t\t<ul>" . $lis . "</ul>"; $html .= "\t\t\t<div class='selectbox-dropdown-bottom'><div class='selectbox-dropdown-bottomright'></div></div>"; $html .= "\t\t</div>"; $html .= "\t</div>"; $html .= "\t<select id='params" . $name . "' name='params[" . $name . "]' class='selectbox-real " . $imapreset . "'>"; $html .= $options; $html .= "\t</select>"; $html .= "</div>"; $html .= "<div class='clr'></div>"; $html .= "</div>"; return $html; }
/** * @global gantry used to access the core Gantry class * @param $name * @param $value * @param $node * @param $control_name * @return void */ function fetchElement($name, $value, &$node, $control_name) { global $gantry; $output = ""; $document =& JFactory::getDocument(); $arrayList = "'" . implode("', '", explode(",", str_replace(" ", "", $node->attributes('default')))) . "'"; if (!defined('GANTRY_ADMIN')) { include_once dirname(dirname(__FILE__)) . '/../gantry.php'; gantry_import('core.gantrybrowser'); $browser = new GantryBrowser(); $gantry_created_dirs = array($gantry->custom_dir, $gantry->custom_menuitemparams_dir); $this->template = end(explode(DS, $gantry->templatePath)); gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css'); if ($browser->name == 'ie' && $browser->version == '7' && file_exists($gantry->gantryPath . DS . 'admin' . DS . 'widgets' . DS . 'gantry-ie7.css')) { gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry-ie7.css'); } gantry_addScript($gantry->gantryUrl . '/admin/widgets/gantry.js'); gantry_addInlineScript("var GantrySlideList = [" . $arrayList . "];var AdminURI = '" . JURI::base() . "';var UnallowedParams = ['" . implode("', '", $gantry->dontsetinmenuitem) . '\'];'); gantry_addInlineScript($this->gantryLang()); // fixes Firefox < 3.7 input line-height issue if ($browser->name == 'firefox' && $browser->version < '3.7' || $browser->name == 'ie' && $browser->version > '6') { $css = ".text-short, .text-medium, .text-long, .text-color {padding-top: 4px;height:19px;}"; gantry_addInlineStyle($css); } if ($browser->name == 'ie' && $browser->shortversion == '7') { $css = "\n\t\t\t\t\t.g-surround, .g-inner, .g-surround > div {zoom: 1;position: relative;}\n\t\t\t\t\t.text-short, .text-medium, .text-long, .text-color {border:0 !important;}\n\t\t\t\t\t.selectbox {z-index:500;position:relative;}\n\t\t\t\t\t.group-fusionmenu, .group-splitmenu {position:relative;margin-top:0 !important;zoom:1;}\n\t\t\t\t\t.scroller .inner {position:relative;}\n\t\t\t\t\t.moor-hexLabel {display:inline-block;zoom:1;float:left;}\n\t\t\t\t\t.moor-hexLabel input {float:left;}\n\t\t\t\t"; gantry_addInlineStyle($css); } //create dirs needed by gantry foreach ($gantry_created_dirs as $dir) { if (is_readable(dirname($dir)) && is_writeable(dirname($dir)) && !JFolder::exists($dir)) { JFolder::create($dir); } } if (version_compare(JVERSION, '1.5.14', '<=')) { $tmpscripts = array(); foreach ($document->_scripts as $script => $type) { if ($script != $gantry->baseUrl . 'media/system/js/mootools.js') { $tmpscripts[$script] = $type; } else { $tmpscripts[$gantry->gantryUrl . '/js/mootools-1.1.2.js'] = $type; } } $document->_scripts = $tmpscripts; } $this->checkAjaxTool(); define('GANTRY_ADMIN', 1); } if (file_exists($gantry->templatePath . "/gantry.scripts.php") && is_readable($gantry->templatePath . "/gantry.scripts.php")) { include_once $gantry->templatePath . "/gantry.scripts.php"; if (function_exists('gantry_params_init')) { gantry_params_init(); } } $this->_parent->addElementPath($gantry->templatePath . DS . 'elements'); $this->_parent->addElementPath($gantry->templatePath . DS . 'admin/elements'); }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; if (!defined('GANTRY_GRADIENT')) { gantry_addScript($gantry->gantryUrl . '/admin/widgets/gradient/js/gradient.js'); define('GANTRY_GRADIENT', 1); } $functions = "_jsInit_" . $gantry->platform->getJSInit(); gantry_addInlineScript($this->{$functions}($name, $value, $node, $control_name)); $output = "<div id='" . $name . "' class='gradient-preview'></div>\n"; return $output; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' ); $mode = $node->attributes('mode'); if (!isset($mode)) $mode = 'dropdown'; $options = array(); if (!array_key_exists($name,$gantry->presets)) { return JText::_('Unable to find the preset information'); } foreach ($gantry->presets[$name] as $preset_name => $preset_value) { $val = $preset_name; $text = $preset_value['name']; $options[] = JHTML::_('select.option', $val, JText::_($text)); } if (!defined('GANTRY_PRESET')) { gantry_import('core.gantryjson'); $this->template = end(explode(DS, $gantry->templatePath)); 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]).';'); } define('GANTRY_PRESET', 1); } $this->presets = $gantry->originalPresets[$name]; gantry_addInlineScript($this->populatePresets($name)); if ($mode == 'dropdown') { include_once('selectbox.php'); gantry_addInlineScript("window.addEvent('domready', PresetDropdown.init.bind(PresetDropdown, '$name'));"); $selectbox = new JElementSelectBox; $node->addAttribute('preset', true); return $selectbox->fetchElement($name, $value, $node, $control_name, $options); } else { gantry_addInlineScript("window.addEvent('domready', Scroller.init.bind(Scroller, '$name'));"); return $this->scrollerLayout($name, $value, $node, $control_name); } }
function fetchElement($name, $value, &$node, $control_name) { //global $stylesList; /** * @global Gantry $gantry */ global $gantry; $output = ''; $this->template = end(explode(DS, $gantry->templatePath)); //$styles = '../templates/'.$this->template.'/styles.php'; //if (file_exists($styles)) include_once($styles); //else return "No styles file found"; $transparent = 1; if ($node->attributes('transparent') == 'false') $transparent = 0; if (!defined('GANTRY_CSS')) { gantry_addStyle($gantry->gantryUrl.'/admin/widgets/gantry.css'); define('GANTRY_CSS', 1); } if (!defined('GANTRY_MOORAINBOW')) { gantry_addStyle($gantry->gantryUrl.'/admin/widgets/colorchooser/css/mooRainbow.css'); gantry_addScript($gantry->gantryUrl.'/admin/widgets/colorchooser/js/mooRainbow.js'); //$scriptconfig = $this->populateStyles($stylesList); $scriptconfig = $this->rainbowInit(); gantry_addInlineScript($scriptconfig); define('GANTRY_MOORAINBOW',1); } $scriptconfig = $this->newRainbow($name, $transparent); gantry_addInlineScript($scriptconfig); $output .= "<div class='wrapper'>"; $output .= "<input class=\"picker-input text-color\" id=\"".$control_name.$name."\" name=\"".$control_name."[".$name."]\" type=\"text\" size=\"7\" maxlength=\"11\" value=\"".$value."\" />"; $output .= "<div class=\"picker\" id=\"myRainbow_".$name."_input\"><div class=\"overlay".(($value == 'transparent') ? ' overlay-transparent' : '')."\" style=\"background-color: ".$value."\"><div></div></div></div>\n"; $output .= "</div>"; //$output = false; return $output; }
function fetchElement($name, $value, &$node, $control_name = 'params') { global $gantry; $hidden = '<input type="hidden" name="' . $name . '" value="_" />'; $options = array(); $options[] = array('value' => 1, 'text' => 'On/Off', 'id' => $name); if (!defined('GANTRY_TOGGLE')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl . '/admin/widgets/toggle/js/touch.js'); gantry_addScript($gantry->gantryUrl . '/admin/widgets/toggle/js/toggle.js'); define('GANTRY_TOGGLE', 1); } gantry_addInlineScript($this->toggleInit($name)); $checked = $value == 0 ? '' : 'checked="checked"'; return "\n\t\t<div class='wrapper'>\n\t\t\t<input name='" . $control_name . "[" . $name . "]' value='{$value}' type='hidden' />\n\t\t\t<input type='checkbox' class='toggle' id='params{$name}' {$checked} />\n\t\t</div>\n\t\t"; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; if (!defined('GANTRY_RADIOS')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl . '/admin/widgets/radios/js/radios.js'); } $options = array(); $class = $node->attributes('class') ? $node->attributes('class') : 'rokradios'; foreach ($node->children() as $option) { $val = $option->attributes('value'); $text = $option->data(); $options[] = JHTML::_('select.option', $val, JText::_($text)); } return JHTML::_('select.radiolist', $options, '' . $control_name . '[' . $name . ']', 'class="' . $class . '"', 'value', 'text', $value, $control_name . $name); }
function fetchElement($name, $value, &$node, $control_name='params') { global $gantry; $hidden = '<input type="hidden" name="'.$name.'" value="_" />'; $options = array (); $options[] = array('value'=>1,'text'=>'On/Off','id'=>$name); if (!defined('GANTRY_TOGGLE')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl.'/admin/widgets/toggle/js/touch.js'); gantry_addScript($gantry->gantryUrl.'/admin/widgets/toggle/js/toggle.js'); define('GANTRY_TOGGLE',1); } //gantry_addInlineScript($this->toggleInit($name)); $checked = ($value == 0) ? '' : 'checked="checked"'; if ($value == 0) $toggleStatus = 'unchecked'; else $toggleStatus = 'checked'; return ' <div class="wrapper">'."\n".' <div class="toggle">'."\n".' <div class="toggle-container toggle-'.$toggleStatus.'">'."\n".' <div class="toggle-sides">'."\n".' <div class="toggle-wrapper">'."\n".' <div class="toggle-switch"></div>'."\n".' <input type="hidden" name="'.$control_name.'['.$name.']" value="'.$value.'" />'."\n".' <input type="checkbox" class="toggle-input" id="params'.$name.'" value="'.$value.'" '.$checked.' />'."\n".' </div>'."\n".' <div class="toggle-button"></div>'."\n".' </div>'."\n".' </div>'."\n".' </div>'."\n".' </div>'."\n".' '; return " <div class='wrapper'> <input name='".$control_name."[".$name."]' value='$value' type='hidden' /> <input type='checkbox' class='toggle' id='params$name' $checked /> </div> "; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; $output = ''; $this->template = end(explode(DS, $gantry->templatePath)); $class = $node->attributes('class') ? $node->attributes('class') : ''; if (!defined('GANTRY_CSS')) { gantry_addStyle($gantry->gantryUrl.'/admin/widgets/gantry.css'); define('GANTRY_CSS', 1); } if (!defined('GANTRY_POSITIONS')) { gantry_addScript($gantry->gantryUrl.'/admin/widgets/slider/js/slider.js'); if (!defined('GANTRY_SLIDER')) define('GANTRY_SLIDER', 1); } $this->value = $value; $this->children = array(); foreach($node->children() as $children) { $this->children[] = $children->data(); } $scriptinit = $this->sliderInit($name); gantry_addInlineScript($scriptinit); $output = ' <div class="wrapper"> <div id="'.$name.'" class="'.$class.'"> <!--<div class="note"> Internet Explorer 6 supports only the <strong>Low Quality</strong> setting. </div>--> <div class="slider"> <div class="slider2"></div> <div class="knob"></div> </div> <input type="hidden" id="params'.$name.'" class="slider" name="'.$control_name.'['.$name.']'.'" value="'.$this->value.'" /> </div> </div> '; return $output; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; $output = ''; $lis = ''; $currentScheme = ''; $this->template = end(explode(DS, $gantry->templatePath)); $this->name = $name; $this->value = $value; $this->default = explode(',', str_replace(' ', '', $node->attributes('default'))); $this->defaultCount = count($this->default); // [0] => schemas | [1] => words | [2] => maxgrid | [3] => type $opts = $node->children(); $this->maxGrid = (int) $gantry->get('grid_system'); if (!$this->maxGrid) { $this->maxGrid = 12; } $this->type = "regular"; if (count($opts)) { foreach ($opts as $opt) { $optName = $opt->name(); if ($optName == 'words') { $this->words = explode(",", $opt->data()); } if ($optName == 'schemas') { $this->schemas = explode(",", $opt->data()); } if ($optName == 'type') { $this->type = $opt->data(); } } } $this->keyName = ''; if ($this->type == 'custom') { $tmpName = str_replace("Position", "Schemas", $this->name); $tmpSchema = $this->{$tmpName}; $this->keyName = key($tmpSchema[1][0]); } $this->layoutSchemas = $gantry->layoutSchemas[$this->maxGrid]; $this->defaultMainbodySchemas = $gantry->mainbodySchemas; $this->mainbodySchemas = $gantry->mainbodySchemasCombos[$this->maxGrid]; if (!defined('GANTRY_CSS')) { gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css'); define('GANTRY_CSS', 1); } if (!defined('POSITIONS')) { if (!defined('GANTRY_SLIDER')) { gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/slider.js'); define('GANTRY_SLIDER', 1); } gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/unserialize.js'); $functions = "generalFunctions_" . $gantry->platform->getJSInit(); gantry_addInlineScript($this->{$functions}()); $this->settings = array("words" => $this->words, "schemas" => $this->schemas, "maxGrid" => $this->maxGrid); if ($this->type == 'custom') { $this->customCombinations = $this->getCombinations(); } else { $this->combinations = $this->getCombinations(); } define('POSITIONS', 1); } $posName = $name == "mainbodyPosition" ? "sidebar" : str_replace("Position", "", $name); $realCount = $gantry->countModules($posName); if ($posName == 'sidebar') { $realCount += 1; } if ($realCount > 0) { if (!in_array($realCount, $this->schemas)) { $realCount = $this->schemas[0]; } $this->default = $this->oneCharConversion($this->layoutSchemas[$realCount]); $this->defaultCount = $realCount; } // if the same type of combinations are requested, use the cached ones, otherwise get the new set if ($this->type != "custom" && ($this->words != $this->settings["words"] || $this->schemas != $this->settings["schemas"] || $this->maxGrid != $this->settings["maxGrid"])) { $this->combinations = $this->getCombinations(); } if ($this->type == "custom") { $this->customCombinations = $this->getCombinations(); } if (!in_array((string) $this->defaultCount, $this->schemas)) { $this->defaultCount = (int) $this->schemas[0]; } foreach ($this->schemas as $scheme) { $active = ""; if ((int) $scheme == $this->defaultCount) { $active = ' class="active"'; $currentLayout = $scheme; } $lis .= '<li' . $active . '><a href="#"><span>' . $scheme . '</span></a></li>'; } $init_function = "sliderInit_" . $gantry->platform->getJSInit(); gantry_addInlineScript($this->{$init_function}($name)); $output = ' <div class="wrapper"> <div id="' . $name . '" class="g-position"> <div class="navigation"> <span class="title">Positions:</span> <ul class="list">' . $lis . '</ul> </div> <div class="clr"></div> <div id="' . $name . '-wrapper" class="col' . $this->maxGrid . ' miniatures"> <div class="mini-container layout-grid-' . $currentLayout . '"> <div class="mini-grid mini-grid-2">a</div> <div class="mini-grid mini-grid-2">b</div> <div class="mini-grid mini-grid-2">c</div> <div class="mini-grid mini-grid-2">d</div> <div class="mini-grid mini-grid-2">e</div> <div class="mini-grid mini-grid-2">f</div> </div> <div class="clr"></div> <div class="position"> <div class="position2"></div> <div class="knob"></div> </div> </div> <div class="current-positions"> <span class="title">' . str_replace('%d', "<strong class='" . $name . "-currentPosition countPositions'>" . $realCount . "</strong>", JText::_('CURRENT_POSITIONS')) . '</span> </div> <div class="debug" style="display: none;"> <span class="title">DEBUG</span> <div id="output"></div> </div> <input type="hidden" id="params' . $name . '" name="' . $control_name . '[' . $name . ']' . '" value=\''; $output .= $this->value; $output .= '\' /> </div> </div> '; return $output; }
function fetchElement($name, $value, &$node, $control_name) { global $gantry; $output = ''; $this->template = $gantry->templateName; $class = $node->attributes('class') ? $node->attributes('class') : ''; $preview = $node->attributes('preview') ? $node->attributes('preview') : "false"; $path = $node->attributes('path') ? $node->attributes('path') : false; $this->default = $node->attributes('default') ? $node->attributes('default') : 'none'; if (!$path) { return "No path set in templateDetails.xml"; } if ($preview == 'true') { $class .= " overlay-slider"; } if (!defined('GANTRY_CSS')) { gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css'); define('GANTRY_CSS', 1); } if (!defined('GANTRY_SLIDER')) { gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/slider.js'); if (!defined('GANTRY_SLIDER')) { define('GANTRY_SLIDER', 1); } } if (!defined('GANTRY_OVERLAYS')) { $gantry->addInlineScript('var GantryOverlays = {};'); define('GANTRY_OVERLAYS', 1); } $this->value = $value; $rootPath = str_replace("__TEMPLATE__", $gantry->templatePath, $path); $urlPath = str_replace("__TEMPLATE__", $gantry->templateUrl, $path); $this->_loadOverlays($name, $rootPath); $overlays = array(); $__overlays = $gantry->retrieveTemp('overlays', 'overlays', array()); $__paths = $gantry->retrieveTemp('overlays', 'paths', array()); $overlays[$name] = "'none': {'file': 'overlay-off.png', 'value': 'none', 'name': 'Off', 'path': '" . $gantry->gantryUrl . "/admin/widgets/overlays/images/overlay-off.png'}, "; foreach ($__overlays[$name] as $title => $file) { $overlays[$name] .= "'" . $file['name'] . "': {'file': '" . $file['file'] . "', 'value': '" . $file['name'] . "', 'name': '" . $title . "', 'path': '" . $urlPath . $file['file'] . "'}, "; } $overlays[$name] = substr($overlays[$name], 0, -2); $gantry->addInlineScript('GantryOverlays["' . $name . '"] = new Hash({' . $overlays[$name] . '});'); $init_function = "sliderInit_" . $gantry->platform->getJSInit(); $scriptinit = $this->{$init_function}($name); gantry_addInlineScript($scriptinit); $output = ' <div class="wrapper"> '; $output .= '<div class="overlay-tip"> <div class="overlay-tip-left"></div> <div class="overlay-tip-mid"><span>Example</span></div> <div class="overlay-tip-right"></div> </div>'; if ($preview == 'true') { $output .= '<div class="overlay-preview"><div></div></div>'; } $output .= ' <div id="' . $name . '" class="' . $class . '"> <div class="slider"> <div class="slider2"></div> <div class="knob"></div> </div> <input type="hidden" id="params' . $name . '" class="slider" name="' . $control_name . '[' . $name . ']' . '" value="' . $this->value . '" /> </div> </div> '; $gantry->addTemp('overlays', 'overlays', $__overlays); $gantry->addTemp('overlays', 'paths', $__paths); return $output; }
function fetchElement($name, $value, &$node, $control_name, $options = false, $translation = true) { global $gantry; if (!defined('GANTRY_SELECTBOX')) { $this->template = end(explode(DS, $gantry->templatePath)); gantry_addScript($gantry->gantryUrl.'/admin/widgets/selectbox/js/selectbox.js'); define('GANTRY_SELECTBOX', 1); } $lis = $activeElement = ""; $options_list = ""; $xml = false; if (!$options) { $options = $node->children(); $xml = true; } $isPreset = ($node->attributes('preset')) ? $node->attributes('preset') : false; foreach($options as $option) { if ($xml) { $optionData = $option->data(); $optionValue = $option->attributes('value'); $optionDisabled = $option->attributes('disable'); } else { $optionData = $option->text; $optionValue = $option->value; $optionDisabled = $option->disable; } $disabled = ($optionDisabled == 'disable') ? "disabled='disabled'" : ""; $selected = ($value == $optionValue) ? "selected='selected'" : ""; $active = ($value == $optionValue) ? "class='active'" : ""; if (strlen($active)) $activeElement = $optionData; if (strlen($disabled)) $active = "class='disabled'"; $imapreset = ($isPreset) ? "im-a-preset" : ""; $text = ($translation) ? JTEXT::_($optionData) : $optionData; $options_list .= "<option value='$optionValue' $selected $disabled>".$text."</option>\n"; $lis .= "<li ".$active.">".$text."</li>"; } // add webfonts if enabled if ($gantry->get('webfonts-enabled')) { // only google right now if ($gantry->get('webfonts-source') == 'google') { $webfonts = $this->_google_fonts; } foreach ($webfonts as $webfont) { $webfontsData = $webfont; $webfontsValue = $webfont; $selected = ($value == $webfontsValue) ? "selected='selected'" : ""; $active = ($value == $webfontsValue) ? "class='active'" : ""; if (strlen($active)) $activeElement = $webfontsData; $text = $webfontsData; $options_list .= "<option value='$webfontsValue' $selected>".$text."</option>\n"; $lis .= "<li ".$active.">".$text."</li>"; } } $html = "<div class='wrapper'>"; $html .= "<div class='selectbox-wrapper'>"; $html .= " <div class='selectbox'>"; $html .= " <div class='selectbox-top'>"; $html .= " <div class='selected'><span>".JTEXT::_($activeElement)."</span></div>"; $html .= " <div class='arrow'></div>"; $html .= " </div>"; $html .= " <div class='selectbox-dropdown'>"; $html .= " <ul>".$lis."</ul>"; $html .= " <div class='selectbox-dropdown-bottom'><div class='selectbox-dropdown-bottomright'></div></div>"; $html .= " </div>"; $html .= " </div>"; $html .= " <select id='params".$name."' name='params[".$name."]' class='selectbox-real ".$imapreset."'>"; $html .= $options_list; $html .= " </select>"; $html .= "</div>"; $html .= "<div class='clr'></div>"; $html .= "</div>"; return $html; }