當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TranslationPeer::doSelectRS方法代碼示例

本文整理匯總了PHP中TranslationPeer::doSelectRS方法的典型用法代碼示例。如果您正苦於以下問題:PHP TranslationPeer::doSelectRS方法的具體用法?PHP TranslationPeer::doSelectRS怎麽用?PHP TranslationPeer::doSelectRS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TranslationPeer的用法示例。


在下文中一共展示了TranslationPeer::doSelectRS方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: export

 public function export()
 {
     G::LoadSystem('i18n_po');
     G::LoadClass("system");
     //get labels MichelangeloFE
     try {
         $oTranslation = new Translation();
         $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js";
         if (file_exists($MichelangeloFE)) {
             $labels = self::readLabelsDirectory($MichelangeloFE, true);
             foreach ($labels as $label) {
                 $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label);
             }
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     //creating the .po file
     $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
     $poFile = new i18n_PO($sPOFile);
     $poFile->buildInit();
     $language = new Language();
     $locale = $_GET['LOCALE'];
     $_TARGET_LANG = $_GET['LOCALE'];
     $_BASE_LANG = 'en';
     if (strpos($locale, Translation::$localeSeparator) !== false) {
         list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $_GET['LOCALE']);
         $iCountry = new IsoCountry();
         $iCountryRecord = $iCountry->findById($IC_UID);
         if (!isset($iCountryRecord['IC_UID'])) {
             throw new Exception("Country Target ID '{$_GET['LAN_ID']}' doesn't exist!");
         }
         $sCountry = $iCountryRecord['IC_NAME'];
     } else {
         $LAN_ID = $locale;
         $sCountry = $IC_UID = '';
     }
     $langRecord = $language->findById($LAN_ID);
     if (!isset($langRecord['LAN_NAME'])) {
         throw new Exception("Language Target ID \"{$LAN_ID}\" doesn't exist!");
     }
     $sLanguage = $langRecord['LAN_NAME'];
     //setting headers
     $poFile->addHeader('Project-Id-Version', 'ProcessMaker ' . System::getVersion());
     $poFile->addHeader('POT-Creation-Date', '');
     $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s'));
     $poFile->addHeader('Last-Translator', '');
     $poFile->addHeader('Language-Team', 'Colosa Developers Team <developers@colosa.com>');
     $poFile->addHeader('MIME-Version', '1.0');
     $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
     $poFile->addHeader('Content-Transfer_Encoding', '8bit');
     $poFile->addHeader('X-Poedit-Language', ucwords($sLanguage));
     $poFile->addHeader('X-Poedit-Country', ucwords($sCountry));
     $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8');
     $poFile->addHeader('Content-Transfer-Encoding', '8bit');
     $aLabels = array();
     $aMsgids = array('' => true);
     // selecting all translations records of base language 'en' on TRANSLATIONS table
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
     $oCriteria->add(TranslationPeer::TRN_LANG, 'en');
     $oDataset = TranslationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $targetLangRecords = array();
     // retrieve the translation for the target language
     if ($LAN_ID != 'en') {
         // only if it is different language than base language 'en'
         $c = new Criteria('workflow');
         $c->addSelectColumn(TranslationPeer::TRN_CATEGORY);
         $c->addSelectColumn(TranslationPeer::TRN_ID);
         $c->addSelectColumn(TranslationPeer::TRN_VALUE);
         $c->add(TranslationPeer::TRN_LANG, $_GET['LOCALE']);
         $ds = TranslationPeer::doSelectRS($c);
         $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($ds->next()) {
             $row = $ds->getRow();
             $targetLangRecords[$row['TRN_CATEGORY'] . '/' . $row['TRN_ID']] = $row['TRN_VALUE'];
         }
     }
     // get the respective translation for each english label
     while ($oDataset->next()) {
         $aRow1 = $oDataset->getRow();
         $trnCategory = trim($aRow1['TRN_CATEGORY']);
         # Validation, validate that the TRN_CATEGORY contains valid characteres
         preg_match("/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult);
         // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
         if ($sTestResult[0] !== $trnCategory || $trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT') {
             $oTranslation = new Translation();
             $oTranslation->remove($aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en');
             //remove not accepted translations
             continue;
             //jump to next iteration
         }
         // retrieve the translation for the target language
         if ($LAN_ID != 'en') {
             // only if it is different language than base language 'en'
             if (isset($targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']])) {
                 $msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE'];
//.........這裏部分代碼省略.........
開發者ID:emildev35,項目名稱:processmaker,代碼行數:101,代碼來源:Language.php

示例2: getAll

 function getAll($lang = 'en', $start = null, $limit = null, $search = null, $dateFrom = null, $dateTo = null)
 {
     $totalCount = 0;
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_LANG);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_UPDATE_DATE);
     $oCriteria->add(TranslationPeer::TRN_LANG, $lang);
     $oCriteria->add(TranslationPeer::TRN_CATEGORY, 'LABEL');
     //$oCriteria->addAscendingOrderByColumn ( 'TRN_CATEGORY' );
     $oCriteria->addAscendingOrderByColumn('TRN_ID');
     if ($search) {
         $oCriteria->add($oCriteria->getNewCriterion(TranslationPeer::TRN_ID, "%{$search}%", Criteria::LIKE)->addOr($oCriteria->getNewCriterion(TranslationPeer::TRN_VALUE, "%{$search}%", Criteria::LIKE)));
     }
     // for date filter
     if ($dateFrom && $dateTo) {
         $oCriteria->add($oCriteria->getNewCriterion(TranslationPeer::TRN_UPDATE_DATE, "{$dateFrom}", Criteria::GREATER_EQUAL)->addAnd($oCriteria->getNewCriterion(TranslationPeer::TRN_UPDATE_DATE, "{$dateTo}", Criteria::LESS_EQUAL)));
     }
     // end filter
     $c = clone $oCriteria;
     $c->clearSelectColumns();
     $c->addSelectColumn('COUNT(*)');
     $oDataset = TranslationPeer::doSelectRS($c);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     if (is_array($aRow)) {
         $totalCount = $aRow[0];
     }
     if ($start) {
         $oCriteria->setOffset($start);
     }
     if ($limit) {
         //&& !isset($seach) && !isset($search))
         $oCriteria->setLimit($limit);
     }
     $rs = TranslationPeer::doSelectRS($oCriteria);
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rows = array();
     while ($rs->next()) {
         $rows[] = $rs->getRow();
     }
     $result->data = $rows;
     $result->totalCount = $totalCount;
     return $result;
 }
開發者ID:nshong,項目名稱:processmaker,代碼行數:47,代碼來源:Translation.php

示例3: doSelect

 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      Connection $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, $con = null)
 {
     return TranslationPeer::populateObjects(TranslationPeer::doSelectRS($criteria, $con));
 }
開發者ID:nshong,項目名稱:processmaker,代碼行數:13,代碼來源:BaseTranslationPeer.php


注:本文中的TranslationPeer::doSelectRS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。