AAAAhome/academiac/www/administrator/components/com_xmap/models/fields/xmapmenus.php 0000604 00000014304 15146665356 0024355 0 ustar 00 getQuery(true); //$currentMenus = array_keys(get_object_vars($this->value)); $currentMenus = array(); $query->select('menutype As value, title As text'); $query->from('#__menu_types AS a'); $query->order('a.title'); // Get the options. $db->setQuery($query); // echo $db->getQuery(); $menus = $db->loadObjectList('value'); $options = array(); // Add the current sitemap menus in the defined order to the list foreach ($currentMenus as $menutype) { if (!empty($menus[$menutype])) { $options[] = $menus[$menutype]; } } // Add the rest of the menus to the list (if any) foreach ($menus as $menutype => $menu) { if (!in_array($menutype, $currentMenus)) { $options[] = $menu; } } // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } $options = array_merge( parent::getOptions(), $options ); return $options; } /** * Method to get the field input. * * @return string The field input. */ protected function getInput() { $disabled = $this->element['disabled'] == 'true' ? true : false; $readonly = $this->element['readonly'] == 'true' ? true : false; $attributes = ' '; $type = 'radio'; if ($v = $this->element['size']) { $attributes .= 'size="' . $v . '" '; } if ($v = $this->element['class']) { $attributes .= 'class="' . $v . '" '; } else { $attributes .= 'class="inputbox" '; } if ($m = $this->element['multiple']) { $type = 'checkbox'; } $value = $this->value; if (!is_array($value)) { // Convert the selections field to an array. $registry = new JRegistry; $registry->loadString($value); $value = $registry->toArray(); } $doc = JFactory::getDocument(); $doc->addScriptDeclaration(" window.addEvent('domready',function(){ \$\$('div.xmap-menu-options select').addEvent('mouseover',function(event){xmapMenusSortable.detach();}) \$\$('div.xmap-menu-options select').addEvent('mouseout',function(event){xmapMenusSortable.attach();}) var xmapMenusSortable = new Sortables(\$('ul_" . $this->inputId . "'),{ clone:true, revert: true, preventDefault: true, onStart: function(el) { el.setStyle('background','#bbb'); }, onComplete: function(el) { el.setStyle('background','#eee'); } }); });"); if ($disabled || $readonly) { $attributes .= 'disabled="disabled"'; } $options = (array) $this->_getOptions(); $return = '