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


PHP QQN::NarroLanguage方法代码示例

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


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

示例1: __construct

 public function __construct($objParentObject, $strControlId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->blnAutoRenderChildren = true;
     $this->strTemplate = dirname(__FILE__) . '/' . __CLASS__ . '.tpl.php';
     $this->txtSearch = new QTextBox($this);
     $this->txtSearch->Name = t('Text');
     $this->txtSearch->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'txtSearch_KeyUp'));
     $this->txtSearch->SetCustomAttribute('autocomplete', 'off');
     $this->btnClear = new QImageButton($this);
     $this->btnClear->AlternateText = t('Clear');
     $this->btnClear->ToolTip = $this->btnClear->AlternateText;
     $this->btnClear->CssClass = 'clear_button';
     $this->btnClear->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/clear.png';
     $this->btnClear->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnClear_Click'));
     $this->lstLanguage = new QListBox($this);
     $arrLanguages = NarroLanguage::LoadAllActive(QQ::OrderBy(QQN::NarroLanguage()->LanguageName));
     foreach ($arrLanguages as $objLanguage) {
         $this->lstLanguage->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageId, $objLanguage->LanguageCode == QApplication::$TargetLanguage->LanguageCode);
     }
     $this->btnSearch = new QImageButton($this);
     $this->btnSearch->AlternateText = t('Search');
     $this->btnSearch->ToolTip = $this->btnSearch->AlternateText;
     $this->btnSearch->CssClass = 'clear_button';
     $this->btnSearch->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/search.png';
     $this->btnSearch->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'txtSearch_KeyUp'));
     $this->dtgSuggestion = new NarroSuggestionDataGrid($this);
     $this->dtgSuggestion->ShowHeader = false;
     $this->dtgSuggestion->MetaAddColumn(QQN::NarroSuggestion()->SuggestionValue);
     $this->dtgSuggestion->AdditionalClauses = array(QQ::LimitInfo(20), QQ::OrderBy(QQN::NarroSuggestion()->Text->TextCharCount));
     $this->btnClear_Click();
 }
开发者ID:Jobava,项目名称:narro,代码行数:32,代码来源:NarroSuggestionSearchPanel.class.php

示例2: dtgLanguage_Create

 protected function dtgLanguage_Create()
 {
     $this->dtgLanguage = new NarroLanguageDataGrid($this);
     $this->dtgLanguage->SortColumnIndex = 1;
     $this->dtgLanguage->SortDirection = 1;
     $this->dtgLanguage->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroLanguage()->Active, true), QQ::Equal(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProjectId, $this->objProject->ProjectId));
     $this->dtgLanguage->AdditionalClauses = array(QQ::Expand(QQN::NarroLanguage()->NarroProjectProgressAsLanguage));
     $colLanguage = $this->dtgLanguage->MetaAddColumn(QQN::NarroLanguage()->LanguageName);
     $colLanguage->Name = t('Language');
     $colProgress = new QDataGridColumn(t('Progress'));
     $colProgress->Html = '<?=$_CONTROL->ParentControl->dtgLanguage_PercentTranslated_Render($_ITEM)?>';
     $colProgress->HtmlEntities = false;
     $colProgress->OrderByClause = QQ::OrderBy(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent, 1, QQN::NarroLanguage()->NarroProjectProgressAsLanguage->FuzzyTextCount, 1);
     $colProgress->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent, 0, QQN::NarroLanguage()->NarroProjectProgressAsLanguage->FuzzyTextCount, 0);
     $this->dtgLanguage->AddColumn($colProgress);
     //$colLanguage = $this->dtgLanguage->MetaAddColumn(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent);
 }
开发者ID:Jobava,项目名称:narro,代码行数:17,代码来源:NarroProjectLanguageListPanel.class.php

