/**
  * Display the form for removing a comment list
  */
 public function deleteAllAction()
 {
     $this->assertPermission('monitoring/command/comment/delete');
     $listCommentsLink = Url::fromPath('monitoring/list/comments')->setQueryString('comment_type=(comment|ack)');
     $delCommentForm = new DeleteCommentsCommandForm();
     $delCommentForm->setTitle($this->view->translate('Remove all Comments'));
     $delCommentForm->addDescription(sprintf($this->translate('Confirm removal of %d comments.'), $this->comments->count()));
     $delCommentForm->setComments($this->comments->fetchAll())->setRedirectUrl($listCommentsLink)->handleRequest();
     $this->view->delCommentForm = $delCommentForm;
     $this->view->comments = $this->comments;
     $this->view->listAllLink = Url::fromPath('monitoring/list/comments')->setQueryString($this->filter->toQueryString());
 }
 /**
  * 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;
 }
Пример #3
0
 /**
  * Return whether this object matches the given filter
  *
  * @param   Filter  $filter
  *
  * @return  bool
  *
  * @throws  ProgrammingError    In case the object cannot be found
  */
 public function matches(Filter $filter)
 {
     if ($this->properties === null && $this->fetch() === false) {
         throw new ProgrammingError('Unable to apply filter. Object %s of type %s not found.', $this->getName(), $this->getType());
     }
     $queryString = $filter->toQueryString();
     $row = clone $this->properties;
     if (strpos($queryString, '_host_') !== false || strpos($queryString, '_service_') !== false) {
         if ($this->customvars === null) {
             $this->fetchCustomvars();
         }
         foreach ($this->customvars as $name => $value) {
             if (!is_object($value)) {
                 $row->{'_' . $this->getType() . '_' . $name} = $value;
             }
         }
     }
     if (strpos($queryString, 'hostgroup_name') !== false) {
         if ($this->hostgroups === null) {
             $this->fetchHostgroups();
         }
         $row->hostgroup_name = array_keys($this->hostgroups);
     }
     if (strpos($queryString, 'servicegroup_name') !== false) {
         if ($this->servicegroups === null) {
             $this->fetchServicegroups();
         }
         $row->servicegroup_name = array_keys($this->servicegroups);
     }
     return $filter->matches($row);
 }