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(); }
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 if (isset($_GET['action'])) { if ($_GET['action'] == 'add-hf') { // name // str_hf_resource // hf_resource_type if (isset($_POST['name']) && isset($_POST['str_hf_resource'])) { if (strlen($_POST['name']) > 0) { $already_exists = false; $existing_hf = new hf_id_user(); $hf_list = $existing_hf->get_from_hashrange($u->id_user); foreach ($hf_list as $existing_his_function) {