Пример #1
0
 public function action_deleteMaterial()
 {
     $group = new Model_Material('groups');
     $data['groups'] = $group->getTree();
     $url = $this->request->param('url');
     $gid = $this->request->param('id');
     if ($url == 'clear_cart') {
         $res = $group->clearCart();
     } else {
         $mid = $materialId = $group->getMaterialIdByUrl($this->request->param('url'), $gid);
         $res = $group->deleteMaterial($mid, $gid);
     }
     if ($res) {
         Controller::redirect('admin/materials/' . $gid);
     } else {
         $data['errors'] = $group->getErrors();
     }
     $wpm['status'] = Cookie::get('wpm', FALSE);
     $wpm['folder'] = Cookie::get('wpm_folder', '');
     $this->template->content = View::factory('admin/admMaterials', array('data' => $data, 'wpm' => $wpm, 'user' => $this->user));
 }