Monitoring/Forms: Don't use DateTime as PhpDateTime

refs #4440
This commit is contained in:
Eric Lippmann 2013-08-06 16:11:36 +02:00
parent 1f10cb3124
commit 1a2ea656fd
3 changed files with 11 additions and 10 deletions

View File

@ -28,14 +28,15 @@
namespace Monitoring\Form\Command; namespace Monitoring\Form\Command;
use \DateTime;
use Icinga\Web\Form\Element\DateTimePicker; use Icinga\Web\Form\Element\DateTimePicker;
use \DateTime as PhpDateTime;
use \DateInterval; use \DateInterval;
use Icinga\Web\Form\Element\Note; use Icinga\Web\Form\Element\Note;
use Icinga\Protocol\Commandpipe\Acknowledgement; use Icinga\Protocol\Commandpipe\Acknowledgement;
use Icinga\Protocol\Commandpipe\Comment; use Icinga\Protocol\Commandpipe\Comment;
/** /**
* Form for acknowledge commands * Form for problem acknowledgements
*/ */
class AcknowledgeForm extends CommandForm class AcknowledgeForm extends CommandForm
{ {
@ -90,7 +91,7 @@ class AcknowledgeForm extends CommandForm
); );
if ($this->getRequest()->getPost('expire', '0') === '1') { if ($this->getRequest()->getPost('expire', '0') === '1') {
$now = new PhpDateTime(); $now = new DateTime();
$interval = new DateInterval('PT1H'); // Add 3600 seconds $interval = new DateInterval('PT1H'); // Add 3600 seconds
$now->add($interval); $now->add($interval);
@ -162,7 +163,7 @@ class AcknowledgeForm extends CommandForm
{ {
$expireTime = -1; $expireTime = -1;
if ($this->getValue('expire')) { if ($this->getValue('expire')) {
$time = new PhpDateTime($this->getValue('expiretime')); $time = new DateTime($this->getValue('expiretime'));
$expireTime = $time->getTimestamp(); $expireTime = $time->getTimestamp();
} }
return new Acknowledgement( return new Acknowledgement(

View File

@ -28,9 +28,9 @@
namespace Monitoring\Form\Command; namespace Monitoring\Form\Command;
use \DateTime;
use Icinga\Web\Form\Element\DateTimePicker; use Icinga\Web\Form\Element\DateTimePicker;
use Zend_Form_Element_Checkbox; use Zend_Form_Element_Checkbox;
use DateTime as PhpDateTime;
/** /**
* Form for RescheduleNextCheck * Form for RescheduleNextCheck
@ -44,7 +44,7 @@ class RescheduleNextCheckForm extends WithChildrenCommandForm
protected function create() protected function create()
{ {
$now = new PhpDateTime(); $now = new DateTime();
$dateElement = new DateTimePicker( $dateElement = new DateTimePicker(
array( array(
'name' => 'checktime', 'name' => 'checktime',

View File

@ -28,10 +28,10 @@
namespace Monitoring\Form\Command; namespace Monitoring\Form\Command;
use \DateTime;
use Icinga\Web\Form\Element\DateTimePicker; use Icinga\Web\Form\Element\DateTimePicker;
use Icinga\Protocol\Commandpipe\Downtime; use Icinga\Protocol\Commandpipe\Downtime;
use Icinga\Protocol\Commandpipe\Comment; use Icinga\Protocol\Commandpipe\Comment;
use \DateTime as PhpDateTime;
use \DateInterval; use \DateInterval;
use \Zend_Form_Element_Text; use \Zend_Form_Element_Text;
use \Zend_Validate_GreaterThan; use \Zend_Validate_GreaterThan;
@ -75,7 +75,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
{ {
$out = array(); $out = array();
$dateTimeObject = new PhpDateTime(); $dateTimeObject = new DateTime();
$out[] = $dateTimeObject->format($this->getDateFormat()); $out[] = $dateTimeObject->format($this->getDateFormat());
$dateInterval = new DateInterval(self::DEFAULT_ENDTIME_INTERVAL); $dateInterval = new DateInterval(self::DEFAULT_ENDTIME_INTERVAL);
@ -304,8 +304,8 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
if ($this->getValue('type') === self::TYPE_FLEXIBLE) { if ($this->getValue('type') === self::TYPE_FLEXIBLE) {
$duration = ($this->getValue('hours')*3600) + ($this->getValue('minutes')*60); $duration = ($this->getValue('hours')*3600) + ($this->getValue('minutes')*60);
} }
$starttime = new PhpDateTime($this->getValue('starttime')); $starttime = new DateTime($this->getValue('starttime'));
$endtime = new PhpDateTime($this->getValue('endtime')); $endtime = new DateTime($this->getValue('endtime'));
$downtime = new Downtime( $downtime = new Downtime(
$starttime->getTimestamp(), $starttime->getTimestamp(),