コード例 #1
0
ファイル: view.html.php プロジェクト: thangredweb/redCORE
 /**
  * Display method
  *
  * @param   string  $tpl  The template name
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->translationTable = RedcoreHelpersTranslation::getTranslationTable();
     $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml);
     $this->item = $this->get('Item');
     $editor = JFactory::getConfig()->get('editor');
     $this->editor = JEditor::getInstance($editor);
     $this->columns = array();
     $this->noTranslationColumns = array();
     $tableColumns = (array) $this->translationTable->columns;
     $this->fieldsXml = $this->contentElement->getTranslateFields();
     foreach ($this->fieldsXml as $field) {
         foreach ($tableColumns as $column) {
             if ($column == (string) $field['name']) {
                 $attributes = current($field->attributes());
                 $attributes['titleLabel'] = (string) $field;
                 $this->columns[$column] = $attributes;
                 break;
             }
         }
         if ((string) $field['translate'] == '0' && (string) $field['type'] != 'referenceid') {
             $attributes = current($field->attributes());
             $attributes['titleLabel'] = (string) $field;
             $this->noTranslationColumns[(string) $field['name']] = $attributes;
         }
     }
     // 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);
 }
コード例 #2
0
ファイル: componentlist.php プロジェクト: thangredweb/redCORE
 /**
  * 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();
         $lang = JFactory::getLanguage();
         $options = array();
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('*')->from('#__extensions')->where('type=' . $db->quote('component'));
         // Setup the query
         $db->setQuery($query);
         // Return the result
         $components = $db->loadObjectList();
         if (!empty($components)) {
             foreach ($components as $value) {
                 $extension = $value->element;
                 $source = JPATH_ADMINISTRATOR . '/components/' . $extension;
                 $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($extension . '.sys', $source, null, false, true);
                 $contentElements = '';
                 if ($this->getAttribute('loadContentElements', 'false') == 'true') {
                     $contentElementsArray = RTranslationHelper::getContentElements($value->name);
                     if (!empty($contentElementsArray)) {
                         $contentElements = ' (' . count($contentElementsArray) . ')';
                     }
                 }
                 if ($this->getAttribute('showFullName', 'false') == 'true') {
                     $title = JText::_($value->name);
                 } else {
                     $title = $value->name;
                 }
                 $options[] = JHtml::_('select.option', $value->element, $title . $contentElements);
             }
             static::$cache[$hash] = array_merge(static::$cache[$hash], $options);
         }
     }
     $component = JFactory::getApplication()->input->get->getString('component', '');
     if (!empty($component)) {
         $this->value = $component;
     }
     return static::$cache[$hash];
 }
コード例 #3
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];
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: thangredweb/redCORE
 /**
  * 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);
 }
コード例 #5
0
ファイル: sidebar.php プロジェクト: thangredweb/redCORE
<?php

/**
 * @package     Redcore.Admin
 * @subpackage  Layouts
 *
 * @copyright   Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$option = JFactory::getApplication()->input->getString('component', '');
$view = RInflector::pluralize(JFactory::getApplication()->input->getString('view', ''));
$return = JFactory::getApplication()->input->getString('return', '');
$contentElement = JFactory::getApplication()->input->getString('contentelement', '');
$components = RedcoreHelpersView::getExtensionsRedcore();
$translationTables = RTranslationHelper::getInstalledTranslationTables();
if (empty($return)) {
    $return = base64_encode('index.php?option=com_redcore&view=dashboard');
}
?>
<ul class="nav nav-list">
	<?php 
if ($view === 'dashboards') {
    ?>
		<li class="nav-header"><?php 
    echo JText::_('COM_REDCORE_DASHBOARD');
    ?>
</li>
	<?php 
} else {
    ?>
コード例 #6
0
ファイル: bootstrap.php プロジェクト: thangredweb/redCORE
 /**
  * Effectively bootstrap redCORE.
  *
  * @param   bool  $loadBootstrap  Load bootstrap with redcore plugin options
  *
  * @return  void
  */
 public static function bootstrap($loadBootstrap = true)
 {
     if ($loadBootstrap && !defined('REDCORE_BOOTSTRAPPED')) {
         define('REDCORE_BOOTSTRAPPED', 1);
     }
     if (!defined('REDCORE_LIBRARY_LOADED')) {
         // Sets bootstrapped variable, to avoid bootstrapping redCORE twice
         define('REDCORE_LIBRARY_LOADED', 1);
         // Use our own base field
         if (!class_exists('JFormField', false)) {
             $baseField = JPATH_LIBRARIES . '/redcore/joomla/form/field.php';
             if (file_exists($baseField)) {
                 require_once $baseField;
             }
         }
         // Register the classes for autoload.
         JLoader::registerPrefix('R', JPATH_REDCORE);
         // Setup the RLoader.
         RLoader::setup();
         // Make available the redCORE fields
         JFormHelper::addFieldPath(JPATH_REDCORE . '/form/field');
         JFormHelper::addFieldPath(JPATH_REDCORE . '/form/fields');
         // Make available the redCORE form rules
         JFormHelper::addRulePath(JPATH_REDCORE . '/form/rules');
         // HTML helpers
         JHtml::addIncludePath(JPATH_REDCORE . '/html');
         RHtml::addIncludePath(JPATH_REDCORE . '/html');
         // Load library language
         $lang = JFactory::getLanguage();
         $lang->load('lib_redcore', JPATH_REDCORE);
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
         }
         // Make available the fields
         JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
         // Make available the rules
         JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
         // Replaces Joomla database driver for redCORE database driver
         JFactory::$database = null;
         JFactory::$database = RFactory::getDbo();
         if (self::getConfig('enable_translations', 0) == 1 && !JFactory::getApplication()->isAdmin()) {
             // This is our object now
             $db = JFactory::getDbo();
             // Enable translations
             $db->translate = self::getConfig('enable_translations', 0) == 1;
             // Reset plugin translations params if needed
             RTranslationHelper::resetPluginTranslation();
         }
     }
 }
