本文整理汇总了PHP中AppLocale::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::getLocale方法的具体用法?PHP AppLocale::getLocale怎么用?PHP AppLocale::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppLocale
的用法示例。
在下文中一共展示了AppLocale::getLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emails
/**
* Display a list of the emails within the current conference.
*/
function emails()
{
$this->validate();
$this->setupTemplate(true);
$conference =& Request::getConference();
$rangeInfo = Handler::getRangeInfo('emails', array());
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$emailTemplatesArray =& $emailTemplateDao->getEmailTemplates(AppLocale::getLocale(), $conference->getId());
import('core.ArrayItemIterator');
if ($rangeInfo && $rangeInfo->isValid()) {
while (true) {
$emailTemplates = new ArrayItemIterator($emailTemplatesArray, $rangeInfo->getPage(), $rangeInfo->getCount());
if ($emailTemplates->isInBounds()) {
break;
}
unset($rangeInfo);
$rangeInfo =& $emailTemplates->getLastPageRangeInfo();
unset($emailTemplates);
}
} else {
$emailTemplates = new ArrayItemIterator($emailTemplatesArray);
}
$templateMgr =& TemplateManager::getManager();
// The bread crumbs depends on whether we're doing scheduled conference or conference
// management. FIXME: this is going to be a common situation, and this isn't
// an elegant way of testing for it.
if (Request::getRequestedPage() === 'manager') {
$templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'manager'), 'manager.conferenceSiteManagement')));
} else {
$templateMgr->assign('pageHierarchy', array(array(Request::url(null, null, 'manager'), 'manager.schedConfManagement')));
}
$templateMgr->assign_by_ref('emailTemplates', $emailTemplates);
$templateMgr->assign('helpTopicId', 'conference.generalManagement.emails');
$templateMgr->display('manager/emails/emails.tpl');
}
示例2: getAnnouncementTypeName
/**
* Retrieve announcement type name by ID.
* @param $typeId int
* @return string
*/
function getAnnouncementTypeName($typeId)
{
$result = $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM announcement_type_settings p LEFT JOIN announcement_type_settings l ON (l.type_id = ? AND l.setting_name = ? AND l.locale = ?) WHERE p.type_id = ? AND p.setting_name = ? AND p.locale = ?', array((int) $typeId, 'name', AppLocale::getLocale(), (int) $typeId, 'name', AppLocale::getPrimaryLocale()));
$returner = isset($result->fields[0]) ? $result->fields[0] : false;
$result->Close();
return $returner;
}
示例3: initialize
function initialize(&$request)
{
parent::initialize($request);
// Basic grid configuration
$this->setId('preparedEmailsGrid');
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
// Set the grid title.
$this->setTitle('grid.preparedEmails.title');
$this->setInstructions('grid.preparedEmails.description');
// Elements to be displayed in the grid
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
/* @var $emailTemplateDao EmailTemplateDAO */
$emailTemplates =& $emailTemplateDao->getEmailTemplates(AppLocale::getLocale(), $this->getContextId($request));
$rowData = array();
foreach ($emailTemplates as $emailTemplate) {
$rowData[$emailTemplate->getEmailKey()] = $emailTemplate;
}
$this->setGridDataElements($rowData);
// Grid actions
import('lib.pkp.controllers.grid.settings.preparedEmails.linkAction.EditEmailLinkAction');
$addEmailLinkAction = new EditEmailLinkAction($request);
$this->addAction($addEmailLinkAction);
import('lib.pkp.classes.linkAction.LinkAction');
import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
$router =& $request->getRouter();
$this->addAction(new LinkAction('resetAll', new RemoteActionConfirmationModal(__('manager.emails.resetAll.message'), null, $router->url($request, null, 'grid.settings.preparedEmails.PreparedEmailsGridHandler', 'resetAllEmails')), __('manager.emails.resetAll'), 'reset_default'));
// Columns
import('lib.pkp.controllers.grid.settings.preparedEmails.PreparedEmailsGridCellProvider');
$cellProvider = new PreparedEmailsGridCellProvider();
$this->addColumn(new GridColumn('name', 'common.name', null, 'controllers/grid/gridCell.tpl', $cellProvider, array('width' => 40)));
$this->addColumn(new GridColumn('sender', 'email.sender', null, 'controllers/grid/gridCell.tpl', $cellProvider, array('width' => 10)));
$this->addColumn(new GridColumn('recipient', 'email.recipient', null, 'controllers/grid/gridCell.tpl', $cellProvider));
$this->addColumn(new GridColumn('subject', 'common.subject', null, 'controllers/grid/gridCell.tpl', $cellProvider));
$this->addColumn(new GridColumn('enabled', 'common.enabled', null, 'controllers/grid/common/cell/selectStatusCell.tpl', $cellProvider, array('width' => 5)));
}
示例4: displayPaymentForm
/**
* @see PaymentPlugin::displayPaymentForm
*/
function displayPaymentForm($queuedPaymentId, &$queuedPayment, &$request)
{
if (!$this->isConfigured()) {
return false;
}
$schedConf =& $request->getSchedConf();
$user =& $request->getUser();
$params = array('charset' => Config::getVar('i18n', 'client_charset'), 'business' => $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'), 'item_name' => $queuedPayment->getDescription(), 'amount' => sprintf('%.2F', $queuedPayment->getAmount()), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(AppLocale::getLocale(), 3), 'custom' => $queuedPaymentId, 'notify_url' => $request->url(null, null, 'payment', 'plugin', array($this->getName(), 'ipn')), 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => $request->url(null, null, 'payment', 'plugin', array($this->getName(), 'cancel')), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'item_number' => 1, 'cmd' => '_xclick');
$templateMgr =& TemplateManager::getManager();
switch ($queuedPayment->getType()) {
case QUEUED_PAYMENT_TYPE_REGISTRATION:
// Provide registration-specific details to template.
$registrationDao = DAORegistry::getDAO('RegistrationDAO');
$registrationOptionDao = DAORegistry::getDAO('RegistrationOptionDAO');
$registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO');
$registration =& $registrationDao->getRegistration($queuedPayment->getAssocId());
if (!$registration || $registration->getUserId() != $queuedPayment->getUserId() || $registration->getSchedConfId() != $queuedPayment->getSchedConfId()) {
break;
}
$registrationOptionIterator =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
$registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($registration->getTypeId());
$registrationOptionIds = $registrationOptionDao->getRegistrationOptions($registration->getRegistrationId());
$templateMgr->assign('registration', $registration);
$templateMgr->assign('registrationType', $registrationTypeDao->getRegistrationType($registration->getTypeId()));
$templateMgr->assign('registrationOptions', $registrationOptionIterator->toArray());
$templateMgr->assign('registrationOptionCosts', $registrationOptionCosts);
$templateMgr->assign('registrationOptionIds', $registrationOptionIds);
}
$templateMgr->assign('params', $params);
$templateMgr->assign('paypalFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl'));
$templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
return true;
}
示例5: getTemplateVarsFromRowColumn
/**
* Extracts variables for a given column from a data element
* so that they may be assigned to template before rendering.
* @param $element mixed
* @param $columnId string
* @return array
*/
function getTemplateVarsFromRowColumn($row, $column)
{
$element =& $row->getData();
$columnId = $column->getId();
assert(is_a($element, 'DataObject') && !empty($columnId));
$roleDao = DAORegistry::getDAO('RoleDAO');
/* @var $roleDao RoleDAO */
switch ($columnId) {
case 'name':
$label = $element->getEmailKey();
return array('label' => ucwords(strtolower(str_replace('_', ' ', $label))));
case 'sender':
$roleId = $element->getFromRoleId();
$label = $roleDao->getRoleNames(false, array($roleId));
return array('label' => __(array_shift($label)));
case 'recipient':
$roleId = $element->getToRoleId();
$label = $roleDao->getRoleNames(false, array($roleId));
return array('label' => __(array_shift($label)));
case 'subject':
$locale = AppLocale::getLocale();
$label = $element->getSubject();
return array('label' => $label);
case 'enabled':
$selectDisabled = $element->getCanDisable() ? false : true;
return array('selected' => $element->getEnabled(), 'disabled' => $selectDisabled);
}
}
示例6: _cacheMiss
function _cacheMiss(&$cache, $id)
{
$allCodelistItems =& Registry::get('all' . $this->getListName() . 'CodelistItems', true, null);
if ($allCodelistItems === null) {
// Add a locale load to the debug notes.
$notes =& Registry::get('system.debug.notes');
$locale = $cache->cacheId;
if ($locale == null) {
$locale = AppLocale::getLocale();
}
$filename = $this->getFilename($locale);
$notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
// Reload locale registry file
$xmlDao = new XMLDAO();
$listName = $this->getListName();
// i.e., 'List30'
import('lib.pkp.classes.codelist.ONIXParserDOMHandler');
$handler = new ONIXParserDOMHandler($listName);
import('lib.pkp.classes.xslt.XSLTransformer');
import('lib.pkp.classes.file.FileManager');
import('classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$fileManager = new FileManager();
// Ensure that the temporary file dir exists
$tmpDir = $temporaryFileManager->getBasePath();
if (!file_exists($tmpDir)) {
mkdir($tmpDir);
}
$tmpName = tempnam($tmpDir, 'ONX');
$xslTransformer = new XSLTransformer();
$xslTransformer->setParameters(array('listName' => $listName));
$xslTransformer->setRegisterPHPFunctions(true);
$xslFile = 'lib/pkp/xml/onixFilter.xsl';
$filteredXml = $xslTransformer->transform($filename, XSL_TRANSFORMER_DOCTYPE_FILE, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING);
if (!$filteredXml) {
assert(false);
}
$data = null;
if (is_writeable($tmpName)) {
$fp = fopen($tmpName, 'wb');
fwrite($fp, $filteredXml);
fclose($fp);
$data = $xmlDao->parseWithHandler($tmpName, $handler);
$fileManager->deleteFile($tmpName);
} else {
fatalError('misconfigured directory permissions on: ' . $tmpDir);
}
// Build array with ($charKey => array(stuff))
if (isset($data[$listName])) {
foreach ($data[$listName] as $code => $codelistData) {
$allCodelistItems[$code] = $codelistData;
}
}
if (is_array($allCodelistItems)) {
asort($allCodelistItems);
}
$cache->setEntireCache($allCodelistItems);
}
return null;
}
示例7: viewBookForReview
/**
* Public view book for review details.
*/
function viewBookForReview($args = array(), &$request)
{
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalId = $journal->getId();
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$bookId = !isset($args) || empty($args) ? null : (int) $args[0];
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is valid and for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
$book =& $bfrDao->getBookForReview($bookId);
$bfrPlugin->import('classes.BookForReview');
// Ensure book is still available
if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
$isAuthor = Validation::isAuthor();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('coverPagePath', $coverPagePath);
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign_by_ref('bookForReview', $book);
$templateMgr->assign('isAuthor', $isAuthor);
$templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
}
}
$request->redirect(null, 'booksForReview');
}
示例8: _cacheMiss
/**
* Handle a cache miss
* @param $cache GenericCache
* @param $id mixed ID that wasn't found in the cache
* @return null
*/
function _cacheMiss($cache, $id)
{
$allCodelistItems =& Registry::get('all' . $this->getName() . 'CodelistItems', true, null);
if ($allCodelistItems === null) {
// Add a locale load to the debug notes.
$notes =& Registry::get('system.debug.notes');
$locale = $cache->cacheId;
if ($locale == null) {
$locale = AppLocale::getLocale();
}
$filename = $this->getFilename($locale);
$notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
// Reload locale registry file
$xmlDao = new XMLDAO();
$nodeName = $this->getName();
// i.e., subject
$data = $xmlDao->parseStruct($filename, array($nodeName));
// Build array with ($charKey => array(stuff))
if (isset($data[$nodeName])) {
foreach ($data[$nodeName] as $codelistData) {
$allCodelistItems[$codelistData['attributes']['code']] = array($codelistData['attributes']['text']);
}
}
if (is_array($allCodelistItems)) {
asort($allCodelistItems);
}
$cache->setEntireCache($allCodelistItems);
}
return null;
}
示例9: foreach
/**
* @see Filter::process()
* @param $input MetadataDescription NLM citation description
* @return string formatted citation output
*/
function &process(&$input)
{
// Initialize view
$locale = AppLocale::getLocale();
$templateMgr =& TemplateManager::getManager($this->_request);
// Add the filter's directory as additional template dir so that
// citation output format templates can include sub-templates in
// the same folder.
$templateMgr->template_dir[] = $this->getBasePath();
// Loop over the statements in the schema and add them
// to the template
$propertyNames =& $input->getPropertyNames();
foreach ($propertyNames as $propertyName) {
$templateVariable = $input->getNamespacedPropertyId($propertyName);
if ($input->hasProperty($propertyName)) {
$propertyLocale = $input->getProperty($propertyName)->getTranslated() ? $locale : null;
$templateMgr->assign_by_ref($templateVariable, $input->getStatement($propertyName, $propertyLocale));
} else {
// Delete potential leftovers from previous calls
$templateMgr->clear_assign($templateVariable);
}
}
// Let the template engine render the citation
$templateName = $this->_getCitationTemplate();
$output = $templateMgr->fetch($templateName);
// Remove the additional template dir
array_pop($templateMgr->template_dir);
return $output;
}
示例10: register
function register($category, $path)
{
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
// Add custom locale data for already registered locale files.
$locale = AppLocale::getLocale();
$localeFiles = AppLocale::getLocaleFiles($locale);
$journal = Request::getJournal();
$journalId = $journal->getId();
$publicFilesDir = Config::getVar('files', 'public_files_dir');
$customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
foreach ($localeFiles as $localeFile) {
$customLocalePath = $customLocalePathBase . $localeFile->getFilename();
if ($fileManager->fileExists($customLocalePath)) {
AppLocale::registerLocaleFile($locale, $customLocalePath, true);
}
}
// Add custom locale data for all locale files registered after this plugin
HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale'));
}
return true;
}
return false;
}
示例11: displaySubmissionFile
/**
* Display this galley in some manner.
*
* @param $publishedMonograph PublishedMonograph
* @param $submissionFile SubmissionFile
*/
function displaySubmissionFile($publishedMonograph, $publicationFormat, $submissionFile)
{
$templateMgr = TemplateManager::getManager($this->getRequest());
$templateFilename = $this->getTemplateFilename();
if ($templateFilename === null) {
return '';
}
// Set up the viewable file template variables.
$submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO');
$chapterDao = DAORegistry::getDAO('ChapterDAO');
$genreDao = DAORegistry::getDAO('GenreDAO');
// Find a good candidate for a publication date
$publicationDateDao = DAORegistry::getDAO('PublicationDateDAO');
$publicationDates = $publicationDateDao->getByPublicationFormatId($publicationFormat->getId());
$bestPublicationDate = null;
while ($publicationDate = $publicationDates->next()) {
// 11: Date of first publication; 01: Publication date
if ($publicationDate->getRole() != '11' && $publicationDate->getRole() != '01') {
continue;
}
if ($bestPublicationDate) {
$bestPublicationDate = min($bestPublicationDate, $publicationDate->getUnixTime());
} else {
$bestPublicationDate = $publicationDate->getUnixTime();
}
}
$templateMgr->assign(array('submissionKeywords' => $submissionKeywordDao->getKeywords($publishedMonograph->getId(), array_merge(array(AppLocale::getLocale()), array_keys(AppLocale::getSupportedLocales()))), 'publishedMonograph' => $publishedMonograph, 'publicationFormat' => $publicationFormat, 'submissionFile' => $submissionFile, 'chapter' => $chapterDao->getChapter($submissionFile->getData('chapterId')), 'genre' => $genreDao->getById($submissionFile->getGenreId()), 'bestPublicationDate' => $bestPublicationDate));
// Fetch the viewable file template render.
$templateMgr->assign('viewableFileContent', $templateMgr->fetch($this->getTemplatePath() . $templateFilename));
// Show the front-end.
$templateMgr->display('frontend/pages/viewFile.tpl');
}
示例12: execute
/**
* Save the new image file.
* @param $request Request.
*/
function execute($request)
{
$temporaryFile = $this->fetchTemporaryFile($request);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if (is_a($temporaryFile, 'TemporaryFile')) {
$type = $temporaryFile->getFileType();
$extension = $publicFileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$locale = AppLocale::getLocale();
$uploadName = $this->getFileSettingName() . '_' . $locale . $extension;
if ($publicFileManager->copyFile($temporaryFile->getFilePath(), $publicFileManager->getSiteFilesPath() . '/' . $uploadName)) {
// Get image dimensions
$filePath = $publicFileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
$site = $request->getSite();
$siteDao = DAORegistry::getDAO('SiteDAO');
$value = $site->getSetting($this->getFileSettingName());
$imageAltText = $this->getData('imageAltText');
$value[$locale] = array('originalFilename' => $temporaryFile->getOriginalFileName(), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate(), 'altText' => $imageAltText[$locale]);
$site->updateSetting($this->getFileSettingName(), $value, 'object', true);
// Clean up the temporary file
$this->removeTemporaryFile($request);
return true;
}
}
return false;
}
示例13: _assignTemplateCounterXML
/**
* Internal function to assign information for the Counter part of a report
*/
function _assignTemplateCounterXML($templateManager, $begin, $end = '')
{
$journal =& Request::getJournal();
$counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalIds = $counterReportDao->getJournalIds();
if ($end == '') {
$end = $begin;
}
$i = 0;
foreach ($journalIds as $journalId) {
$journal =& $journalDao->getById($journalId);
if (!$journal) {
continue;
}
$entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
$journalsArray[$i]['entries'] = $this->_arrangeEntries($entries, $begin, $end);
$journalsArray[$i]['journalTitle'] = $journal->getLocalizedTitle();
$journalsArray[$i]['publisherInstitution'] = $journal->getSetting('publisherInstitution');
$journalsArray[$i]['printIssn'] = $journal->getSetting('printIssn');
$journalsArray[$i]['onlineIssn'] = $journal->getSetting('onlineIssn');
$i++;
}
$siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
$siteTitle = $siteSettingsDao->getSetting('title', AppLocale::getLocale());
$base_url =& Config::getVar('general', 'base_url');
$reqUser =& Request::getUser();
$templateManager->assign_by_ref('reqUser', $reqUser);
$templateManager->assign_by_ref('journalsArray', $journalsArray);
$templateManager->assign('siteTitle', $siteTitle);
$templateManager->assign('base_url', $base_url);
}
示例14:
/**
* @see Filter::process()
*/
function &process(&$input)
{
// Initialize view
$locale = AppLocale::getLocale();
$application = PKPApplication::getApplication();
$request = $application->getRequest();
$templateMgr = TemplateManager::getManager($request);
// Add the filter's directory as additional template dir so that
// templates can include sub-templates in the same folder.
array_unshift($templateMgr->template_dir, $this->getBasePath());
// Give sub-filters a chance to add their variables
// to the template.
$this->addTemplateVars($templateMgr, $input, $request, $locale);
// Use a base path hash as compile id to make sure that we don't
// get namespace problems if several filters use the same
// template names.
$previousCompileId = $templateMgr->compile_id;
$templateMgr->compile_id = md5($this->getBasePath());
// Let the template engine render the citation.
$output = $templateMgr->fetch($this->getTemplateName());
// Remove the additional template dir
array_shift($templateMgr->template_dir);
// Restore the compile id.
$templateMgr->compile_id = $previousCompileId;
return $output;
}
示例15: getSubscriptionTypeName
/**
* Retrieve subscription type name by ID.
* @param $typeId int
* @return string
*/
function getSubscriptionTypeName($typeId)
{
$result = $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM subscription_type_settings l LEFT JOIN subscription_type_settings p ON (p.type_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.type_id = ? AND l.setting_name = ? AND l.locale = ?', array($typeId, 'name', AppLocale::getLocale(), $typeId, 'name', AppLocale::getPrimaryLocale()));
$returner = isset($result->fields[0]) ? $result->fields[0] : false;
$result->Close();
return $returner;
}