00001 <?php 00002 /* 00003 * This file is part of NOALYSS. 00004 * 00005 * NOALYSS is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * NOALYSS is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with NOALYSS; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu 00020 /*! \file 00021 * \brief module to manage the card (removing, listing, creating, modify attribut) 00022 */ 00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); 00024 include_once ("ac_common.php"); 00025 require_once("class_itext.php"); 00026 require_once("class_ihidden.php"); 00027 require_once('class_fiche.php'); 00028 require_once('class_database.php'); 00029 include_once ("user_menu.php"); 00030 require_once('class_dossier.php'); 00031 require_once 'class_sort_table.php'; 00032 require_once 'class_fiche_def.php'; 00033 require_once 'class_tool_uos.php'; 00034 00035 $retour=HtmlInput::button_anchor("Retour à la liste", HtmlInput::get_to_string(array("gDossier","ac"))); 00036 00037 /*******************************************************************************************/ 00038 // Add an attribut 00039 /*******************************************************************************************/ 00040 if ( isset($_POST['add_line'])) 00041 { 00042 $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); 00043 $fiche_def->InsertAttribut($_REQUEST['ad_id']); 00044 echo $fiche_def->input_detail(); 00045 echo $retour; 00046 exit(); 00047 } 00048 /*******************************************************************************************/ 00049 // Remove an attribut 00050 /*******************************************************************************************/ 00051 if ( isset ($_POST['remove_line'])) 00052 { 00053 $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); 00054 $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); 00055 $fiche_def->RemoveAttribut($_REQUEST['chk_remove']); 00056 echo $fiche_def->input_detail(); 00057 echo $retour; 00058 exit(); 00059 } 00060 /*******************************************************************************************/ 00061 // Try to remove a category 00062 /*******************************************************************************************/ 00063 if ( isset ($_POST['remove_cat'])) 00064 { 00065 $fd_id=new Fiche_Def($cn,$_POST['fd_id']); 00066 $remains=$fd_id->remove(); 00067 if ( $remains != 0 ) 00068 /* some card are not removed because it is used */ 00069 alert(_('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées'."\n". 00070 'Les fiches non utilisées ont cependant été effacées')); 00071 } 00072 /*******************************************************************************************/ 00073 // Change some basis info 00074 /*******************************************************************************************/ 00075 if ( isset ($_POST['change_name'])) 00076 { 00077 if (isset ($_REQUEST['label']) ) 00078 { 00079 $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); 00080 $fiche_def->SaveLabel($_REQUEST['label']); 00081 if ( isset($_REQUEST['create'])) 00082 { 00083 $fiche_def->set_autocreate(true); 00084 } 00085 else 00086 { 00087 $fiche_def->set_autocreate(false); 00088 } 00089 $fiche_def->save_class_base($_REQUEST['class_base']); 00090 $fiche_def->save_description($_REQUEST['fd_description']); 00091 00092 } 00093 echo $fiche_def->input_detail(); 00094 echo $retour; 00095 exit(); 00096 } 00097 /*******************************************************************************************/ 00098 // Save order of the attributes 00099 /*******************************************************************************************/ 00100 if ( isset($_POST['save_line'])) 00101 { 00102 $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); 00103 $fiche_def->save_order($_POST); 00104 echo $fiche_def->input_detail(); 00105 echo $retour; 00106 exit(); 00107 } 00108 /*******************************************************************************************/ 00109 // Save a new category of card 00110 /*******************************************************************************************/ 00111 if ( isset($_POST['add_modele'])) 00112 { 00113 $single=new Tool_Uos("dup"); 00114 if ($single->get_count()==0) 00115 { 00116 $single->save(); 00117 $fiche_def=new Fiche_Def($cn); 00118 if ( $fiche_def->Add($_POST) == 0 ) 00119 { 00120 echo $fiche_def->input_detail(); 00121 echo $retour; 00122 exit(); 00123 } 00124 else 00125 { 00126 $fiche_def->input_new(); 00127 echo $retour; 00128 exit(); 00129 } 00130 } 00131 else 00132 { 00133 alert('Doublon'); 00134 } 00135 } 00136 $fiche_def=new Fiche_def($cn); 00137 00138 $fiche_def->Display(); 00139 $dossier=Dossier::id(); 00140 ?>