parent
68842f00d8
commit
02eb944608
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
namespace Icinga\Forms\Announcement;
|
namespace Icinga\Forms\Announcement;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Icinga\Authentication\Auth;
|
use Icinga\Authentication\Auth;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Forms\RepositoryForm;
|
use Icinga\Forms\RepositoryForm;
|
||||||
|
@ -21,43 +22,44 @@ class AnnouncementForm extends RepositoryForm
|
||||||
'text',
|
'text',
|
||||||
'author',
|
'author',
|
||||||
array(
|
array(
|
||||||
|
'disabled' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'value' => Auth::getInstance()->getUser()->getUsername(),
|
'value' => Auth::getInstance()->getUser()->getUsername()
|
||||||
'disabled' => true
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'textarea',
|
'textarea',
|
||||||
'message',
|
'message',
|
||||||
array(
|
array(
|
||||||
'required' => true,
|
'description' => $this->translate('The message to display to users'),
|
||||||
'label' => $this->translate('Message'),
|
'label' => $this->translate('Message'),
|
||||||
'description' => $this->translate('The message to display to users')
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'dateTimePicker',
|
'dateTimePicker',
|
||||||
'start',
|
'start',
|
||||||
array(
|
array(
|
||||||
'required' => true,
|
'description' => $this->translate('The time to display the announcement from'),
|
||||||
'label' => $this->translate('Start'),
|
'label' => $this->translate('Start'),
|
||||||
'description' => $this->translate('The time to display the announcement from')
|
'placeholder' => new DateTime('tomorrow'),
|
||||||
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'dateTimePicker',
|
'dateTimePicker',
|
||||||
'end',
|
'end',
|
||||||
array(
|
array(
|
||||||
'required' => true,
|
'description' => $this->translate('The time to display the announcement until'),
|
||||||
'label' => $this->translate('End'),
|
'label' => $this->translate('End'),
|
||||||
'description' => $this->translate('The time to display the announcement until')
|
'placeholder' => new DateTime('tomorrow +1day'),
|
||||||
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->setTitle($this->translate('Create a new announcement'));
|
$this->setTitle($this->translate('Create a new announcement'));
|
||||||
$this->setSubmitLabel($this->translate('Create'));
|
$this->setSubmitLabel($this->translate('Create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -43,6 +43,9 @@ class Zend_View_Helper_FormDateTime extends Zend_View_Helper_FormElement
|
||||||
// If value was valid, it's a DateTime object
|
// If value was valid, it's a DateTime object
|
||||||
$value = $this->formatDate($value, $attribs['local']);
|
$value = $this->formatDate($value, $attribs['local']);
|
||||||
}
|
}
|
||||||
|
if (isset($attribs['placeholder']) && $attribs['placeholder'] instanceof DateTime) {
|
||||||
|
$attribs['placeholder'] = $this->formatDate($attribs['placeholder'], $attribs['local']);
|
||||||
|
}
|
||||||
$min = '';
|
$min = '';
|
||||||
if (! empty($attribs['min'])) {
|
if (! empty($attribs['min'])) {
|
||||||
$min = sprintf(' min="%s"', $this->formatDate($attribs['min'], $attribs['local']));
|
$min = sprintf(' min="%s"', $this->formatDate($attribs['min'], $attribs['local']));
|
||||||
|
|
Loading…
Reference in New Issue