本文整理汇总了PHP中Locale::getSupportedFormLocales方法的典型用法代码示例。如果您正苦于以下问题:PHP Locale::getSupportedFormLocales方法的具体用法?PHP Locale::getSupportedFormLocales怎么用?PHP Locale::getSupportedFormLocales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::getSupportedFormLocales方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
示例2: 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', Locale::getSupportedFormLocales());
// Determine the current locale to display fields with
$formLocale = Request::getUserVar('formLocale');
if (empty($formLocale)) {
$formLocale = Locale::getLocale();
}
if (!in_array($formLocale, array_keys(Locale::getSupportedFormLocales()))) {
$formLocale = Locale::getPrimaryLocale();
}
$templateMgr->assign('formLocale', $formLocale);
if ($fetch) {
return $templateMgr->fetch($this->_template);
} else {
$templateMgr->display($this->_template);
return null;
}
}