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


PHP QApplication::HasPermissionForThisLang方法代码示例

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


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

示例1: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders = array(NarroLink::ProjectList(t('Projects')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
     /**
      * Do not show the langauge tab if only two languages are active (source and target
      * Unless the user is an administrator and might want to set another one active
      */
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $this->pnlLanguageTab = new QTabs($this->pnlTab);
         $pnlDummy = new QPanel($this->pnlLanguageTab);
         $arrLangHeaders[] = t('List');
         if (QApplication::HasPermissionForThisLang('Can add language')) {
             $this->pnlLanguageEdit = new NarroLanguageEditPanel($this->pnlLanguageTab, NarroLanguage::Load(QApplication::QueryString('lid')));
             $arrLangHeaders[] = QApplication::QueryString('lid') ? t('Edit') : t('Add');
         }
         $this->pnlLanguageTab->Headers = $arrLangHeaders;
         $this->pnlLanguageTab->Selected = 1;
         $arrHeaders[] = t('Languages');
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:35,代码来源:language_edit.php

示例2: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $this->pnlUserList = new NarroUserListPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $this->pnlTab->Selected = count($arrHeaders) - 1;
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:25,代码来源:users.php

示例3: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     if (!QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) {
         QApplication::Redirect(NarroLink::ProjectList());
     }
     $pnlDummy = new QPanel($this->pnlMainTab);
     $arrHeaders[] = NarroLink::Project($this->objProject->ProjectId, t('Overview'));
     if ($this->objProject instanceof NarroProject && QApplication::HasPermissionForThisLang('Can edit project', $this->objProject->ProjectId)) {
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectEdit($this->objProject->ProjectId, t('Edit'));
     }
     $pnlDummy = new QPanel($this->pnlMainTab);
     $arrHeaders[] = NarroLink::Translate($this->objProject->ProjectId, '', 0, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlMainTab);
     $arrHeaders[] = NarroLink::Review($this->objProject->ProjectId, '', NarroReviewPanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review'));
     $pnlDummy = new QPanel($this->pnlMainTab);
     $arrHeaders[] = NarroLink::ProjectFileList($this->objProject->ProjectId, '', '', t('Files'));
     $pnlDummy = new QPanel($this->pnlMainTab);
     $arrHeaders[] = NarroLink::ProjectLanguages($this->objProject->ProjectId, t('Languages'));
     if (QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectImport($this->objProject->ProjectId, t('Import'));
     }
     if (QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) {
         $this->pnlSelectedTab = new NarroProjectExportPanel($this->objProject, $this->pnlMainTab);
         $arrHeaders[] = t('Export');
         $this->pnlMainTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlMainTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:export.php

示例4: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     /**
      * Create the project list panel and set the filter from the url.
      * The filter is used to show only projects of a given status based on their progress
      * (finished, empty, in progress).
      */
     $this->pnlProjectList = new NarroProjectListPanel($this->pnlTab);
     $this->pnlTop = new NarroTopPanel(date(sprintf('Y-m-%d 00:00:00', date('d') - date('N') + 1)), $this);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders = array(t('Projects'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
     /**
      * Do not show the langauge tab if only two languages are active (source and target
      * Unless the user is an administrator and might want to set another one active
      */
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:32,代码来源:projects.php

示例5: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     if (QApplication::GetUserId() == NarroUser::ANONYMOUS_USER_ID) {
         QApplication::Redirect(NarroLink::ProjectList());
         exit;
     }
     if (QApplication::GetUserId() != QApplication::QueryString('u') && QApplication::HasPermissionForThisLang('Can manage users', null)) {
         $this->objUser = NarroUser::Load(QApplication::QueryString('u'));
     }
     if (!$this->objUser instanceof NarroUser) {
         $this->objUser = QApplication::$User;
     }
     $this->pnlBreadcrumb->setElements(NarroLink::ProjectList(t('Projects')), NarroLink::UserList('', t('Users')), $this->objUser->RealName);
     $this->pnlTab = new QTabs($this);
     new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserProfile($this->objUser->UserId, t('Profile'));
     if (QApplication::GetUserId() == $this->objUser->UserId || QApplication::HasPermissionForThisLang('Can manage users', null)) {
         new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::UserPreferences($this->objUser->UserId, t('Preferences'));
     }
     new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserRole($this->objUser->UserId, t('Roles'));
     if (QApplication::GetUserId() == $this->objUser->UserId || QApplication::HasPermissionForThisLang('Can manage users', null)) {
         $this->pnlUser = new NarroUserEditPanel($this->objUser, $this->pnlTab);
         $arrHeaders[] = NarroLink::UserEdit($this->objUser->UserId, t('Edit'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:30,代码来源:account.php

示例6: ExportFile

 public function ExportFile($strTemplateFile, $strTranslatedFile)
 {
     if ($strTranslatedFile != $this->objProject->DefaultTranslationPath . '/' . $this->objFile->FilePath && QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
         if (file_exists($this->objProject->DefaultTranslationPath . '/' . $this->objFile->FilePath)) {
             copy($this->objProject->DefaultTranslationPath . '/' . $this->objFile->FilePath, $strTranslatedFile);
         } else {
             copy($strTemplateFile, $strTranslatedFile);
         }
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:10,代码来源:NarroUnsupportedFileImporter.class.php

示例7: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     if (QApplication::QueryString('p') == 0) {
         $this->pnlMainTab = new QTabs($this);
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
         $this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
         $arrHeaders[] = t('Review');
         $this->pnlMainTab->Selected = count($arrHeaders) - 1;
         if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
         }
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::UserList('', t('Users'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
         if (QApplication::HasPermissionForThisLang('Administrator')) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         }
         $this->pnlMainTab->Headers = $arrHeaders;
     } else {
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Project($this->objProject->ProjectId, t('Overview'));
         if ($this->objProject instanceof NarroProject && QApplication::HasPermissionForThisLang('Can edit project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectEdit($this->objProject->ProjectId, t('Edit'));
         }
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Translate($this->objProject->ProjectId, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
         $this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
         $arrHeaders[] = t('Review');
         $this->pnlMainTab->Selected = count($arrHeaders) - 1;
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectFileList($this->objProject->ProjectId, '', '', t('Files'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectLanguages($this->objProject->ProjectId, t('Languages'));
         if (QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectImport($this->objProject->ProjectId, t('Import'));
         }
         if (QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectExport($this->objProject->ProjectId, t('Export'));
         }
         $this->pnlMainTab->Headers = $arrHeaders;
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:52,代码来源:review.php

示例8: __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

示例9: __construct

 public function __construct(NarroFile $objFile, $objParentObject, $strControlId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->objFile = $objFile;
     $this->btnExport = new QButton($this);
     $this->btnExport->Text = t('Download');
     $this->btnExport->ActionParameter = $this->objFile->FileId;
     $this->btnExport->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnExport_Click'));
     $strTemplateFile = $this->objFile->Project->DefaultTemplatePath . $this->objFile->FilePath;
     if (file_exists($strTemplateFile) && (filesize($strTemplateFile) < __MAXIMUM_FILE_SIZE_TO_EXPORT__ || QApplication::HasPermissionForThisLang('Can export file', $this->objFile->ProjectId)) && file_exists($strTemplateFile)) {
         $this->blnDisplay = true;
     } else {
         $this->blnDisplay = false;
     }
     $this->fileToUpload = new QFileControl($this);
 }
开发者ID:Jobava,项目名称:narro,代码行数:16,代码来源:NarroFileExportPanel.class.php

示例10: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabPanel($this);
     $this->pnlTab->UseAjax = false;
     $this->pnlRoleTab = new QTabPanel($this->pnlTab);
     $this->pnlRoleEdit = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
     $this->pnlRoleTab->addTab(new QPanel($this->pnlRoleTab), t('List'), NarroLink::RoleList());
     $this->pnlRoleTab->addTab($this->pnlRoleEdit, QApplication::QueryString('lid') ? t('Edit') : t('Add'));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Projects'), NarroLink::ProjectList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Translate'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Languages'), NarroLink::LanguageList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Users'), NarroLink::UserList());
     $this->pnlTab->addTab($this->pnlRoleTab, t('Roles'));
     $this->pnlTab->SelectedTab = 4;
     $this->pnlRoleTab->SelectedTab = 1;
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $this->pnlRoleTab = new QTabs($this->pnlTab);
     new QPanel($this->pnlRoleTab);
     $arrRoleHeaders[] = NarroLink::RoleList(0, '', t('List'));
     if (QApplication::HasPermissionForThisLang('Can add role')) {
         $pnlDummy = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
         $arrRoleHeaders[] = NarroLink::RoleEdit(null, t('Add'));
         $this->pnlRoleTab->Selected = count($arrRoleHeaders) - 1;
     }
     $this->pnlRoleTab->Headers = $arrRoleHeaders;
     $arrHeaders[] = t('Roles');
     $this->pnlTab->Selected = count($arrHeaders) - 1;
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:46,代码来源:role.php

示例11: __construct

 public function __construct($objParentObject, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->strTemplate = __NARRO_INCLUDES__ . '/narro/panel/NarroUserListPanel.tpl.php';
     $colActions = new QDataGridColumn(QApplication::Translate('Actions'), '<?= $_CONTROL->ParentControl->dtgUser_ActionsColumn_Render($_ITEM) ?>');
     $colActions->HtmlEntities = false;
     // Setup DataGrid
     $this->dtgUser = new NarroUserDataGrid($this);
     $this->dtgUser->UseAjax = QApplication::$UseAjax;
     $this->dtgUser->ShowHeader = true;
     $this->dtgUser->ShowFilter = false;
     $this->dtgUser->Title = t('Users');
     // Datagrid Paginator
     $this->dtgUser->Paginator = new QPaginator($this->dtgUser);
     $this->dtgUser->PaginatorAlternate = new QPaginator($this->dtgUser);
     $this->dtgUser->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
     // Specify the local databind method this datagrid will use
     $this->dtgUser->SetDataBinder('dtgUser_Bind', $this);
     $this->dtgUser->MetaAddColumn(QQN::NarroUser()->RealName, sprintf('Name="%s"', t('Real name')), 'Html="<?= $_CONTROL->ParentControl->dtgUser_RealNameColumn_Render($_ITEM) ?>"', 'HtmlEntities=false');
     $this->dtgUser->MetaAddColumn(QQN::NarroUser()->Username, sprintf('Name="%s"', t('Username')), 'Html="<?= $_CONTROL->ParentControl->dtgUser_UsernameColumn_Render($_ITEM) ?>"', 'HtmlEntities=false');
     if (QApplication::HasPermissionForThisLang('Administrator', null)) {
         $this->dtgUser->MetaAddColumn(QQN::NarroUser()->Email, sprintf('Name="%s"', t('Email')), 'Html="<?= $_CONTROL->ParentControl->dtgUser_EmailColumn_Render($_ITEM) ?>"', 'HtmlEntities=false');
     }
     if (QApplication::HasPermissionForThisLang('Can manage users', null)) {
         $this->dtgUser->AddColumn($colActions);
     }
     $this->dtgUser->SortColumnIndex = 0;
     $this->txtSearch = new QTextBox($this);
     $this->btnSearch = new QButton($this);
     $this->btnSearch->Text = t('Search');
     $this->btnSearch->PrimaryButton = true;
     if (QApplication::$UseAjax) {
         $this->btnSearch->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'dtgUser_Bind'));
     } else {
         $this->btnSearch->AddAction(new QClickEvent(), new QServerControlAction($this, 'dtgUser_Bind'));
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:43,代码来源:NarroUserListPanel.class.php

示例12: btnImport_Click

 public function btnImport_Click($strFormId, $strControlId, $strParameter)
 {
     if (!$this->fileToUpload->Display) {
         $this->fileToUpload->Display = true;
         return false;
     }
     $objFileImporter = NarroFileType::GetFileImporter($this->objNarroFile->TypeId);
     $objFileImporter->User = QApplication::$User;
     $objFileImporter->Project = $this->objNarroFile->Project;
     $objFileImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE);
     $objFileImporter->TargetLanguage = QApplication::$TargetLanguage;
     $objFileImporter->CheckEqual = true;
     $objFileImporter->File = $this->objNarroFile;
     $objFileImporter->OnlySuggestions = !QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId);
     $objFileImporter->ApproveAlreadyApproved = QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId);
     $objFileImporter->Approve = QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId);
     $strTempFileName = tempnam(__TMP_PATH__, QApplication::$TargetLanguage->LanguageCode);
     $objFileImporter->ImportFile($this->objNarroFile->Project->DefaultTemplatePath . $this->objNarroFile->FilePath, $this->fileToUpload->File);
 }
开发者ID:Jobava,项目名称:narro,代码行数:19,代码来源:NarroFileImportPanel.class.php

示例13: __construct

 public function __construct(NarroText $objText, $objParentObject, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->blnAutoRenderChildren = true;
     $this->intTextId = $objText->TextId;
     $this->strText = sprintf('<span class="instructions">%s</span>', t('User comments'));
     $this->dtgComments = new NarroTextCommentDataGrid($this);
     $colComment = $this->dtgComments->MetaAddColumn(QQN::NarroTextComment()->CommentText);
     $colComment->HtmlEntities = false;
     $colComment->Html = '<?=$_CONTROL->ParentControl->colComment_Render($_ITEM)?>';
     $this->dtgComments->ShowFilter = false;
     $this->dtgComments->ShowHeader = false;
     $this->dtgComments->AdditionalConditions = QQ::Equal(QQN::NarroTextComment()->TextId, $objText->TextId);
     $this->dtgComments->AdditionalClauses = array(QQ::OrderBy(QQN::NarroTextComment()->Created, 1), QQ::Expand(QQN::NarroTextComment()->Language), QQ::Expand(QQN::NarroTextComment()->User));
     $this->txtComment = new QTextBox($this);
     $this->txtComment->Name = t('Comment');
     $this->txtComment->TextMode = QTextMode::MultiLine;
     $this->txtComment->PreferedRenderMethod = 'Render';
     $this->txtComment->Columns = 80;
     $this->txtComment->ToolTip = t('Enter your comments here');
     $this->txtComment->CssClass = 'comment';
     $this->txtComment->DisplayStyle = QDisplayStyle::Block;
     $this->txtComment->Display = QApplication::HasPermissionForThisLang('Can comment');
     $this->btnSave = new QImageButton($this);
     $this->btnSave->AlternateText = t('Add comment');
     $this->btnSave->CssClass = 'imgbutton save';
     $this->btnSave->ToolTip = $this->btnSave->AlternateText;
     $this->btnSave->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/comment.png';
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
     $this->btnSave->Display = QApplication::HasPermissionForThisLang('Can comment');
 }
开发者ID:Jobava,项目名称:narro,代码行数:37,代码来源:NarroTextCommentPanel.class.php

示例14: btnDelete_Click

 public function btnDelete_Click($strFormId, $strControlId, $strParameter)
 {
     if (QApplication::HasPermissionForThisLang('Can delete language', null)) {
         $this->objNarroLanguage->Delete();
     }
     QApplication::Redirect(NarroLink::LanguageList());
 }
开发者ID:Jobava,项目名称:narro,代码行数:7,代码来源:NarroLanguageEditPanel.class.php

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


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