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

class_admin.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.2 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 require_once("constant.php");
00022 require_once("postgres.php");
00023 require_once("class_parm_code.php");
00024 require_once("class_widget.php");
00025 
00026 require_once('class_fiche.php');
00027 require_once('class_poste.php');
00028 require_once('user_common.php');
00037 // Use the view vw_supplier
00038 // 
00039 class Admin extends fiche{
00040 
00041   var $name;        
00042   var $street;      
00043   var $country;     
00044   var $cp;          
00045   var $vat_number;  
00049   function Admin($p_cn,$p_id=0) {
00050       $this->fiche_def_ref=FICHE_TYPE_ADM_TAX;
00051       fiche::fiche($p_cn,$p_id) ;
00052 
00053   }
00054 
00065   function Summary($p_search) 
00066     {
00067       $p_search=FormatString($p_search);
00068       $url=urlencode($_SERVER['REQUEST_URI']);
00069       $script=$_SERVER['SCRIPT_NAME'];
00070       // Creation of the nav bar
00071       // Get the max numberRow
00072       $all_admin=$this->CountByDef($this->fiche_def_ref,$p_search); 
00073       // Get offset and page variable
00074       $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
00075       $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
00076       $bar=jrn_navigation_bar($offset,$all_admin,$_SESSION['g_pagesize'],$page);
00077       // set a filter ?
00078       $search="";
00079       if ( trim($p_search) != "" )
00080         {
00081           $search=" and f_id in
00082 (select f_id from jnt_fic_att_value 
00083                   join fiche using (f_id) 
00084                   join attr_value using (jft_id)
00085                 where
00086                 ad_id=1 and av_text ~* '$p_search')";
00087         }
00088       // Get The result Array
00089       $step_admin=$this->GetAll($offset,$search);
00090       if ( $all_admin == 0 ) return "";
00091       $r=$bar;
00092       $r.='<table>
00093 <TR style="background-color:lightgrey;">
00094 <TH>Quick Code</TH>
00095 <th>Nom</th>
00096 <th>Adresse</th>
00097 <th>Action </th>
00098 </TR>';
00099       if ( sizeof ($step_admin ) == 0 )
00100         return $r;
00101       foreach ($step_admin as $admin ) {
00102         $r.="<TR>";
00103         $e=sprintf('<A HREF="%s?p_action=admin&sa=detail&f_id=%d&url=%s" title="Détail"> ',
00104                     $script,$admin->id,$url);
00105 
00106         $r.="<TD> $e".$admin->strAttribut(ATTR_DEF_QUICKCODE)."</A></TD>";
00107         $r.="<TD>".$admin->strAttribut(ATTR_DEF_NAME)."</TD>";
00108         $r.="<TD>".$admin->strAttribut(ATTR_DEF_ADRESS).
00109           " ".$admin->strAttribut(ATTR_DEF_CP).
00110           " ".$admin->strAttribut(ATTR_DEF_PAYS).
00111           "</TD>";
00112         $r.="<td>";
00113         $r.=sprintf('<A class="mtitle" HREF="%s?p_action=contact&qcode=%s&url=%s" title="Contact">C</A> - ',
00114                     $script,$admin->strAttribut(ATTR_DEF_QUICKCODE),$url);
00115         $r.=sprintf('<A class="mtitle" HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&url=%s" title="Action">A</A> - ',
00116                     $script,$admin->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
00117 
00118         $r.='</TD>';
00119 
00120         $r.="</TR>";
00121 
00122       }
00123       $r.="</TABLE>";
00124       $r.=$bar;
00125       return $r;
00126     }
00127 
00128 }
00129 
00130 ?>