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
00022
00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 require_once("class_iselect.php");
00025 require_once("class_ihidden.php");
00026 require_once("class_contact.php");
00027 require_once("class_ibutton.php");
00028 require_once('class_fiche_def.php');
00029
00030
00031
00032 $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
00033
00034
00035
00036 $href=basename($_SERVER['PHP_SELF']);
00037
00038
00039 if ($low_action == "")
00040 $low_action = "list";
00041
00042
00043
00044
00045
00046 if (isset($_POST['delete_card']))
00047 {
00048 if ($g_user->check_action(FICADD) == 0)
00049 {
00050 alert(j(_('Vous ne pouvez pas enlever de fiche')));
00051 return;
00052 }
00053
00054 $f_id = $_REQUEST['f_id'];
00055
00056 $fiche = new Contact($cn, $f_id);
00057 $fiche->remove();
00058 $low_action = "list";
00059 }
00060
00061
00062
00063
00064 if ($low_action == "list")
00065 {
00066 ?>
00067 <div class="content">
00068 <div>
00069 <form method="get" action="<?php echo $href;?>">
00070 <?php
00071 echo dossier::hidden();
00072 $a = (isset($_GET['query'])) ? $_GET['query'] : "";
00073 printf(_('Recherche') . HtmlInput::filter_table("contact_tb", "0,1,2,3,4,5,6", 1));
00074 $sel_card = new ISelect('cat');
00075 $sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def ' .
00076 ' where frd_id=' . FICHE_TYPE_CONTACT .
00077 ' order by fd_label ', 1);
00078 $sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
00079 $sel_card->javascript = ' onchange="submit(this);"';
00080
00081 echo _('Catégorie :') . $sel_card->input();
00082
00083 $sl_company=new ISelect("sel_company");
00084 $sl_company->value = $cn->make_array('select distinct ad_value,ad_value from fiche_detail as fd' .
00085 ' join fiche as f1 on (f1.f_id=fd.f_id) join fiche_def as fdf on (f1.fd_id=fdf.fd_id)
00086 where
00087 ad_id='.ATTR_DEF_COMPANY. " and frd_id= ".FICHE_TYPE_CONTACT.
00088 ' order by 1', 1);
00089 $sl_company->selected = (isset($_GET['sel_company'])) ? $_GET['sel_company'] : '';
00090 echo _('Société :') . $sl_company->input();
00091
00092 ?>
00093 <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
00094 <input type="hidden" name="ac" value="<?php echo $_REQUEST['ac']?>">
00095 </form>
00096 </div>
00097 <?php
00098 $client = new contact($cn);
00099 $search = (isset($_GET['query'])) ? $_GET['query'] : "";
00100 $sql = "";
00101 if (isset($_GET['cat']))
00102 {
00103 if ($_GET['cat'] != -1)
00104 $sql = sprintf(" and fd_id = %d", $_GET['cat']);
00105 }
00106 if (isset($_GET['sel_company']))
00107 {
00108 if ($_GET['sel_company'] != '' && $_GET['sel_company'] != -1)
00109 {
00110
00111 $client->company=$_GET['sel_company'];
00112 }
00113 }
00114
00115 echo '<div class="content">';
00116 echo $client->Summary($search,"contact",$sql);
00117
00118
00119 echo '<br>';
00120 echo '<br>';
00121 echo '<br>';
00122
00123 $f_add_button = new IButton('add_card');
00124 $f_add_button->label = _('Créer une nouvelle fiche');
00125 $f_add_button->set_attribute('win_refresh', 'yes');
00126 $f_add_button->set_attribute('type_cat', FICHE_TYPE_CONTACT);
00127 $f_add_button->javascript = " select_card_type(this);";
00128 echo $f_add_button->input();
00129
00130 $f_cat_button=new IButton('add_cat');
00131 $f_cat_button->set_attribute('ipopup','ipop_cat');
00132 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_CONTACT);
00133 $f_cat_button->label=_('Ajout d\'une catégorie');
00134 $f_cat_button->javascript='add_category(this)';
00135 echo $f_cat_button->input();
00136
00137 echo '</div>';
00138 echo '</div>';
00139
00140
00141 }
00142
00143
00144
00145
00146 if ( $low_action == 'detail')
00147 {
00148
00149 require_once('category_card.inc.php');
00150 exit();
00151 }
00152
00153 html_page_stop();
00154 ?>