/** * Display the form for removing a downtime list */ public function deleteAllAction() { $this->assertPermission('monitoring/command/downtime/delete'); $this->view->downtimes = $this->downtimes; $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes')->setQueryString($this->filter->toQueryString()); $delDowntimeForm = new DeleteDowntimesCommandForm(); $delDowntimeForm->setTitle($this->view->translate('Remove all Downtimes')); $delDowntimeForm->addDescription(sprintf($this->translate('Confirm removal of %d downtimes.'), $this->downtimes->count())); $delDowntimeForm->setRedirectUrl(Url::fromPath('monitoring/list/downtimes')); $delDowntimeForm->setDowntimes($this->downtimes->fetchAll())->handleRequest(); $this->view->delAllDowntimeForm = $delDowntimeForm; }
/** * Remove service downtimes */ public function removeServiceDowntimeAction() { $filter = $this->getFilterOrExitIfEmpty(); $downtimes = $this->backend->select()->from('downtime', array('host_name', 'service_description', 'id' => 'downtime_internal_id', 'name' => 'downtime_name'))->where('object_type', 'service')->applyFilter($this->getRestriction('monitoring/filter/objects'))->applyFilter($filter); if (!$downtimes->count()) { $this->getResponse()->json()->setFailData(array('filter' => 'No downtimes found matching the filter'))->sendResponse(); } $form = new DeleteDowntimesCommandForm(); $form->setIsApiTarget(true)->setDowntimes($downtimes->fetchAll())->handleRequest($this->getRequest()); // @TODO(el): Respond w/ the downtimes deleted instead of the notifiaction added by // DeleteDowntimesCommandForm::onSuccess(). }