Esempio n. 1
0
 public function action_delete(Params $param)
 {
     $this->content->bind('form', $torn);
     $project = Jelly::select('project')->link($param->id)->load();
     if (!$project->loaded()) {
         throw new Error404_Exception();
     }
     $torn = new Torn($project);
     if ($torn->check()) {
         $project->delete();
         $this->request->redirect(Route::get('protected')->uri(array('controller' => 'project')));
     }
 }
Esempio n. 2
0
 public function action_delete(Params $param)
 {
     $this->content->bind('form', $torn);
     $category = Jelly::select('category')->link($param->id)->load();
     if (!$category->loaded()) {
         throw new Error404_Exception();
     }
     $torn = new Torn($category);
     if ($torn->check()) {
         foreach ($category->projects as $v) {
             $v->reset_priority();
             try {
                 unlink(DOCROOT . 'media/files/' . $v->file);
             } catch (Exception $e) {
                 Kohana::$log->add('info', 'Requested remove of ":file". Failed.', array(':file' => DOCROOT . 'media/files/' . $v->file));
             }
         }
         $category->delete($_POST);
         $this->request->redirect(Route::get('protected')->uri(array('controller' => 'category')));
     }
 }