コード例 #7
0
ファイル: translations.php プロジェクト: thangredweb/redCORE
 /**
  * Build an SQL query to load the list data.
  *
  * @return  JDatabaseQuery
  */
 protected function getListQuery()
 {
     $table = RedcoreHelpersTranslation::getTranslationTable();
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     if (empty($table)) {
         $query->select('*')->from('#__extensions')->where('1=2');
         return $query;
     }
     $query->select('o.*')->from($db->qn($table->table, 'o'));
     $columns = (array) $table->columns;
     foreach ($columns as $column) {
         $query->select($db->qn('t.' . $column, 't_' . $column));
     }
     $query->select(array($db->qn('t.rctranslations_id'), $db->qn('t.rctranslations_language'), $db->qn('t.rctranslations_originals'), $db->qn('t.rctranslations_modified'), $db->qn('t.rctranslations_state')));
     $leftJoinOn = array();
     foreach ($table->primaryKeys as $primaryKey) {
         $leftJoinOn[] = 'o.' . $primaryKey . ' = t.' . $primaryKey;
     }
     if ($language = $this->getState('filter.language')) {
         $leftJoinOn[] = 't.rctranslations_language = ' . $db->q($language);
     } else {
         // We will return empty query
         $leftJoinOn[] = '1 = 2';
     }
     $leftJoinOn = implode(' AND ', $leftJoinOn);
     $query->leftJoin($db->qn(RTranslationTable::getTranslationsTableName($table->table, ''), 't') . (!empty($leftJoinOn) ? ' ON ' . $leftJoinOn . '' : ''));
     // Filter search
     $search = $this->getState('filter.search_translations');
     if (!empty($search)) {
         $search = $db->quote('%' . $db->escape($search, true) . '%');
         $searchColumns = array();
         foreach ($columns as $column) {
             $searchColumns[] = '(o.' . $column . ' LIKE ' . $search . ')';
             $searchColumns[] = '(t.' . $column . ' LIKE ' . $search . ')';
         }
         if (!empty($searchColumns)) {
             $query->where('(' . implode(' OR ', $searchColumns) . ')');
         }
     }
     // Content Element filter
     $contentElement = RTranslationHelper::getContentElement($table->option, $table->xml);
     $filters = $contentElement->getTranslateFilter();
     if (!empty($filters)) {
         foreach ($filters as $filter) {
             $query->where((string) $filter);
         }
     }
     // Ordering
     $orderList = $this->getState('list.ordering');
     $directionList = $this->getState('list.direction');
     $order = !empty($orderList) ? $orderList : 't.rctranslations_language';
     $direction = !empty($directionList) ? $directionList : 'DESC';
     $query->order($db->escape($order) . ' ' . $db->escape($direction));
     return $query;
 }
