Example #1
0
 public function rest_delete()
 {
     $layout_name = $this->param('name', NULL, TRUE);
     $layout = new Model_File_Layout($layout_name);
     if (!$layout->is_exists()) {
         throw HTTP_API_Exception::factory(API::ERROR_PAGE_NOT_FOUND, 'Layout not found!', array(':name' => $layout_name));
     }
     // find the user to delete
     if (!$layout->is_used()) {
         if ($layout->delete()) {
             $this->response($layout);
         } else {
             throw HTTP_API_Exception::factory(API::ERROR_UNKNOWN, 'Something went wrong!');
         }
     } else {
         throw HTTP_API_Exception::factory(API::ERROR_PERMISSIONS, 'Layout is used! It CAN NOT be deleted!');
     }
 }
Example #2
0
 public function action_delete()
 {
     $this->auto_render = FALSE;
     $layout_name = $this->request->param('id');
     $layout = new Model_File_Layout($layout_name);
     // find the user to delete
     if (!$layout->is_used()) {
         if ($layout->delete()) {
             Kohana::$log->add(Log::INFO, 'Layout :name has been deleted by :user', array(':name' => $layout_name))->write();
             Messages::success(__('Layout has been deleted!'));
             Observer::notify('layout_after_delete', $layout_name);
         } else {
             Messages::errors(__('Something went wrong!'));
         }
     } else {
         Messages::errors(__('Layout is used! It CAN NOT be deleted!'));
     }
     $this->go();
 }