本文整理汇总了PHP中DateTimeUtil::resolveValueForDateLocaleFormattedDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::resolveValueForDateLocaleFormattedDisplay方法的具体用法?PHP DateTimeUtil::resolveValueForDateLocaleFormattedDisplay怎么用?PHP DateTimeUtil::resolveValueForDateLocaleFormattedDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::resolveValueForDateLocaleFormattedDisplay方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderEditableFirstValueContent
/**
* @return string
*/
protected function renderEditableFirstValueContent()
{
$cClipWidget = new CClipWidget();
$cClipWidget->beginClip("EditableDateElement");
$cClipWidget->widget('application.core.widgets.ZurmoJuiDatePicker', array('value' => DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->model->value), 'htmlOptions' => $this->getHtmlOptionsForFirstValue()));
$cClipWidget->endClip();
$inputContent = $cClipWidget->getController()->clips['EditableDateElement'];
$inputContent = ZurmoHtml::tag('div', array('class' => 'has-date-select'), $inputContent);
$error = $this->form->error($this->model, 'value', array('inputID' => $this->getFirstValueEditableInputId()));
return $inputContent . $error;
}
示例2: testValidAndInvalidDateDateTimeValidation
public function testValidAndInvalidDateDateTimeValidation()
{
$language = Yii::app()->getLanguage();
$this->assertEquals($language, 'en');
$this->assertEquals(false, CDateTimeParser::parse('04:04:1980', DatabaseCompatibilityUtil::getDateFormat()));
$this->assertEquals(null, DateTimeUtil::resolveValueForDateLocaleFormattedDisplay('04:04:1980'));
$model = new DateDateTime();
$model->aDate = '04:04:1980';
$model->aDateTime = 'notATimeStamp';
$saved = $model->save();
$this->assertFalse($saved);
$compareData = array('aDate' => array('A Date must be date.'), 'aDateTime' => array('A Date Time must be datetime.'));
$this->assertEquals($compareData, $model->getErrors());
//Now test setting an integer for dateTime which is wrong
$model = new DateDateTime();
$model->aDate = '1981-07-05';
$model->aDateTime = 1241341412421;
$saved = $model->save();
$this->assertFalse($saved);
$compareData = array('aDateTime' => array('A Date Time must be datetime.'));
$this->assertEquals($compareData, $model->getErrors());
//Now test a successful validation.
$this->assertEquals('M/d/yy', DateTimeUtil::getLocaleDateFormat());
$model = new DateDateTime();
$model->aDate = '1981-07-05';
$model->aDateTime = '1981-07-05 04:04:04';
$saved = $model->save();
$this->assertEquals(array(), $model->getErrors());
$this->assertTrue($saved);
$this->assertNull($model->aDateTime2);
//now set DateTime2 and test if you save and then clear it that it is behaving properly.
$model->aDateTime2 = '1981-07-05 04:04:04';
$saved = $model->save();
$this->assertTrue($saved);
$this->assertEquals('1981-07-05 04:04:04', $model->aDateTime2);
$model->aDateTime2 = null;
$saved = $model->save();
$this->assertTrue($saved);
$id = $model->id;
$model->forget();
$model = DateDateTime::getById($id);
$this->assertNull($model->aDateTime2);
}
示例3: resolveAbbreviatedDayMonthDisplayLabel
/**
* @param string $date
* @return null
*/
protected static function resolveAbbreviatedDayMonthDisplayLabel($date)
{
assert('is_string($date)');
return DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($date, DateTimeUtil::DISPLAY_FORMAT_ABBREVIATED_MONTH_AND_DAY_WIDTH);
}
示例4: renderControlNonEditable
/**
* Renders the attribute from the model.
* @return The element's content.
*/
protected function renderControlNonEditable()
{
return DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->model->{$this->attribute});
}
示例5: getDisplayLabel
private function getDisplayLabel($date, $groupingBy)
{
$dateForLabel = $date;
$format = DateTimeUtil::DISPLAY_FORMAT_ABBREVIATED_MONTH_AND_DAY_WIDTH;
if ($groupingBy == MarketingOverallMetricsForm::GROUPING_TYPE_WEEK) {
$date = new DateTime($date);
$date->modify('Sunday' == $date->format('l') ? 'Monday last week' : 'Monday this week');
$dateForLabel = $date->format('Y-m-d');
} elseif ($groupingBy == MarketingOverallMetricsForm::GROUPING_TYPE_MONTH) {
$format = DateTimeUtil::DISPLAY_FORMAT_ABBREVIATED_MONTH_ONLY_WIDTH;
}
$displayLabel = DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($dateForLabel, $format);
return $displayLabel;
}
示例6: testResolveValueForDateLocaleFormattedDisplay
public function testResolveValueForDateLocaleFormattedDisplay()
{
$displayValue = DateTimeUtil::resolveValueForDateLocaleFormattedDisplay('2007-07-01');
$this->assertEquals('7/1/07', $displayValue);
//other locales
Yii::app()->setLanguage('de');
$displayValue = DateTimeUtil::resolveValueForDateLocaleFormattedDisplay('2007-07-01');
$this->assertEquals('01.07.07', $displayValue);
}
示例7: formatValue
/**
* @param DisplayAttributeForReportForm $displayAttribute
* @param mixed $value
* @return mixed
* @throws NotSupportedException if the currencyConversionType is invalid or null, when the displayAttribute
* is a currency type
*/
protected function formatValue(DisplayAttributeForReportForm $displayAttribute, $value)
{
if ($displayAttribute->isATypeOfCurrencyValue()) {
if ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_ACTUAL) {
return Yii::app()->numberFormatter->formatDecimal((double) $value);
} elseif ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_BASE) {
return Yii::app()->numberFormatter->formatCurrency((double) $value, Yii::app()->currencyHelper->getBaseCode());
} elseif ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_SPOT) {
return Yii::app()->numberFormatter->formatCurrency((double) $value * $this->report->getFromBaseToSpotRate(), $this->report->getSpotConversionCurrencyCode());
} else {
throw new NotSupportedException();
}
} elseif ($displayAttribute->getDisplayElementType() == 'Decimal') {
return Yii::app()->numberFormatter->formatDecimal((double) $value);
} elseif ($displayAttribute->getDisplayElementType() == 'Integer') {
return Yii::app()->numberFormatter->formatDecimal((int) $value);
} elseif ($displayAttribute->getDisplayElementType() == 'Date') {
return DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($value);
} elseif ($displayAttribute->getDisplayElementType() == 'DateTime') {
return DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($value);
} else {
return $value;
}
}
示例8: renderEditableSecondDateContent
protected function renderEditableSecondDateContent($disabled = null)
{
assert('$disabled === null || $disabled = "disabled"');
$cClipWidget = new CClipWidget();
$cClipWidget->beginClip("EditableDateElement");
$cClipWidget->widget('application.core.widgets.ZurmoJuiDatePicker', array('attribute' => $this->attribute, 'value' => DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->getValueSecondDate()), 'htmlOptions' => array('id' => $this->getValueSecondDateEditableInputId(), 'name' => $this->getValueSecondDateEditableInputName(), 'disabled' => $disabled)));
$cClipWidget->endClip();
$content = $cClipWidget->getController()->clips['EditableDateElement'];
return ZurmoHtml::tag('div', array('class' => 'has-date-select'), $content);
}
示例9: renderConfigureElementsContent
/**
* @return string
*/
protected function renderConfigureElementsContent()
{
$dateRangeContent = DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->resolveForm()->beginDate) . ' - ' . DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->resolveForm()->endDate);
$content = ZurmoHtml::tag('div', array(), $dateRangeContent);
$content .= $this->renderGroupByConfigurationForm();
return $content;
}
示例10: renderEditableSecondDateContent
protected function renderEditableSecondDateContent()
{
$themePath = Yii::app()->baseUrl . '/themes/' . Yii::app()->theme->name;
$value = $this->model->{$this->attribute};
$cClipWidget = new CClipWidget();
$cClipWidget->beginClip("EditableDateElement");
$cClipWidget->widget('ext.zurmoinc.framework.widgets.JuiDatePicker', array('attribute' => $this->attribute, 'value' => DateTimeUtil::resolveValueForDateLocaleFormattedDisplay(ArrayUtil::getArrayValue($value, 'secondDate')), 'language' => YiiToJqueryUIDatePickerLocalization::getLanguage(), 'htmlOptions' => array('id' => $this->getEditableInputId($this->attribute, 'secondDate'), 'name' => $this->getEditableInputName($this->attribute, 'secondDate')), 'options' => array('showOn' => 'both', 'buttonText' => ZurmoHtml::tag('span', array(), '<!--Date-->'), 'showButtonPanel' => true, 'buttonImageOnly' => false, 'dateFormat' => YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormat()))));
$cClipWidget->endClip();
$content = $cClipWidget->getController()->clips['EditableDateElement'];
return ZurmoHtml::tag('div', array('class' => 'has-date-select'), $content);
}