本文整理汇总了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'];
//.........这里部分代码省略.........
示例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;
}
示例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));
}