コード例 #8
0
 /**
  * Checks if this query is qualified for translation and parses query
  *
  * @param   string  $sql     SQL query
  * @param   string  $prefix  Table prefix
  *
  * @return  mixed  Parsed query with added table joins and fields if found
  */
 public static function buildTranslationQuery($sql = '', $prefix = '')
 {
     $db = JFactory::getDbo();
     $selectedLanguage = !empty($db->forceLanguageTranslation) ? $db->forceLanguageTranslation : JFactory::getLanguage()->getTag();
     if (!empty($db->parseTablesBefore)) {
         foreach ($db->parseTablesBefore as $tableGroup) {
             $sql = self::parseSelectQuery($sql, $prefix, $tableGroup->language, $tableGroup->translationTables);
         }
     }
     /**
      * Basic check for translations, translation will not be inserted if:
      * If we do not have SELECT anywhere in query
      * If current language is site default language
      * If we are in administration
      */
     if (empty($sql) || JFactory::getApplication()->isAdmin() || !stristr(mb_strtolower($sql), 'select') || RTranslationHelper::getSiteLanguage() == $selectedLanguage) {
         if (empty($db->parseTablesBefore) && empty($db->parseTablesAfter)) {
             return null;
         }
     }
     $translationTables = RTranslationHelper::getInstalledTranslationTables();
     $translationTables = RTranslationHelper::removeFromEditForm($translationTables);
     $sql = self::parseSelectQuery($sql, $prefix, $selectedLanguage, $translationTables);
     if (!empty($db->parseTablesAfter)) {
         foreach ($db->parseTablesAfter as $tableGroup) {
             $sql = self::parseSelectQuery($sql, $prefix, $tableGroup->language, $tableGroup->translationTables);
         }
     }
     return $sql;
 }
コード例 #9
0
ファイル: default.php プロジェクト: thangredweb/redCORE
				<div class="control-label">
					<?php 
echo $this->form->getLabel('params');
?>
				</div>
				<div class="controls">
					<?php 
echo $this->form->getInput('params');
?>
				</div>
			</div>
			<?php 
$element = new RTranslationContentElement('com_plugins', '');
$element->name = 'plugins';
$column = array('name' => 'params', 'formname' => 'plugin');
echo RLayoutHelper::render('translation.params', array('form' => RTranslationHelper::loadParamsForm($column, $element, $this->item, 'plugin'), 'column' => $column, 'translationForm' => true));
?>
		</div>
	</div>

	<!-- hidden fields -->
	<input type="hidden" name="option" value="com_redcore">
	<input type="hidden" name="id" value="<?php 
echo $this->item->id;
?>
">
	<input type="hidden" name="task" value="">
	<?php 
