Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

fiche.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta 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  *   PhpCompta 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 PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.19 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00024 include_once ("ac_common.php");
00025 html_page_start($_SESSION['g_theme']);
00026 
00027 if ( ! isset ( $_SESSION['g_dossier'] ) ) {
00028   echo "You must choose a Dossier ";
00029   exit -2;
00030 }
00031 include_once ("postgres.php");
00032 include_once ("user_menu.php");
00033 
00034 
00035 $rep=DbConnect();
00036 include_once ("class_user.php");
00037 $User=new cl_user($rep);
00038 $User->Check();
00039 include ("check_priv.php");
00040 echo '<div class="u_tmenu">';
00041 echo ShowMenuCompta($_SESSION['g_dossier']);
00042 echo '</div>';
00043 echo JS_SEARCH_POSTE;
00044 
00045 if ( !isset($sessid)) 
00046 {
00047   $sessid=$_REQUEST["PHPSESSID"];
00048 } 
00049 $search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$sessid."')\">";
00050 
00051 
00052 include_once("fiche_inc.php");
00053 
00054 $cn=DbConnect($_SESSION['g_dossier']);
00055 
00056 // Security check
00057 $read=$User->CheckAction($cn,FICHE_READ);
00058 $write=$User->CheckAction($cn,FICHE_WRITE);
00059 if ($read+$write == 0 ){
00060   /* Cannot Access */
00061   NoAccess();
00062 }
00063 
00064 // Creation of a new model of card
00065 // in the database
00066 if ( isset($_POST['add_modele'])  and $write != 0) {
00067   // insert the model of card in database
00068   AddModele($cn,$HTTP_POST_VARS);
00069 }
00070 
00071 ShowMenuFiche($_SESSION['g_dossier']);
00072 
00073 if ( isset ( $_GET["action"]) ) {
00074   $action=$_GET["action"];
00075   // View the details of the selected cat. of cards
00076   if ( isset ($_GET["fiche"]) && $action=="vue" ) {
00077     echo '<DIV class="u_redcontent">';
00078     ViewFiche($cn,$_GET["fiche"]);
00079     echo '</DIV>';
00080   }// Display the detail of a card
00081   if ($action== "detail" ) {
00082     echo '<DIV class="u_redcontent">';
00083     if ( $write == 0) echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
00084     ViewFicheDetail($cn,$_GET["fiche_id"]);
00085     echo '</DIV>';
00086   }
00087   // Display the form where you can enter
00088   // the property of the card model
00089   if ($action == "add_modele" and $write !=0) {
00090     echo '<DIV class="u_redcontent">';
00091     DefModele($cn,$search);
00092     echo '</DIV>';
00093   }
00094   // Modify a card Model
00095   if ($action == "modifier" ) {
00096     echo '<DIV class="u_redcontent">';
00097     if ( $write ==0)  
00098       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00099     else
00100       UpdateModele($cn,$_GET["fiche"],$search);
00101     echo '</DIV>';
00102   }
00103   // delete a card
00104   if ($action== "delete"  ) {
00105     echo '<DIV class="u_redcontent">';
00106     if ( $write ==0)  
00107       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00108     else
00109       {
00110         Remove($cn,$_GET["fiche_id"]);
00111         
00112         ViewFiche($cn,$_GET["f_fd_id"]);
00113       }
00114     echo "</DIV>";
00115   }  
00116 }
00117 // Add a line in the card model
00118 if ( isset ($_GET["add_ligne"])  ) {
00119   echo '<DIV class="u_redcontent">';
00120     if ( $write ==0)  
00121       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00122     else
00123       {
00124         SaveModeleName($cn,$_GET["fd_id"],$_GET["label"]);
00125         InsertModeleLine($cn,$_GET["fd_id"],$_GET["ad_id"]);
00126         UpdateModele($cn,$_GET["fd_id"],$search);
00127       }
00128   echo '</DIV>';
00129 }
00130 // Change the name of the card  model
00131 if ( isset ($_GET["change_name"] )  ) {
00132   echo '<DIV class="u_redcontent">';
00133     if ( $write ==0)  
00134       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00135     else
00136       {
00137         SaveModeleName($cn,$_GET["fd_id"],$_GET["label"]);
00138         UpdateModele($cn,$_GET["fd_id"],$search);
00139       }
00140   echo '</DIV>';
00141 }
00142 
00143 // Display a blank  card from the selected category
00144 if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) {
00145   echo '<DIV class="u_redcontent">';
00146     if ( $write ==0)  
00147       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00148     else
00149       EncodeFiche($cn,$_POST["fiche"]);
00150   echo '</DIV>';
00151 }
00152 // Add the data (attribute) of the card
00153 if ( isset ($_POST["add_fiche"]) ) {
00154   echo '<DIV class="u_redcontent">';
00155   
00156   if ( $write ==0)  
00157     echo "<h2 class=\"error\"> Pas d'accès </h2>";
00158   else
00159     {
00160       AddFiche($cn,$_POST["fiche"],$HTTP_POST_VARS);
00161       ViewFiche($cn,$_POST["fiche"]);
00162     }
00163   echo '</DIV>';
00164 }
00165 // Update a card
00166 if ( isset ($_POST["update_fiche"])  ) {
00167   echo '<DIV class="u_redcontent">';
00168       if ( $write ==0)  
00169       echo "<h2 class=\"error\"> Pas d'accès </h2>";
00170     else
00171       {
00172         $a=UpdateFiche($cn,$HTTP_POST_VARS);
00173       }
00174       $fd_id=GetFicheDef($cn,$_POST["f_id"]);
00175       ViewFiche($cn,$fd_id);
00176 
00177 
00178   echo '</DIV>';
00179 }
00180 html_page_stop();
00181 ?>