/** * Gets all associated NarroSuggestionsAsLanguage as an array of NarroSuggestion objects * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return NarroSuggestion[] */ public function GetNarroSuggestionAsLanguageArray($objOptionalClauses = null) { if (is_null($this->intLanguageId)) { return array(); } try { return NarroSuggestion::LoadArrayByLanguageId($this->intLanguageId, $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
$strCacheId = sprintf('rssfeed_suggestion_%d_%d', $objProject->ProjectId, QApplication::QueryString('l')); } else { $strCacheId = sprintf('rssfeed_suggestion_%d', QApplication::QueryString('l')); } if (!($objRssFeed = QApplication::$Cache->load($strCacheId))) { if (isset($objProject) && $objProject instanceof NarroProject) { $objRssFeed = new QRssFeed(sprintf(t('Translations for %s'), $objProject->ProjectName), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s for %s'), t(QApplication::$TargetLanguage->LanguageName), $objProject->ProjectName)); } else { $objRssFeed = new QRssFeed(sprintf(t('Translations for all projects'), t(QApplication::$TargetLanguage->LanguageName)), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s'), t(QApplication::$TargetLanguage->LanguageName))); } if (isset($objProject) && $objProject instanceof NarroProject) { $objProjectCondition = QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $objProject->ProjectId); } else { $objProjectCondition = QQ::All(); } $arrNarroSuggestion = NarroSuggestion::LoadArrayByLanguageId(QApplication::GetLanguageId(), array(QQ::OrderBy(QQN::NarroSuggestion()->Created, 0), QQ::LimitInfo(20, 0))); $intOldTextId = 0; $intOldProjectId = 0; $strDescription = ''; foreach ($arrNarroSuggestion as $objNarroSuggestion) { $arrNarroContextInfo = NarroContextInfo::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroContextInfo()->Context->TextId, $objNarroSuggestion->TextId), QQ::Equal(QQN::NarroContextInfo()->Context->Active, 1), $objProjectCondition)); $strUserLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::UserProfile($objNarroSuggestion->UserId); foreach ($arrNarroContextInfo as $objNarroContextInfo) { $strContextLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::Translate($objNarroContextInfo->Context->ProjectId, '', NarroTranslatePanel::SHOW_ALL, $objNarroSuggestion->SuggestionValue, 0, 0, 10, 0, $objNarroContextInfo->ContextInfoId); $strFileLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::FileTextList($objNarroContextInfo->Context->ProjectId, $objNarroContextInfo->Context->FileId, 1, 2, $objNarroSuggestion->SuggestionValue); $strProjectLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::ProjectTextList($objNarroContextInfo->Context->ProjectId, NarroTranslatePanel::SHOW_ALL, $objNarroSuggestion->SuggestionValue); $strDescription = sprintf('<li>' . t('<a href="%s">%s</a> from the file <a href="%s">%s</a>, project <a href="%s">%s</a>') . '</li>', $strContextLink, NarroString::HtmlEntities($objNarroContextInfo->Context->Context), $strFileLink, $objNarroContextInfo->Context->File->FileName, $strProjectLink, $objNarroContextInfo->Context->Project->ProjectName); } if (count($arrNarroContextInfo)) { $objItem = new QRssItem(strlen($objNarroSuggestion->SuggestionValue) > 124 ? substr($objNarroSuggestion->SuggestionValue, 0, 124) . '...' : $objNarroSuggestion->SuggestionValue, null, '<p>' . t('Original text') . ': ' . NarroString::HtmlEntities($objNarroSuggestion->Text->TextValue) . '</p>' . '<p>' . t('Translation') . ': ' . NarroString::HtmlEntities($objNarroSuggestion->SuggestionValue) . '</p>' . '<p>' . t('Author') . ': ' . sprintf('<a href="%s">%s</a>', $strUserLink, $objNarroSuggestion->User->RealName) . '</p>' . '<p>' . t('Contexts where the suggestion can be used:') . '</p>' . '<ul>' . $strDescription . '</ul>' . t('Click on the context to use the suggestion, on the file name or project name to search for the suggestion in them.')); $objItem->PubDate = new QDateTime($objNarroSuggestion->Created);