コード例 #1
0
ファイル: model.classes.php プロジェクト: hisapi/his
 public function delete($recursive = false)
 {
     global $u;
     $this->refresh_assignments(false);
     if ($recursive) {
         $this->build();
     }
     if ($recursive) {
         $user_inherit = new user_inherit();
         $user_inherit->get_from_hashrange($u->id_user, $this->id);
         // handled by str_/obj_ auto deletion
         //$this->obj_expression->delete();
         if ($user_inherit->id_hf != "undefined") {
             $user_inherit->delete();
         }
         foreach ($this->obj_hf_inherit as $inherit) {
             if ($inherit->id_hf == $this->id) {
                 $inherit->delete();
             }
         }
         $all_hf = new hf_id_user();
         $all_hfs = $all_hf->get_from_hashrange($this->id_user);
         foreach ($all_hfs as $each_hf) {
             $all_hfi = new hf_inherit();
             $all_hfis = $all_hfi->get_from_hashrange($each_hf['id']);
             foreach ($all_hfis as $each_hfi) {
                 if ($each_hfi['id'] != "undefined") {
                     if ($each_hfi['id_inherit'] == $this->id) {
                         $delete_hfi = new hf_inherit();
                         $delete_hfi->set($each_hfi);
                         if ($delete_hfi->id != "undefined") {
                             $delete_hfi->delete();
                         }
                     }
                 }
             }
             // END FOREACH
         }
         // END FOREACH
         foreach ($this->obj_hf_parameters as $param) {
             if ($param->id_hf == $this->id) {
                 $param->delete();
             }
         }
         foreach ($this->obj_hf_node_filters as $filter) {
             if ($filter->id_hf == $this->id) {
                 $filter->delete();
             }
         }
         foreach ($this->obj_hf_tags as $tag) {
             if ($tag->id_hf == $this->id) {
                 $tag->delete();
             }
         }
         foreach ($this->obj_hf_outputs as $output) {
             if ($output->id_hf == $this->id) {
                 $output->delete();
             }
         }
         foreach ($this->obj_hf_files as $afile) {
             if ($afile->id_hf == $this->id) {
                 $afile->delete();
             }
         }
         foreach ($this->obj_hf_kill as $akill) {
             if ($akill->id_hf == $this->id) {
                 $akill->delete();
             }
         }
         foreach ($this->obj_hf_resources as $res) {
             if ($res->id_hf == $this->id) {
                 foreach ($res->obj_system_kinds as $sk) {
                     $sk->delete();
                 }
                 $res->delete();
             }
         }
         foreach ($this->obj_hf_system_kind as $sk) {
             if ($sk->id_hf == $this->id) {
                 $sk->delete();
             }
         }
     }
     parent::delete();
 }
コード例 #2
0
        //print_r($_POST);
        if (isset($_POST['btnInheritanceOn'])) {
            $props = array();
            $props['id_user'] = $u->id_user;
            $props['id_hf'] = $_GET['q'];
            $new_user_inherit = new user_inherit();
            $new_user_inherit->get_from_hashrange($props['id_user'], $props['id_hf']);
            if ($new_user_inherit->id_user == "undefined") {
                $new_user_inherit->create($props);
            }
        }
        if (isset($_POST['btnInheritanceOff'])) {
            $new_user_inherit = new user_inherit();
            $new_user_inherit->get_from_hashrange($u->id_user, $_GET['q']);
            if ($new_user_inherit->id_user != "undefined") {
                $new_user_inherit->delete();
            }
        }
    }
}
// main page - add a hf
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'delete-hf-inherit') {
        if (isset($_POST['id'])) {
            $this_hf_inherit = new hf_inherit();
            $this_hf_inherit->get_from_hashrange($_GET['q'], $_POST['id']);
            $this_hf_inherit->delete();
        }
    }
}
// main page - add a hf