本文整理匯總了PHP中i18n::get_date_format方法的典型用法代碼示例。如果您正苦於以下問題:PHP i18n::get_date_format方法的具體用法?PHP i18n::get_date_format怎麽用?PHP i18n::get_date_format使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類i18n
的用法示例。
在下文中一共展示了i18n::get_date_format方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testDateFormatCustom
public function testDateFormatCustom()
{
i18n::set_locale('en_US');
$this->assertEquals('MMM d, y', i18n::get_date_format());
i18n::config()->date_format = 'd/MM/yyyy';
$this->assertEquals('d/MM/yyyy', i18n::get_date_format());
}
示例2: testDateFormatCustom
function testDateFormatCustom()
{
i18n::set_locale('en_US');
$this->assertEquals('MM/dd/yyyy', i18n::get_date_format());
i18n::set_date_format('d/MM/yyyy');
$this->assertEquals('d/MM/yyyy', i18n::get_date_format());
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet('Root', new Tab('Main', _t('SiteTree.TABMAIN', 'Main'), new TextField('Title', _t('UniadsObject.db_Title', 'Title')))));
if ($this->ID) {
$previewLink = Director::absoluteBaseURL() . 'admin/' . UniadsAdmin::config()->url_segment . '/UniadsObject/preview/' . $this->ID;
$fields->addFieldToTab('Root.Main', new ReadonlyField('Impressions', _t('UniadsObject.db_Impressions', 'Impressions')), 'Title');
$fields->addFieldToTab('Root.Main', new ReadonlyField('Clicks', _t('UniadsObject.db_Clicks', 'Clicks')), 'Title');
$fields->addFieldsToTab('Root.Main', array(DropdownField::create('CampaignID', _t('UniadsObject.has_one_Campaign', 'Campaign'), DataList::create('UniadsCampaign')->map())->setEmptyString(_t('UniadsObject.Campaign_none', 'none')), DropdownField::create('ZoneID', _t('UniadsObject.has_one_Zone', 'Zone'), DataList::create('UniadsZone')->map())->setEmptyString(_t('UniadsObject.Zone_select', 'select one')), new NumericField('Weight', _t('UniadsObject.db_Weight', 'Weight (controls how often it will be shown relative to others)')), new TextField('TargetURL', _t('UniadsObject.db_TargetURL', 'Target URL')), new Treedropdownfield('InternalPageID', _t('UniadsObject.has_one_InternalPage', 'Internal Page Link'), 'Page'), new CheckboxField('NewWindow', _t('UniadsObject.db_NewWindow', 'Open in a new Window')), $file = new UploadField('File', _t('UniadsObject.has_one_File', 'Advertisement File')), $AdContent = new TextareaField('AdContent', _t('UniadsObject.db_AdContent', 'Advertisement Content')), $Starts = new DateField('Starts', _t('UniadsObject.db_Starts', 'Starts')), $Expires = new DateField('Expires', _t('UniadsObject.db_Expires', 'Expires')), new NumericField('ImpressionLimit', _t('UniadsObject.db_ImpressionLimit', 'Impression Limit')), new CheckboxField('Active', _t('UniadsObject.db_Active', 'Active')), new LiteralField('Preview', '<a href="' . $previewLink . '" target="_blank">' . _t('UniadsObject.Preview', 'Preview this advertisement') . "</a>")));
$app_categories = File::config()->app_categories;
$file->setFolderName($this->config()->files_dir);
$file->getValidator()->setAllowedMaxFileSize(array('*' => $this->config()->max_file_size));
$file->getValidator()->setAllowedExtensions(array_merge($app_categories['image'], $app_categories['flash']));
$AdContent->setRows(10);
$AdContent->setColumns(20);
$Starts->setConfig('showcalendar', true);
$Starts->setConfig('dateformat', i18n::get_date_format());
$Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires->setConfig('showcalendar', true);
$Expires->setConfig('dateformat', i18n::get_date_format());
$Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
}
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例4: __construct
function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
{
if (!$this->locale) {
$this->locale = i18n::get_locale();
}
if (!$this->getConfig('dateformat')) {
$this->setConfig('dateformat', i18n::get_date_format());
}
parent::__construct($name, $title, $value, $form, $rightTitle);
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$Starts = $fields->fieldByName('Root.Main.Starts');
$Starts->setConfig('showcalendar', true);
$Starts->setConfig('dateformat', i18n::get_date_format());
$Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires = $fields->fieldByName('Root.Main.Expires');
$Expires->setConfig('showcalendar', true);
$Expires->setConfig('dateformat', i18n::get_date_format());
$Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
$fields->changeFieldOrder(array('Title', 'ClientID', 'Starts', 'Expires', 'Active'));
return $fields;
}
示例6: __construct
function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
{
if (!$this->locale) {
$this->locale = i18n::get_locale();
}
if (!$this->getConfig('dateformat')) {
$this->setConfig('dateformat', i18n::get_date_format());
}
foreach (self::$default_config as $defaultK => $defaultV) {
if ($defaultV) {
if ($defaultK == 'locale') {
$this->locale = $defaultV;
} else {
$this->setConfig($defaultK, $defaultV);
}
}
}
parent::__construct($name, $title, $value, $form, $rightTitle);
}
示例7: getFormField
/**
* Return the form field.
*
* @todo Make a jQuery safe form field. The current CalendarDropDown
* breaks on the front end.
*/
public function getFormField()
{
// scripts for jquery date picker
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.datepicker.js');
$dateFormat = DateField_View_JQuery::convert_iso_to_jquery_format(i18n::get_date_format());
Requirements::customScript(<<<JS
\t\t\t(function(jQuery) {
\t\t\t\t\$(document).ready(function() {
\t\t\t\t\t\$('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker({ dateFormat: '{$dateFormat}' });
\t\t\t\t});
\t\t\t})(jQuery);
JS
, 'UserFormsDate');
// css for jquery date picker
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui-1.8rc3.custom.css');
$default = $this->getSetting('DefaultToToday') ? date('d/m/Y') : $this->Default;
return new DateField($this->Name, $this->Title, $default);
}
示例8: __construct
public function __construct($name, $title = null, $value = null)
{
if (!$this->locale) {
$this->locale = i18n::get_locale();
}
$this->config = $this->config()->default_config;
if (!$this->getConfig('dateformat')) {
$this->setConfig('dateformat', i18n::get_date_format());
}
foreach ($this->config()->default_config as $defaultK => $defaultV) {
if ($defaultV) {
if ($defaultK == 'locale') {
$this->locale = $defaultV;
} else {
$this->setConfig($defaultK, $defaultV);
}
}
}
parent::__construct($name, $title, $value);
}
示例9: getDateFormat
/**
* Override the default getter for DateFormat so the
* default format for the user's locale is used
* if the user has not defined their own.
*
* @return string ISO date format
*/
public function getDateFormat()
{
if ($this->getField('DateFormat')) {
return $this->getField('DateFormat');
} elseif ($this->getField('Locale')) {
require_once 'Zend/Date.php';
return Zend_Locale_Format::getDateFormat($this->Locale);
} else {
return i18n::get_date_format();
}
}