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


PHP Authentication::setCachedLanguageProgress方法代码示例

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


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

示例1: approveEditsByContributor

 public static function approveEditsByContributor($repositoryID, $languageID, $contributorID)
 {
     $edits = self::getPendingEditsByRepositoryLanguageAndUser($repositoryID, $languageID, $contributorID);
     foreach ($edits as $edit) {
         $previousPhraseData = Database::getPhrase($repositoryID, $languageID, $edit['phraseKey']);
         if (empty($previousPhraseData)) {
             $phraseObject = Phrase::create(0, $edit['phraseKey'], $edit['payload'], 0, true);
         } else {
             $phraseObject = Phrase::create(0, $edit['phraseKey'], $previousPhraseData['payload'], 0);
         }
         $phraseObject->setPhraseValue($edit['phraseSubKey'], $edit['suggestedValue']);
         self::updatePhrase($repositoryID, $languageID, $edit['phraseKey'], $phraseObject->getPayload());
         self::updateContributor($repositoryID, $edit['userID']);
         self::deleteEdit($edit['id']);
     }
     Authentication::setCachedLanguageProgress($repositoryID, NULL);
     // unset cached version of this repository's progress
 }
开发者ID:jeckel420,项目名称:Localize,代码行数:18,代码来源:Database.php

示例2: getPage_Project


//.........这里部分代码省略.........
                 if ($isAdmin) {
                     $form->addContent(new UI_Form_ButtonGroup(array($buttonSubmit, $buttonManageGroups, $buttonCancel)));
                 } else {
                     $form->addContent(new UI_Form_ButtonGroup(array($buttonSubmit, $buttonCancel)));
                 }
                 self::setTitle('Import XML');
                 $contents[] = new UI_Heading('Import XML', true);
                 $contents[] = $form;
             } elseif (empty($languageData)) {
                 self::setTitle($repositoryData['name']);
                 $heading = new UI_Heading(htmlspecialchars($repositoryData['name']), true, 1, $repository->getShareURL());
                 $languageTable = new UI_Table(array('Language', 'Completion'));
                 $languageTable->setColumnPriorities(8, 4);
                 $languages = Language::getList($defaultLanguage->getID());
                 $cachedLanguageProgress = Authentication::getCachedLanguageProgress($repositoryID);
                 $newCachedLanguageProgress = array();
                 if (empty($cachedLanguageProgress)) {
                     $repository->loadLanguages(false, Repository::SORT_NO_LANGUAGE, Repository::LOAD_ALL_LANGUAGES);
                 }
                 foreach ($languages as $languageID) {
                     $linkURL = URL::toLanguage($repositoryID, $languageID);
                     $nameLink = new UI_Link(Language::getLanguageNameFull($languageID), $linkURL, UI_Link::TYPE_UNIMPORTANT);
                     if (empty($cachedLanguageProgress)) {
                         $languageObject = $repository->getLanguage($languageID);
                         $completeness = intval($languageObject->getCompleteness() * 100);
                     } else {
                         $completeness = intval($cachedLanguageProgress[$languageID]);
                     }
                     $progressBar = new UI_Progress($completeness);
                     $rowClass = $languageID == $defaultLanguage->getID() ? 'active' : '';
                     $languageTable->addRow(array($nameLink->getHTML(), $progressBar->getHTML()), '', $rowClass);
                     $newCachedLanguageProgress[$languageID] = $completeness;
                 }
                 Authentication::setCachedLanguageProgress($repositoryID, $newCachedLanguageProgress);
                 $actionsForm = new UI_Form(URL::toProject($repositoryID), false);
                 $actionsForm->addContent(new UI_Form_Hidden('exportXML', 1));
                 $actionButtons = array();
                 if (Repository::hasUserPermissions(Authentication::getUserID(), $repositoryID, $repositoryData, Repository::ROLE_DEVELOPER)) {
                     $actionButtons[] = new UI_Link('Export', URL::toExport($repositoryID), UI_Link::TYPE_SUCCESS);
                     $actionButtons[] = new UI_Link('Import XML', URL::toImport($repositoryID), UI_Link::TYPE_UNIMPORTANT);
                     if (Repository::hasUserPermissions(Authentication::getUserID(), $repositoryID, $repositoryData, Repository::ROLE_ADMINISTRATOR)) {
                         $actionButtons[] = new UI_Link('Edit project', URL::toEditProject($repositoryID), UI_Link::TYPE_UNIMPORTANT);
                     }
                     $actionButtons[] = new UI_Link('Add phrase', URL::toAddPhrase($repositoryID, $defaultLanguage->getID()), UI_Link::TYPE_UNIMPORTANT);
                     $actionButtons[] = new UI_Link('Watch', URL::toWatchProject($repositoryID), UI_Link::TYPE_INFO);
                 }
                 if (!empty($actionButtons)) {
                     $actionsForm->addContent(new UI_Form_ButtonGroup($actionButtons, true));
                 }
                 $contents[] = $heading;
                 $contents[] = $actionsForm;
                 $contents[] = $languageTable;
                 $contents[] = $actionsForm;
             } else {
                 try {
                     $mayMovePhrases = Repository::isRoleAllowedToMovePhrases($role);
                     $language = new Language_Android($languageID);
                     self::addBreadcrumbItem(URL::toLanguage($repositoryID, $languageID), $language->getNameFull());
                     self::setTitle($languageData->getNameFull());
                     $heading = new UI_Heading($languageData->getNameFull(), true);
                     $repository->loadLanguages(false, $languageID, $languageID);
                     $languageLeft = $repository->getLanguage($repository->getDefaultLanguage());
                     $languageRight = $repository->getLanguage($language->getID());
                     $languageLeftPhrases = $languageLeft->getPhrases();
                     $languageRightPhrases = $languageRight->getPhrases();
                     if (count($languageLeftPhrases) != count($languageRightPhrases)) {
开发者ID:jeckel420,项目名称:Localize,代码行数:67,代码来源:UI.php


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