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

contact Class Reference

Class contact (customer, supplier...). More...

Inheritance diagram for contact:

fiche

Public Member Functions

 contact ($p_cn, $p_id=0)
 constructor
 Summary ($p_search)
 show the default screen

Data Fields

 $company

Detailed Description

Class contact (customer, supplier...).

Definition at line 32 of file class_contact.php.


Constructor & Destructor Documentation

contact::contact p_cn,
p_id = 0
 

constructor

Definition at line 36 of file class_contact.php.

References fiche::fiche().

00037     {
00038       $this->fiche_def_ref=FICHE_TYPE_CONTACT;
00039       fiche::fiche($p_cn,$p_id) ;
00040       $this->company="";
00041     }


Member Function Documentation

contact::Summary p_search  ) 
 

show the default screen

Summary

Parameters:
p_search (filter)
Returns:
string to display

Definition at line 50 of file class_contact.php.

References $bar, $contact, $offset, $page, $r, $search, $url, fiche::CountByDef(), f_id, fiche::fiche(), FormatString(), fiche::GetAll(), jrn_navigation_bar(), name, table, and value.

00051     {
00052       $p_search=FormatString($p_search);
00053       $extra_sql="";
00054       if ( $this->company != "") 
00055         {
00056           $extra_sql="and f_id in (select f_id from jnt_fic_att_value join 
00057 attr_value using (jft_id) where av_text='".$this->company."' and ad_id=".ATTR_DEF_COMPANY.") ";
00058         }
00059       $url=urlencode($_SERVER['REQUEST_URI']);
00060       $script=$_SERVER['SCRIPT_NAME'];
00061       // Creation of the nav bar
00062       // Get the max numberRow
00063       $all_contact=$this->CountByDef($this->fiche_def_ref,$p_search,$extra_sql); 
00064       // Get offset and page variable
00065       $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
00066       $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
00067       $bar=jrn_navigation_bar($offset,$all_contact,$_SESSION['g_pagesize'],$page);
00068       // set a filter ?
00069       $search="";
00070       if ( trim($p_search) != "" )
00071         {
00072           $search=" and f_id in
00073 (select f_id from jnt_fic_att_value 
00074                   join fiche using (f_id) 
00075                   join attr_value using (jft_id)
00076                 where
00077                 ad_id=1 and av_text ~* '$p_search') ";
00078         }
00079       // Get The result Array
00080       $step_contact=$this->GetAll($offset,$search.$extra_sql);
00081       if ( $all_contact == 0 ) return "";
00082       $r=$bar;
00083       $r.='<table border="0">
00084 <TR style="background-color:lightgrey;">
00085 <th>Nom</th>
00086 <th>Téléphone</th>
00087 <th>email</th>
00088 <th>Fax</th>
00089 <th colspan="2">Société</th>
00090 </TR>';
00091       $base=$_SERVER['SCRIPT_NAME'];
00092       // Compute the url
00093       $url="";
00094       $and="?";
00095       $get=$_GET;
00096       if ( isset ($get) ) {
00097         foreach ($get as $name=>$value ) {
00098           // we clean the parameter offset, step, page and size
00099           if (  ! in_array($name,array('f_id','detail'))) {
00100             $url.=$and.$name."=".$value;
00101             $and="&";
00102           }// if
00103         }//foreach
00104       }// if
00105 
00106       if ( sizeof ($step_contact ) == 0 )
00107         return $r;
00108       echo JS_SEARCH_CARD;
00109       foreach ($step_contact as $contact ) {
00110         $l_company=new fiche($this->cn);
00111         $l_company->GetByQCode($contact->strAttribut(ATTR_DEF_COMPANY),false);
00112         $l_company_name=$l_company->strAttribut(ATTR_DEF_NAME);
00113         if ( $l_company_name == '- ERROR -' ) $l_company_name="";
00114         // add popup for detail
00115         if ( $l_company_name !="")
00116           {
00117             $l_company_name=sprintf("<A HREF=\"javascript:showfiche('%s','%s')\">%s  - %s</A>",
00118                                     $_REQUEST['PHPSESSID'],
00119                                     $contact->strAttribut(ATTR_DEF_COMPANY),
00120                                     $contact->strAttribut(ATTR_DEF_COMPANY),
00121                                     $l_company_name
00122                                     );
00123           }
00124         $r.="<TR>";
00125         $r.='<TD><A HREF="'.$url."&sa=detail&f_id=".$contact->id."\">".$contact->strAttribut(ATTR_DEF_NAME)."</A></TD>";
00126         $r.="<TD>".$contact->strAttribut(ATTR_DEF_TEL)."</TD>";
00127         $r.="<TD>".$contact->strAttribut(ATTR_DEF_EMAIL)."</TD>".
00128             "<TD> ".$contact->strAttribut(ATTR_DEF_FAX)."</TD>".
00129             "<TD> ".$l_company_name. "</TD>";
00130 
00131         $r.="</TR>";
00132 
00133       }
00134       $r.="</TABLE>";
00135       $r.=$bar;
00136       return $r;
00137     }


Field Documentation

contact::$company
 

company of the contact (ad_id=ATTR_DEF_COMPANY)

Definition at line 34 of file class_contact.php.


The documentation for this class was generated from the following file: