本文整理汇总了PHP中AppLocale::getSupportedFormLocales方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::getSupportedFormLocales方法的具体用法?PHP AppLocale::getSupportedFormLocales怎么用?PHP AppLocale::getSupportedFormLocales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppLocale
的用法示例。
在下文中一共展示了AppLocale::getSupportedFormLocales方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
* @param $template string the path to the form template file
*/
function __construct($template = null, $callHooks = true, $requiredLocale = null, $supportedLocales = null)
{
if ($requiredLocale === null) {
$requiredLocale = AppLocale::getPrimaryLocale();
}
$this->requiredLocale = $requiredLocale;
if ($supportedLocales === null) {
$supportedLocales = AppLocale::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();
if ($callHooks === true) {
// 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_codesafe(get_class($this)) . '::Constructor', array($this, &$template));
}
}
示例2: Form
/**
* Constructor.
* @param $template string the path to the form template file
*/
function Form($template = null, $callHooks = true, $requiredLocale = null, $supportedLocales = null)
{
if ($requiredLocale === null) {
$requiredLocale = AppLocale::getPrimaryLocale();
}
$this->requiredLocale = $requiredLocale;
if ($supportedLocales === null) {
$supportedLocales = AppLocale::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'));
if ($callHooks === true) {
// 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(get_class($this)) . '::Constructor', array(&$this, &$template));
}
}
示例3: MultilingualListbuilderGridColumn
/**
* Constructor
*/
function MultilingualListbuilderGridColumn($listbuilder, $id = '', $title = null, $titleTranslated = null, $template = null, $cellProvider = null, $availableLocales = null, $flags = array())
{
// Make sure this is a text input
assert($listbuilder->getSourceType() == LISTBUILDER_SOURCE_TYPE_TEXT);
// Provide a default set of available locales if not specified
if (!$availableLocales) {
$availableLocales = AppLocale::getSupportedFormLocales();
}
// Set some flags for multilingual support
$flags['multilingual'] = true;
// This is a multilingual column.
$flags['availableLocales'] = $availableLocales;
// Provide available locales
parent::ListbuilderGridColumn($listbuilder, $id, $title, $titleTranslated, $template, $cellProvider, $flags);
}
示例4: render
/**
* To be used by a GridRow to generate a rendered representation of
* the element for the given column.
*
* @param $row GridRow
* @param $column GridColumn
* @return string the rendered representation of the element for the given column
*/
function render($request, $row, $column)
{
$columnId = $column->getId();
assert(!empty($columnId));
// Construct a default cell id (null for "nonexistent" new rows)
$rowId = $row->getId();
// Potentially null (indicating row not backed in the DB)
$cellId = isset($rowId) ? $rowId . '-' . $columnId : null;
// Assign values extracted from the element for the cell.
$templateMgr = TemplateManager::getManager($request);
$templateVars = $this->getTemplateVarsFromRowColumn($row, $column);
foreach ($templateVars as $varName => $varValue) {
$templateMgr->assign($varName, $varValue);
}
$templateMgr->assign(array('id' => $cellId, 'column' => $column, 'actions' => $this->getCellActions($request, $row, $column), 'flags' => $column->getFlags(), 'formLocales' => AppLocale::getSupportedFormLocales()));
$template = $column->getTemplate();
assert(!empty($template));
return $templateMgr->fetch($template);
}
示例5: createProductNode
//.........这里部分代码省略.........
$contributorNode->appendChild($this->_buildTextNode($doc, 'NamesBeforeKey', trim(join(' ', array($author->getFirstName(), $author->getMiddleName())))));
if ($author->getLastName() != '') {
$contributorNode->appendChild($this->_buildTextNode($doc, 'KeyNames', $author->getLastName()));
} else {
$contributorNode->appendChild($this->_buildTextNode($doc, 'KeyNames', $author->getFullName()));
}
if ($author->getSuffix() != '') {
$contributorNode->appendChild($this->_buildTextNode($doc, 'SuffixToKey', $author->getSuffix()));
}
if ($author->getLocalizedBiography() != '') {
$contributorNode->appendChild($this->_buildTextNode($doc, 'BiographicalNote', $author->getLocalizedBiography()));
}
if ($author->getCountry() != '') {
$contributorPlaceNode = $doc->createElementNS($deployment->getNamespace(), 'ContributorPlace');
$contributorNode->appendChild($contributorPlaceNode);
$contributorPlaceNode->appendChild($this->_buildTextNode($doc, 'ContributorPlaceRelator', '04'));
$contributorPlaceNode->appendChild($this->_buildTextNode($doc, 'CountryCode', $author->getCountry()));
unset($contributorPlaceNode);
}
$sequence++;
$descDetailNode->appendChild($contributorNode);
unset($contributorNode);
unset($sequenceNode);
unset($userGroup);
unset($author);
}
if (sizeof($authors) == 0) {
// this will probably never happen, but include the possibility.
$descDetailNode->appendChild($this->_buildTextNode($doc, 'NoContributor', ''));
// empty state of fact.
}
/* --- Add Language elements --- */
$submissionLanguageDao = DAORegistry::getDAO('SubmissionLanguageDAO');
$allLanguages = $submissionLanguageDao->getLanguages($submission->getId(), array_keys(AppLocale::getSupportedFormLocales()));
$uniqueLanguages = array();
foreach ($allLanguages as $locale => $languages) {
$uniqueLanguages = array_merge($uniqueLanguages, $languages);
}
foreach ($uniqueLanguages as $language) {
$languageNode = $doc->createElementNS($deployment->getNamespace(), 'Language');
$languageNode->appendChild($this->_buildTextNode($doc, 'LanguageRole', '01'));
$onixLanguageCode = $onixCodelistItemDao->getCodeFromValue($language, 'List74');
if ($onixLanguageCode != '') {
$languageNode->appendChild($this->_buildTextNode($doc, 'LanguageCode', $onixLanguageCode));
$descDetailNode->appendChild($languageNode);
}
unset($languageNode);
}
/* --- add Extents for 00 (main content), 04 (back matter), 08 for digital works ---*/
if ($publicationFormat->getFrontMatter() > 0) {
// 03 - Pages
$extentNode = $this->_createExtentNode($doc, $deployment, '00', $publicationFormat->getFrontMatter(), '03');
$descDetailNode->appendChild($extentNode);
unset($extentNode);
}
if ($publicationFormat->getBackMatter() > 0) {
$extentNode = $this->_createExtentNode($doc, $deployment, '04', $publicationFormat->getBackMatter(), '03');
$descDetailNode->appendChild($extentNode);
unset($extentNode);
}
if (!$publicationFormat->getPhysicalFormat()) {
// EBooks and digital content have extent information about file sizes
$fileSize = $publicationFormat->getFileSize() ? $publicationFormat->getFileSize() : $publicationFormat->getCalculatedFileSize();
$extentNode = $this->_createExtentNode($doc, $deployment, '08', $fileSize, '05');
$descDetailNode->appendChild($extentNode);
unset($extentNode);
示例6: display
/**
* Display the form.
* @param $request PKPRequest
* @param $fetch boolean if set to true will return the rendered
* form rather than sending the response to the user
* @return string the rendered form if fetch is true, otherwise null
*/
function display($request = null, $fetch = false)
{
if (checkPhpVersion('4.3.0')) {
$returner = null;
$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::display"
// Note that class names are always lower case.
if (HookRegistry::call(strtolower($trace[1]['class']) . '::' . $trace[0]['function'], array(&$this, &$returner))) {
return $returner;
}
}
$templateMgr =& TemplateManager::getManager($request);
$templateMgr->setCacheability(CACHEABILITY_NO_STORE);
$templateMgr->register_function('fieldLabel', array(&$this, 'smartyFieldLabel'));
$templateMgr->register_function('form_language_chooser', array(&$this, 'smartyFormLanguageChooser'));
$templateMgr->register_function('modal_language_chooser', array(&$this, 'smartyModalLanguageChooser'));
$templateMgr->register_block('form_locale_iterator', array(&$this, 'formLocaleIterator'));
// modifier vocabulary for creating forms
$templateMgr->register_block('fbvFormSection', array(&$this, 'smartyFBVFormSection'));
$templateMgr->register_block('fbvCustomElement', array(&$this, 'smartyFBVCustomElement'));
$templateMgr->register_block('fbvFormArea', array(&$this, 'smartyFBVFormArea'));
$templateMgr->register_function('fbvButton', array(&$this, 'smartyFBVButton'));
$templateMgr->register_function('fbvTextInput', array(&$this, 'smartyFBVTextInput'));
$templateMgr->register_function('fbvTextarea', array(&$this, 'smartyFBVTextArea'));
$templateMgr->register_function('fbvSelect', array(&$this, 'smartyFBVSelect'));
$templateMgr->register_function('fbvElement', array(&$this, 'smartyFBVElement'));
$templateMgr->register_function('fbvElementMultilingual', array(&$this, 'smartyFBVElementMultilingual'));
$templateMgr->register_function('fbvCheckbox', array(&$this, 'smartyFBVCheckbox'));
$templateMgr->register_function('fbvRadioButton', array(&$this, 'smartyFBVRadioButton'));
$templateMgr->register_function('fbvFileInput', array(&$this, 'smartyFBVFileInput'));
$templateMgr->assign('fbvStyles', $this->fbvStyles);
$templateMgr->assign($this->_data);
$templateMgr->assign('isError', !$this->isValid());
$templateMgr->assign('errors', $this->getErrorsArray());
$templateMgr->assign('formLocales', AppLocale::getSupportedFormLocales());
// Determine the current locale to display fields with
$formLocale = Request::getUserVar('formLocale');
if (empty($formLocale)) {
$formLocale = AppLocale::getLocale();
}
if (!in_array($formLocale, array_keys(AppLocale::getSupportedFormLocales()))) {
$formLocale = AppLocale::getPrimaryLocale();
}
$templateMgr->assign('formLocale', $formLocale);
if ($fetch) {
return $templateMgr->fetch($this->_template);
} else {
$templateMgr->display($this->_template);
return null;
}
}
示例7: addMetadata
/**
* Add the submission metadata for a submission to its DOM element.
* @param $doc DOMDocument
* @param $submissionNode DOMElement
* @param $submission Submission
*/
function addMetadata($doc, $submissionNode, $submission)
{
$this->createLocalizedNodes($doc, $submissionNode, 'title', $submission->getTitle(null, false));
$this->createLocalizedNodes($doc, $submissionNode, 'prefix', $submission->getPrefix(null));
$this->createLocalizedNodes($doc, $submissionNode, 'subtitle', $submission->getSubtitle(null));
$this->createLocalizedNodes($doc, $submissionNode, 'abstract', $submission->getAbstract(null));
$this->createLocalizedNodes($doc, $submissionNode, 'coverage', $submission->getCoverage(null));
$this->createLocalizedNodes($doc, $submissionNode, 'type', $submission->getType(null));
$this->createLocalizedNodes($doc, $submissionNode, 'source', $submission->getSource(null));
$this->createLocalizedNodes($doc, $submissionNode, 'rights', $submission->getRights(null));
// add controlled vocabularies
// get the supported locale keys
$supportedLocales = array_keys(AppLocale::getSupportedFormLocales());
$controlledVocabulariesMapping = $this->_getControlledVocabulariesMappings();
foreach ($controlledVocabulariesMapping as $controlledVocabulariesNodeName => $mappings) {
$dao = DAORegistry::getDAO($mappings[0]);
$getFunction = $mappings[1];
$controlledVocabularyNodeName = $mappings[2];
$controlledVocabulary = $dao->{$getFunction}($submission->getId(), $supportedLocales);
$this->addControlledVocabulary($doc, $submissionNode, $controlledVocabulariesNodeName, $controlledVocabularyNodeName, $controlledVocabulary);
}
$this->createOptionalNode($doc, $submissionNode, 'comments_to_editor', $submission->getCommentsToEditor());
}