echo JHTML::_('form.token');
?>
</form>
コード例 #10
0
ファイル: translation.php プロジェクト: thangredweb/redCORE
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  */
 public function save($data)
 {
     $translationTable = RedcoreHelpersTranslation::getTranslationTable();
     $contentElement = RTranslationHelper::getContentElement($translationTable->option, $translationTable->xml);
     $translation = JFactory::getApplication()->input->get('translation', array(), 'array');
     $original = JFactory::getApplication()->input->get('original', array(), 'array');
     $id = !empty($data['rctranslations_id']) ? (int) $data['rctranslations_id'] : 0;
     $data = array_merge($data, $translation);
     $fieldsXml = $contentElement->getTranslateFields();
     foreach ($fieldsXml as $field) {
         if ((string) $field['type'] == 'params' && (string) $field['translate'] == '1') {
             $fieldName = (string) $field['name'];
             $original[$fieldName] = $original['params_' . $fieldName];
             $paramsChanged = false;
             if (!empty($data[$fieldName])) {
                 $registry = new JRegistry();
                 $registry->loadString($original[$fieldName]);
                 $originalParams = $registry->toArray();
                 foreach ($data[$fieldName] as $paramKey => $paramValue) {
                     if (!isset($originalParams[$paramKey]) && $paramValue != '' || $originalParams[$paramKey] != $paramValue) {
                         $paramsChanged = true;
                         break;
                     }
                 }
                 if ($paramsChanged) {
                     $data[$fieldName] = json_encode($data[$fieldName]);
                 } else {
                     $data[$fieldName] = '';
                 }
             }
         }
     }
     $dispatcher = RFactory::getDispatcher();
     /** @var RedcoreTableTranslation $table */
     $table = $this->getTable();
     if (empty($id)) {
         $db = $this->getDbo();
         $query = $db->getQuery(true)->select('rctranslations_id')->from($db->qn(RTranslationTable::getTranslationsTableName($translationTable->table, '')))->where('rctranslations_language = ' . $db->q($data['rctranslations_language']));
         foreach ($translationTable->primaryKeys as $primaryKey) {
             if (!empty($data[$primaryKey])) {
                 $query->where($db->qn($primaryKey) . ' = ' . $db->q($data[$primaryKey]));
             }
         }
         $db->setQuery($query);
         $id = $db->loadResult();
     }
     foreach ($translationTable->primaryKeys as $primaryKey) {
         $original[$primaryKey] = $data[$primaryKey];
     }
     $isNew = true;
     // Load the row if saving an existing item.
     $table->load((int) $id);
     if ($table->rctranslations_modified) {
         $isNew = false;
     }
     $data['rctranslations_originals'] = RTranslationTable::createOriginalValueFromColumns($original, $translationTable->columns);
     // We run posthandler methods
     foreach ($fieldsXml as $field) {
         $postHandler = (string) $field['posthandler'];
         $fieldName = (string) $field['name'];
         if (!empty($postHandler) && (string) $field['translate'] == '1') {
             $postHandlerFunctions = explode(',', $postHandler);
             foreach ($postHandlerFunctions as $postHandlerFunction) {
                 $postHandlerFunctionArray = explode('::', $postHandlerFunction);
                 if (empty($postHandlerFunctionArray[1])) {
                     $postHandlerFunctionArray[1] = $postHandlerFunctionArray[0];
                     $postHandlerFunctionArray[0] = 'RTranslationContentHelper';
                     $postHandlerFunction = 'RTranslationContentHelper::' . $postHandlerFunction;
                 }
                 if (method_exists($postHandlerFunctionArray[0], $postHandlerFunctionArray[1])) {
                     call_user_func_array(array($postHandlerFunctionArray[0], $postHandlerFunctionArray[1]), array($field, &$data[$fieldName], &$data, $translationTable));
                 }
             }
         }
     }
     // Bind the data.
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     // Prepare the row for saving
     $this->prepareTable($table);
     // Check the data.
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     // Trigger the onContentBeforeSave event.
     $result = $dispatcher->trigger($this->event_before_save, array($this->option . '.' . $this->name, &$table, $isNew));
     if (in_array(false, $result, true)) {
         $this->setError($table->getError());
         return false;
     }
     // Store the data.
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
     // Trigger the onContentAfterSave event.
     $dispatcher->trigger($this->event_after_save, array($this->option . '.' . $this->name, &$table, $isNew));
     $this->setState($this->getName() . '.id', $table->rctranslations_id);
     // Clear the cache
     $this->cleanCache();
     return true;
 }
コード例 #11
0
ファイル: config.php プロジェクト: thangredweb/redCORE
 /**
  * Loading of related XML files
  *
  * @param   string  $extensionName    Extension name
  * @param   array   $contentElements  Content elements
  *
  * @return  array  List of objects
  */
 public function loadMissingContentElements($extensionName, $contentElements = array())
 {
     $translationTables = RTranslationHelper::getInstalledTranslationTables();
     $missingTables = array();
     foreach ($translationTables as $translationTableKey => $translationTable) {
         $translationTable->table = str_replace('#__', '', $translationTable->table);
         if ($translationTable->option == $extensionName) {
             $foundTable = false;
             foreach ($contentElements as $contentElement) {
                 if (!empty($contentElement->table) && $contentElement->table == $translationTable->table) {
                     $foundTable = true;
                     break;
                 }
             }
             if (!$foundTable) {
                 $missingTables[$translationTableKey] = $translationTable;
             }
         }
     }
     return $missingTables;
 }
コード例 #12
0
ファイル: install.php プロジェクト: hanshenrikchr/redCORE
 /**
  * Uninstall all Translation tables from database
  *
  * @return  void
  */
 protected function uninstallTranslations()
 {
     $class = get_called_class();
     $extensionOption = strtolower(strstr($class, 'Installer', true));
     $translationTables = RTranslationHelper::getInstalledTranslationTables();
     if (!empty($translationTables)) {
         $db = JFactory::getDbo();
         foreach ($translationTables as $translationTable => $translationTableParams) {
             if (method_exists('RTranslationTable', 'getTranslationsTableName') && ($class == 'Com_RedcoreInstallerScript' || $extensionOption == $translationTableParams->option)) {
                 $newTable = RTranslationTable::getTranslationsTableName($translationTable, '');
                 try {
                     RTranslationTable::removeExistingConstraintKeys($translationTable);
                     $db->dropTable($newTable);
                 } catch (Exception $e) {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_DELETE_ERROR', $e->getMessage()), 'error');
                 }
             }
         }
     }
 }
