Пример #1
0
 public function deleteAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = new ConfirmForm($this->getServiceLocator());
         $form->setData($this->getRequest()->getPost());
         if ($form->isValid()) {
             $response = $this->api()->delete('site_pages', ['slug' => $this->params('page-slug')]);
             if ($response->isError()) {
                 $this->messenger()->addError('Page could not be deleted');
             } else {
                 $this->messenger()->addSuccess('Page successfully deleted');
             }
         } else {
             $this->messenger()->addError('Page could not be deleted');
         }
     }
     return $this->redirect()->toRoute('admin/site/page', ['action' => 'index'], true);
 }
Пример #2
0
 public function deleteAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = new ConfirmForm($this->getServiceLocator());
         $form->setData($this->getRequest()->getPost());
         if ($form->isValid()) {
             $response = $this->api()->delete('custom_vocabs', $this->params('id'));
             if ($response->isError()) {
                 $this->messenger()->addError('Vocab could not be deleted');
             } else {
                 $this->messenger()->addSuccess('Vocab successfully deleted');
             }
         } else {
             $this->messenger()->addError('Vocab could not be deleted');
         }
     }
     return $this->redirect()->toRoute('admin/custom-vocab');
 }
 public function deleteAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = new ConfirmForm($this->getServiceLocator());
         $form->setData($this->getRequest()->getPost());
         if ($form->isValid()) {
             $response = $this->api()->delete('resource_templates', $this->params('id'));
             if ($response->isError()) {
                 $this->messenger()->addError('Resource template could not be deleted');
             } else {
                 $this->messenger()->addSuccess('Resource template successfully deleted');
             }
         } else {
             $this->messenger()->addError('Resource template could not be deleted');
         }
     }
     return $this->redirect()->toRoute(null, ['action' => 'browse'], true);
 }
Пример #4
0
 public function stopAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = new ConfirmForm($this->getServiceLocator());
         $form->setData($this->getRequest()->getPost());
         if ($form->isValid()) {
             $response = $this->api()->read('jobs', $this->params('id'));
             $job = $response->getContent();
             if (Job::STATUS_IN_PROGRESS == $job->status()) {
                 $dispatcher = $this->getServiceLocator()->get('Omeka\\JobDispatcher');
                 $dispatcher->stop($job->id());
                 $this->messenger()->addSuccess('Attempting to stop the job.');
             } else {
                 $this->messenger()->addError('The job could not be stopped.');
             }
         } else {
             $this->messenger()->addError('The job could not be stopped.');
         }
     }
     return $this->redirect()->toRoute('admin/default', ['action' => 'browse'], true);
 }