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

sec_pdf.php

Go to the documentation of this file.
00001 <?
00002 
00003 /*
00004  *   This file is part of PhpCompta.
00005  *
00006  *   PhpCompta is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   PhpCompta is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with PhpCompta; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 // Copyright Stanislas Pinte stanpinte@sauvages.be
00021 
00022 // $Revision: 1.6 $
00027 if ( ! isset($_SESSION['g_dossier']) ) {
00028   echo "INVALID G_DOSSIER UNKNOWN !!! ";
00029   exit();
00030 }
00031 include_once("ac_common.php");
00032 include_once("postgres.php");
00033 include_once("class.ezpdf.php");
00034 require_once("check_priv.php");
00035 echo_debug('sec_pdf.php',__LINE__,"imp pdf securité");
00036 $cn=DbConnect($_SESSION['g_dossier']);
00037 //-----------------------------------------------------
00038 // Security 
00039 
00040 // Check User
00041 $rep=DbConnect();
00042 include_once ("class_user.php");
00043 $User=new cl_user($rep);
00044 $User->Check();
00045 // Check Priv
00046 if ( $User->CheckAction($cn,SECU) == 0 ) {
00047   /* Cannot Access */
00048   NoAccess();
00049   exit -1;
00050  }
00051 //-----------------------------------------------------
00052 // Get User's info
00053 if ( ! isset($_GET['user_id']) ) 
00054   return;
00055 
00056 $SecUser=new cl_user($rep,$_GET['user_id']);
00057 
00058 
00059 //-----------------------------------------------------
00060 // Print result
00061 
00062 $pdf=& new Cezpdf("A4");
00063 $pdf->selectFont('./addon/fonts/Helvetica.afm');
00064 $str_user=sprintf("( %d ) %s %s [ %s ]",
00065                   $SecUser->id,
00066                   $SecUser->first_name,
00067                   $SecUser->name,
00068                   $SecUser->login);
00069 
00070 $pdf->ezText($str_user,14,array('justification'=>'center'));
00071 
00072 if ( $SecUser->active==0)
00073   $pdf->ezText('Bloqué',12,array('justification'=>'center'));
00074 
00075 if ( $SecUser->admin==1)
00076   $pdf->ezText('Administrateur',12,array('justification'=>'center'));
00077 //-----------------------------------------------------
00078 // Journal
00079 $Res=ExecSql($cn,"select jrn_def_id,jrn_def_name  from jrn_def ");
00080 for ($e=0;$e < pg_NumRows($Res);$e++) {
00081   $row=pg_fetch_array($Res,$e);
00082   $a_jrn[$e]['jrn_name']=$row['jrn_def_name'];
00083   $priv=CheckJrn($_SESSION['g_dossier'],$SecUser->login,$row['jrn_def_id']);
00084   switch($priv) {
00085   case 0:
00086     $a_jrn[$e]['priv']="pas d'accès";
00087     break;
00088   case 1:
00089     $a_jrn[$e]['priv']="lecture";
00090     break;
00091   case 2:
00092   case 3:
00093     $a_jrn[$e]['priv']="Ecriture";
00094     break;
00095   }
00096 
00097  }
00098 $pdf->ezTable($a_jrn,
00099                 array ('jrn_name'=>' Journal',
00100                        'priv'=>'Privilège')," ",
00101                 array('shaded'=>0,'showHeadings'=>1,'width'=>500));
00102 
00103 //-----------------------------------------------------
00104 // Action
00105 $Res=ExecSql($cn,
00106              "select ac_id, ac_description from action   order by ac_description ");
00107 
00108 $Max=pg_NumRows($Res);
00109 
00110 for ( $i =0 ; $i < $Max; $i++ ) {
00111    $l_line=pg_fetch_array($Res,$i);
00112    $action['lib']=$l_line['ac_description'];
00113    $right=CheckAction($_SESSION['g_dossier'],$SecUser->login,$l_line['ac_id']);
00114    switch ($right) {
00115    case 0:
00116      $action['priv']="Pas d'accès";
00117      break;
00118    case 1:
00119    case 2:
00120      $action['priv']="Accès";
00121      break;
00122    }
00123    $a_action[$i]=$action;
00124  }
00125 $pdf->ezTable($a_action ,
00126                 array ('lib'=>'Description',
00127                        'priv'=>'Privilège')," ",
00128                 array('shaded'=>0,'showHeadings'=>1,'width'=>500));
00129 
00130 
00131 $pdf->ezStream();
00132 
00133 ?>