本文整理汇总了PHP中AppLocale类的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale类的具体用法?PHP AppLocale怎么用?PHP AppLocale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AppLocale类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* @see PKPHandler::initialize()
*/
function initialize($request)
{
// Load user-related translations.
AppLocale::requireComponents(LOCALE_COMPONENT_APP_ADMIN, LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_PKP_MANAGER);
// Basic grid configuration.
$this->setTitle('manager.reviewForms');
// Grid actions.
$router = $request->getRouter();
import('lib.pkp.classes.linkAction.request.AjaxModal');
$this->addAction(new LinkAction('createReviewForm', new AjaxModal($router->url($request, null, null, 'createReviewForm', null, null), __('manager.reviewForms.create'), 'modal_add_item', true), __('manager.reviewForms.create'), 'add_item'));
//
// Grid columns.
//
import('lib.pkp.controllers.grid.settings.reviewForms.ReviewFormGridCellProvider');
$reviewFormGridCellProvider = new ReviewFormGridCellProvider();
// Review form name.
$this->addColumn(new GridColumn('name', 'manager.reviewForms.title', null, null, $reviewFormGridCellProvider));
// Review Form 'in review'
$this->addColumn(new GridColumn('inReview', 'manager.reviewForms.inReview', null, null, $reviewFormGridCellProvider));
// Review Form 'completed'.
$this->addColumn(new GridColumn('completed', 'manager.reviewForms.completed', null, null, $reviewFormGridCellProvider));
// Review form 'activate/deactivate'
// if ($element->getActive()) {
$this->addColumn(new GridColumn('active', 'common.active', null, 'controllers/grid/common/cell/selectStatusCell.tpl', $reviewFormGridCellProvider));
}
示例2: initialize
/**
* @copydoc PKPHandler::initialize()
*/
function initialize($request)
{
parent::initialize($request);
// Load user-related translations.
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_MANAGER);
// Basic grid configuration.
$this->setTitle('grid.user.currentUsers');
// Grid actions.
$router = $request->getRouter();
$pluginName = $request->getUserVar('pluginName');
assert(!empty($pluginName));
$this->_pluginName = $pluginName;
$dispatcher = $request->getDispatcher();
$url = $dispatcher->url($request, ROUTE_PAGE, null, 'manager', 'importexport', array('plugin', $pluginName, 'exportAllUsers'));
$this->addAction(new LinkAction('exportAllUsers', new RedirectConfirmationModal(__('grid.users.confirmExportAllUsers'), null, $url), __('grid.action.exportAllUsers'), 'export_users'));
//
// Grid columns.
//
// First Name.
$cellProvider = new DataObjectGridCellProvider();
$this->addColumn(new GridColumn('firstName', 'user.firstName', null, null, $cellProvider));
// Last Name.
$cellProvider = new DataObjectGridCellProvider();
$this->addColumn(new GridColumn('lastName', 'user.lastName', null, null, $cellProvider));
// User name.
$cellProvider = new DataObjectGridCellProvider();
$this->addColumn(new GridColumn('username', 'user.username', null, null, $cellProvider));
// Email.
$cellProvider = new DataObjectGridCellProvider();
$this->addColumn(new GridColumn('email', 'user.email', null, null, $cellProvider));
}
开发者ID:relaciones-internacionales-journal,项目名称:pkp-lib,代码行数:34,代码来源:ExportableUsersGridHandler.inc.php
示例3: startWizard
/**
* Displays the context settings wizard.
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function startWizard($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
AppLocale::requireComponents(LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_PKP_MANAGER);
$this->setupTemplate($request);
return $templateMgr->fetchJson('controllers/wizard/settings/settingsWizard.tpl');
}
示例4: initialize
/**
* @copydoc SetupListbuilderHandler::initialize()
*/
function initialize($request)
{
parent::initialize($request);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
$footerCategoryId = (int) $request->getUserVar('footerCategoryId');
$context = $request->getContext();
$footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
$footerCategory = $footerCategoryDao->getById($footerCategoryId, $context->getId());
if ($footerCategoryId && !isset($footerCategory)) {
fatalError('Footer Category does not exist within this context.');
} else {
$this->_footerCategoryId = $footerCategoryId;
}
// Basic configuration
$this->setTitle('grid.content.navigation.footer.FooterLink');
$this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
$this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
$this->setSaveFieldName('footerLinks');
import('lib.pkp.controllers.listbuilder.content.navigation.FooterLinkListbuilderGridCellProvider');
// Title column
$titleColumn = new MultilingualListbuilderGridColumn($this, 'title', 'common.title', null, null, null, null, array('tabIndex' => 1));
$titleColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
$this->addColumn($titleColumn);
// Url column
$urlColumn = new MultilingualListbuilderGridColumn($this, 'url', 'common.url', null, null, null, null, array('tabIndex' => 2));
$urlColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
$this->addColumn($urlColumn);
}
示例5: _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);
}
示例6: FileLoader
/**
* Constructor.
* @param $args array script arguments
*/
function FileLoader($args)
{
parent::ScheduledTask($args);
// Set an initial process id and load translations (required
// for email notifications).
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN);
$this->_newProcessId();
// Canonicalize the base path.
$basePath = rtrim($args[0], DIRECTORY_SEPARATOR);
$basePathFolder = basename($basePath);
// We assume that the parent folder of the base path
// does already exist and can be canonicalized.
$basePathParent = realpath(dirname($basePath));
if ($basePathParent === false) {
$basePath = null;
} else {
$basePath = $basePathParent . DIRECTORY_SEPARATOR . $basePathFolder;
}
$this->_basePath = $basePath;
// Configure paths.
if (!is_null($basePath)) {
$this->_stagePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_STAGING;
$this->_archivePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_ARCHIVE;
$this->_rejectPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_REJECT;
$this->_processingPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_PROCESSING;
}
// Set admin email and name.
$siteDao = DAORegistry::getDAO('SiteDAO');
/* @var $siteDao SiteDAO */
$site = $siteDao->getSite();
/* @var $site Site */
$this->_adminEmail = $site->getLocalizedContactEmail();
$this->_adminName = $site->getLocalizedContactName();
}
示例7: getWorkflowStageTranslationKeys
/**
* Return a mapping of workflow stages and its translation keys.
* @return array
*/
static function getWorkflowStageTranslationKeys()
{
$applicationStages = Application::getApplicationStages();
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION);
static $stageMapping = array(WORKFLOW_STAGE_ID_SUBMISSION => 'submission.submission', WORKFLOW_STAGE_ID_INTERNAL_REVIEW => 'workflow.review.internalReview', WORKFLOW_STAGE_ID_EXTERNAL_REVIEW => 'workflow.review.externalReview', WORKFLOW_STAGE_ID_EDITING => 'submission.editorial', WORKFLOW_STAGE_ID_PRODUCTION => 'submission.production');
return array_intersect_key($stageMapping, array_flip($applicationStages));
}
示例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: sendReminder
function sendReminder($subscription, $journal, $emailKey)
{
$userDao = DAORegistry::getDAO('UserDAO');
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$journalName = $journal->getLocalizedName();
$user = $userDao->getById($subscription->getUserId());
if (!isset($user)) {
return false;
}
$subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
$subscriptionName = $journal->getSetting('subscriptionName');
$subscriptionEmail = $journal->getSetting('subscriptionEmail');
$subscriptionPhone = $journal->getSetting('subscriptionPhone');
$subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress');
$subscriptionContactSignature = $subscriptionName;
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON);
if ($subscriptionMailingAddress != '') {
$subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
}
if ($subscriptionPhone != '') {
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone;
}
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail;
$paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
import('lib.pkp.classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false);
$mail->setReplyTo($subscriptionEmail, $subscriptionName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
示例10: 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;
}
示例11: fetch
/**
* Fetch the form.
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$journal = $request->getJournal();
// set up the accessibility options pulldown
$templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess'));
$templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription')));
if ($this->issue) {
$templateMgr->assign('issue', $this->issue);
$templateMgr->assign('issueId', $this->issue->getId());
}
// Cover image preview
$coverImage = null;
if ($this->issue) {
$coverImage = $this->issue->getCoverImage();
}
// Cover image delete link action
if ($coverImage) {
import('lib.pkp.classes.linkAction.LinkAction');
import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
$router = $request->getRouter();
$deleteCoverImageLinkAction = new LinkAction('deleteCoverImage', new RemoteActionConfirmationModal($request->getSession(), __('common.confirmDelete'), null, $router->url($request, null, null, 'deleteCoverImage', null, array('coverImage' => $coverImage, 'issueId' => $this->issue->getId())), 'modal_delete'), __('common.delete'), null);
$templateMgr->assign('deleteCoverImageLinkAction', $deleteCoverImageLinkAction);
}
return parent::fetch($request);
}
示例12:
/**
* @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;
}
示例13: fetch
/**
* @copydoc ContextSettingsForm::fetch
*/
function fetch($request, $params = null)
{
$templateMgr = TemplateManager::getManager($request);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
$templateMgr->assign('ccLicenseOptions', array_merge(array('' => 'common.other'), Application::getCCLicenseOptions()));
return parent::fetch($request, $params);
}
示例14: validate
/**
* Check to make sure form conditions are met
*/
function validate()
{
// Ensure all submission types have names in the primary locale
// as well as numeric word limits (optional)
$primaryLocale = AppLocale::getPrimaryLocale();
if (isset($this->_data['paperTypes'])) {
$paperTypes =& $this->_data['paperTypes'];
if (!is_array($paperTypes)) {
return false;
}
foreach ($paperTypes as $paperTypeId => $paperType) {
if (!isset($paperType['name'][$primaryLocale]) || empty($paperType['name'][$primaryLocale])) {
$fieldName = 'paperTypeName-' . $paperTypeId;
$this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.nameMissing', array('primaryLocale' => $primaryLocale)));
$this->addErrorField($fieldName);
}
if (isset($paperType['abstractLength']) && !empty($paperType['abstractLength']) && (!is_numeric($paperType['abstractLength']) || $paperType['abstractLength'] <= 0)) {
$fieldName = 'paperTypeAbstractLength-' . $paperTypeId;
$this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.abstractLengthInvalid'));
$this->addErrorField($fieldName);
}
}
}
return parent::validate();
}
示例15: array
/**
* Get a piece of data for this object, localized to the current
* locale if possible.
* @param $key string
* @param $preferredLocale string
* @return mixed
*/
function &getLocalizedData($key, $preferredLocale = null)
{
if (is_null($preferredLocale)) {
$preferredLocale = AppLocale::getLocale();
}
$localePrecedence = array($preferredLocale, $this->getLocale());
foreach ($localePrecedence as $locale) {
if (empty($locale)) {
continue;
}
$value =& $this->getData($key, $locale);
if (!empty($value)) {
return $value;
}
unset($value);
}
// Fallback: Get the first available piece of data.
$data =& $this->getData($key, null);
if (!empty($data)) {
return $data[array_shift(array_keys($data))];
}
// No data available; return null.
unset($data);
$data = null;
return $data;
}