示例#1
0
 /**
  * Schedule service downtimes
  */
 public function scheduleServiceDowntimeAction()
 {
     $filter = $this->getFilterOrExitIfEmpty();
     $serviceList = new ServiceList($this->backend);
     $serviceList->applyFilter($this->getRestriction('monitoring/filter/objects'))->applyFilter($filter);
     if (!$serviceList->count()) {
         $this->getResponse()->json()->setFailData(array('filter' => 'No services found matching the filter'))->sendResponse();
     }
     $form = new ScheduleServiceDowntimeCommandForm();
     $form->setIsApiTarget(true)->setBackend($this->backend)->setObjects($serviceList->fetch())->handleRequest($this->getRequest());
 }
 /**
  * (non-PHPDoc)
  * @see \Icinga\Web\Form::createElements() For the method documentation.
  */
 public function createElements(array $formData = array())
 {
     parent::createElements($formData);
     $this->addElement('checkbox', 'all_services', array('description' => $this->translate('Schedule downtime for all services on the hosts and the hosts themselves.'), 'label' => $this->translate('All Services'), 'value' => false));
     if (substr($this->getBackend()->getProgramVersion(), 0, 2) !== 'v2') {
         $this->addElement('select', 'child_hosts', array('description' => $this->translate('Define what should be done with the child hosts of the hosts.'), 'label' => $this->translate('Child Hosts'), 'multiOptions' => array(0 => $this->translate('Do nothing with child hosts'), 1 => $this->translate('Schedule triggered downtime for all child hosts'), 2 => $this->translate('Schedule non-triggered downtime for all child hosts')), 'value' => 0));
     }
     return $this;
 }
示例#3
0
 /**
  * Schedule service downtimes
  */
 public function scheduleDowntimeAction()
 {
     $this->assertPermission('monitoring/command/downtime/schedule');
     $form = new ScheduleServiceDowntimeCommandForm();
     $form->setTitle($this->translate('Schedule Service Downtimes'));
     $this->handleCommandForm($form);
 }
 /**
  * (non-PHPDoc)
  * @see \Icinga\Web\Form::createElements() For the method documentation.
  */
 public function createElements(array $formData = array())
 {
     parent::createElements($formData);
     $this->addElements(array(array('checkbox', 'all_services', array('label' => $this->translate('All Services'), 'description' => $this->translate('Schedule downtime for all services on the hosts and the hosts themselves.'))), array('select', 'child_hosts', array('label' => $this->translate('Child Hosts'), 'required' => true, 'multiOptions' => array(0 => $this->translate('Do nothing with child hosts'), 1 => $this->translate('Schedule triggered downtime for all child hosts'), 2 => $this->translate('Schedule non-triggered downtime for all child hosts')), 'description' => $this->translate('Define what should be done with the child hosts of the hosts.')))));
     return $this;
 }