本文整理汇总了PHP中Locale::getPrimaryLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Locale::getPrimaryLocale方法的具体用法?PHP Locale::getPrimaryLocale怎么用?PHP Locale::getPrimaryLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::getPrimaryLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = Locale::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, Locale::translate('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, Locale::translate('manager.schedConfSetup.submissions.typeOfSubmission.abstractLengthInvalid'));
$this->addErrorField($fieldName);
}
}
}
return parent::validate();
}
示例2: Form
/**
* Constructor.
* @param $template string the path to the form template file
*/
function Form($template = null, $callHooks = true, $requiredLocale = null, $supportedLocales = null)
{
if ($callHooks === true && checkPhpVersion('4.3.0')) {
$trace = debug_backtrace();
// Call hooks based on the calling entity, assuming
// this method is only called by a subclass. Results
// in hook calls named e.g. "papergalleyform::Constructor"
// Note that class names are always lower case.
HookRegistry::call(strtolower($trace[1]['class']) . '::Constructor', array(&$this, &$template));
}
if ($requiredLocale === null) {
$requiredLocale = Locale::getPrimaryLocale();
}
$this->requiredLocale = $requiredLocale;
if ($supportedLocales === null) {
$supportedLocales = Locale::getSupportedFormLocales();
}
$this->supportedLocales = $supportedLocales;
$this->_template = $template;
$this->_data = array();
$this->_checks = array();
$this->_errors = array();
$this->errorsArray = array();
$this->errorFields = array();
$this->formSectionErrors = array();
$this->fbvStyles = array('size' => array('SMALL' => 'SMALL', 'MEDIUM' => 'MEDIUM', 'LARGE' => 'LARGE'), 'float' => array('RIGHT' => 'RIGHT', 'LEFT' => 'LEFT'), 'align' => array('RIGHT' => 'RIGHT', 'LEFT' => 'LEFT'), 'measure' => array('1OF1' => '1OF1', '1OF2' => '1OF2', '1OF3' => '1OF3', '2OF3' => '2OF3', '1OF4' => '1OF4', '3OF4' => '3OF4', '1OF5' => '1OF5', '2OF5' => '2OF5', '3OF5' => '3OF5', '4OF5' => '4OF5', '1OF10' => '1OF10', '8OF10' => '8OF10'), 'layout' => array('THREE_COLUMNS' => 'THREE_COLUMNS', 'TWO_COLUMNS' => 'TWO_COLUMNS', 'ONE_COLUMN' => 'ONE_COLUMN'));
}
示例3: 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;
}
示例4: getMessage
/**
* Get the error message associated with a failed validation check.
* @see FormValidator::getMessage()
* @return string
*/
function getMessage()
{
$primaryLocale = Locale::getPrimaryLocale();
$allLocales = Locale::getAllLocales();
//return parent::getMessage() . ' (' . $allLocales[$this->_requiredLocale] . ')';
return parent::getMessage();
//Edited by Anne Ivy Mirasol, April 27, 2011
}
示例5: 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;
}
示例6: 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', Locale::getLocale(), $typeId, 'name', Locale::getPrimaryLocale()));
$returner = isset($result->fields[0]) ? $result->fields[0] : false;
$result->Close();
unset($result);
return $returner;
}
示例7: getArticleReport
/**
* Get the article report data.
* @param $journalId int
* @return array
*/
function getArticleReport($journalId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$result =& $this->retrieve('SELECT
a.article_id AS article_id,
COALESCE(asl1.setting_value, aspl1.setting_value) AS title,
COALESCE(asl2.setting_value, aspl2.setting_value) AS abstract,
u.first_name AS fname,
u.middle_name AS mname,
u.last_name AS lname,
u.email AS email,
u.affiliation AS affiliation,
u.country AS country,
u.phone AS phone,
u.fax AS fax,
u.url AS url,
u.mailing_address AS address,
COALESCE(usl.setting_value, uspl.setting_value) AS biography,
COALESCE(sl.setting_value, spl.setting_value) AS section_title,
a.language AS language
FROM
articles a
LEFT JOIN users u ON a.user_id=u.user_id
LEFT JOIN user_settings uspl ON (u.user_id=uspl.user_id AND uspl.setting_name = ? AND uspl.locale = ?)
LEFT JOIN user_settings usl ON (u.user_id=usl.user_id AND usl.setting_name = ? AND usl.locale = ?)
LEFT JOIN article_settings aspl1 ON (aspl1.article_id=a.article_id AND aspl1.setting_name = ? AND aspl1.locale = ?)
LEFT JOIN article_settings asl1 ON (asl1.article_id=a.article_id AND asl1.setting_name = ? AND asl1.locale = ?)
LEFT JOIN article_settings aspl2 ON (aspl2.article_id=a.article_id AND aspl2.setting_name = ? AND aspl2.locale = ?)
LEFT JOIN article_settings asl2 ON (asl2.article_id=a.article_id AND asl2.setting_name = ? AND asl2.locale = ?)
LEFT JOIN section_settings spl ON (spl.section_id=a.section_id AND spl.setting_name = ? AND spl.locale = ?)
LEFT JOIN section_settings sl ON (sl.section_id=a.section_id AND sl.setting_name = ? AND sl.locale = ?)
WHERE
a.journal_id = ?
ORDER BY
title', array('biography', $primaryLocale, 'biography', $locale, 'title', $primaryLocale, 'title', $locale, 'abstract', $primaryLocale, 'abstract', $locale, 'title', $primaryLocale, 'title', $locale, $journalId));
$articlesReturner =& new DBRowIterator($result);
$result =& $this->retrieve('SELECT MAX(ed.date_decided) AS date,
ed.article_id AS article_id
FROM edit_decisions ed,
articles a
WHERE a.journal_id = ? AND
a.article_id = ed.article_id
GROUP BY ed.article_id', array($journalId));
$decisionDatesIterator =& new DBRowIterator($result);
$decisions = array();
$decisionsReturner = array();
while ($row =& $decisionDatesIterator->next()) {
$result =& $this->retrieve('SELECT decision AS decision,
article_id AS article_id
FROM edit_decisions
WHERE date_decided = ? AND
article_id = ?', array($row['date'], $row['article_id']));
$decisionsReturner[] =& new DBRowIterator($result);
unset($result);
}
return array($articlesReturner, $decisionsReturner);
}
示例8: lockss
function lockss($args, $request)
{
$this->validate();
$this->setupTemplate();
$journal =& $request->getJournal();
$templateMgr =& TemplateManager::getManager();
if ($journal != null) {
if (!$journal->getSetting('enableLockss')) {
$request->redirect(null, 'index');
}
$year = $request->getUserVar('year');
$issueDao =& DAORegistry::getDAO('IssueDAO');
// FIXME Should probably go in IssueDAO or a subclass
if (isset($year)) {
$year = (int) $year;
$result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year));
if ($result->RecordCount() == 0) {
unset($year);
}
}
if (!isset($year)) {
$showInfo = true;
$result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1', $journal->getId());
list($year) = $result->fields;
$result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year));
} else {
$showInfo = false;
}
$issues = new DAOResultFactory($result, $issueDao, '_returnIssueFromRow');
$prevYear = null;
$nextYear = null;
if (isset($year)) {
$result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1 AND year < ?', array($journal->getId(), $year));
list($prevYear) = $result->fields;
$result =& $issueDao->retrieve('SELECT MIN(year) FROM issues WHERE journal_id = ? AND published = 1 AND year > ?', array($journal->getId(), $year));
list($nextYear) = $result->fields;
}
$templateMgr->assign_by_ref('journal', $journal);
$templateMgr->assign_by_ref('issues', $issues);
$templateMgr->assign('year', $year);
$templateMgr->assign('prevYear', $prevYear);
$templateMgr->assign('nextYear', $nextYear);
$templateMgr->assign('showInfo', $showInfo);
$locales =& $journal->getSupportedLocaleNames();
if (!isset($locales) || empty($locales)) {
$localeNames =& Locale::getAllLocales();
$primaryLocale = Locale::getPrimaryLocale();
$locales = array($primaryLocale => $localeNames[$primaryLocale]);
}
$templateMgr->assign_by_ref('locales', $locales);
} else {
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journals =& $journalDao->getJournals(true);
$templateMgr->assign_by_ref('journals', $journals);
}
$templateMgr->display('gateway/lockss.tpl');
}
示例9: getRegistrantReport
/**
* Get the registrant report data.
* @param $conferenceId int
* @param $schedConfId int
* @return array
*/
function getRegistrantReport($conferenceId, $schedConfId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$result =& $this->retrieve('SELECT
r.registration_id AS registration_id,
r.user_id AS userid,
u.username AS uname,
u.first_name AS fname,
u.middle_name AS mname,
u.last_name AS lname,
u.affiliation AS affiliation,
u.url AS url,
u.email AS email,
u.phone AS phone,
u.fax AS fax,
u.mailing_address AS address,
u.country AS country,
COALESCE(rtsl.setting_value, rtspl.setting_value) AS type,
r.date_registered AS regdate,
r.date_paid AS paiddate,
r.special_requests AS specialreq
FROM
registrations r
LEFT JOIN users u ON r.user_id=u.user_id
LEFT JOIN registration_type_settings rtsl ON (r.type_id=rtsl.type_id AND rtsl.locale=? AND rtsl.setting_name=?)
LEFT JOIN registration_type_settings rtspl ON (r.type_id=rtspl.type_id AND rtsl.locale=? AND rtspl.setting_name=?)
WHERE
r.sched_conf_id= ?
ORDER BY
lname', array($locale, 'name', $primaryLocale, 'name', $schedConfId));
// prepare an iterator of all the registration information
$registrationReturner = new DBRowIterator($result);
$result =& $this->retrieve('SELECT
r.registration_id as registration_id,
roa.option_id as option_id
FROM
registrations r
LEFT JOIN registration_option_assoc roa ON (r.registration_id = roa.registration_id)
WHERE
r.sched_conf_id= ?', $schedConfId);
// Prepare an array of registration Options by registration Id
$registrationOptionDAO =& DAORegistry::getDAO('RegistrationOptionDAO');
$iterator = new DBRowIterator($result);
$registrationOptionReturner = array();
while ($row =& $iterator->next()) {
$registrationId = $row['registration_id'];
$registrationOptionReturner[$registrationId] =& $registrationOptionDAO->getRegistrationOptions($registrationId);
}
return array($registrationReturner, $registrationOptionReturner);
}
示例10: getFieldValue
/**
* @see FormValidator::getFieldValue()
* @return mixed
*/
function getFieldValue()
{
$form =& $this->getForm();
$data = $form->getData($this->getField());
$primaryLocale = Locale::getPrimaryLocale();
$fieldValue = '';
if (is_array($data) && isset($data[$primaryLocale])) {
$fieldValue = $data[$primaryLocale];
if (is_scalar($fieldValue)) {
$fieldValue = trim((string) $fieldValue);
}
}
return $fieldValue;
}
示例11: array
function &getPapersBySchedConfIdOrderByTrack($schedConfId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$params = array('title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, $schedConfId);
$papers = array();
$result =& $this->retrieve('SELECT p.*,
COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev
FROM papers p
LEFT JOIN tracks t ON t.track_id = p.track_id
LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
WHERE p.sched_conf_id = ? ORDER BY track_id', $params);
$returner = new DAOResultFactory($result, $this, '_returnPaperFromRow');
return $returner;
}
示例12: getSitePageHeaderTitle
/**
* Get "localized" site page title (if applicable).
* @return string
*/
function getSitePageHeaderTitle()
{
$typeArray = $this->getData('pageHeaderTitleType');
$imageArray = $this->getData('pageHeaderTitleImage');
$titleArray = $this->getData('title');
$title = null;
foreach (array(Locale::getLocale(), Locale::getPrimaryLocale()) as $locale) {
if (isset($typeArray[$locale]) && $typeArray[$locale]) {
if (isset($imageArray[$locale])) {
$title = $imageArray[$locale];
}
}
if (empty($title) && isset($titleArray[$locale])) {
$title = $titleArray[$locale];
}
if (!empty($title)) {
return $title;
}
}
return null;
}
示例13: ON
/**
* Retrieve an series editor submission by monograph ID.
* @param $monographId int
* @return EditorSubmission
*/
function &getSeriesEditorSubmission($monographId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$result =& $this->retrieve('SELECT m.*,
COALESCE(stl.setting_value, stpl.setting_value) AS series_title,
COALESCE(sal.setting_value, sapl.setting_value) AS series_abbrev
FROM monographs m
LEFT JOIN series s ON (s.series_id = m.series_id)
LEFT JOIN series_settings stpl ON (s.series_id = stpl.series_id AND stpl.setting_name = ? AND stpl.locale = ?)
LEFT JOIN series_settings stl ON (s.series_id = stl.series_id AND stl.setting_name = ? AND stl.locale = ?)
LEFT JOIN series_settings sapl ON (s.series_id = sapl.series_id AND sapl.setting_name = ? AND sapl.locale = ?)
LEFT JOIN series_settings sal ON (s.series_id = sal.series_id AND sal.setting_name = ? AND sal.locale = ?)
WHERE m.monograph_id = ?', array('title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, $monographId));
$returner = null;
if ($result->RecordCount() != 0) {
$returner =& $this->_fromRow($result->GetRowAssoc(false));
}
$result->Close();
unset($result);
return $returner;
}
示例14: array
/**
* Retrieve all published authors for a press in an associative array by
* the first letter of the last name, for example:
* $returnedArray['S'] gives array($misterSmithObject, $misterSmytheObject, ...)
* Keys will appear in sorted order. Note that if pressId is null,
* alphabetized authors for all presses are returned.
* @param $pressId int
* @param $initial An initial the last names must begin with
* @return array Authors ordered by sequence
*/
function &getAuthorsAlphabetizedByPress($pressId = null, $initial = null, $rangeInfo = null)
{
$authors = array();
$params = array('affiliation', Locale::getPrimaryLocale(), 'affiliation', Locale::getLocale());
if (isset($pressId)) {
$params[] = $pressId;
}
if (isset($initial)) {
$params[] = String::strtolower($initial) . '%';
$initialSql = ' AND LOWER(ma.last_name) LIKE LOWER(?)';
} else {
$initialSql = '';
}
$result =& $this->retrieveRange('SELECT DISTINCT
CAST(\'\' AS CHAR) AS url,
0 AS author_id,
0 AS submission_id,
CAST(\'\' AS CHAR) AS email,
0 AS primary_contact,
0 AS seq,
ma.first_name AS first_name,
ma.middle_name AS middle_name,
ma.last_name AS last_name,
asl.setting_value AS affiliation_l,
asl.locale,
aspl.setting_value AS affiliation_pl,
aspl.locale AS primary_locale,
ma.country
FROM authors ma
LEFT JOIN author_settings aspl ON (aa.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
LEFT JOIN author_settings asl ON (aa.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?)
LEFT JOIN monographs a ON (ma.submission_id = a.monograph_id)
WHERE a.status = ' . STATUS_PUBLISHED . ' ' . (isset($pressId) ? 'AND a.press_id = ? ' : '') . '
AND (ma.last_name IS NOT NULL AND ma.last_name <> \'\')' . $initialSql . '
ORDER BY ma.last_name, ma.first_name', $params, $rangeInfo);
$returner = new DAOResultFactory($result, $this, '_returnAuthorFromRow');
return $returner;
}
示例15: getReviewReport
/**
* Get the review report data.
* @param $conferenceId int
* @param $schedConfId int
* @return array
*/
function getReviewReport($schedConfId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$result =& $this->retrieve('SELECT paper_id,
comments,
author_id
FROM paper_comments
WHERE comment_type = ?', array(COMMENT_TYPE_PEER_REVIEW));
import('db.DBRowIterator');
$commentsReturner = new DBRowIterator($result);
$result =& $this->retrieve('SELECT r.stage AS reviewStage,
COALESCE(psl.setting_value, pspl.setting_value) AS paper,
p.paper_id AS paperId,
u.user_id AS reviewerId,
u.username AS reviewer,
u.first_name AS firstName,
u.middle_name AS middleName,
u.last_name AS lastName,
r.date_assigned AS dateAssigned,
r.date_notified AS dateNotified,
r.date_confirmed AS dateConfirmed,
r.date_completed AS dateCompleted,
r.date_reminded AS dateReminded,
(r.declined=1) AS declined,
(r.cancelled=1) AS cancelled,
r.recommendation AS recommendation
FROM review_assignments r
LEFT JOIN papers p ON r.paper_id=p.paper_id
LEFT JOIN paper_settings psl ON (p.paper_id=psl.paper_id AND psl.locale=? AND psl.setting_name=?)
LEFT JOIN paper_settings pspl ON (p.paper_id=pspl.paper_id AND pspl.locale=? AND pspl.setting_name=?),
users u
WHERE u.user_id=r.reviewer_id AND p.sched_conf_id= ?
ORDER BY paper', array($locale, 'title', $primaryLocale, 'title', $schedConfId));
$reviewsReturner = new DBRowIterator($result);
return array($commentsReturner, $reviewsReturner);
}