Beispiel #1
0
 /**
  * Delete a form and the corresponding elements.
  *
  * return void
  */
 public function deleteAction()
 {
     $this->view->title = "Suppression d'un formulaire";
     if ($this->view->aclIsAllowed($this->_name, 'manage', true)) {
         // variables
         $formID = (int) $this->_getParam('formID');
         // generate the form
         $returnUrl = "/form/index/list/";
         $this->view->assign('return', "{$this->view->baseUrl()}{$returnUrl}");
         $formSelect = new Form();
         $select = $formSelect->getFormList($formID);
         $formData = $formSelect->fetchRow($select);
         $this->view->form = $formData->toArray();
         if ($this->_request->isPost()) {
             $del = $this->_request->getPost('delete');
             if ($del && $formID > 0) {
                 // Delete the emails list
                 $oNotification = new FormNotificationObject();
                 $oNotification->delete($formID);
                 // Delete the form;
                 $formDel = new FormObject();
                 $formDel->deleteAll($formID);
             }
             $this->_redirect($returnUrl);
         }
     }
 }