echo JText::_('COM_NENO_INSTALLATION_DEFAULT_SETTINGS_MESSAGE'); ?> </p> <div id="translation-method-selectors"> <?php $displayData = array(); ?> <?php $displayData['n'] = 0; ?> <?php $displayData['assigned_translation_methods'] = NenoHelper::getDefaultTranslationMethods(); ?> <?php $displayData['translation_methods'] = NenoHelper::getTranslationMethods('dropdown'); ?> <?php echo JLayoutHelper::render('translationmethodselector', $displayData, JPATH_NENO_LAYOUTS); ?> </div> </div> <div class="span6 doc"> <p><?php echo JText::_('COM_NENO_INSTALLATION_DEFAULT_SETTINGS_DESCRIPTION_TEXT_P1'); ?> </p> <p><?php echo JText::_('COM_NENO_INSTALLATION_DEFAULT_SETTINGS_DESCRIPTION_TEXT_P2'); ?>
/** * Get translation method selector * * @return void */ public function getTranslationMethodSelector() { $input = $this->input; $n = $input->getInt('n', 0); $selected_methods = $input->get('selected_methods', array(), 'ARRAY'); $placement = $input->getString('placement', 'general'); $translationMethods = NenoHelper::loadTranslationMethods(); $app = JFactory::getApplication(); // Ensure that we know what was selected for the previous selector if ($n > 0 && !isset($selected_methods[$n - 1]) || $n > 0 && $selected_methods[$n - 1] == 0) { $app->close(); } // As a safety measure prevent more than 5 selectors and always allow only one more selector than already selected if ($n > 4 || $n > count($selected_methods) + 1) { $app->close(); } // Reduce the translation methods offered depending on the parents if ($n > 0 && !empty($selected_methods)) { $parent_method = $selected_methods[$n - 1]; $acceptable_follow_up_method_ids = $translationMethods[$parent_method]->acceptable_follow_up_method_ids; $acceptable_follow_up_methods = explode(',', $acceptable_follow_up_method_ids); foreach ($translationMethods as $k => $translation_method) { if (!in_array($k, $acceptable_follow_up_methods)) { unset($translationMethods[$k]); } } } // If there are no translation methods left then return nothing if (!count($translationMethods)) { JFactory::getApplication()->close(); } // Prepare display data $displayData = array(); $displayData['translation_methods'] = $translationMethods; $displayData['n'] = $n; if ($placement == 'general') { $displayData['assigned_translation_methods'] = NenoHelper::getTranslationMethods('dropdown'); } else { $lang = $input->getString('language'); $displayData['assigned_translation_methods'] = NenoHelper::getLanguageDefault($lang, $n); } $selectorHTML = JLayoutHelper::render('translationmethodselector', $displayData, JPATH_NENO_LAYOUTS); echo $selectorHTML; $app->close(); }
/** * Load translation methods for filter * * @return void */ protected function getTranslationMethods() { $this->methods = NenoHelper::getTranslationMethods(); }