mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
parent
32abb20a60
commit
74241258f5
@ -209,25 +209,29 @@ class GeneralForm extends Form
|
|||||||
$phpUrl = '<a href="http://php.net/manual/en/function.date.php" target="_new">'
|
$phpUrl = '<a href="http://php.net/manual/en/function.date.php" target="_new">'
|
||||||
. 'the official PHP documentation</a>';
|
. 'the official PHP documentation</a>';
|
||||||
|
|
||||||
|
$dateFormatValue = $this->getRequest()->getParam('date_format', $cfg->get('dateFormat', 'd/m/Y'));
|
||||||
$txtDefaultDateFormat = new Zend_Form_Element_Text(
|
$txtDefaultDateFormat = new Zend_Form_Element_Text(
|
||||||
array(
|
array(
|
||||||
'name' => 'date_format',
|
'name' => 'date_format',
|
||||||
'label' => 'Date Format',
|
'label' => 'Date Format',
|
||||||
'helptext' => 'Display dates according to this format. See ' . $phpUrl . ' for possible values',
|
'helptext' => 'Display dates according to this format. (See ' . $phpUrl . ' for possible values.) '
|
||||||
|
. 'Example result: ' . $this->getView()->dateFormat()->format(time(), $dateFormatValue),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'value' => $cfg->get('dateFormat', 'd/m/Y')
|
'value' => $dateFormatValue
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement($txtDefaultDateFormat);
|
$this->addElement($txtDefaultDateFormat);
|
||||||
$txtDefaultDateFormat->addValidator(new DateFormatValidator());
|
$txtDefaultDateFormat->addValidator(new DateFormatValidator());
|
||||||
|
|
||||||
|
$timeFormatValue = $this->getRequest()->getParam('time_format', $cfg->get('timeFormat', 'g:i A'));
|
||||||
$txtDefaultTimeFormat = new Zend_Form_Element_Text(
|
$txtDefaultTimeFormat = new Zend_Form_Element_Text(
|
||||||
array(
|
array(
|
||||||
'name' => 'time_format',
|
'name' => 'time_format',
|
||||||
'label' => 'Time Format',
|
'label' => 'Time Format',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'helptext' => 'Display times according to this format. See ' . $phpUrl . ' for possible values',
|
'helptext' => 'Display times according to this format. (See ' . $phpUrl . ' for possible values.) '
|
||||||
'value' => $cfg->get('timeFormat', 'g:i A')
|
. 'Example result: ' . $this->getView()->dateFormat()->format(time(), $timeFormatValue),
|
||||||
|
'value' => $timeFormatValue
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$txtDefaultTimeFormat->addValidator(new TimeFormatValidator());
|
$txtDefaultTimeFormat->addValidator(new TimeFormatValidator());
|
||||||
|
@ -161,13 +161,18 @@ class GeneralForm extends Form
|
|||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$dateFormatValue = $this->getRequest()->getParam(
|
||||||
|
'date_format',
|
||||||
|
$prefs->get('app.dateFormat', $cfg->get('dateFormat', 'd/m/Y'))
|
||||||
|
);
|
||||||
$txtDefaultDateFormat = new Zend_Form_Element_Text(
|
$txtDefaultDateFormat = new Zend_Form_Element_Text(
|
||||||
array(
|
array(
|
||||||
'name' => 'date_format',
|
'name' => 'date_format',
|
||||||
'label' => 'Preferred Date Format',
|
'label' => 'Preferred Date Format',
|
||||||
'helptext' => 'Display dates according to this format. See ' . $phpUrl . ' for possible values',
|
'helptext' => 'Display dates according to this format. (See ' . $phpUrl . ' for possible values.) '
|
||||||
|
. 'Example result: ' . $this->getView()->dateFormat()->format(time(), $dateFormatValue),
|
||||||
'required' => !$useGlobalDateFormat,
|
'required' => !$useGlobalDateFormat,
|
||||||
'value' => $prefs->get('app.dateFormat', $cfg->get('dateFormat', 'd/m/Y'))
|
'value' => $dateFormatValue
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -186,13 +191,18 @@ class GeneralForm extends Form
|
|||||||
'required' => !$useGlobalTimeFormat
|
'required' => !$useGlobalTimeFormat
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$timeFormatValue = $this->getRequest()->getParam(
|
||||||
|
'time_format',
|
||||||
|
$prefs->get('app.timeFormat', $cfg->get('timeFormat', 'g:i A'))
|
||||||
|
);
|
||||||
$txtDefaultTimeFormat = new Zend_Form_Element_Text(
|
$txtDefaultTimeFormat = new Zend_Form_Element_Text(
|
||||||
array(
|
array(
|
||||||
'name' => 'time_format',
|
'name' => 'time_format',
|
||||||
'label' => 'Preferred Time Format',
|
'label' => 'Preferred Time Format',
|
||||||
'required' => !$useGlobalTimeFormat,
|
'required' => !$useGlobalTimeFormat,
|
||||||
'helptext' => 'Display times according to this format. See ' . $phpUrl . ' for possible values',
|
'helptext' => 'Display times according to this format. (See ' . $phpUrl . ' for possible values.) '
|
||||||
'value' => $prefs->get('app.timeFormat', $cfg->get('timeFormat', 'g:i A'))
|
. 'Example result: ' . $this->getView()->dateFormat()->format(time(), $timeFormatValue),
|
||||||
|
'value' => $timeFormatValue
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$txtDefaultTimeFormat->addValidator(new TimeFormatValidator());
|
$txtDefaultTimeFormat->addValidator(new TimeFormatValidator());
|
||||||
|
@ -50,7 +50,7 @@ class Zend_View_Helper_DateFormat extends Zend_View_Helper_Abstract
|
|||||||
* @param string $format
|
* @param string $format
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function format($timestamp, $format)
|
public function format($timestamp, $format)
|
||||||
{
|
{
|
||||||
$dt = DateTimeFactory::create();
|
$dt = DateTimeFactory::create();
|
||||||
$dt->setTimestamp($timestamp);
|
$dt->setTimestamp($timestamp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user