Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 require_once("class_fiche.php");
00022 require_once("constant.php");
00023 require_once("user_common.php");
00024
00025
00026
00027
00028
00029
00030
00031 class contact extends Fiche
00032 {
00033 var $company;
00034
00035 function contact($p_cn,$p_id=0)
00036 {
00037 $this->fiche_def_ref=FICHE_TYPE_CONTACT;
00038 parent::__construct($p_cn,$p_id) ;
00039 $this->company="";
00040 }
00041
00042
00043
00044
00045
00046
00047
00048
00049 function Summary($p_search="",$p_action="",$p_sql="",$p_nothing=false)
00050 {
00051 $p_search=sql_string($p_search);
00052 $extra_sql="";
00053 if ( $this->company != "")
00054 {
00055 $extra_sql="and f_id in (select f_id from fiche_detail
00056 where ad_value=upper('".$this->company."') and ad_id=".ATTR_DEF_COMPANY.") ";
00057 }
00058 $url=urlencode($_SERVER['REQUEST_URI']);
00059 $script=$_SERVER['PHP_SELF'];
00060
00061
00062 $all_contact=$this->count_by_modele($this->fiche_def_ref,$p_search,$extra_sql);
00063
00064 $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
00065 $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
00066 $bar=navigation_bar($offset,$all_contact,$_SESSION['g_pagesize'],$page);
00067
00068 $search="";
00069 if ( trim($p_search) != "" )
00070 {
00071 $search=" and f_id in
00072 (select f_id from fiche_Detail
00073 where
00074 ad_id=1 and ad_value ~* '$p_search') ";
00075 }
00076
00077 $step_contact=$this->get_by_category($offset,$search.$extra_sql.$p_sql);
00078
00079 if ( $all_contact == 0 ) return "";
00080 $r=$bar;
00081 $r.='<table id="contact_tb" class="sortable">
00082 <TR>
00083 <th>Quick Code</th>
00084 <th>Nom</th>
00085 <th>Prénom</th>
00086 <th>Société</th>
00087 <th>Téléphone</th>
00088 <th>email</th>
00089 <th>Fax</th>
00090 </TR>';
00091 $base=$_SERVER['PHP_SELF'];
00092
00093 $url="";
00094 $and="?";
00095 $get=$_GET;
00096 if ( isset ($get) )
00097 {
00098 foreach ($get as $name=>$value )
00099 {
00100
00101 if ( ! in_array($name,array('f_id','detail')))
00102 {
00103 $url.=$and.$name."=".$value;
00104 $and="&";
00105 }
00106 }
00107 }
00108 $back_url=urlencode($_SERVER['REQUEST_URI']);
00109 if ( sizeof ($step_contact ) == 0 )
00110 return $r;
00111 $idx=0;
00112 foreach ($step_contact as $contact )
00113 {
00114 $l_company=new Fiche($this->cn);
00115 $l_company->get_by_qcode($contact->strAttribut(ATTR_DEF_COMPANY),false);
00116 $l_company_name=$l_company->strAttribut(ATTR_DEF_NAME);
00117 if ( $l_company_name == NOTFOUND ) $l_company_name="";
00118
00119 if ( $l_company_name !="")
00120 {
00121 $l_company_name=HtmlInput::card_detail($contact->strAttribut(ATTR_DEF_COMPANY),$l_company_name,'style="text-decoration:underline;"');
00122 }
00123 $tr=($idx%2==0)?' <tr class="odd">':'<tr class="even">';
00124 $idx++;
00125 $r.=$tr;
00126 $qcode=$contact->strAttribut(ATTR_DEF_QUICKCODE);
00127 $r.='<TD>'.HtmlInput::card_detail($qcode)."</TD>";
00128 $r.="<TD>".$contact->strAttribut(ATTR_DEF_NAME)."</TD>";
00129 $r.="<TD>".$contact->strAttribut(ATTR_DEF_FIRST_NAME)."</TD>";
00130 $r.="<TD>".$l_company_name."</TD>";
00131 $r.="<TD>".$contact->strAttribut(ATTR_DEF_TEL)."</TD>";
00132 $r.="<TD>".$contact->strAttribut(ATTR_DEF_EMAIL)."</TD>".
00133 "<TD> ".$contact->strAttribut(ATTR_DEF_FAX)."</TD>";
00134
00135 $r.="</TR>";
00136
00137 }
00138 $r.="</TABLE>";
00139 $r.=$bar;
00140 return $r;
00141 }
00142
00143 }