当前位置: 首页>>代码示例>>PHP>>正文


PHP QQN::NarroSuggestion方法代码示例

本文整理汇总了PHP中QQN::NarroSuggestion方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::NarroSuggestion方法的具体用法?PHP QQN::NarroSuggestion怎么用?PHP QQN::NarroSuggestion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QQN的用法示例。


在下文中一共展示了QQN::NarroSuggestion方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     // Instantiate the Meta DataGrid
     $this->dtgNarroSuggestions = new NarroSuggestionDataGrid($this);
     // Style the DataGrid (if desired)
     $this->dtgNarroSuggestions->CssClass = 'datagrid';
     $this->dtgNarroSuggestions->AlternateRowStyle->CssClass = 'alternate';
     // Add Pagination (if desired)
     $this->dtgNarroSuggestions->Paginator = new QPaginator($this->dtgNarroSuggestions);
     $this->dtgNarroSuggestions->ItemsPerPage = __FORM_DRAFTS_FORM_LIST_ITEMS_PER_PAGE__;
     // Use the MetaDataGrid functionality to add Columns for this datagrid
     // Create an Edit Column
     $strEditPageUrl = __VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/narro_suggestion_edit.php';
     $this->dtgNarroSuggestions->MetaAddEditLinkColumn($strEditPageUrl, 'Edit', 'Edit');
     // Create the Other Columns (note that you can use strings for narro_suggestion's properties, or you
     // can traverse down QQN::narro_suggestion() to display fields that are down the hierarchy)
     $this->dtgNarroSuggestions->MetaAddColumn('SuggestionId');
     $this->dtgNarroSuggestions->MetaAddColumn(QQN::NarroSuggestion()->User);
     $this->dtgNarroSuggestions->MetaAddColumn(QQN::NarroSuggestion()->Text);
     $this->dtgNarroSuggestions->MetaAddColumn(QQN::NarroSuggestion()->Language);
     $this->dtgNarroSuggestions->MetaAddColumn('SuggestionValue');
     $this->dtgNarroSuggestions->MetaAddColumn('SuggestionValueMd5');
     $this->dtgNarroSuggestions->MetaAddColumn('SuggestionCharCount');
     $this->dtgNarroSuggestions->MetaAddColumn('SuggestionWordCount');
     $this->dtgNarroSuggestions->MetaAddColumn('HasComments');
     $this->dtgNarroSuggestions->MetaAddColumn('IsImported');
     $this->dtgNarroSuggestions->MetaAddColumn('Created');
     $this->dtgNarroSuggestions->MetaAddColumn('Modified');
 }
开发者ID:Jobava,项目名称:narro,代码行数:30,代码来源:NarroSuggestionListFormBase.class.php

示例2: txtSearch_KeyUp

 public function txtSearch_KeyUp()
 {
     if (strlen($this->txtSearch->Text) < 2 || preg_match("/^'.*'\$/", $this->txtSearch->Text) || preg_match('/^".*"$/', $this->txtSearch->Text)) {
         $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, substr($this->txtSearch->Text, 1, -1)));
     } else {
         $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, '%' . $this->txtSearch->Text . '%'));
     }
     $this->dtgSuggestion->Refresh();
 }
开发者ID:Jobava,项目名称:narro,代码行数:9,代码来源:NarroSuggestionSearchPanel.class.php

示例3: dtgTranslation_Create

 public function dtgTranslation_Create()
 {
     $this->dtgTranslation = new NarroSuggestionDataGrid($this);
     $this->dtgTranslation->ShowFilter = false;
     $this->dtgTranslation->ShowHeader = false;
     $this->dtgTranslation->ShowFooter = false;
     $this->dtgTranslation->AdditionalClauses = array(QQ::Expand(QQN::NarroSuggestion()->User));
     $this->dtgTranslation->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroSuggestion()->TextId, $this->objContextInfo->Context->TextId));
     $colSuggestion = $this->dtgTranslation->MetaAddColumn('SuggestionValue');
     $colSuggestion->HtmlEntities = false;
     $colSuggestion->Html = '<?=$_CONTROL->ParentControl->dtgTranslaton_colSuggestion_Render($_ITEM)?>';
     $colActions = new QDataGridColumn('Actions');
     $colActions->HtmlEntities = false;
     $colActions->CssClass = 'actions';
     $colActions->Html = '<?=$_CONTROL->ParentControl->dtgTranslation_colActions_Render($_ITEM)?>';
     $this->dtgTranslation->AddColumn($colActions);
 }
