* @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 \DateTime as PhpDateTime; use \DateInterval; use Icinga\Web\Form\Element\Note; /** * Form for acknowledge commands */ class Acknowledge extends AbstractCommand { /** * Interface method to build the form * @see Form::create() */ protected function create() { $this->addElement($this->createAuthorField()); $this->addElement( 'textarea', 'comment', array( 'label' => t('Comment'), 'rows' => 4 ) ); $this->addElement( 'checkbox', 'persistent', array( 'label' => t('Persistent comment'), 'value' => false ) ); $expireCheck = $this->createElement( 'checkbox', 'expire', array( 'label' => t('Use expire time'), 'value' => false ) ); $now = new PhpDateTime(); $interval = new DateInterval('PT1H'); // Add 3600 seconds $now->add($interval); $expireTime = new DateTime( array( 'name' => 'expiretime', 'label' => t('Expire time'), 'value' => $now->format('Y-m-d H:i:s') ) ); $expireNote = new Note( array( 'name' => 'expirenote', 'value' => t('If the acknowledgement should expire, check the box and enter an expiration timestamp.') ) ); $this->addElements(array($expireNote, $expireCheck, $expireTime)); $this->addDisplayGroup( array( 'expirenote', 'expire', 'expiretime' ), 'expire_group', array( 'legend' => t('Expire acknowledgement') ) ); $this->addElement( 'checkbox', 'sticky', array( 'label' => t('Sticky acknowledgement'), 'value' => false ) ); $this->addElement( 'checkbox', 'notify', array( 'label' => t('Send notification'), 'value' => false ) ); $this->setSubmitLabel(t('Acknowledge problem')); parent::create(); } }