Ejemplo n.º 1
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		global $gantry;
		
		$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' );
		
		$position = str_replace('-showmax', '', $name);
		$count = count($gantry->getPositions($position));
		
		$options = $choices = array();
        
		for($i = 1; $i <= $count; $i++){
			array_push($choices, $i);
		}
		
		if (!$count) $choices = array(1, 2, 3, 4, 5, 6);

		foreach ($choices as $option)
		{
			$options[] = JHTML::_('select.option', $option, $option);
		}

		include_once('selectbox.php');
		$selectbox = new JElementSelectBox;
		return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
	}
Ejemplo n.º 2
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $db =& JFactory::getDBO();
     $section = $node->attributes('section');
     $class = $node->attributes('class');
     if (!$class) {
         $class = "inputbox";
     }
     if (!isset($section)) {
         // alias for section
         $section = $node->attributes('scope');
         if (!isset($section)) {
             $section = 'content';
         }
     }
     if ($section == 'content') {
         // This might get a conflict with the dynamic translation - TODO: search for better solution
         $query = 'SELECT c.id, CONCAT_WS( "/",s.title, c.title ) AS title' . ' FROM #__categories AS c' . ' LEFT JOIN #__sections AS s ON s.id=c.section' . ' WHERE c.published = 1' . ' AND s.scope = ' . $db->Quote($section) . ' ORDER BY s.title, c.title';
     } else {
         $query = 'SELECT c.id, c.title' . ' FROM #__categories AS c' . ' WHERE c.published = 1' . ' AND c.section = ' . $db->Quote($section) . ' ORDER BY c.title';
     }
     $db->setQuery($query);
     $options = $db->loadObjectList();
     foreach ($options as $index => $option) {
         $option->text = $option->title;
         $option->value = $option->id;
         $option->disable = false;
         $options[$index] = $option;
     }
     array_unshift($options, JHTML::_('select.option', '0', '- ' . JText::_('Select Category') . ' -', 'value', 'text'));
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 3
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
     $options = array();
     $choices = array(1, 2, 3, 4, 5, 6);
     foreach ($choices as $option) {
         $options[] = JHTML::_('select.option', $option, $option);
     }
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 4
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
     $options = array();
     $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 $option) {
         $options[] = JHTML::_('select.option', $option, $option);
     }
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 6
0
	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);
		}
	}
Ejemplo n.º 7
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
     $options = array();
     $dates = $node->children();
     $now =& JFactory::getDate();
     foreach ($dates as $option) {
         $val = $option->attributes('value');
         $option->_data = $now->toFormat($val);
         $options[] = JHTML::_('select.option', $val, $option->data());
     }
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 8
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
     $db =& JFactory::getDBO();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
     $menuTypes = MenusHelper::getMenuTypes();
     if (null == $value || !isset($value) || !in_array($value, $menuTypes)) {
         $value = $menuTypes[0];
     }
     foreach ($menuTypes as $menutype) {
         $options[] = JHTML::_('select.option', $menutype, $menutype);
     }
     array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Select Menu') . ' -'));
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 9
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $db =& JFactory::getDBO();
     $query = 'SELECT id, title FROM #__sections WHERE published = 1 AND scope = "content" ORDER BY title';
     $db->setQuery($query);
     $options = $db->loadObjectList();
     foreach ($options as $index => $option) {
         $option->text = $option->title;
         $option->value = $option->id;
         $option->disable = false;
         $options[$index] = $option;
     }
     array_unshift($options, JHTML::_('select.option', '0', '- ' . JText::_('Select Section') . ' -', 'value', 'text'));
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }
Ejemplo n.º 10
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     global $gantry;
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
     $unique = $node->attributes('unique');
     if (isset($unique) && $unique == 'true') {
         $positions = $gantry->getUniquePositions();
     } else {
         $positions = $gantry->getPositions();
     }
     $options = array();
     foreach ($positions as $position) {
         $val = $position;
         $text = $position;
         $options[] = JHTML::_('select.option', $val, $text);
     }
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options, false);
 }
