本文整理汇总了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
}
示例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)) {