/** * Get the options for the element * * @param object $node * * @return array * * @since 11.1 * * @deprecated 12.1 Use JFormFieldContentLanguage::getOptions instead */ protected function _getOptions(&$node) { // Deprecation warning. JLog::add('JElementContentLanguages::_getOptions() is deprecated.', JLog::WARNING, 'deprecated'); $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'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }
/** * Get the options for the list. * @since 11.1 * * @deprecated 12.1 */ protected function _getOptions(&$node) { $clientId = ($v = $node->attributes('client_id')) ? $v : 0; $options = array(); $path1 = null; $path2 = null; // Load template entries for each menuid $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('template'); $query->from('#__template_styles'); $query->where('client_id = '.(int) $clientId); $query->where('home = 1'); $db->setQuery($query); $template = $db->loadResult(); if ($module = $node->attributes('module')) { $base = ($clientId == 1) ? JPATH_ADMINISTRATOR : JPATH_SITE; $module = preg_replace('#\W#', '', $module); $path1 = $base . '/modules/' . $module . '/tmpl'; $path2 = $base . '/templates/' . $template . '/html/' . $module; $options[] = JHTML::_('select.option', '', ''); } if ($path1 && $path2) { jimport('joomla.filesystem.file'); $path1 = JPath::clean($path1); $path2 = JPath::clean($path2); $files = JFolder::files($path1, '^[^_]*\.php$'); foreach ($files as $file) { $options[] = JHTML::_('select.option', JFile::stripExt($file)); } if (is_dir($path2) && $files = JFolder::files($path2, '^[^_]*\.php$')) { $options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT')); foreach ($files as $file) { $options[] = JHTML::_('select.option', JFile::stripExt($file)); } $options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT')); } } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }
/** * Get the options for the list. * * @return array * * @deprecated 12.1 * @since 11.1 */ protected function _getOptions(&$node) { $options = array(); $path1 = null; $path2 = null; // Load template entries for each menuid $db = JFactory::getDBO(); $query = 'SELECT template' . ' FROM #__template_styles' . ' WHERE client_id = 0 AND home = 1'; $db->setQuery($query); $template = $db->loadResult(); if ($view = $node->attributes('view') && $extn = $node->attributes('extension')) { $view = preg_replace('#\W#', '', $view); $extn = preg_replace('#\W#', '', $extn); $path1 = JPATH_SITE . '/components/' . $extn . '/views/' . $view . '/tmpl'; $path2 = JPATH_SITE . '/templates/' . $template . '/html/' . $extn . '/' . $view; $options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_MENU_REQUEST_SETTING')); } if ($path1 && $path2) { jimport('joomla.filesystem.file'); $path1 = JPath::clean($path1); $path2 = JPath::clean($path2); $files = JFolder::files($path1, '^[^_]*\.php$'); foreach ($files as $file) { $options[] = JHtml::_('select.option', JFile::stripExt($file)); } if (is_dir($path2) && $files = JFolder::files($path2, '^[^_]*\.php$')) { $options[] = JHtml::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT_TEMPLATE')); foreach ($files as $file) { $options[] = JHtml::_('select.option', JFile::stripExt($file)); } $options[] = JHtml::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT_TEMPLATE')); } } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }
/** * Get the options for the element * * @param object $node * @return array */ protected function _getOptions(&$node) { $db =& JFactory::getDbo(); $query = new JQuery(); $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'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }
/** * Get the options for the list. */ protected function _getOptions(&$node) { $options = array(); $path1 = null; $path2 = null; // Load template entries for each menuid $db =& JFactory::getDBO(); $query = 'SELECT template' . ' FROM #__template_styles' . ' WHERE client_id = 0 AND home = 1'; $db->setQuery($query); $template = $db->loadResult(); if ($view = $node->attributes('view') && ($extn = $node->attributes('extension'))) { $view = preg_replace('#\\W#', '', $view); $extn = preg_replace('#\\W#', '', $extn); $path1 = JPATH_SITE . DS . 'components' . DS . $extn . DS . 'views' . DS . $view . DS . 'tmpl'; $path2 = JPATH_SITE . DS . 'templates' . DS . $template . DS . 'html' . DS . $extn . DS . $view; $options[] = JHTML::_('select.option', '', JText::_('JOption_Use_Menu_Request_Setting')); } if ($path1 && $path2) { jimport('joomla.filesystem.file'); $path1 = JPath::clean($path1); $path2 = JPath::clean($path2); $files = JFolder::files($path1, '^[^_]*\\.php$'); foreach ($files as $file) { $options[] = JHTML::_('select.option', JFile::stripExt($file)); } if (is_dir($path2) && ($files = JFolder::files($path2, '^[^_]*\\.php$'))) { $options[] = JHTML::_('select.optgroup', JText::_('JOption_From_Default_Template')); foreach ($files as $file) { $options[] = JHTML::_('select.option', JFile::stripExt($file)); } } } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }