예제 #1
0
 /**
  * Method to get the options to populate to populate list
  *
  * @return  array  The field option objects.
  *
  * @since   1.0
  */
 protected function getOptions()
 {
     // Accepted modifiers
     $hash = md5($this->element);
     if (!isset(static::$cache[$hash])) {
         static::$cache[$hash] = parent::getOptions();
         $options = array();
         $translationTables = RTranslationHelper::getInstalledTranslationTables();
         if (!empty($translationTables)) {
             foreach ($translationTables as $value) {
                 $options[] = JHtml::_('select.option', str_replace('#__', '', $value->table), $value->name);
             }
             static::$cache[$hash] = array_merge(static::$cache[$hash], $options);
         }
     }
     $contentElement = RedcoreHelpersTranslation::getCurrentContentElement();
     if (!empty($contentElement)) {
         $this->value = $contentElement;
     }
     return static::$cache[$hash];
 }
예제 #2
0
 /**
  * Display method
  *
  * @param   string  $tpl  The template name
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $app = JFactory::getApplication();
     $this->contentElementName = RedcoreHelpersTranslation::getCurrentContentElement();
     $this->componentName = $app->input->get->get('component', $model->getState('filter.component', ''));
     $this->activeFilters = $model->getActiveFilters();
     $this->state = $model->getState();
     $this->filterForm = $model->getForm();
     $this->pagination = $model->getPagination();
     if (!empty($this->contentElementName)) {
         $this->translationTable = RedcoreHelpersTranslation::getTranslationTable();
         $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml);
         $this->items = $model->getItems();
         $this->filterForm->removeField('component', 'filter');
     } else {
         /** @var RedcoreModelConfig $modelConfig */
         $modelConfig = RModelAdmin::getAdminInstance('Config', array('ignore_request' => true), 'com_redcore');
         if (!empty($this->componentName)) {
             $this->component = $modelConfig->getComponent($this->componentName);
         }
         $this->contentElements = $modelConfig->loadContentElements($this->componentName);
         $this->missingContentElements = $modelConfig->loadMissingContentElements($this->componentName, $this->contentElements);
         $this->return = base64_encode('index.php?option=com_redcore&view=translations&contentelement=&component=' . $this->componentName);
         $layout = 'manage';
         $this->setLayout($layout);
         $app->input->set('layout', $layout);
         $this->filterForm->removeField('language', 'filter');
         $this->filterForm->removeField('search_translations', 'filter');
         $this->filterForm->removeField('translations_limit', 'list');
         $this->filterForm->removeField('contentelement', 'filter');
     }
     // Check if option is enabled
     if (RBootstrap::getConfig('enable_translations', 0) == 0) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_CONFIG_TRANSLATIONS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error');
     }
     parent::display($tpl);
 }