示例3: __construct

 public function __construct($objParentObject, $strControlId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->strTemplate = __NARRO_INCLUDES__ . '/narro/panel/NarroHeaderPanel.tpl.php';
     $this->strHorizontalAlign = QHorizontalAlign::Right;
     $this->lstLanguage = new QListBox($this);
     $this->lstLanguage->AddAction(new QChangeEvent(), new QServerControlAction($this, 'lstLanguage_Change'));
     $arrLanguages = NarroLanguage::LoadAllActive(QQ::OrderBy(QQN::NarroLanguage()->LanguageName));
     foreach ($arrLanguages as $objLanguage) {
         $this->lstLanguage->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == QApplication::$TargetLanguage->LanguageCode);
     }
     $this->btnLogout = new QLinkButton($this);
     $this->btnLogout->Text = '<img src="assets/images/logout.png" alt="' . t('Logout') . '" border="0" title="' . t('Logout') . '" />';
     $this->btnLogout->HtmlEntities = false;
     $this->btnLogout->ToolTip = t('Logout');
     $this->btnLogout->SetCustomStyle('vertical-align', 'bottom');
     $this->btnLogout->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnLogout_Click'));
 }
开发者ID:Jobava,项目名称:narro,代码行数:18,代码来源:NarroHeaderPanel.class.php

示例4: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     if (!QApplication::HasPermissionForThisLang('Administrator')) {
         QApplication::Redirect(NarroLink::ProjectList());
     }
     $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('Review'));
     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')) {
         $this->pnlLog = new QPanel($this->pnlTab);
         $this->pnlLog->AutoRenderChildren = true;
         $btnClearLog = new QButton($this->pnlLog);
         $btnClearLog->Text = t('Clear the log');
         $btnClearLog->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete all the logged messages?')));
         $btnClearLog->AddAction(new QClickEvent(), new QAjaxAction('btnClearLog_Click'));
         $this->dtgLog = new NarroLogDataGrid($this->pnlLog);
         // Datagrid Paginator
         $this->dtgLog->Paginator = new QPaginator($this->dtgLog);
         $this->dtgLog->PaginatorAlternate = new QPaginator($this->dtgLog);
         $this->dtgLog->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
         $this->dtgLog->SortColumnIndex = 0;
         $this->dtgLog->SortDirection = 1;
         $colDate = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Date);
         $colDate->OrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId);
         $colDate->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId, 0);
         if (QApplication::HasPermission('Administrator')) {
             $colLanguage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Language->LanguageName);
             $colLanguage->Filter = null;
             $colLanguage->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->LanguageId));
             foreach (NarroLanguage::LoadAll(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)) as $objLanguage) {
                 $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroLog()->LanguageId, $objLanguage->LanguageId));
             }
         } else {
             $this->dtgLog->AdditionalConditions = QQ::Equal(QQN::NarroLog()->LanguageId, QApplication::GetLanguageId());
         }
         $colProject = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Project->ProjectName);
         $colProject->Filter = null;
         $colProject->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->ProjectId));
         foreach (NarroProject::LoadAll(QQ::OrderBy(QQN::NarroProject()->ProjectName)) as $objProject) {
             $colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroLog()->ProjectId, $objProject->ProjectId));
         }
         $colUser = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->User->Username);
         $colUser->Html = '<?=(($_ITEM->UserId)?NarroLink::UserProfile($_ITEM->UserId, $_ITEM->User->Username):"")?>';
         $colUser->HtmlEntities = false;
         $colPriority = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Priority);
         $colPriority->Name = 'P';
         $colPriority->Width = 16;
         $colPriority->FilterBoxSize = 1;
         $colPriority->HtmlEntities = false;
         $colMessage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Message);
         $colMessage->HtmlEntities = false;
         $colMessage->Html = '<?=$_FORM->dtgLog_colMessage_Render($_ITEM)?>';
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
开发者ID:Jobava,项目名称:narro,代码行数:70,代码来源:log.php

