Exemple #1
0
 public function delete()
 {
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     if (isset($this->request->get['tmpl_id'])) {
         $tmpl_id = $this->request->get['tmpl_id'];
     } else {
         $tmpl_id = null;
     }
     if (isset($this->request->get['page_id'])) {
         $page_id = $this->request->get['page_id'];
     } else {
         $page_id = null;
     }
     if (isset($this->request->get['layout_id'])) {
         $layout_id = $this->request->get['layout_id'];
     } else {
         $layout_id = null;
     }
     $success = false;
     if ($this->request->is_GET() && $this->request->get['confirmed_delete'] == 'yes') {
         $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
         //do delete this page/layout validate that it is alowed to delete
         $page = $layout->getPageData();
         if ($page['restricted']) {
             $this->session->data['warning'] = $this->language->get('text_delete_restricted');
         } else {
             if ($layout->deletePageLayoutByID($page_id, $layout_id)) {
                 $this->session->data['success'] = $this->language->get('text_delete_success');
                 $success = true;
             } else {
                 $this->session->data['warning'] = 'Error! Try again.';
             }
         }
     }
     $url = '';
     if (!$success) {
         if ($tmpl_id) {
             $url .= '&tmpl_id=' . $tmpl_id;
         }
         if ($layout_id) {
             $url .= '&layout_id=' . $layout_id;
         }
         if ($page_id) {
             $url .= '&page_id=' . $page_id;
         }
     }
     $this->redirect($this->html->getSecureURL('design/layout', $url));
 }