开发者ID:Jobava,项目名称:narro,代码行数:17,代码来源:NarroContextInfoEditor.class.php

示例4: catch

 } catch (Exception $objEx) {
     if (strstr($objEx->getMessage(), 'Duplicate')) {
         $arrDuplicateTexts = NarroText::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroText()->TextValue, $objText->TextValue), QQ::NotEqual(QQN::NarroText()->TextId, $objText->TextId)));
         error_log(sprintf('Found duplicates for "%s": %d', $objText->TextValue, count($arrDuplicateTexts)));
         foreach ($arrDuplicateTexts as $objDuplicateText) {
             if ($objText->TextValue !== $objDuplicateText->TextValue) {
                 continue;
             }
             foreach (NarroTextComment::LoadArrayByTextId($objDuplicateText->TextId) as $objTextComment) {
                 error_log('Moving text comment');
                 $objTextComment->TextId = $objText->TextId;
                 $objTextComment->Save();
             }
             foreach (NarroSuggestion::LoadArrayByTextId($objDuplicateText->TextId) as $objSuggestion) {
                 error_log('Moving text from suggestion');
                 $arrDuplicateSuggestions = NarroSuggestion::QueryArray(QQ::AndCondition(QQ::NotEqual(QQN::NarroSuggestion()->SuggestionId, $objSuggestion->SuggestionId), QQ::Equal(QQN::NarroSuggestion()->SuggestionValue, $objSuggestion->SuggestionValue), QQ::Equal(QQN::NarroSuggestion()->TextId, $objText->TextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $objSuggestion->LanguageId)));
                 if (count($arrDuplicateSuggestions)) {
                     error_log(sprintf('Found duplicates for "%s": %d', $objSuggestion->SuggestionValue, count($arrDuplicateSuggestions)));
                     foreach ($arrDuplicateSuggestions as $objDuplicateSuggestion) {
                         if ($objSuggestion->SuggestionValue !== $objDuplicateSuggestion->SuggestionValue) {
                             continue;
                         }
                         foreach (NarroSuggestionComment::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionComment) {
                             error_log('Moving suggestion comment');
                             $objSuggestionComment->SuggestionId = $objSuggestion->SuggestionId;
                             $objSuggestionComment->Save();
                         }
                         foreach (NarroSuggestionVote::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionVote) {
                             error_log('Moving suggestion vote');
                             $objSuggestionVote->SuggestionId = $objSuggestion->SuggestionId;
                             $objSuggestionVote->Save();
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:update_narro_from_0.9.4_to_1.0.0.php

示例5: CountByTextIdLanguageId

 /**
  * Count NarroSuggestions
  * by TextId, LanguageId Index(es)
  * @param integer $intTextId
  * @param integer $intLanguageId
  * @return int
  */
 public static function CountByTextIdLanguageId($intTextId, $intLanguageId)
 {
     // Call NarroSuggestion::QueryCount to perform the CountByTextIdLanguageId query
     return NarroSuggestion::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->TextId, $intTextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $intLanguageId)));
 }
开发者ID:Jobava,项目名称:narro,代码行数:12,代码来源:NarroSuggestionGen.class.php

示例6: CountByTextIdForCurrentLanguage

 public static function CountByTextIdForCurrentLanguage($intTextId)
 {
     return self::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroSuggestion()->TextId, $intTextId)));
 }
开发者ID:Jobava,项目名称:narro,代码行数:4,代码来源:NarroSuggestion.class.php

