* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} namespace Monitoring\Form\Command; use Icinga\Web\Form\Element\DateTime; use Zend_Form_Element_Checkbox; use DateTime as PhpDateTime; /** * Form for RescheduleNextCheck */ class RescheduleNextCheckForm extends WithChildrenCommandForm { /** * Interface method to build the form * @see CommandForm::create */ protected function create() { $now = new PhpDateTime(); $dateElement = new DateTime( array( 'name' => 'checktime', 'label' => t('Check time'), 'value' => $now->format($this->getDateFormat()) ) ); $dateElement->setRequired(true); $dateElement->addValidator($this->createDateTimeValidator(), true); $this->addElement($dateElement); $checkBox = new Zend_Form_Element_Checkbox( array( 'name' => 'forcecheck', 'label' => t('Force check'), 'value' => true ) ); $this->addElement($checkBox); if ($this->getWithChildren() === true) { $this->addNote(t('Reschedule next check for this host and its services.')); } else { $this->addNote(t('Reschedule next check for this object.')); } $this->setSubmitLabel(t('Reschedule check')); parent::create(); } public function isForced() { return $this->getValue('forcecheck') == true; } }