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


PHP Locale::getLocale方法代码示例

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


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

示例1: array

    /**
     * Get all authors for a given chapter.
     * @param $chapterId int
     * @param $monographId int
     * @return DAOResultFactory
     */
    function &getAuthors($monographId = null, $chapterId = null)
    {
        $params = array('affiliation', Locale::getPrimaryLocale(), 'affiliation', Locale::getLocale());
        if (isset($monographId)) {
            $params[] = (int) $monographId;
        }
        if (isset($chapterId)) {
            $params[] = (int) $chapterId;
        }
        // get all the monograph_author fields,
        // but replace the primary_contact and seq with monograph_chapter_authors.primary_contact
        $sql = 'SELECT	ma.author_id,
				ma.submission_id,
				mca.chapter_id,
				mca.primary_contact,
				mca.seq,
				ma.first_name,
				ma.middle_name,
				ma.last_name,
				asl.setting_value AS affiliation_l,
				asl.locale,
				aspl.setting_value AS affiliation_pl,
				aspl.locale AS primary_locale,
				ma.country,
				ma.email,
				ma.url,
				ma.user_group_id
			FROM	authors ma
				JOIN monograph_chapter_authors mca ON (ma.author_id = mca.author_id)
				LEFT JOIN author_settings aspl ON (mca.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
				LEFT JOIN author_settings asl ON (mca.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?)' . (count($params) > 0 ? ' WHERE' : '') . (isset($monographId) ? ' ma.submission_id = ?' : '') . (isset($monographId) && isset($chapterId) ? ' AND' : '') . (isset($chapterId) ? ' mca.chapter_id = ?' : '') . ' ORDER BY mca.chapter_id, mca.seq';
        $result =& $this->retrieve($sql, $params);
        $returner = new DAOResultFactory($result, $this, '_returnFromRow', array('id'));
        return $returner;
    }
开发者ID:jerico-dev,项目名称:omp,代码行数:41,代码来源:ChapterAuthorDAO.inc.php

示例2: foreach

 /**
  * @see Filter::process()
  * @param $input MetadataDescription NLM citation description
  * @return string formatted citation output
  */
 function &process(&$input)
 {
     // Initialize view
     $locale = Locale::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;
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:34,代码来源:NlmCitationSchemaCitationOutputFormatFilter.inc.php

示例3: 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(Locale::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');
 }
开发者ID:jalperin,项目名称:ocs,代码行数:38,代码来源:EmailHandler.inc.php

示例4:

 /**
  * @see Filter::process()
  */
 function &process(&$input)
 {
     // Initialize view
     $locale = Locale::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;
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:29,代码来源:TemplateBasedFilter.inc.php

示例5: register

 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         $this->addLocaleData();
         if ($this->getEnabled()) {
             // Add custom locale data for already registered locale files.
             $locale = Locale::getLocale();
             $localeFiles = Locale::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('file.FileManager');
             foreach ($localeFiles as $localeFile) {
                 $customLocalePath = $customLocalePathBase . $localeFile->getFilename();
                 if (FileManager::fileExists($customLocalePath)) {
                     Locale::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;
 }
开发者ID:philschatz,项目名称:ojs,代码行数:26,代码来源:CustomLocalePlugin.inc.php

示例6: execute

 /**
  * Save group group.
  * @see Form::execute()
  */
 function execute()
 {
     $groupDao =& DAORegistry::getDAO('GroupDAO');
     $press =& Request::getPress();
     if (!isset($this->group)) {
         $this->group = $groupDao->newDataObject();
     }
     $this->group->setAssocType(ASSOC_TYPE_PRESS);
     $this->group->setAssocId($press->getId());
     $this->group->setTitle($this->getData('title'), Locale::getLocale());
     // Localized
     $this->group->setContext($this->getData('context'));
     // Eventually this will be a general Groups feature; for now,
     // we're just using it to display press team entries in About.
     $this->group->setAboutDisplayed(true);
     // Update or insert group group
     if ($this->group->getId() != null) {
         $groupDao->updateObject($this->group);
     } else {
         $this->group->setSequence(REALLY_BIG_NUMBER);
         $groupDao->insertGroup($this->group);
         // Re-order the groups so the new one is at the end of the list.
         $groupDao->resequenceGroups($this->group->getAssocType(), $this->group->getAssocId());
     }
     return true;
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:30,代码来源:GroupForm.inc.php

示例7: initialize

 function initialize(&$request)
 {
     parent::initialize($request);
     // Basic grid configuration
     $this->setId('preparedEmailsGrid');
     $this->setTitle('grid.preparedEmails.currentList');
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_MANAGER));
     // Elements to be displayed in the grid
     $press =& $request->getPress();
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     /* @var $emailTemplateDao EmailTemplateDAO */
     $emailTemplates =& $emailTemplateDao->getEmailTemplates(Locale::getLocale(), $press->getId());
     $rowData = array();
     foreach ($emailTemplates as $emailTemplate) {
         $rowData[$emailTemplate->getEmailKey()] = $emailTemplate;
     }
     $this->setGridDataElements($rowData);
     // Grid actions
     import('lib.pkp.classes.linkAction.LinkAction');
     import('lib.pkp.classes.linkAction.request.ConfirmationModal');
     $router =& $request->getRouter();
     $this->addAction(new LinkAction('resetAll', new ConfirmationModal(__('manager.emails.resetAll.message'), null, $router->url($request, null, 'grid.settings.preparedEmails.PreparedEmailsGridHandler', 'resetAllEmails')), __('manager.emails.resetAll'), 'delete'));
     import('controllers.grid.settings.preparedEmails.linkAction.EditEmailLinkAction');
     $addEmailLinkAction =& new EditEmailLinkAction($request);
     $this->addAction($addEmailLinkAction);
     // Columns
     import('controllers.grid.settings.preparedEmails.PreparedEmailsGridCellProvider');
     $cellProvider =& new PreparedEmailsGridCellProvider();
     $this->addColumn(new GridColumn('name', 'common.name', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $this->addColumn(new GridColumn('sender', 'email.sender', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $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/checkMarkCell.tpl', $cellProvider));
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:34,代码来源:PreparedEmailsGridHandler.inc.php

示例8: displayPaymentForm

 function displayPaymentForm($queuedPaymentId, &$queuedPayment)
 {
     if (!$this->isConfigured()) {
         return false;
     }
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $params = array('business' => $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'), 'item_name' => $queuedPayment->getDescription(), 'amount' => $queuedPayment->getAmount(), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::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');
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:32,代码来源:PayPalPlugin.inc.php

示例9: 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' => str_replace('_', ' ', $label));
         case 'sender':
             $roleId = $element->getFromRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'recipient':
             $roleId = $element->getToRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'subject':
             $locale = Locale::getLocale();
             $label = $element->getSubject();
             return array('label' => $label);
         case 'enabled':
             return array('isChecked' => $element->getEnabled());
     }
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:34,代码来源:PreparedEmailsGridCellProvider.inc.php

示例10: addItem

 function addItem($args, &$request)
 {
     $this->setupTemplate();
     $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
     $divisionDao =& DAORegistry::getDAO('DivisionDAO');
     $press =& $request->getPress();
     $index = 'sourceTitle-' . $this->getId();
     $divisionTitle = $args[$index];
     if (!isset($divisionTitle)) {
         $json = new JSON('false');
         return $json->getString();
     } else {
         // Make sure the item doesn't already exist
         $divisions = $divisionDao->getByTitle($divisionTitle, $press->getId());
         if (isset($divisions)) {
             $json = new JSON('false', Locale::translate('common.listbuilder.itemExists'));
             return $json->getString();
             return false;
         }
         $division =& $divisionDao->newDataObject();
         $division->setTitle($divisionTitle, Locale::getLocale());
         //FIXME: Get locale from form
         $division->setPressId($press->getId());
         $divisionId = $divisionDao->insertObject($division);
         // Return JSON with formatted HTML to insert into list
         $row =& $this->getRowInstance();
         $row->setGridId($this->getId());
         $row->setId($divisionId);
         $rowData = array('item' => $divisionTitle);
         $row->setData($rowData);
         $row->initialize($request);
         $json = new JSON('true', $this->_renderRowInternally($request, $row));
         return $json->getString();
     }
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:35,代码来源:DivisionsListbuilderHandler.inc.php

示例11: _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->getJournal($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', Locale::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);
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:35,代码来源:CounterHandler.inc.php

示例12: 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', Locale::getLocale());
             $templateMgr->assign_by_ref('bookForReview', $book);
             $templateMgr->assign('isAuthor', $isAuthor);
             $templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
         }
     }
     $request->redirect(null, 'booksForReview');
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:32,代码来源:BooksForReviewHandler.inc.php

示例13: execute

 /**
  * Save submission file
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, &$request)
 {
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $monographFile =& $submissionFileDao->getLatestRevision($this->_fileId);
     $monographFile->setName($this->getData('name'), Locale::getLocale());
     $submissionFileDao->updateObject($monographFile);
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:13,代码来源:ReviewerSelectorForm.inc.php

示例14: initData

 /**
  * Initialize form data.
  */
 function initData()
 {
     $PagSeguroPlugin =& $this->PagSeguroPlugin;
     $user =& Request::getUser();
     $userId = $user ? $user->getUserId() : null;
     $queuedPayment =& $this->queuedPayment;
     $this->_data = array('email_cobranca' => 'sbe@fgv.br', 'item_name' => $queuedPayment->getDescription(), 'a3' => $queuedPayment->getAmount($args), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $this->key, 'notify_url' => Request::url(null, null, 'payment', 'ipn', array($queuedPayment->getQueuedPaymentId())), 'return' => Request::url(null, null, 'payment', 'return', array($queuedPayment->getQueuedPaymentId())), 'cancel_return' => Request::url(null, null, 'payment', 'cancel', array($queuedPayment->getQueuedPaymentId())), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'city' => '', 'zip' => '', 'item_number' => 1);
 }
开发者ID:antoanne,项目名称:OCSPagSeguro,代码行数:11,代码来源:PagSeguroPaymentForm.inc.php

示例15: getRegistrationOptionName

 /**
  * Retrieve registration option name by ID.
  * @param $optionId int
  * @return string
  */
 function getRegistrationOptionName($optionId)
 {
     $result =& $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM registration_option_settings l LEFT JOIN registration_option_settings p ON (p.option_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.option_id = ? AND l.setting_name = ? AND l.locale = ?', array($optionId, 'name', Locale::getLocale(), $optionId, 'name', Locale::getPrimaryLocale()));
     $returner = isset($result->fields[0]) ? $result->fields[0] : false;
     $result->Close();
     unset($result);
     return $returner;
 }
开发者ID:jmacgreg,项目名称:ocs,代码行数:13,代码来源:RegistrationOptionDAO.inc.php


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