示例7: dtgSuggestions_Create

 protected function dtgSuggestions_Create()
 {
     $dtgSuggestions = new NarroSuggestionDataGrid($this->tabActivity);
     $dtgSuggestions->SetCustomStyle('padding', '5px');
     $dtgSuggestions->Title = sprintf(t('Translations added by <b>%s</b>'), $this->objUser->RealName);
     //$dtgSuggestions->SetCustomStyle('margin-left', '15px');
     $colText = $dtgSuggestions->MetaAddColumn(QQN::NarroSuggestion()->Text->TextValue);
     $colText->Name = t('Original text');
     $colText->Html = '<?= $_CONTROL->colText_Render($_ITEM); ?>';
     $colText->HtmlEntities = false;
     $colSuggestion = $dtgSuggestions->MetaAddColumn(QQN::NarroSuggestion()->SuggestionValue);
     $colSuggestion->Name = t('Translated text');
     $colSuggestion->Html = '<?= $_CONTROL->colSuggestion_Render($_ITEM); ?>';
     $colLanguage = $dtgSuggestions->MetaAddColumn(QQN::NarroSuggestion()->Language->LanguageName);
     $colLanguage->Name = t('Language');
     $colLanguage->Filter = null;
     foreach (NarroLanguage::LoadAllActive() as $objLanguage) {
         $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroSuggestion()->LanguageId, $objLanguage->LanguageId));
     }
     $colLanguage->FilterActivate(QApplication::$TargetLanguage->LanguageName);
     $colLanguage->Html = '<?= $_CONTROL->colLanguage_Render($_ITEM); ?>';
     $colCreated = $dtgSuggestions->MetaAddColumn(QQN::NarroSuggestion()->Created);
     $colCreated->Name = t('Created');
     $colCreated->FilterType = QFilterType::None;
     $colCreated->Html = '<?= $_CONTROL->colCreated_Render($_ITEM); ?>';
     $colCreated->HtmlEntities = false;
     $colCreated->Wrap = false;
     // Datagrid Paginator
     $dtgSuggestions->Paginator = new QPaginator($dtgSuggestions);
     $dtgSuggestions->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
     $dtgSuggestions->SortColumnIndex = 3;
     $dtgSuggestions->SortDirection = true;
     $dtgSuggestions->AdditionalClauses = array(QQ::Expand(QQN::NarroSuggestion()->Text), QQ::Expand(QQN::NarroSuggestion()->Language));
     $dtgSuggestions->AdditionalConditions = QQ::Equal(QQN::NarroSuggestion()->UserId, $this->objUser->UserId);
     $dtgSuggestions->btnFilter_Click($this->Form->FormId, $dtgSuggestions->FilterButton->ControlId, '');
 }
开发者ID:Jobava,项目名称:narro,代码行数:36,代码来源:NarroUserSuggestionsPanel.class.php

