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


PHP QApplication::GetLanguageId方法代码示例

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


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

示例1: DisplayInProjectListInProgressColumn

 public function DisplayInProjectListInProgressColumn(NarroProject $objProject, $strText = '')
 {
     $strExportText = '';
     if ($objProject->ProjectType != NarroProjectType::Mozilla) {
         return array($objProject, '');
     }
     $objCache = new NarroCache(__CLASS__, QApplication::GetLanguageId());
     $objData = $objCache->GetData();
     if (!$objData) {
         $strJson = @file_get_contents($this->strUrl);
         if ($strJson) {
             $objData = json_decode($strJson);
             if ($objData) {
                 $objCache->SaveData($objData);
             }
         }
     }
     if (is_array($objData->items)) {
         foreach ($objData->items as $objItem) {
             if ($objItem->id == sprintf('%s/%s', $objProject->GetPreferenceValueByName('Code name on mozilla l10n dashboard'), QApplication::$TargetLanguage->LanguageCode)) {
                 $strWarning = $objItem->warnings ? sprintf('%d warnings', $objItem->warnings) : '';
                 $strMissing = $objItem->missing ? sprintf('%d missing', $objItem->missing) : '';
                 $strExportText = sprintf('<a title="Visit the Mozilla l10n dashboard" target="_blank" href="https://l10n-stage-sj.mozilla.org/dashboard/compare?run=%d">%s</a>', $objItem->runid, join(', ', array($objItem->result, $strMissing, $strWarning)));
                 break;
             }
         }
     }
     return array($objProject, $strExportText);
 }
开发者ID:Jobava,项目名称:narro,代码行数:29,代码来源:NarroMozillaDashboard.class.php

