/** * Get the options for the element * * @param object &$node XMLElement node object containing the settings for the element * @return array */ protected function _getOptions(&$node) { $db = \App::get('db'); $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()) { throw new Exception($db->getErrorMsg(), 500); } // Merge any additional options in the XML definition. return array_merge(parent::_getOptions($node), $options); }
/** * Get the options for the list. * * @param object &$node XMLElement node object containing the settings for the element * @return array */ protected function _getOptions(&$node) { $options = array(); $path1 = null; $path2 = null; // Load template entries for each menuid $db = \App::get('db'); $query = 'SELECT template' . ' FROM #__template_styles' . ' WHERE client_id = 0 AND home = 1'; $db->setQuery($query); $template = $db->loadResult(); $view = (string) $node['view']; $extn = (string) $node['extension']; if ($view && $extn) { $view = preg_replace('#\\W#', '', $view); $extn = preg_replace('#\\W#', '', $extn); $path1 = PATH_CORE . '/components/' . $extn . '/site/views/' . $view . '/tmpl'; $path2 = PATH_ROOT . '/templates/' . $template . '/html/' . $extn . '/' . $view; $options[] = Builder\Select::option('', App::get('language')->txt('JOPTION_USE_MENU_REQUEST_SETTING')); } if ($path1 && $path2) { $path1 = Util::normalizePath($path1); $path2 = Util::normalizePath($path2); $files = App::get('filesystem')->files($path1, '^[^_]*\\.php$'); foreach ($files as $file) { $options[] = Builder\Select::option(App::get('filesystem')->extension($file)); } if (is_dir($path2) && ($files = App::get('filesystem')->files($path2, '^[^_]*\\.php$'))) { $options[] = Builder\Select::optgroup(App::get('language')->txt('JOPTION_FROM_DEFAULT_TEMPLATE')); foreach ($files as $file) { $options[] = Builder\Select::option(App::get('filesystem')->extension($file)); } $options[] = Builder\Select::optgroup(App::get('language')->txt('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 list. * * @param object &$node XMLElement node object containing the settings for the element * @return string */ protected function _getOptions(&$node) { $v = (int) $node['client_id']; $clientId = $v ? $v : 0; $options = array(); $path1 = null; $path2 = null; // Load template entries for each menuid $db = \App::get('db'); $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 = (string) $node['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[] = Builder\Select::option('', ''); } if ($path1 && $path2) { $path1 = Util::normalizePath($path1); $path2 = Util::normalizePath($path2); $files = App::get('filesystem')->files($path1, '^[^_]*\\.php$'); foreach ($files as $file) { $options[] = Builder\Select::option(App::get('filesystem')->extension($file)); } if (is_dir($path2) && ($files = App::get('filesystem')->files($path2, '^[^_]*\\.php$'))) { $options[] = Builder\Select::optgroup(App::get('language')->txt('JOPTION_FROM_DEFAULT')); foreach ($files as $file) { $options[] = Builder\Select::option(App::get('filesystem')->extension($file)); } $options[] = Builder\Select::optgroup(App::get('language')->txt('JOPTION_FROM_DEFAULT')); } } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions($node), $options); return $options; }