示例8: ResolveContentItem

 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a NarroSuggestion-based QQNode.
  * It will also verify that it is a proper NarroSuggestion-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'narro_suggestion') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "narro_suggestion".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'SuggestionId':
                     return QQN::NarroSuggestion()->SuggestionId;
                 case 'UserId':
                     return QQN::NarroSuggestion()->UserId;
                 case 'User':
                     return QQN::NarroSuggestion()->User;
                 case 'TextId':
                     return QQN::NarroSuggestion()->TextId;
                 case 'Text':
                     return QQN::NarroSuggestion()->Text;
                 case 'LanguageId':
                     return QQN::NarroSuggestion()->LanguageId;
                 case 'Language':
                     return QQN::NarroSuggestion()->Language;
                 case 'SuggestionValue':
                     return QQN::NarroSuggestion()->SuggestionValue;
                 case 'SuggestionValueMd5':
                     return QQN::NarroSuggestion()->SuggestionValueMd5;
                 case 'SuggestionCharCount':
                     return QQN::NarroSuggestion()->SuggestionCharCount;
                 case 'SuggestionWordCount':
                     return QQN::NarroSuggestion()->SuggestionWordCount;
                 case 'HasComments':
                     return QQN::NarroSuggestion()->HasComments;
                 case 'IsImported':
                     return QQN::NarroSuggestion()->IsImported;
                 case 'Created':
                     return QQN::NarroSuggestion()->Created;
                 case 'Modified':
                     return QQN::NarroSuggestion()->Modified;
                 default:
                     throw new QCallerException('Simple Property not found in NarroSuggestionDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:77,代码来源:NarroSuggestionDataGridGen.class.php

示例9: GetUserListSuggestion

 /**
  * Get the most recent suggestion for a context made by a list of users
  *
  * @param integer $intContextId
  * @param integer $intTextId
  * @param integer $intUserId
  * @return NarroSuggestion
  */
 protected function GetUserListSuggestion($intContextId, $intTextId, $intUserId)
 {
     return NarroSuggestion::QuerySingle(QQ::AndCondition(QQ::In(QQN::NarroSuggestion()->UserId, $this->arrExportAuthorList), QQ::Equal(QQN::NarroSuggestion()->TextId, $intTextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->objTargetLanguage->LanguageId)));
 }
开发者ID:Jobava,项目名称:narro,代码行数:12,代码来源:NarroFileImporter.class.php

示例10: foreach

         if (isset($objProject) && $objProject instanceof NarroProject) {
             $objCondition = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $objProject->ProjectId));
         } else {
             $objCondition = QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId());
         }
         foreach (NarroContextInfo::QueryArray($objCondition, array(QQ::OrderBy(QQN::NarroContextInfo()->Modified, 0), QQ::LimitInfo(20, 0))) as $intKey => $objNarroContextInfo) {
             $strContextLink = sprintf(__HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::Translate($objNarroContextInfo->Context->ProjectId, '', 0, '', 0, 0, 10, 0, $objNarroContextInfo->ContextInfoId));
             $strProjectLink = sprintf(__HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::ProjectTextList($objNarroContextInfo->Context->ProjectId, NarroTranslatePanel::SHOW_ALL, ''));
             $strUserLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::UserProfile($objNarroContextInfo->ValidatorUserId);
             if (isset($objProject) && $objProject instanceof NarroProject) {
                 $strItemName = '';
             } else {
                 $strItemName = $objNarroContextInfo->Context->Project->ProjectName . ' :: ';
             }
             $objItem = new QRssItem($strItemName . (strlen($objNarroContextInfo->Context->Text->TextValue) > 124 ? substr($objNarroContextInfo->Context->Text->TextValue, 0, 124) . '...' : $objNarroContextInfo->Context->Text->TextValue), $strContextLink);
             $objItem->Description = sprintf('<p>' . t('Project') . ': <a href="%s">%s</a></p>', $strProjectLink, $objNarroContextInfo->Context->Project->ProjectName) . sprintf('<p>' . t('Context') . ': <a href="%s">%s</a></p>', $strContextLink, NarroString::HtmlEntities($objNarroContextInfo->Context->Context)) . sprintf('<p>' . t('Original text') . ': %s</p>', $objNarroContextInfo->Context->TextAccessKey ? NarroString::Replace($objNarroContextInfo->Context->TextAccessKey, '<u>' . $objNarroContextInfo->Context->TextAccessKey . '</u>', NarroString::HtmlEntities($objNarroContextInfo->Context->Text->TextValue), 1) : NarroString::HtmlEntities($objNarroContextInfo->Context->Text->TextValue)) . ($objNarroContextInfo->ValidSuggestionId ? sprintf('<p>' . t('Approved suggestion') . ': %s</p>', $objNarroContextInfo->Context->TextAccessKey ? NarroString::Replace($objNarroContextInfo->SuggestionAccessKey, '<u>' . $objNarroContextInfo->SuggestionAccessKey . '</u>', NarroString::HtmlEntities($objNarroContextInfo->ValidSuggestion->SuggestionValue), 1) : NarroString::HtmlEntities($objNarroContextInfo->ValidSuggestion->SuggestionValue)) : '') . ($objNarroContextInfo->HasSuggestions ? sprintf(t('The text has %s suggestions'), NarroSuggestion::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->TextId, $objNarroContextInfo->Context->TextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, QApplication::GetLanguageId())))) : t('The text has no suggestions')) . ($objNarroContextInfo->ValidSuggestionId && $objNarroContextInfo->ValidatorUserId != NarroUser::ANONYMOUS_USER_ID ? sprintf('<p>' . t('Approved by') . ': <a href="%s">%s</a>', $strUserLink, $objNarroContextInfo->ValidSuggestionId ? $objNarroContextInfo->ValidatorUser->RealName : '') : '');
             $objItem->PubDate = new QDateTime($objNarroContextInfo->Modified);
             $objItem->Author = $objNarroContextInfo->ValidSuggestionId ? $objNarroContextInfo->ValidatorUser->RealName : '';
             $objRssFeed->AddItem($objItem);
             $strDescription = '';
         }
         $objRssFeed->Language = strtolower(QApplication::$TargetLanguage->LanguageCode);
         $objRssFeed->Image = new QRssImage(__HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/assets/images/narro.png', t('Narro - Translate, we\'re open!'), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/index.php');
         QApplication::$Cache->save($objRssFeed, $strCacheId, array(), 3600);
     }
     $objRssFeed->Run();
     break;
 case 'textcomment':
     if (isset($objProject) && $objProject instanceof NarroProject) {
         $strCacheId = sprintf('rssfeed_textcomment_%d_%d', $objProject->ProjectId, QApplication::QueryString('l'));
     } else {
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:rss.php


注:本文中的QQN::NarroSuggestion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。