示例2: btnSave_Click

 public function btnSave_Click()
 {
     if (trim($this->txtComment->Text)) {
         $objComment = new NarroTextComment();
         $objComment->UserId = QApplication::GetUserId();
         $objComment->LanguageId = QApplication::GetLanguageId();
         $objComment->TextId = $this->intTextId;
         $objComment->Created = QDateTime::Now();
         $objComment->CommentText = $this->txtComment->Text;
         $objComment->CommentTextMd5 = md5($objComment->CommentText);
         $objComment->Save();
         $this->dtgComments->Refresh();
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:14,代码来源:NarroTextCommentPanel.class.php

示例3: __construct

 public function __construct(NarroUser $objUser, $objParentObject, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->strTemplate = dirname(__FILE__) . '/' . __CLASS__ . '.tpl.php';
     $this->objUser = $objUser;
     $this->pnlTranslatedPerProjectPie = new QDatabasePieChart($this);
     $this->pnlTranslatedPerProjectPie->Query = sprintf('
                         SELECT
                             narro_project.project_name AS label, COUNT(narro_suggestion.suggestion_id) AS cnt
                         FROM
                             narro_suggestion, narro_context, narro_project
                         WHERE
                             narro_context.text_id = narro_suggestion.text_id AND
                             narro_project.project_id = narro_context.project_id AND
                             narro_suggestion.language_id=%d AND
                             narro_suggestion.user_id=%d
                         GROUP BY narro_context.project_id', QApplication::GetLanguageId(), $this->objUser->UserId);
     $intSuggestionCount = NarroSuggestion::CountByUserId($this->objUser->UserId);
     $this->pnlTranslatedPerProjectPie->Total = $intSuggestionCount;
     $this->pnlTranslatedPerProjectPie->MinimumDataValue = 0;
     $this->pnlApprovedPie = new QPieChart($this);
     $this->pnlApprovedPie->Total = $this->pnlTranslatedPerProjectPie->Total;
     $this->pnlApprovedPie->MinimumDataValue = 0;
     $objDatabase = NarroContextInfo::GetDatabase();
     $strQuery = sprintf("\n                            SELECT\n                                DISTINCT narro_context_info.valid_suggestion_id\n                            FROM\n                                narro_context_info, narro_suggestion\n                            WHERE\n                                narro_context_info.valid_suggestion_id=narro_suggestion.suggestion_id AND\n                                narro_suggestion.user_id=%d", $this->objUser->UserId);
     $objDbResult = $objDatabase->Query($strQuery);
     $intValidSuggestionCount = $objDbResult->CountRows();
     $this->pnlApprovedPie->Data = array(t('Approved') => $intValidSuggestionCount, t('Not approved') => $intSuggestionCount - $intValidSuggestionCount);
     $this->tabActivity = new QTabs($this);
     $this->dtgSuggestions_Create();
     $arrHeaders[] = t('Translations');
     $this->dtgReviews_Create();
     $arrHeaders[] = t('Reviews');
     $this->dtgComments_Create();
     $arrHeaders[] = t('Comments');
     $this->dtgVotes_Create();
     $arrHeaders[] = t('Votes');
     if (QApplication::HasPermissionForThisLang('Administrator') || QApplication::GetUserId() == $this->objUser->UserId) {
         $this->dtgLog_Create();
         $arrHeaders[] = t('Logged messages');
     }
     $this->tabActivity->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:49,代码来源:NarroUserSuggestionsPanel.class.php

示例4: DisplayInProjectListInProgressColumn

 public function DisplayInProjectListInProgressColumn(NarroProject $objProject, $strText = '')
 {
     $strExportText = '';
     $objCache = new NarroCache(QApplication::GetLanguageId() . '/' . $objProject->ProjectId, __CLASS__);
     $arrData = $objCache->GetData();
     switch ($objProject->ProjectName) {
         case 'Fennec Aurora':
             if ($arrData) {
                 return $arrData;
             }
             // set up basic connection
             $conn_id = ftp_connect('ftp.mozilla.org');
             // login with username and password
             $login_result = ftp_login($conn_id, 'anonymous', 'user@domain.com');
             // get contents of the current directory
             $contents = ftp_nlist($conn_id, "/pub/mobile/nightly/latest-mozilla-aurora-linux-l10n");
             if (is_array($contents)) {
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/fennec\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.linux\\-i686\\.tar\\.bz2$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">linux i686</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
             }
             $contents = ftp_nlist($conn_id, "/pub/mobile/nightly/latest-mozilla-aurora-win32-l10n");
             if (is_array($contents)) {
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/fennec\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.win32\\.zip$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">win32</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
             }
             $contents = ftp_nlist($conn_id, "/pub/mobile/nightly/latest-mozilla-aurora-macosx-l10n");
             if (is_array($contents)) {
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/fennec\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.mac\\.dmg$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">mac</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
             }
             $contents = ftp_nlist($conn_id, "/pub/mobile/nightly/latest-mozilla-aurora-android");
             if (is_array($contents)) {
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/fennec\\-(.*)\\.multi\\.android\\-arm\\.apk$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">android</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
             }
             $strLinks = join(', ', $arrLink);
             if ($strLinks != '') {
                 $arrData = array($objProject, sprintf('nightly: %s', $strLinks));
                 $objCache->SaveData($arrData);
                 return $arrData;
             } else {
                 return array($objProject, '');
             }
         case 'Firefox Aurora':
             if ($arrData) {
                 return $arrData;
             }
             // set up basic connection
             $conn_id = ftp_connect('ftp.mozilla.org');
             // login with username and password
             $login_result = ftp_login($conn_id, 'anonymous', 'user@domain.com');
             // get contents of the current directory
             $contents = ftp_nlist($conn_id, "/pub/firefox/nightly/latest-mozilla-aurora-l10n/");
             if (is_array($contents)) {
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/firefox\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.linux\\-i686\\.tar\\.bz2$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">linux i686</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/firefox\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.linux\\-x86\\_64\\.tar\\.bz2$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">linux x86_64</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/firefox\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.win32\\.zip$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">win32</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
                 foreach ($contents as $strFile) {
                     if (preg_match('/\\/firefox\\-(.*)\\.' . preg_quote(QApplication::$TargetLanguage->LanguageCode) . '\\.mac\\.dmg$/', $strFile, $arrMatches)) {
                         $objDateSpan = new QDateTimeSpan(time() - ftp_mdtm($conn_id, $strFile));
                         $arrLink[] = sprintf('<a title="Download a localized nightly build %s built %s ago" href="ftp://ftp.mozilla.org%s">mac</a>', $arrMatches[1], $objDateSpan->SimpleDisplay(), $strFile);
                     }
                 }
             }
             $strLinks = join(', ', $arrLink);
             if ($strLinks != '') {
                 $arrData = array($objProject, sprintf('nightly: %s', $strLinks));
                 $objCache->SaveData($arrData);
                 return $arrData;
//.........这里部分代码省略.........
开发者ID:Jobava,项目名称:narro,代码行数:101,代码来源:NarroMozillaFtp.class.php

示例5: btnReplace_Click

 public function btnReplace_Click()
 {
     if (!QApplication::HasPermissionForThisLang('Can approve')) {
         return false;
     }
     if ($this->txtReplace->Display == false) {
         $this->txtReplace->Display = true;
     } else {
         if ($this->txtSearch->Text == '') {
             return false;
         }
         if ($this->txtReplace->Text == '') {
             return false;
         }
         $strQuery = NarroContextInfo::GetQueryForConditions($objQueryBuilder, QQ::AndCondition($this->arrConditions), $this->arrClauses);
         $objDbResult = NarroContextInfo::GetDatabase()->Query($strQuery);
         if ($objDbResult) {
             $intReplaceCnt = 0;
             $intApproved = 0;
             $intTranslations = 0;
             $arrProcessed = array();
             while ($objDbRow = $objDbResult->GetNextRow()) {
                 $objContextInfo = NarroContextInfo::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
                 if (in_array($objContextInfo->ContextInfoId, $arrProcessed)) {
                     continue;
                 } else {
                     $arrProcessed[] = $objContextInfo->ContextInfoId;
                 }
                 $objReplaceSuggestion = null;
                 if (preg_match("/^'.*'\$/", $this->txtSearch->Text)) {
                     $strToReplace = substr($this->txtSearch->Text, 1, -1);
                 } else {
                     $strToReplace = $this->txtSearch->Text;
                 }
                 if ($strToReplace == $objContextInfo->Context->Text->TextValue) {
                     $objReplaceSuggestion = NarroSuggestion::LoadByTextIdLanguageIdSuggestionValueMd5($objContextInfo->Context->TextId, QApplication::GetLanguageId(), md5($this->txtReplace->Text));
                     if (!$objReplaceSuggestion) {
                         $objSuggestion = new NarroSuggestion();
                         $objSuggestion->UserId = QApplication::GetUserId();
                         $objSuggestion->TextId = $objContextInfo->Context->TextId;
                         $objSuggestion->LanguageId = QApplication::GetLanguageId();
                         $objSuggestion->SuggestionValue = $this->txtReplace->Text;
                         $objSuggestion->HasComments = 0;
                         $objSuggestion->IsImported = 0;
                         $objSuggestion->Created = QDateTime::Now();
                         $objSuggestion->Modified = null;
                         $objSuggestion->Save();
                         $intTranslations++;
                         $objReplaceSuggestion = $objSuggestion;
                     }
                 }
                 if ($objReplaceSuggestion instanceof NarroSuggestion) {
                     $intReplaceCnt++;
                     if ($objContextInfo->ValidSuggestionId != $objReplaceSuggestion->SuggestionId || $this->chkApprove->Checked) {
                         if ($objContextInfo->ValidSuggestionId == null) {
                             $intApproved++;
                         }
                         $objContextInfo->ValidSuggestionId = $objReplaceSuggestion->SuggestionId;
                         $objContextInfo->ValidatorUserId = QApplication::GetUserId();
                         $objContextInfo->Modified = QDateTime::Now();
                         $objContextInfo->Save();
                     }
                 }
             }
             $this->dtrText->RemoveChildControls(true);
             $this->btnReplace->Refresh();
             QApplication::ExecuteJavaScript(sprintf('jQuery(\'#%s\').after(\'&nbsp;<small style="padding: 2px;" class="ui-state-highlight ui-corner-all"><span style="width:16px; height: 16px; display:inline-block" class="ui-icon ui-icon-info"></span>&nbsp;%s.</small>\')', $this->btnReplace->ControlId, sprintf(t('%d occurences of "%s" translated with "%s", out of which %d were already approved, %d translations added.'), $intReplaceCnt, $strToReplace, $this->txtReplace->Text, $intApproved, $intTranslations)));
         }
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:70,代码来源:NarroTranslatePanel.class.php

示例6: dtgProjectList_Bind

 public function dtgProjectList_Bind()
 {
     if ($this->txtSearch->Text != '') {
         $arrConditions[] = QQ::Like(QQN::NarroProject()->ProjectName, sprintf('%%%s%%', $this->txtSearch->Text));
     } else {
         $arrConditions[] = QQ::All();
     }
     if (QApplication::HasPermissionForThisLang('Can manage project')) {
         $arrConditions[] = QQ::All();
     } else {
         $arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroProject()->NarroProjectProgressAsProject->Active, 1), QQ::Equal(QQN::NarroProject()->Active, 1));
     }
     // Setup the $objClauses Array
     $objClauses = array(QQ::Expand(QQN::NarroProject()->NarroProjectProgressAsProject, QQ::Equal(QQN::NarroProject()->NarroProjectProgressAsProject->LanguageId, QApplication::GetLanguageId())));
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgProjectList->TotalItemCount = NarroProject::QueryCount(QQ::AndCondition($arrConditions), $objClauses);
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgProjectList->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgProjectList->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all NarroProjectProgress objects, given the clauses above
     $this->dtgProjectList->DataSource = NarroProject::QueryArray(QQ::AndCondition($arrConditions), $objClauses);
 }
开发者ID:Jobava,项目名称:narro,代码行数:28,代码来源:NarroProjectListPanel.class.php

示例7: __construct

 public function __construct($strDate, $objParentObject, NarroProject $objProject = null, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->strTemplate = dirname(__FILE__) . '/' . __CLASS__ . '.tpl.php';
     $this->blnAutoRenderChildren = true;
     // Tabs
     $this->tabTop = new QTabs($this);
     $pnlTranslators = new NarroUserDataGrid($this->tabTop);
     $pnlTranslators->CssClass = 'datagrid';
     $colUsername = $pnlTranslators->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Translations'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlTranslators->SortColumnIndex = 1;
     $pnlTranslators->ShowHeader = false;
     $pnlTranslators->SortDirection = 1;
     $pnlTranslators->AddColumn($colCnt);
     $pnlTranslators->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroSuggestionAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroSuggestionAsUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroSuggestionAsUser->Text->NarroContextAsText->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlTranslators->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroSuggestionAsUser->SuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlReviewers = new NarroUserDataGrid($this->tabTop);
     $pnlReviewers->CssClass = 'datagrid';
     $colUsername = $pnlReviewers->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlReviewers->SortColumnIndex = 1;
     $pnlReviewers->ShowHeader = false;
     $pnlReviewers->SortDirection = 1;
     $pnlReviewers->AddColumn($colCnt);
     $pnlReviewers->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroContextInfoAsValidatorUser->Modified, $strDate), QQ::Equal(QQN::NarroUser()->NarroContextInfoAsValidatorUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroContextInfoAsValidatorUser->Context->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlReviewers->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroContextInfoAsValidatorUser->ValidSuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlVoters = new NarroUserDataGrid($this->tabTop);
     $pnlVoters->CssClass = 'datagrid';
     $colUsername = $pnlVoters->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlVoters->SortColumnIndex = 1;
     $pnlVoters->ShowHeader = false;
     $pnlVoters->SortDirection = 1;
     $pnlVoters->AddColumn($colCnt);
     $pnlVoters->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroSuggestionVoteAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroSuggestionVoteAsUser->Suggestion->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroSuggestionVoteAsUser->Suggestion->Text->NarroContextAsText->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlVoters->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroSuggestionVoteAsUser->SuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlComments = new NarroUserDataGrid($this->tabTop);
     $pnlComments->CssClass = 'datagrid';
     $colUsername = $pnlComments->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlComments->SortColumnIndex = 1;
     $pnlComments->ShowHeader = false;
     $pnlComments->SortDirection = 1;
     $pnlComments->AddColumn($colCnt);
     $pnlComments->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroTextCommentAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroTextCommentAsUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID));
     $pnlComments->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroTextCommentAsUser->TextCommentId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $this->tabTop->Headers = array(t('Translators'), t('Reviewers'), t('Voters'), t('Comments'));
 }
开发者ID:Jobava,项目名称:narro,代码行数:67,代码来源:NarroTopPanel.class.php

示例8: btnClearLog_Click

 public function btnClearLog_Click($strFormId, $strControlId, $strParameter)
 {
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         if (QApplication::HasPermission('Administrator')) {
             NarroLog::GetDatabase()->NonQuery(sprintf('DELETE FROM narro_log'));
         } else {
             NarroLog::GetDatabase()->NonQuery(sprintf('DELETE FROM narro_log WHERE language_id=%d', QApplication::GetLanguageId()));
         }
         $this->dtgLog->btnFilterReset_Click($strFormId, $strControlId, $strParameter);
         $this->dtgLog->Refresh();
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:12,代码来源:log.php

示例9: 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

示例10: __construct

 public function __construct($objUser, $objParentObject, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->strTemplate = __NARRO_INCLUDES__ . '/narro/panel/NarroUserRolePanel.tpl.php';
     $this->objUser = $objUser;
     // Setup DataGrid Columns
     $this->colLanguage = new QDataGridColumn(t('Language'), '<?= $_CONTROL->ParentControl->dtgUserRole_LanguageColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Language->LanguageName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Language->LanguageName, false)));
     $this->colLanguage->HtmlEntities = false;
     $this->colProject = new QDataGridColumn(t('Project'), '<?= $_CONTROL->ParentControl->dtgUserRole_ProjectColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Project->ProjectName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Project->ProjectName, false)));
     $this->colProject->HtmlEntities = false;
     $this->colRole = new QDataGridColumn(t('Roles'), '<?= $_CONTROL->ParentControl->dtgUserRole_RoleColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Role->RoleName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroUserRole()->Role->RoleName, false)));
     $this->colRole->HtmlEntities = false;
     $this->colActions = new QDataGridColumn(t('Actions'), '<?= $_CONTROL->ParentControl->dtgUserRole_ActionsColumn_Render($_ITEM) ?>');
     $this->colActions->HtmlEntities = false;
     // Setup DataGrid
     $this->dtgUserRole = new NarroDataGrid($this);
     $this->dtgUserRole->Title = sprintf(t('<b>%s</b>\'s roles'), NarroLink::UserProfile($this->objUser->UserId, $this->objUser->RealName));
     $this->dtgUserRole->ShowHeader = true;
     $this->dtgUserRole->Paginator = new QPaginator($this->dtgUserRole);
     $this->dtgUserRole->PaginatorAlternate = new QPaginator($this->dtgUserRole);
     $this->dtgUserRole->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgUserRole->UseAjax = QApplication::$UseAjax;
     // Specify the local databind method this datagrid will use
     $this->dtgUserRole->SetDataBinder('dtgUserRole_Bind', $this);
     $this->dtgUserRole->AddColumn($this->colLanguage);
     $this->dtgUserRole->AddColumn($this->colProject);
     $this->dtgUserRole->AddColumn($this->colRole);
     $this->lstLanguage = new QListBox($this);
     $this->lstLanguage->AddItem('Any');
     foreach (NarroLanguage::LoadAllActive(array(QQ::OrderBy(QQN::NarroLanguage()->LanguageName))) as $objNarroLanguage) {
         if (QApplication::HasPermission('Can manage user roles', null, $objNarroLanguage->LanguageId)) {
             $this->blnCanManageSomeRoles = true;
         }
         $this->lstLanguage->AddItem($objNarroLanguage->LanguageName, $objNarroLanguage->LanguageId);
     }
     $this->lstLanguage->SelectedValue = QApplication::GetLanguageId();
     $this->lstProject = new QListBox($this);
     $this->lstProject->AddItem('Any');
     foreach (NarroProject::QueryArray(QQ::Equal(QQN::NarroProject()->Active, 1), array(QQ::OrderBy(QQN::NarroProject()->ProjectName))) as $objNarroProject) {
         if (QApplication::HasPermission('Can manage user roles', $objNarroProject->ProjectId)) {
             $this->blnCanManageSomeRoles = true;
         }
         $this->lstProject->AddItem($objNarroProject->ProjectName, $objNarroProject->ProjectId);
     }
     if (!$this->blnCanManageSomeRoles && QApplication::HasPermission('Can manage user roles')) {
         $this->blnCanManageSomeRoles = true;
     }
     if ($this->blnCanManageSomeRoles) {
         $this->dtgUserRole->AddColumn($this->colActions);
     }
     $this->lstRole = new QListBox($this);
     foreach (NarroRole::LoadAll(array(QQ::OrderBy(QQN::NarroRole()->RoleName))) as $objNarroRole) {
         if ($objNarroRole->RoleName == 'Administrator' && !QApplication::HasPermission('Administrator')) {
             continue;
         }
         $this->lstRole->AddItem($objNarroRole->RoleName, $objNarroRole->RoleId);
     }
     $this->btnAddRole = new QButton($this);
     $this->btnAddRole->Text = t('Add');
     $this->btnAddRole->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnAddRole_Click'));
 }
开发者ID:Jobava,项目名称:narro,代码行数:68,代码来源:NarroUserRolePanel.class.php

示例11: btnSave_Click

 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     foreach ($this->arrControls as $strName => $objControl) {
         switch (NarroProject::$AvailablePreferences[$strName]['type']) {
             case 'number':
                 $this->objProject->SetPreferenceValueByName($strName, $objControl->Text);
                 break;
             case 'text':
                 $this->objProject->SetPreferenceValueByName($strName, $objControl->Text);
                 break;
             case 'option':
                 $this->objProject->SetPreferenceValueByName($strName, $objControl->SelectedValue);
                 break;
         }
     }
     try {
         $this->objProject->Save();
         $this->objProject = NarroProject::Load($this->objProject->ProjectId);
         $this->objProjectProgress = NarroProjectProgress::LoadByProjectIdLanguageId($this->objProject->ProjectId, QApplication::GetLanguageId());
         $this->lblMessage->Text = t('Your preferences were saved successfuly.');
         $this->lblMessage->ForeColor = 'green';
     } catch (Exception $objEx) {
         $this->lblMessage->Text = t('An error occurred while trying to save your preferences.');
         $this->lblMessage->ForeColor = 'red';
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:26,代码来源:NarroProjectPreferencesPanel.class.php

示例12: sprintf

 case 'textcomment':
     if (isset($objProject) && $objProject instanceof NarroProject) {
         $strCacheId = sprintf('rssfeed_textcomment_%d_%d', $objProject->ProjectId, QApplication::QueryString('l'));
     } else {
         $strCacheId = sprintf('rssfeed_textcomment_%d', QApplication::QueryString('l'));
     }
     if (!($objRssFeed = QApplication::$Cache->load($strCacheId))) {
         if (isset($objProject) && $objProject instanceof NarroProject) {
             $objRssFeed = new QRssFeed(sprintf(t('Comments on texts from %s'), $objProject->ProjectName), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest debates on texts from the project %s'), $objProject->ProjectName));
         } else {
             $objRssFeed = new QRssFeed(t('Comments on texts'), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, t('Get the latest debates on texts'));
         }
         if (isset($objProject) && $objProject instanceof NarroProject) {
             $strSqlQuery = sprintf('SELECT DISTINCT narro_text_comment.* FROM narro_text_comment, narro_context WHERE narro_text_comment.text_id=narro_context.text_id AND narro_context.active=1 AND narro_context.project_id=%d AND narro_text_comment.language_id=%d ORDER BY created DESC LIMIT 0, 20', $objProject->ProjectId, QApplication::GetLanguageId());
         } else {
             $strSqlQuery = sprintf('SELECT DISTINCT narro_text_comment.* FROM narro_text_comment WHERE narro_text_comment.language_id=%d ORDER BY created DESC LIMIT 0, 20', QApplication::GetLanguageId());
         }
         $objDatabase = QApplication::$Database[1];
         $objDbResult = $objDatabase->Query($strSqlQuery);
         if ($objDbResult) {
             $arrTextComment = NarroTextComment::InstantiateDbResult($objDbResult);
             foreach ($arrTextComment as $objTextComment) {
                 if (isset($objProject) && $objProject instanceof NarroProject) {
                     $arrContext = NarroContext::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContext()->ProjectId, $objProject->ProjectId), QQ::Equal(QQN::NarroContext()->TextId, $objTextComment->TextId), QQ::Equal(QQN::NarroContext()->Active, 1)));
                 } else {
                     $arrContext = NarroContext::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContext()->TextId, $objTextComment->TextId), QQ::Equal(QQN::NarroContext()->Active, 1)));
                 }
                 if (count($arrContext)) {
                     $arrProjectLinks = array();
                     $arrProjects = array();
                     $strDescription = sprintf('
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:rss.php

示例13: dtgFile_SetConditions

 public function dtgFile_SetConditions()
 {
     if ($this->txtSearch->Text == '') {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId));
     } else {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId), QQ::Like(QQN::NarroFileProgress()->File->FileName, sprintf('%%%s%%', $this->txtSearch->Text)));
     }
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if (!$this->chkShowHierarchy->Checked) {
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = $objCommonCondition;
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } elseif ($this->objParentFile) {
         $objParentCondition = QQ::Equal(QQN::NarroFileProgress()->File->ParentId, $this->objParentFile->FileId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } else {
         $objParentCondition = QQ::IsNull(QQN::NarroFileProgress()->File->ParentId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     }
     $this->MarkAsModified();
 }
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:NarroProjectFileListPanel.class.php

示例14: btnImport_Click

 public function btnImport_Click($strFormId, $strControlId, $strParameter)
 {
     if (!QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
         return false;
     }
     $strProcLogFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-import-process.log';
     $strProcPidFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-import-process.pid';
     $strProgressFile = __TMP_PATH__ . '/import-' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode;
     if ($strParameter == 1) {
         if (NarroUtils::IsProcessRunning('import', $this->objProject->ProjectId)) {
             $this->objImportProgress->Translated = NarroProgress::GetProgress($this->objProject->ProjectId, 'import');
             $this->objImportProgress->MarkAsModified();
         } else {
             $this->lblImport->Text = t('Import finished.');
             if (QApplication::$UseAjax) {
                 QApplication::ExecuteJavaScript('if (typeof lastImportId != \'undefined\') clearInterval(lastImportId)');
             }
             if (file_exists($strProcLogFile) && filesize($strProcLogFile)) {
                 NarroLogger::LogInfo(sprintf('There are messages from the background process: %s', file_get_contents($strProcLogFile)));
             }
             if (file_exists($strProcLogFile)) {
                 unlink($strProcLogFile);
             }
             if (file_exists($strProcPidFile)) {
                 unlink($strProcPidFile);
             }
             if (file_exists($strProgressFile)) {
                 unlink($strProgressFile);
             }
             $this->lblImport->Visible = true;
             $this->btnImport->Visible = true;
             $this->btnKillProcess->Visible = false;
             $this->objImportProgress->Translated = 0;
             $this->objImportProgress->Visible = false;
         }
         $this->pnlLogViewer->MarkAsModified();
     } elseif ($strParameter == 2) {
         $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId;
         $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId();
         $this->pnlLogViewer->DateStart = QDateTime::Now();
         NarroProgress::ClearProgressFileName($this->objProject->ProjectId, 'import');
         set_time_limit(0);
         if (file_exists($strProcLogFile)) {
             unlink($strProcLogFile);
         }
         if (file_exists($strProcPidFile)) {
             unlink($strProcPidFile);
         }
         if (file_exists($strProgressFile)) {
             unlink($strProgressFile);
         }
         $objNarroImporter = new NarroProjectImporter();
         /**
          * Get boolean options
          */
         $objNarroImporter->CheckEqual = true;
         $objNarroImporter->Approve = $this->chkApproveImportedTranslations->Checked;
         $objNarroImporter->ApproveAlreadyApproved = !$this->chkApproveOnlyNotApproved->Checked;
         $objNarroImporter->OnlySuggestions = !$this->chkImportSourceTexts->Checked;
         $objNarroImporter->Project = $this->objProject;
         $objNarroImporter->ImportUnchangedFiles = $this->chkImportUnchangedFiles->Checked;
         $objNarroImporter->User = QApplication::$User;
         $objNarroImporter->TargetLanguage = QApplication::$TargetLanguage;
         $objNarroImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE);
         try {
             $objNarroImporter->TranslationPath = $this->pnlTranslationsSource->Directory;
             $objNarroImporter->TemplatePath = $this->objProject->DefaultTemplatePath;
         } catch (Exception $objEx) {
             NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage()));
             $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage());
             return false;
         }
         try {
             $objNarroImporter->ImportProject();
         } catch (Exception $objEx) {
             NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage()));
             $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage());
         }
         $this->lblImport->Visible = true;
         $this->btnImport->Visible = true;
         $this->btnKillProcess->Visible = false;
         $this->objImportProgress->Visible = false;
         $this->pnlLogViewer->MarkAsModified();
     } else {
         $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId;
         $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId();
         $this->pnlLogViewer->DateStart = QDateTime::Now();
         NarroProgress::ClearProgressFileName($this->objProject->ProjectId, 'import');
         $this->pnlLogViewer->MarkAsModified();
         $this->btnImport->Visible = false;
         $this->btnKillProcess->Visible = QApplication::HasPermission('Administrator', $this->objProject, QApplication::$TargetLanguage->LanguageCode) && !$this->btnImport->Visible;
         $this->objImportProgress->Visible = true;
         $this->objImportProgress->Translated = 0;
         $this->lblImport->Text = '';
         try {
             $strCommand = sprintf(__PHP_CLI_PATH__ . ' ' . escapeshellarg(sprintf('%s/includes/narro/importer/narro-cli.php', __DOCROOT__ . __SUBDIRECTORY__)) . ' --import --minloglevel 3 --project %d --user %d --check-equal ' . ($this->chkApproveImportedTranslations->Checked ? '--approve ' : '') . ($this->chkImportUnchangedFiles->Checked ? '--import-unchanged-files ' : '') . ($this->chkApproveOnlyNotApproved->Checked ? '' : '--approve-already-approved ') . (!$this->chkImportSourceTexts->Checked || !QApplication::HasPermission('Can import project', $this->objProject->ProjectId) ? '--only-suggestions ' : '') . ' --template-lang %s --translation-lang %s --template-directory %s --translation-directory %s', (int) $this->objProject->ProjectId, (int) QApplication::$User->UserId, escapeshellarg(NarroLanguage::SOURCE_LANGUAGE_CODE), escapeshellarg(QApplication::$TargetLanguage->LanguageCode), escapeshellarg($this->objProject->DefaultTemplatePath), escapeshellarg($this->pnlTranslationsSource->Directory));
         } catch (Exception $objEx) {
             NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage()));
             $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage());
             $this->lblImport->Visible = true;
//.........这里部分代码省略.........
开发者ID:Jobava,项目名称:narro,代码行数:101,代码来源:NarroProjectImportPanel.class.php

示例15: t

" href="rss.php?t=text&l=<?php 
        echo QApplication::GetLanguageId();
        ?>
" />
            <link rel="alternate" type="application/rss+xml" title="<?php 
        echo t('Comments on texts from all projects');
        ?>
" href="rss.php?t=textcomment&l=<?php 
        echo QApplication::GetLanguageId();
        ?>
" />
            <link rel="alternate" type="application/rss+xml" title="<?php 
        echo t('Translations for all projects');
        ?>
" href="rss.php?t=suggestion&l=<?php 
        echo QApplication::GetLanguageId();
        ?>
" />
            <?php 
    }
    ?>
        <?php 
}
?>
        <link type="image/x-icon" href="<?php 
echo __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__;
?>
/assets/images/narro.ico" rel="shortcut icon"/>
        <link type="image/x-icon" href="<?php 
echo __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__;
?>
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:header.inc.php


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