/**
  * (non-PHPDoc)
  * @see \Icinga\Web\Form::onSuccess() For the method documentation.
  */
 public function onSuccess()
 {
     foreach ($this->objects as $object) {
         /** @var \Icinga\Module\Monitoring\Object\Service $object */
         $check = new ScheduleServiceCheckCommand();
         $check->setObject($object);
         $this->scheduleCheck($check, $this->request);
     }
     Notification::success($this->translatePlural('Scheduling service check..', 'Scheduling service checks..', count($this->objects)));
     return true;
 }
 /**
  * (non-PHPDoc)
  * @see \Icinga\Web\Form::onSuccess() For the method documentation.
  */
 public function onSuccess()
 {
     foreach ($this->objects as $object) {
         /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
         if ($object->getType() === $object::TYPE_HOST) {
             $check = new ScheduleHostCheckCommand();
         } else {
             $check = new ScheduleServiceCheckCommand();
         }
         $check->setObject($object)->setForced()->setCheckTime(time());
         $this->getTransport($this->request)->send($check);
     }
     Notification::success(mtp('monitoring', 'Scheduling check..', 'Scheduling checks..', count($this->objects)));
     return true;
 }
 protected function restoreSchedule($hostname)
 {
     $host = $this->getHostObject($hostname);
     $cmd = new ScheduleHostCheckCommand();
     $cmd->setObject($host)->setCheckTime($this->schedule[$hostname]['host']);
     $this->getTransport()->send($cmd);
     foreach ($this->schedule[$hostname]['services'] as $service => $time) {
         $service = $this->getServiceObject($hostname, $service);
         if ($time < time()) {
             continue;
         }
         $cmd = new ScheduleServiceCheckCommand();
         $cmd->setObject($service)->setCheckTime($time);
         $this->getTransport()->send($cmd);
     }
 }