示例5: InitializeLanguage

 public static function InitializeLanguage()
 {
     global $argv;
     if (strstr($_SERVER['REQUEST_URI'], '_devtools')) {
         return false;
     }
     if (strstr($_SERVER['REQUEST_URI'], 'image.php')) {
         return false;
     }
     if (strstr($_SERVER['REQUEST_URI'], 'profile.php')) {
         return false;
     }
     QApplication::$SourceLanguage = NarroLanguage::LoadByLanguageCode(__SOURCE_LANGUAGE_CODE__);
     // language passed through the l parameter
     if (@$_REQUEST['l']) {
         QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode(@$_REQUEST['l']);
     } elseif (isset($argv) && ($strLanguage = $argv[array_search('--translation-lang', $argv) + 1])) {
         QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode($strLanguage);
     } else {
         if (QApplication::$User->UserId != NarroUser::ANONYMOUS_USER_ID) {
             $objGuessedLanguage = NarroLanguage::LoadByLanguageCode(QApplication::$User->GetPreferenceValueByName('Language'));
             if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) {
                 $objGuessedLanguage = null;
             }
         }
         if (!$objGuessedLanguage) {
             $objGuessedLanguage = QApplication::GetBrowserLanguage();
             if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) {
                 $objGuessedLanguage = null;
             }
         }
         if (!$objGuessedLanguage) {
             $objGuessedLanguage = NarroLanguage::QuerySingle(QQ::Equal(QQN::NarroLanguage()->Active, true));
         }
         if (!$objGuessedLanguage) {
             die('There are no active languages in the database.');
         } else {
             if (!isset($_REQUEST['openid_mode']) && !isset($argv)) {
                 QApplication::Redirect(sprintf('projects.php?l=%s', $objGuessedLanguage->LanguageCode));
                 exit;
             } else {
                 QApplication::$TargetLanguage = $objGuessedLanguage;
             }
         }
     }
     if (QApplication::$TargetLanguage->Active == false && !isset($argv)) {
         die(sprintf('The language %s is not active. Please ask the administrator to activate or check your URL if this is not the language you wanted.', QApplication::$TargetLanguage->LanguageName));
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:49,代码来源:QApplication.class.php

示例6: dtgLanguage_Bind

 public function dtgLanguage_Bind()
 {
     if ($this->txtSearch->Text != '') {
         $objSearchCondition = QQ::Like(QQN::NarroLanguage()->LanguageName, sprintf('%%%s%%', $this->txtSearch->Text));
     } else {
         $objSearchCondition = QQ::All();
     }
     switch ($this->lstFilter->SelectedValue) {
         /**
          * Only active
          */
         case 1:
             $objFilterCondition = QQ::AndCondition($objSearchCondition, QQ::Equal(QQN::NarroLanguage()->Active, 1));
             break;
             /**
              * 0 - show all
              */
         /**
          * 0 - show all
          */
         default:
             $objFilterCondition = $objSearchCondition;
     }
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgLanguage->TotalItemCount = NarroLanguage::QueryCount($objFilterCondition);
     // Setup the $objClauses Array
     $objClauses = array(QQ::Expand(QQ::Virtual('last_translation', QQ::SubSql('SELECT MAX(created) FROM narro_suggestion WHERE language_id={1}', QQN::NarroLanguage()->LanguageId))), QQ::Count(QQN::NarroLanguage()->NarroSuggestionAsLanguage->SuggestionId, 'translations_count'), QQ::GroupBy(QQN::NarroLanguage()->LanguageId));
     // 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->dtgLanguage->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgLanguage->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all NarroLanguage objects, given the clauses above
     $this->dtgLanguage->DataSource = NarroLanguage::QueryArray($objFilterCondition, $objClauses);
     QApplication::ExecuteJavaScript('highlight_datagrid();');
 }
开发者ID:Jobava,项目名称:narro,代码行数:41,代码来源:NarroLanguageListPanel.class.php

示例7: CountAllActive

 public static function CountAllActive()
 {
     return parent::QueryCount(QQ::AndCondition(QQ::NotEqual(QQN::NarroLanguage()->LanguageCode, NarroLanguage::SOURCE_LANGUAGE_CODE), QQ::Equal(QQN::NarroLanguage()->Active, 1)));
 }
开发者ID:Jobava,项目名称:narro,代码行数:4,代码来源:NarroLanguage.class.php

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

示例9: CreateNarroTemplate


//.........这里部分代码省略.........
                 foreach ($arrMatches[1] as $intMatchNo => $strText) {
                     if (trim($strText) != '') {
                         $strText = str_replace(array("&&&escapedsimplequote&&&", "&&&escapeddoublequote&&&"), array("'", '\\"'), $strText);
                         $arrMessages[md5($strText)]['text'] = $strText;
                         $arrMessages[md5($strText)]['files'][$strShortPath] = $strShortPath;
                         $strSearchText = $arrMatches[0][$intMatchNo];
                         preg_match_all('/^.*' . preg_quote($strSearchText, '/') . '.*$/m', $strFile, $arrFullMatches);
                         $arrMessages[md5($strText)]['context'] = "#. Preference name\n";
                         foreach ($arrFullMatches[0] as $strLine) {
                             if (isset($strLine) && trim($strLine)) {
                                 $arrMessages[md5($strText)]['context'] .= trim($strLine) . "\n";
                             }
                         }
                     }
                 }
                 foreach ($arrMatches[2] as $intMatchNo => $strText) {
                     if (trim($strText) != '') {
                         $strText = str_replace(array("&&&escapedsimplequote&&&", "&&&escapeddoublequote&&&"), array("'", '\\"'), $strText);
                         $arrMessages[md5($strText)]['text'] = $strText;
                         $arrMessages[md5($strText)]['files'][$strShortPath] = $strShortPath;
                         $strSearchText = $arrMatches[0][$intMatchNo];
                         preg_match_all('/^.*' . preg_quote($strSearchText, '/') . '.*$/m', $strFile, $arrFullMatches);
                         $arrMessages[md5($strText)]['context'] = "#. Preference description\n";
                         foreach ($arrFullMatches[0] as $strLine) {
                             if (isset($strLine) && trim($strLine)) {
                                 $arrMessages[md5($strText)]['context'] .= trim($strLine) . "\n";
                             }
                         }
                     }
                 }
             }
             if (preg_match_all('/t\\(\\$[a-zA-Z]+\\-\\>LanguageName/', $strFile, $arrMatches)) {
                 if (!isset($arrLanguages)) {
                     $arrLanguages = NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                 }
                 $strLangContext = '#. ';
                 foreach ($arrMatches as $intMatchNo => $arrVal) {
                     $strSearchText = $arrMatches[0][$intMatchNo];
                     preg_match_all('/^.*' . preg_quote($strSearchText, '/') . '.*$/m', $strFile, $arrFullMatches);
                     foreach ($arrFullMatches[0] as $strLine) {
                         if (isset($strLine) && trim($strLine)) {
                             $strLangContext .= trim($strLine) . "\n";
                         }
                     }
                 }
                 if (is_array($arrLanguages)) {
                     foreach ($arrLanguages as $objLanguage) {
                         $arrMessages[md5($objLanguage->LanguageName)]['text'] = $objLanguage->LanguageName;
                         $arrMessages[md5($objLanguage->LanguageName)]['files'][$strShortPath] = $strShortPath;
                         $arrMessages[md5($objLanguage->LanguageName)]['context'] = $strLangContext;
                     }
                 }
             }
             if (preg_match_all('/t\\(\\$[a-zA-Z]+\\-\\>RoleName/', $strFile, $arrMatches)) {
                 $strLangContext = '#. ';
                 foreach ($arrMatches as $intMatchNo => $arrVal) {
                     $strSearchText = $arrMatches[0][$intMatchNo];
                     preg_match_all('/^.*' . preg_quote($strSearchText, '/') . '.*$/m', $strFile, $arrFullMatches);
                     foreach ($arrFullMatches[0] as $strLine) {
                         if (isset($strLine) && trim($strLine)) {
                             $strLangContext .= trim($strLine) . "\n";
                         }
                     }
                 }
                 if (is_array($arrRoles)) {
                     foreach ($arrRoles as $objRole) {
开发者ID:Jobava,项目名称:narro,代码行数:67,代码来源:NarroProjectImporter.class.php

示例10: ResolveContentItem

 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a NarroLanguage-based QQNode.
  * It will also verify that it is a proper NarroLanguage-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_language') {
             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_language".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'LanguageId':
                     return QQN::NarroLanguage()->LanguageId;
                 case 'LanguageName':
                     return QQN::NarroLanguage()->LanguageName;
                 case 'LanguageCode':
                     return QQN::NarroLanguage()->LanguageCode;
                 case 'CountryCode':
                     return QQN::NarroLanguage()->CountryCode;
                 case 'DialectCode':
                     return QQN::NarroLanguage()->DialectCode;
                 case 'Encoding':
                     return QQN::NarroLanguage()->Encoding;
                 case 'TextDirection':
                     return QQN::NarroLanguage()->TextDirection;
                 case 'SpecialCharacters':
                     return QQN::NarroLanguage()->SpecialCharacters;
                 case 'PluralForm':
                     return QQN::NarroLanguage()->PluralForm;
                 case 'Active':
                     return QQN::NarroLanguage()->Active;
                 default:
                     throw new QCallerException('Simple Property not found in NarroLanguageDataGrid 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,代码行数:67,代码来源:NarroLanguageDataGridGen.class.php

示例11: LoadByLanguageCode

 /**
  * Load a single NarroLanguage object,
  * by LanguageCode Index(es)
  * @param string $strLanguageCode
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return NarroLanguage
  */
 public static function LoadByLanguageCode($strLanguageCode, $objOptionalClauses = null)
 {
     return NarroLanguage::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroLanguage()->LanguageCode, $strLanguageCode)), $objOptionalClauses);
 }
开发者ID:Jobava,项目名称:narro,代码行数:11,代码来源:NarroLanguageGen.class.php

示例12: GetControlHtml

 protected function GetControlHtml()
 {
     $strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
     foreach (NarroUser::$AvailablePreferences as $strName => $arrPref) {
         switch ($arrPref['type']) {
             case 'number':
                 $txtNumber = new QIntegerTextBox($this);
                 $txtNumber->Name = $strName;
                 $txtNumber->Minimum = 5;
                 $txtNumber->Maximum = 100;
                 $txtNumber->MaxLength = 3;
                 $txtNumber->Width = 50;
                 $txtNumber->Text = $this->objUser->GetPreferenceValueByName($strName);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $txtNumber;
                 break;
             case 'text':
                 $txtTextPref = new QTextBox($this);
                 $txtTextPref->Name = $strName;
                 $txtTextPref->Text = $this->objUser->GetPreferenceValueByName($strName);
                 if ($strName == 'Special characters') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+=this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroDiacriticsPanel::$arrEntities as $strEntityName => $strEntityChar) {
                         $strSelect .= sprintf('<option value=" %s">%s (%s)', $strEntityName, $strEntityChar, $strEntityName);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 } elseif ($strName == 'Other languages') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+= \' \' + this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName))) as $objLanguage) {
                         $strSelect .= sprintf('<option value="%s">%s (%s)', $objLanguage->LanguageCode, t($objLanguage->LanguageName), $objLanguage->LanguageCode);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description']);
                 $this->arrControls[$strName] = $txtTextPref;
                 break;
             case 'option':
                 $lstOption = new QListBox($this);
                 $lstOption->Name = $strName;
                 if ($strName == 'Language') {
                     $arrLanguages = NarroLanguage::LoadAllActive(QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } elseif ($strName == 'Application language') {
                     $arrLanguages = NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } else {
                     foreach ($arrPref['values'] as $strValue) {
                         $lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $lstOption;
                 break;
         }
     }
     $strOutput .= '</table><br />';
     $strOutput .= $this->btnCancel->Render(false) . ' ' . $this->btnSave->Render(false);
     if ($this->txtPreviousUrl) {
         $strOutput .= ' ' . sprintf(t('Click <a href="%s">here</a> to return to the page you were.'), $this->txtPreviousUrl);
     }
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }
开发者ID:Jobava,项目名称:narro,代码行数:71,代码来源:preferences.php


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