コード例 #1
0
 /** Standard constructor
  *
  * @param	languageID		ID of the associated language
  * @param	elementTable	Reference to the ContentElementTable object
  */
 function ContentObject($languageID, &$contentElement, $id = -1)
 {
     $db = JFactory::getDBO();
     if ($id > 0) {
         $this->id = $id;
     }
     $this->language_id = $languageID;
     // active languages are cached in FalangManager - use these if possible
     $jfManager = FalangManager::getInstance();
     if (isset($jfManager) && $jfManager->activeLanguagesCacheByID && array_key_exists($languageID, $jfManager->activeLanguagesCacheByID)) {
         $lang = $jfManager->activeLanguagesCacheByID[$languageID];
     } else {
         $lang = new TableJFLanguage($db);
         $lang->load($languageID);
     }
     $this->language = $lang->title;
     $this->_contentElement = $contentElement;
 }
コード例 #2
0
ファイル: translate.php プロジェクト: kaantunc/MYK-BOR
 function saveTranslation()
 {
     $catid = $this->_catid;
     $select_language_id = $this->_select_language_id;
     $language_id = $this->_language_id;
     $id = JRequest::getVar('reference_id', null);
     $jfc_id = JRequest::getVar('jfc_id ', null);
     $actContentObject = null;
     if (isset($catid) && $catid != "") {
         $contentElement = $this->_joomfishManager->getContentElement($catid);
         JLoader::import('models.ContentObject', JOOMFISH_ADMINPATH);
         $actContentObject = new ContentObject($language_id, $contentElement);
         // get's the config settings on how to store original files
         $storeOriginalText = $this->_joomfishManager->getCfg('storageOfOriginal') == 'md5' ? false : true;
         $actContentObject->bind($_POST, '', '', true, $storeOriginalText);
         $actContentObject->store();
         $this->view->message = JText::_('Translation saved');
         // Clear Translation Cache
         $db =& JFactory::getDBO();
         $lang = new TableJFLanguage($db);
         $lang->load($language_id);
         $cache =& $this->_joomfishManager->getCache($lang->code);
         $cache->clean();
     } else {
         $this->view->message = JText::_('Cannot save - invalid catid');
     }
     if ($this->task == "translate.apply") {
         $cid = $actContentObject->id . "|" . $id . "|" . $language_id;
         JRequest::setVar('cid', array($cid));
         $this->editTranslation();
     } else {
         // redirect to overview
         $this->showTranslate();
     }
 }
コード例 #3
0
 function saveTranslation()
 {
     $catid = $this->_catid;
     $select_language_id = $this->_select_language_id;
     $language_id = $this->_language_id;
     $id = JRequest::getVar('reference_id', null);
     $jfc_id = JRequest::getVar('jfc_id ', null);
     $translationObject = null;
     if (isset($catid) && $catid != "") {
         $contentElement = $this->_joomfishManager->getContentElement($catid);
         $translationClass = $contentElement->getTranslationObjectClass();
         $translationObject = new $translationClass($language_id, $contentElement);
         // get's the config settings on how to store original files
         $storeOriginalText = $this->_joomfishManager->getCfg('storageOfOriginal') == 'md5' ? false : true;
         $translationObject->bind($_POST, '', '', true, $storeOriginalText);
         $success = $translationObject->store();
         if ($success) {
             JPluginHelper::importPlugin('joomfish');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onAfterTranslationSave', array($_POST));
             $this->view->message = JText::_('TRANSLATION_SAVED');
         } else {
             $this->view->message = JText::_('ERROR_SAVING_TRANSLATION');
         }
         // Clear Translation Cache
         $db = JFactory::getDBO();
         $lang = new TableJFLanguage($db);
         $lang->load($language_id);
         $cache = $this->_joomfishManager->getCache($lang->code);
         $cache->clean();
     } else {
         $this->view->message = JText::_('Cannot save - invalid catid');
     }
     if ($this->task == "apply") {
         $cid = $translationObject->id . "|" . $id . "|" . $language_id;
         JRequest::setVar('cid', array($cid));
         //$this->editTranslation();
         $this->setRedirect("index.php?option=com_joomfish&task=translate.edit&cid[]={$cid}", $this->view->message);
     } else {
         // redirect to overview
         $this->setRedirect("index.php?option=com_joomfish&task=translate.overview", $this->view->message);
     }
 }
コード例 #4
0
ファイル: ContentObject.php プロジェクト: kaantunc/MYK-BOR
 /** Standard constructor
  *
  * @param	languageID		ID of the associated language
  * @param	elementTable	Reference to the ContentElementTable object
  */
 function ContentObject($languageID, &$contentElement, $id = -1)
 {
     $db =& JFactory::getDBO();
     if ($id > 0) {
         $this->id = $id;
     }
     $this->language_id = $languageID;
     // active languages are cached in $_JOOMFISH_MANAGER - use these if possible
     global $_JOOMFISH_MANAGER;
     if (isset($_JOOMFISH_MANAGER) && $_JOOMFISH_MANAGER->activeLanguagesCacheByID && array_key_exists($languageID, $_JOOMFISH_MANAGER->activeLanguagesCacheByID)) {
         $lang = $_JOOMFISH_MANAGER->activeLanguagesCacheByID[$languageID];
     } else {
         $lang = new TableJFLanguage($db);
         $lang->load($languageID);
     }
     $this->language = $lang->name;
     $this->_contentElement = $contentElement;
 }
コード例 #5
0
ファイル: translate.php プロジェクト: kosmosby/medicine-prof
 function saveTranslation()
 {
     $catid = $this->_catid;
     $select_language_id = $this->_select_language_id;
     $language_id = $this->_language_id;
     $app = JFactory::getApplication();
     $id = $app->input->get('reference_id', null);
     $jfc_id = $app->input->get('jfc_id ', null);
     $actContentObject = null;
     if (isset($catid) && $catid != "") {
         $contentElement = $this->_falangManager->getContentElement($catid);
         JLoader::import('models.ContentObject', FALANG_ADMINPATH);
         $actContentObject = new ContentObject($language_id, $contentElement);
         // get's the config settings on how to store original files
         $storeOriginalText = $this->_falangManager->getCfg('storageOfOriginal') == 'md5' ? false : true;
         $actContentObject->bind($_POST, '', '', true, $storeOriginalText);
         if ($actContentObject->store() == null) {
             //
             JPluginHelper::importPlugin('falang');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onAfterTranslationSave', array($_POST));
             $this->view->message = JText::_('COM_FALANG_TRANSLATE_SAVED');
         } else {
             $this->view->message = JText::_('COM_FALANG_TRANSLATE_SAVED_ERROR');
         }
         // Clear Translation Cache
         $db = JFactory::getDBO();
         $lang = new TableJFLanguage($db);
         $lang->load($language_id);
         $cache = $this->_falangManager->getCache($lang->code);
         //$cache->clean();
     } else {
         $this->view->message = JText::_('COM_FALANG_TRANSLATE_SAVED_ERROR_CATID');
     }
     if ($this->task == "apply") {
         $cid = $actContentObject->id . "|" . $id . "|" . $language_id;
         JRequest::setVar('cid', array($cid));
         $this->editTranslation();
     } else {
         // redirect to overview
         $this->showTranslate();
     }
 }