Exemplo n.º 1
0
 /**
  * Delete product
  * @param integer id of product
  * @return void
  */
 public function delete($id)
 {
     // Check user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('eshop.delete_product'));
         $this->add_breadcrumb(Kohana::lang('eshop.delete_product'), url::current());
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 $cat = $this->products->get_product_cat($id);
                 $cat = $cat[0];
                 $status = $this->products->delete_data($id);
                 // Also delte images if deletition was successful
                 if ($status == TRUE) {
                     gallery::delete_images($id, 'products');
                 }
                 url::redirect('/cat/' . $cat . '/' . cat::get_name($cat));
             } else {
                 url::redirect('/product/' . $id . '/' . string::to_url(product::get_name($id)));
             }
         }
         // page
         $this->template->content = new View('admin/product_delete');
     } else {
         url::redirect('/denied');
     }
 }
Exemplo n.º 2
0
 /**
  * Delete page
  * @return void
  * @param id of news
  */
 public function delete($id)
 {
     // Check for user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('news.delete_news'));
         $this->add_breadcrumb(Kohana::lang('news.delete_news'), url::current());
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 $status = $this->news->delete_data($id);
                 // Also delte images if deletition was successful
                 if ($status == TRUE) {
                     gallery::delete_images($id, 'news');
                 }
                 url::redirect('/news');
             } else {
                 url::redirect('/news/detail/' . $id);
             }
         }
         // View
         $this->template->content = new View('admin/news_delete');
     } else {
         url::redirect('/denied');
     }
 }