Ejemplo n.º 11
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     global $gantry;
     $db =& JFactory::getDBO();
     $parent = $this->_parent;
     $menuType = $parent ? $parent->get('menu_type') : $this->get('menu_type');
     if (!empty($menuType)) {
         $where = ' WHERE menutype = ' . $db->Quote($menuType);
     } else {
         $where = ' WHERE 1';
     }
     $attributes = $node->attributes();
     $filter = array();
     if (isset($attributes['filterids'])) {
         $filter = explode(',', $attributes['filterids']);
     }
     // get custom menuitems list
     gantry_import('core.params.gantrymenuitemparams');
     $customList = GantryMenuItemParams::_getCustomParamsList();
     // load the list of menu types
     $query = 'SELECT menutype, title FROM #__menu_types ' . ' ORDER BY title';
     $db->setQuery($query);
     $menuTypes = $db->loadObjectList();
     if ($state = $node->attributes('state')) {
         $where .= ' AND published = ' . (int) $state;
     }
     $where .= " AND published!=-2 ";
     // load the list of menu items
     $query = 'SELECT id, parent, name, menutype, type FROM #__menu' . $where . ' ORDER BY menutype, parent, ordering';
     $db->setQuery($query);
     $menuItems = $db->loadObjectList();
     // establish the hierarchy of the menu
     $children = array();
     if ($menuItems) {
         $found_value = false;
         foreach ($menuItems as $v) {
             if ($v->id == $value) {
                 $found_value = true;
                 break;
             }
         }
         if (!$found_value || null == $value || !isset($value)) {
             $db =& JFactory::getDBO();
             $default = 0;
             $query = 'SELECT id' . ' FROM #__menu AS m' . ' WHERE m.home = 1';
             $db->setQuery($query);
             $value = $db->loadResult();
         }
         // first pass - collect children
         foreach ($menuItems as $v) {
             $pt = $v->parent;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     // second pass - get an indent list of the items
     $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     // assemble into menutype groups
     $n = count($list);
     $groupedList = array();
     foreach ($list as $k => $v) {
         $groupedList[$v->menutype][] =& $list[$k];
     }
     // assemble menu items to the array
     $options = array();
     foreach ($menuTypes as $type) {
         if ($menuType == '') {
             $options[] = JHTML::_('select.option', '0', '&nbsp;', 'value', 'text', true);
             $options[] = JHTML::_('select.option', $type->menutype, $type->title, 'value', 'text', true);
         }
         if (isset($groupedList[$type->menutype])) {
             $n = count($groupedList[$type->menutype]);
             for ($i = 0; $i < $n; $i++) {
                 $item =& $groupedList[$type->menutype][$i];
                 if (in_array($item->id, $filter)) {
                     continue;
                 }
                 //If menutype is changed but item is not saved yet, use the new type in the list
                 if (JRequest::getString('option', '', 'get') == 'com_menus') {
                     $currentItemArray = JRequest::getVar('cid', array(0), '', 'array');
                     $currentItemId = (int) $currentItemArray[0];
                     $currentItemType = JRequest::getString('type', $item->type, 'get');
                     if ($currentItemId == $item->id && $currentItemType != $item->type) {
                         $item->type = $currentItemType;
                     }
                 }
                 $disable = strpos($node->attributes('disable'), $item->type) !== false ? true : false;
                 if (in_array($item->id, $customList)) {
                     $special = "<span class='custom-params'> &#x272A; </span>";
                 } else {
                     $special = "<span class='no-custom-params'>&nbsp;&nbsp;&nbsp; </span>";
                 }
                 $options[] = JHTML::_('select.option', $item->id, '' . $special . $item->treename, 'value', 'text', $disable);
             }
         }
     }
     $options = array_slice($options, 1);
     include_once 'selectbox.php';
     $selectbox = new JElementSelectBox();
     return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
 }