コード例 #13
0
ファイル: table.php プロジェクト: thangredweb/redCORE
 /**
  * Method to save the configuration data.
  *
  * @return  bool   True on success, false on failure.
  */
 public static function saveRedcoreTranslationConfig()
 {
     $data = array();
     $component = JComponentHelper::getComponent('com_redcore');
     $component->params->set('translations', RTranslationHelper::getInstalledTranslationTables());
     $data['params'] = $component->params->toString('JSON');
     $dispatcher = RFactory::getDispatcher();
     $table = JTable::getInstance('Extension');
     $isNew = true;
     // Load the previous Data
     if (!$table->load($component->id)) {
         return false;
     }
     // Bind the data.
     if (!$table->bind($data)) {
         return false;
     }
     // Check the data.
     if (!$table->check()) {
         return false;
     }
     // Trigger the onConfigurationBeforeSave event.
     $result = $dispatcher->trigger('onExtensionBeforeSave', array('com_redcore.config', &$table, $isNew));
     if (in_array(false, $result, true)) {
         return false;
     }
     // Store the data.
     if (!$table->store()) {
         return false;
     }
     // Trigger the onConfigurationAfterSave event.
     $dispatcher->trigger('onExtensionAfterSave', array('com_redcore.config', &$table, $isNew));
     return true;
 }
コード例 #14
0
ファイル: redcore.php プロジェクト: thangredweb/redCORE
 /**
  * After route.
  *
  * @return  void
  *
  * @since   3.4
  */
 public function onAfterRoute()
 {
     if (defined('REDCORE_LIBRARY_LOADED')) {
         if (RTranslationHelper::getSiteLanguage() != JFactory::getLanguage()->getTag()) {
             // Reset menus because they are loaded before any other module
             RMenu::resetJoomlaMenuItems();
         }
     }
 }
コード例 #15
0
ファイル: operation.php プロジェクト: thangredweb/redCORE
 /**
  * Set language of the site
  *
  * @param   string  $language  Language name
  *
  * @return  void
  */
 protected function setLanguage($language)
 {
     $languageObject = JFactory::getLanguage();
     $languages = JLanguageHelper::getLanguages('sef');
     if (!empty($language) && isset($languages[$language])) {
         $languageObject->setLanguage($languages[$language]->lang_code);
     } else {
         $languageObject->setLanguage($languages[RTranslationHelper::getSiteLanguage()]->lang_code);
     }
 }
コード例 #16
0
ファイル: helper.php プロジェクト: thangredweb/redCORE
 /**
  * Get default language
  *
  * @param   string  $client  Name of the client to get (site|admin)
  *
  * @return  string  Name of the language ex. en-GB
  */
 public static function getSiteLanguage($client = 'site')
 {
     if (!isset(self::$siteLanguage)) {
         $db = JFactory::getDbo();
         $oldTranslate = $db->translate;
         // We do not want to translate this value
         $db->translate = false;
         self::$siteLanguage = JComponentHelper::getParams('com_languages')->get($client);
         // We put translation check back on
         $db->translate = $oldTranslate;
     }
     return self::$siteLanguage;
 }
コード例 #17
0
ファイル: translation.php プロジェクト: thangredweb/redCORE
 /**
  * Gets translation table object
  *
  * @param   string  $default  Default Content Element Name
  *
  * @return  object  Translation Table object
  */
 public static function getTranslationTable($default = '')
 {
     $contentElement = self::getCurrentContentElement();
     $translationTables = RTranslationHelper::getInstalledTranslationTables();
     return !empty($translationTables['#__' . $contentElement]) ? $translationTables['#__' . $contentElement] : null;
 }
コード例 #18
0
ファイル: edit.php プロジェクト: thangredweb/redCORE
        ?>
</textarea>
							</div>
						</td>
					</tr>
					<tr>
						<td><?php 
        echo JText::_('COM_REDCORE_TRANSLATIONS_TRANSLATION');
        ?>
</td>
						<td id="translation_field_<?php 
        echo $columnKey;
        ?>
">
							<?php 
        echo RLayoutHelper::render('translation.params', array('form' => RTranslationHelper::loadParamsForm($column, $this->contentElement, $this->item->translation, 'translation'), 'original' => $this->item->original->{$columnKey}, 'translation' => $this->item->translation->{$columnKey}, 'name' => $columnKey, 'column' => $column, 'translationForm' => true));
        ?>
						</td>
					</tr>
				<?php 
    }
    ?>
			<?php 
}
?>
			<?php 
foreach ($this->noTranslationColumns as $columnKey => $column) {
    ?>
				<tr>
					<td colspan="2"><?php 
    echo JText::_('COM_REDCORE_TRANSLATIONS_FIELD') . ': <strong>' . $column['titleLabel'];