. */ /** * @brief Delete a structure * * * @file * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup admin */ $core_tools = new core_tools('admin_architecture'); $core_tools->test_admin('admin_architecture', 'apps'); $core_tools->load_lang(); $db = new dbquery(); if(isset($_GET['id'])) { $id = addslashes($db->wash($_GET['id'], "no", _THE_STRUCTURE)); } else { $id = ""; } $db->connect(); $db->query("select doctypes_first_level_label from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_id = ".$id.""); if($db->nb_result() == 0) { $_SESSION['error'] = _STRUCTURE.' '._UNKNOWN."."; header("location: ".$_SESSION['config']['businessappurl']."index.php?page=structures&order=".$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what']); exit(); } else { $info = $db->fetch_object(); // delete structure $db->query("update ".$_SESSION['tablename']['doctypes_first_level']." set enabled = 'N' where doctypes_first_level_id = ".$id); //delete subfolders depending on that structure $db->query("update ".$_SESSION['tablename']['doctypes_second_level']." set enabled = 'N' where doctypes_first_level_id = ".$id); $db2 = new dbquery(); $db2->connect(); if($core_tools->is_module_loaded('folder') == true) { $db->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." where doctypes_first_level_id = ".$id); $db->query("select type_id from ".$_SESSION['tablename']['doctypes']." where doctypes_first_level_id = ".$id); while($res = $db->fetch_object()) { //delete the doctypes from the foldertypes_doctypes table $db2->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes']." where doctype_id = ".$res->type_id); } } // delete the doctypes $db2->query("update ".$_SESSION['tablename']['doctypes']." set enabled = 'N' where doctypes_first_level_id = ".$id); if($_SESSION['history']['structuredel'] == "true") { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); $users = new history(); $users->add($_SESSION['tablename']['doctypes_first_level'], $id,"DEL",_STRUCTURE_DEL." ".strtolower(_NUM).$id."", $_SESSION['config']['databasetype']); } $_SESSION['error'] = _DELETED_STRUCTURE."."; unset($_SESSION['m_admin']); header("location: ".$_SESSION['config']['businessappurl']."index.php?page=structures&order=".$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what']); exit(); } ?>