load->database(); $this->load->helper('date'); $this->load->model('FxForm_model'); } public function mod_getRecords($rowno,$rowperpage,$filtre1="",$filtre2="",$filtre3="",$filtre4="",$mem_listactive=1,$langue='fr') { // list la bb client $this->db->select('*,config_pays.pay_nom_'.$langue.' as com_pay,config_provinces.pro_nom_'.$langue.' as com_pro,cli_genres.gen_nom_'.$langue.' as com_type '); $this->db->from('cli_compte'); $this->db->join('config_pays', 'cli_compte.com_pay_id=config_pays.pay_id','left'); $this->db->join('config_provinces', 'cli_compte.com_pro_id=config_provinces.pro_id','left'); $this->db->join('cli_genres', 'cli_compte.com_gen_id=cli_genres.gen_id','left'); $this->db->limit($rowperpage, $rowno); $this->db->order_by('com_num_client desc'); $this->db->where("com_actif",$mem_listactive ); if($filtre1!="") $this->db->where("com_num_client LIKE '%$filtre1%'"); if($filtre2!="") $this->db->where("com_compagnie LIKE '%$filtre2%'"); if($filtre4!="") $this->db->where("com_gen_id",$filtre4); $query = $this->db->get(); // $clients=$query->result_array(); $newclients=array(); // ajouter la liste des type $xx=0; // for ($x = 0; $x < count($clients); $x++) { foreach ($query->result_array() as $clients) { $this->db->select('*'); $this->db->from('cli_contacts'); $this->db->where('ref_id',$clients['com_id']); $this->db->where('con_actif=1' ); $query2 = $this->db->get(); $row = $query2->result_array(); $mem_contact=""; $mem_contact_list=array(); $xxx=0; foreach($row as $key => $value) { $mem_contact=$mem_contact.$value['con_prenom']." ".$value['con_nom']." ".$value['con_telephone'].' '.$value['con_ext']."
"; $mem_contact_list[$xxx]['con_prenom']=$value['con_prenom']; $mem_contact_list[$xxx]['con_nom']=$value['con_nom']; $mem_contact_list[$xxx]['con_telephone']=$value['con_telephone']; $mem_contact_list[$xxx]['con_ext']=$value['con_ext']; $mem_contact_list[$xxx]['con_courriel']=$value['con_courriel']; $mem_contact_list[$xxx]['con_telephone2']=$value['con_telephone2']; $xxx=$xxx+1; } $mem_type=substr($mem_contact, 0, -4); $mem_skip=false; if($filtre3!=""){ $pos = strrpos(strtolower($mem_type), strtolower($filtre3)); if ($pos === false) { // note: three equal signs $mem_skip=true; } } if (!$mem_skip){ $newclients[$xx]=$clients; $newclients[$xx]['list_contacts']=$mem_type; $newclients[$xx]['contact_list_array']=$mem_contact_list; $xx++; } } return $newclients; } public function mod_getRecordCountfilter($filtre1="",$filtre2="",$filtre3="",$filtre4="",$mem_listactive=1) { // list la bb client $this->db->select('* '); $this->db->from('cli_compte'); $this->db->join('config_pays', 'cli_compte.com_pay_id=config_pays.pay_id','left'); $this->db->join('config_provinces', 'cli_compte.com_pro_id=config_provinces.pro_id','left'); $this->db->join('cli_genres', 'cli_compte.com_gen_id=cli_genres.gen_id','left'); $this->db->order_by('com_num_client desc'); $this->db->where("com_actif",$mem_listactive ); if($filtre1!="") $this->db->where("com_num_client LIKE '%$filtre1%'"); if($filtre2!="") $this->db->where("com_compagnie LIKE '%$filtre2%'"); if($filtre4!="") $this->db->where("com_gen_id",$filtre4); $query = $this->db->get(); $clients=$query->result_array(); $newclients=array(); // ajouter la liste des type $xx=0; for ($x = 0; $x < count($clients); $x++) { $this->db->select('*'); $this->db->from('cli_contacts'); $this->db->where('ref_id',$clients[$x]['com_id']); $query2 = $this->db->get(); $row = $query2->result_array(); $mem_contact=""; foreach($row as $key => $value) { $mem_contact=$mem_contact.$value['con_prenom']." ".$value['con_nom']." ".$value['con_telephone'].' '.$value['con_ext']."
"; } $mem_type=substr($mem_contact, 0, -4); $mem_skip=false; if($filtre3!=""){ $pos = strrpos($mem_type, $filtre3); if ($pos === false) { // note: three equal signs $mem_skip=true; } } if (!$mem_skip){ $newclients[$xx]=$clients[$x]; $newclients[$xx]['list_contacts']=$mem_type; $xx++; } } return $xx; } public function mod_getRecords_contacts($id,$langue='fr') { // list la bb client $this->db->select('*,cli_contacts_roles.rol_nom as role'); $this->db->from('cli_contacts'); $this->db->join('cli_contacts_roles', 'cli_contacts_roles.rol_id=cli_contacts.con_role_id','left'); $this->db->where('cli_contacts.ref_id',$id); $this->db->where('cli_contacts.con_actif',1); $query = $this->db->get(); return $query->result_array(); } public function mod_getRecord($id,$langue='fr') { // trouve un enregiestrement $this->db->select('*,config_pays.pay_nom_'.$langue.' as com_pay,config_provinces.pro_nom_'.$langue.' as com_pro '); $this->db->from('cli_compte'); $this->db->join('config_pays', 'cli_compte.com_pay_id=config_pays.pay_id','left'); $this->db->join('config_provinces', 'cli_compte.com_pro_id=config_provinces.pro_id','left'); $this->db->where('com_id='.$id); $this->db->limit(1); $this->db->order_by('com_num_client desc'); $query = $this->db->get(); return $query->row(); } public function mod_saveRecordbd($id,$data,$pref) { // creation de la chaine de save $mem_data=array(); // ajoute les checkbox if (!isset($data['com_actif'])) $data['com_actif']=0; foreach($data as $key => $value ) { if (substr($key,0,strlen($pref))==$pref){ $mem_data[$key]=$value; } } $mem_data['com_modif']= date("Y-m-d H:i:s") ; $mem_where = "com_id =".$id; $str = $this->db->update('cli_compte', $mem_data, $mem_where); $ok=true; return $ok ; } public function mod_createRecordbd($data,$pref) { if (!isset($data['com_actif'])) $data['com_actif']=0; // creation de la chaine de save $mem_data=array(); foreach($data as $key => $value ) { if (substr($key,0,strlen($pref))==$pref){ $mem_data[$key]=$value; } } $mem_data['com_creation']=date("Y-m-d H:i:s"); $mem_data['com_actif']=1; $str = $this->db->insert('cli_compte', $mem_data); $ok=true; return $this->db->insert_id(); } public function mod_editRecordbdcontact($data,$pref,$ref_id) { $mem_data=array(); foreach($data as $key => $value ) { if (substr($key,0,strlen($pref))==$pref){ $mem_data[$key]=$value; } } $mem_where = "con_id =".$ref_id; $str = $this->db->update('cli_contacts', $mem_data, $mem_where); $ok=true; return ; } public function mod_createRecordbdcontact($data,$pref,$ref_id) { $mem_data=array(); foreach($data as $key => $value ) { if (substr($key,0,strlen($pref))==$pref){ $mem_data[$key]=$value; } } $mem_data['ref_id']=$ref_id; $mem_data['con_creation']=date("Y-m-d H:i:s"); $mem_data['con_actif']=1; $str = $this->db->insert('cli_contacts', $mem_data); $ok=true; return ; } public function mod_deleteRecordbdcontact($id) { $mem_data['con_actif']=0; $mem_where = "con_id =".$id; $str = $this->db->update('cli_contacts', $mem_data, $mem_where); $ok=true; return ; } public function mod_getRecordCount() { $this->db->select('count(*) as allcount'); $this->db->from('cli_compte'); $query = $this->db->get(); $result = $query->result_array(); return $result[0]['allcount']; } public function mod_loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$filtre4='',$mem_listactive=1,$mem_projetsactive=1,$excel=0) { $this->load->model('Config_model'); $filtre1=($filtre1=='null'?'':$filtre1); $filtre2=($filtre2=='null'?'':$filtre2); $filtre3=($filtre3=='null'?'':$filtre3); $filtre4=($filtre4=='null'?'':$filtre4); $recordPerPage = 999; $config["cur_page"] = $record; if($record != 0){ $record = ($record-1) * $recordPerPage; } $recordCount2 = $this->mod_getRecordCount(); $recordCount = $this->mod_getRecordCountfilter($filtre1,$filtre2,$filtre3,$filtre4,$mem_listactive); $client_list = $this->mod_getRecords($record,$recordPerPage,$filtre1,$filtre2,$filtre3,$filtre4,$mem_listactive); $config['base_url'] = base_url().'index.php/Clients/loadData_list'; $config['use_page_numbers'] = TRUE; $config['next_link'] = 'Next'; $config['prev_link'] = 'Previous'; $config['total_rows'] = $recordCount; $config['per_page'] = $recordPerPage; $choice = $config["total_rows"] / $config["per_page"]; $config["uri_segment"] = 2; $config["num_links"] = 2; $config['full_tag_open'] = '
'; $config['first_link'] = '« First'; $config['first_tag_open'] = ''; $config['last_link'] = 'Last »'; $config['last_tag_open'] = ''; $config['next_link'] = 'Next →'; $config['next_tag_open'] = ''; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = ''; $config['cur_tag_open'] = '
  • '; $config['cur_tag_close'] = '
  • '; $config['num_tag_open'] = '
  • '; $config['num_tag_close'] = '
  • '; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $data['recordCount']=$recordCount2; // creation du tableau // prepare header $mem_excel=' '; $mem_link_new=anchor('clients/form/0' , ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-pencil" '); $header=array($mem_excel.$mem_link_new, 'Compagnie', 'Type', 'Ville', 'Contacts','Code Client','Type'); if ($excel==1){ $mem_excel_output['header']=array('','Nom du client', 'Type','Contact','Télépnone','ext', 'Email','Cellulaire', ); $mem_excel_output['headerwidth']=array(5,40,15,30,20,10,40,20,30,5,30,30); } if ($excel==2){ $mem_excel_output['header']=array('Compagnie','Contact',); $mem_excel_output['headerwidth']=array(40,40,40,40,40,40,40,40,40,40,40,40); } $nbitem=0; // filter global $mem_data; $data_row = array(); $data_row[]=array('data'=>'Filtre', 'align' => 'left'); // ----compagnie--------------------------------------------------------------------- $mem_champ='filtre_2'; $mem_value=$filtre2; $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_2'); $mem_filtre=form_input($mem_data['input'][$mem_champ]); $data_row[]=array('data'=>$mem_filtre, 'align' => 'left'); // ----contact--------------------------------------------------------------------- $data_row[]=array('data'=>"", 'align' => 'left'); $data_row[]=array('data'=>"", 'align' => 'left'); // ------------------------------------------------------------------------- $mem_champ='filtre_3'; $mem_value=$filtre3; $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_3'); $mem_filtre=form_input($mem_data['input'][$mem_champ]); $data_row[]=array('data'=>$mem_filtre, 'align' => 'left'); // ------------------------------------------------------------------------- // --code client----------------------------------------------------------------------- $mem_champ='filtre_1'; $mem_value=$filtre1; $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_1',5); $mem_filtre=form_input($mem_data['input'][$mem_champ]); $data_row[]=array('data'=>$mem_filtre, 'align' => 'left'); // ------------------------------------------------------------------------- // --code client----------------------------------------------------------------------- $mem_champ='filtre_4'; $mem_value=$filtre4; $mem_data['select'][$mem_champ]['choix']=$this->Config_model->conf_getGenresClient('fr',true); $mem_filtre=form_dropdown($mem_champ,$mem_data['select'][$mem_champ]['choix'],$mem_value,'class="filtre_4"'); $data_row[]=array('data'=>$mem_filtre, 'align' => 'left'); // ------------------------------------------------------------------------- $tabular_data[] = $data_row; // prépare les donnés du tableau foreach($client_list as $row) { $nbitem++; $mem_excel2=' '; // faire le link pour edit $mem_link_edit=anchor('clients/form/'.$row['com_id'], ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-edit" '); $mem_link_projet=anchor('projets/createRecord/0/'.$row['com_id'], ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-briefcase" '); // '; $data_row = array(); $data_row[] = array('data'=> $mem_link_edit.$mem_excel2, 'align' => 'left' ); $data_row[] = array('data'=>$row['com_compagnie'], 'align' => 'left'); $data_row[] = array('data'=>$row['com_type'], 'align' => 'left'); $data_row[] = array('data'=>$row['com_ville'], 'align' => 'left'); $data_row[] = array('data'=>$row['list_contacts'], 'align' => 'left'); $data_row[] = array('data'=>$row['com_num_client'], 'align' => 'left','width' => '5'); $data_row[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left'); $tabular_data[] = $data_row; // print_r($row['contact_list_array']); // echo('
    '); echo('
    '); // echo('
    '); if ($excel==1){ $data_row_excel = array(); $data_row_excel[] = array('data'=>'', 'align' => 'left'); $data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left'); $data_row_excel[] = array('data'=>$row['com_type'], 'align' => 'left'); // $data_row_excel[] = array('data'=>$row['det_fac_numero'], 'align' => 'left'); // $data_row_excel[] = array('data'=>$row['proj_numero'], 'align' => 'left','width'=>3); // $data_row_excel[] = array('data'=>number_format($row['det_fac_avanttx'],2,'.',''), 'align' => 'left','format'=>'argent'); $mem_nb_contact=1; if(count($row['contact_list_array'])!=0){ foreach($row['contact_list_array'] as $contact){ if ($mem_nb_contact==1){ $data_row_excel[] = array('data'=>$contact['con_prenom'].' '.$contact['con_nom'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_telephone'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_ext'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_courriel'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_telephone2'], 'align' => 'right'); $mem_nb_contact=$mem_nb_contact+1; $mem_excel_output['data'][]=$data_row_excel; }else{ $data_row_excel = array(); $data_row_excel[] = array('data'=>'', 'align' => 'left'); $data_row_excel[] = array('data'=>'', 'align' => 'left'); $data_row_excel[] = array('data'=>'', 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_prenom'].' '.$contact['con_nom'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_telephone'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_ext'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_courriel'], 'align' => 'left'); $data_row_excel[] = array('data'=>$contact['con_telephone2'], 'align' => 'right'); $mem_nb_contact=$mem_nb_contact+1; $mem_excel_output['data'][]=$data_row_excel; } } }else{ $mem_excel_output['data'][]=$data_row_excel;} } $client_listprojet=$this->Config_model->conf_getprojetsclients($row['com_id'],$mem_projetsactive,$filtre3); // echo '
    ';
            //    print_r($client_listprojet);
            //    echo '
    '; // echo("--------------------------"); $mem_projets=$this->Clients_model->mod_listprojets($row['com_id'],$mem_projetsactive,$filtre3,"clients"); if ($excel==2){ // echo '
    ';
                //   print_r($client_listprojet);
               //   echo '
    '; $data_row_excel = array(); $data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left'); $data_row_excel[] = array('data'=>$row['list_contacts'], 'align' => 'left'); // $data_row_excel[] = array('data'=>$row['det_fac_numero'], 'align' => 'left'); // $data_row_excel[] = array('data'=>$row['proj_numero'], 'align' => 'left','width'=>3); // $data_row_excel[] = array('data'=>number_format($row['det_fac_avanttx'],2,'.',''), 'align' => 'left','format'=>'argent'); $mem_excel_output['data'][]=$data_row_excel; $data_row_excel = array(); $mem_excel_output['data'][]=$data_row_excel; $data_row_excel = array(); $data_row_excel[] = array('data'=>'Numéro de projet', 'align' => 'right','bold' => true); $data_row_excel[] = array('data'=>'Étape du projet', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Nom du projet', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Représentant Express Tours', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Contact', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Date de confirmation du projet', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Date de début du projet', 'align' => 'left','bold' => true); $data_row_excel[] = array('data'=>'Date de fin du projet', 'align' => 'left','bold' => true); $mem_excel_output['data'][]=$data_row_excel; $mem_nb_contact=1; if(count($client_listprojet)!=0){ foreach($client_listprojet as $projet){ $data_row_excel = array(); $data_row_excel[] = array('data'=>$projet['proj_numero'], 'align' => 'left'); ; //$data_row_excel[] = array('data'=> $this->Config_model->conf_getGenresProjetid($projet['proj_dest'],$langue='fr'), 'align' => 'left'); ; $data_row_excel[] = array('data'=>$projet['gen_nom_fr'], 'align' => 'left'); ; $data_row_excel[] = array('data'=>$projet['proj_nom'], 'align' => 'left'); $data_row_excel[] = array('data'=>$projet['usa_prenom']." ".$projet['usa_nom'], 'align' => 'left'); $data_row_excel[] = array('data'=>$projet['con_prenom']." ".$projet['con_nom'], 'align' => 'left'); $data_row_excel[] = array('data'=>$projet['proj_date_annule'], 'align' => 'left'); $data_row_excel[] = array('data'=>$projet['proj_date_debut'], 'align' => 'left'); $data_row_excel[] = array('data'=>$projet['proj_date_fin'], 'align' => 'left'); $mem_nb_contact=$mem_nb_contact+1; $mem_excel_output['data'][]=$data_row_excel; } }else{ $mem_excel_output['data'][]=$data_row_excel;} } // valide les projets // $projets=$this->Config_model->conf_getprojetsclients($row['com_id']); // $mem_projets=""; // $mem_projets_client=''; // foreach($projets as $value){ // $mem_link_edit=anchor('projets/form/'.$value['proj_id'], ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-edit statut_'.$value['proj_etape'].'"' ); // $mem_projets=$mem_projets. $mem_link_edit; // $mem_projets=$mem_projets.' '.$value['proj_numero'].' '.$value['proj_nom'].'
    '; // $mem_projets_client=' Création de projet
    '; // } $data_row = array(); $data_row[] = array('data'=>'' ); $data_row[] = array('data'=>$mem_projets,'colspan' => 6 ); $tabular_data[] = $data_row; } $template = array( 'table_open' => '', 'thead_open' => '', 'thead_close' => '', 'heading_row_start' => '', 'heading_row_end' => '', 'heading_cell_start' => '', 'tbody_open' => '', 'tbody_close' => '', 'row_start' => '', 'row_end' => '', 'cell_start' => '', 'row_alt_start' => '', 'row_alt_end' => '', 'cell_alt_start' => '', 'table_close' => '
    ', 'heading_cell_end' => '
    ', 'cell_end' => '
    ', 'cell_alt_end' => '
    ' ); $this->table->set_template($template); $this->table->set_heading($header); $tableau_sortie= $this->table->generate($tabular_data); if ($excel!=0){ // $mem_excel_output['data']=$tabular_data; $data['fichier']="clients.xls"; $mem_excel_output['fichier']="clients"; // $mem_excel_output['titre']="depart du ".$debut.' @ '.$fin; $mem_excel_output['titre']="rapport en date du ".date("Y-m-d H:i");; $mem_parameter=array('premiere_ligne'=>0); $this->Config_model->excel($mem_excel_output,$mem_parameter); } $data['empData'] = $tableau_sortie; return $data; } public function mod_listcontact($record=0) { // $recordCount = $this->Clients_model->getRecordCount(); $client_list = $this->mod_getRecords_contacts($record); // creation du tableau // prepare header //$mem_link_new=anchor('clients/form/0' , ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-plus-sign" '); $mem_link_new=' '; $header=array('','Prénom', 'Nom', 'Téléphone bureau', 'Ext', 'Cellulaire', 'Courriel', 'Role',''); // prépare les donnés du tableau $nbitem=0; foreach($client_list as $row) { $nbitem++; // faire le link pour edit $mem_link_edit=anchor('clients/deletecontact/'.$row['con_id'] .'/'.$record, ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-trash" '); //$mem_link_save=anchor('clients/editcontact/'.$row['con_id'] .'/'.$record, ' ', 'class="btn btn-primary btn-circle glyphicon" '); $mem_link_save=' '; // '; $data_row = array(); $data_row[] = array('data'=> $mem_link_edit, 'align' => 'left','size'=>5); // $data_row[] = array('data'=>$row['con_prenom'], 'align' => 'left'); // $data_row[] = array('data'=>$row['con_nom'], 'align' => 'left'); // $data_row[] = array('data'=>$row['con_telephone'], 'align' => 'left'); // $data_row[] = array('data'=>$row['con_ext'],'width'=>'5', 'align' => 'left'); // $data_row[] = array('data'=>$row['con_telephone2'], 'align' => 'left'); // $data_row[] = array('data'=>$row['con_courriel'], 'align' => 'left'); // $data_row[] = array('data'=>$row['role'], 'align' => 'left'); $data_row[] = array('data'=> form_input(array('value' =>$row['con_prenom'],'name' => $row['con_id'].'/con_prenom' ,'size'=>15))); $data_row[] = array('data'=> form_input(array('value' =>$row['con_nom'],'name' => $row['con_id'].'/con_nom' ,'size'=>15))); $data_row[] = array('data'=> form_input(array('value' =>$row['con_telephone'],'name' => $row['con_id'].'/con_telephone' ,'size'=>10))); $data_row[] = array('data'=> form_input(array('value' =>$row['con_ext'],'name' => $row['con_id'].'/con_ext' ,'size'=>5))); $data_row[] = array('data'=> form_input(array('value' =>$row['con_telephone2'],'name' => $row['con_id'].'/con_telephone2' ,'size'=>10))); $data_row[] = array('data'=> form_input(array('value' =>$row['con_courriel'],'name' => $row['con_id'].'/con_courriel' ,'size'=>15))); $mem_choix=$this->Config_model->conf_getRolesContacts(); $mem_roles=form_dropdown($row['con_id'].'/con_role_id',$mem_choix,$row['con_role_id']) ; $data_row[] = array('data'=>$mem_roles , 'align' => 'left'); $data_row[] = array('data'=>$mem_link_save , 'align' => 'left'); $tabular_data[] = $data_row; } $data_row = array(); $data_row[] = array('data'=> $mem_link_new); $data_row[] = array('data'=> form_input(array('name' => '0/con_prenom','size'=>15))); $data_row[] = array('data'=> form_input(array('name' => '0/con_nom','size'=>15))); $data_row[] = array('data'=> form_input(array('name' => '0/con_telephone','size'=>10))); $data_row[] = array('data'=> form_input(array('name' => '0/con_ext','size'=>5))); $data_row[] = array('data'=> form_input(array('name' => '0/con_telephone2','size'=>10))); $data_row[] = array('data'=> form_input(array('name' => '0/con_courriel','size'=>15))); $mem_choix=$this->Config_model->conf_getRolesContacts(); $mem_roles=form_dropdown('0/con_role_id',$mem_choix) ; $data_row[] = array('data'=>$mem_roles , 'align' => 'left'); $tabular_data[] = $data_row; $template = array( 'table_open' => '', 'thead_open' => '', 'thead_close' => '', 'heading_row_start' => '', 'heading_row_end' => '', 'heading_cell_start' => '', 'tbody_open' => '', 'tbody_close' => '', 'row_start' => '', 'row_end' => '', 'cell_start' => '', 'row_alt_start' => '', 'row_alt_end' => '', 'cell_alt_start' => '', 'table_close' => '
    ', 'heading_cell_end' => '
    ', 'cell_end' => '
    ', 'cell_alt_end' => '
    ' ); $this->table->set_template($template); $this->table->set_heading($header); $tableau_sortie= $this->table->generate($tabular_data); return $tableau_sortie; } public function mod_listprojets($record=0,$mem_projetsactive=1,$filtre3="",$go="") { // $recordCount = $this->Clients_model->getRecordCount(); $client_list=$this->Config_model->conf_getprojetsclients($record,$mem_projetsactive,$filtre3); // creation du tableau // prepare header //$mem_link_new=anchor('clients/form/0' , ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-plus-sign" '); $mem_link_new=' '; $mem_link_projet=anchor('projets/createRecord/0/'.$record, ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-briefcase" '); $header=array($mem_link_projet,'Numéro', '', 'Étape', 'Nom', 'Représentant', 'Contact', 'Confirmation', 'Date début', 'Date fin'); // prépare les donnés du tableau $nbitem=0; foreach($client_list as $row) { $nbitem++; // faire le link pour edit $mem_link_edit=anchor('projets/form/'.$row['proj_id'], ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-edit" '); // '; $data_row = array(); $data_row[] = array('data'=> $mem_link_edit, 'align' => 'left', 'width' => '2'); $data_row[] = array('data'=>$row['proj_numero'], 'align' => 'left', 'width' => '2'); $data_row[] = array('data'=>" ", 'align' => 'left','class'=>'statut_'.$row['proj_etape']); $data_row[] = array( 'data' => $this->load->view('projets/form_etape_client', ['etape' => $row['proj_etape'],'row'=> $row,'key' => $nbitem,"go"=>$go ], true), 'align' => 'left' ); $data_row[] = array('data'=>$row['proj_nom'], 'align' => 'left'); $data_row[] = array('data'=>$row['rep_prenom']." ".$row['rep_nom'], 'align' => 'left'); $data_row[] = array('data'=>$row['con_prenom']." ".$row['con_nom'], 'align' => 'left'); $data_row[] = array('data'=>$row['proj_date_confirmation'], 'align' => 'left'); $data_row[] = array('data'=>$row['proj_date_debut'], 'align' => 'left', 'width' => '75'); $data_row[] = array('data'=>$row['proj_date_fin'], 'align' => 'left', 'width' => '75'); $tabular_data[] = $data_row; } $template = array( 'table_open' => '', 'thead_open' => '', 'thead_close' => '', 'heading_row_start' => '', 'heading_row_end' => '', 'heading_cell_start' => '', 'tbody_open' => '', 'tbody_close' => '', 'row_start' => '', 'row_end' => '', 'cell_start' => '', 'row_alt_start' => '', 'row_alt_end' => '', 'cell_alt_start' => '', 'table_close' => '
    ', 'heading_cell_end' => '
    ', 'cell_end' => '
    ', 'cell_alt_end' => '
    ' ); $this->table->set_template($template); $this->table->set_heading($header); if(!isset($tabular_data)) $tabular_data=array(); $tableau_sortie= $this->table->generate($tabular_data); return $tableau_sortie; } public function mod_getforminfo($id) { global $mem_data, $validation; $this->load->model('Config_model'); $this->load->model('FxForm_model'); // vas chercher les info de la fiche if($id!=0) $info = $this->mod_getRecord($id); // prepare info pour chaque champs utilisé // input $mem_data['mem_id']=$id; $mem_champ='com_compagnie'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Compagnie',''); $this->FxForm_model->fxvaliderequired($mem_champ); // ------------------------------------------------------------------------- $mem_champ='com_num_client'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Numéro client',''); // $this->FxForm_model->fxvaliderequired($mem_champ); // ------------------------------------------------------------------------- $mem_champ='com_gen_id'; $mem_value=($id==0 ? '' : $info->$mem_champ); $mem_data['select'][$mem_champ]['choix']=$this->Config_model->conf_getGenresClient(); $mem_data['select'][$mem_champ]['value']= $mem_value; $mem_data['label'][$mem_champ] = 'Type'; $mem_data['icon'][$mem_champ] = ''; // ------------------------------------------------------------------------- $mem_champ='com_representant_id'; $mem_value=($id==0 ? '' : $info->$mem_champ); $mem_data['select'][$mem_champ]['choix']=$this->Config_model->conf_getRepresentantsClient(); $mem_data['select'][$mem_champ]['value']= $mem_value; $mem_data['label'][$mem_champ] = 'Représentant'; $mem_data['icon'][$mem_champ] = ''; // ------------------------------------------------------------------------- $mem_champ = 'com_langue'; $mem_value = ($id == 0 ? '' : $info->$mem_champ); $mem_data['select'][$mem_champ]['choix'] = $this->Config_model->conf_getLangues(); // value multipli select $mem_value = explode(',', $mem_value); $mem_data['select'][$mem_champ]['value'] = $mem_value; $mem_data['label'][$mem_champ] = 'Langue'; $mem_data['icon'][$mem_champ] = ''; // ------------------------------------------------------------------------- $mem_champ='com_actif'; $mem_value=($id==0 ? true : ($info->$mem_champ==1 ? true:false)); $mem_data['checkbox'][$mem_champ] = array( 'name' => $mem_champ, 'value' => 1, 'checked' => $mem_value, ); $mem_data['label'][$mem_champ] = 'Actif'; $mem_data['icon'][$mem_champ] = ' '; // ------------------------------------------------------------------------- $mem_champ='com_ville'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Ville',''); // $this->FxForm_model->fxvaliderequired($mem_champ); // ------------------------------------------------------------------------- $mem_champ='com_pro_id'; $mem_value=($id==0 ? '' : $info->$mem_champ); $mem_data['select'][$mem_champ]['choix']=$this->Config_model->conf_getProvinces(); $mem_data['select'][$mem_champ]['value']= $mem_value; $mem_data['label'][$mem_champ] = 'Province'; $mem_data['icon'][$mem_champ] = ''; // ------------------------------------------------------------------------- $mem_champ='com_pay_id'; $mem_value=($id==0 ? '' : $info->$mem_champ); $mem_data['select'][$mem_champ]['choix']=$this->Config_model->conf_getPays(); $mem_data['select'][$mem_champ]['value']= $mem_value; $mem_data['label'][$mem_champ] = 'Pays'; $mem_data['icon'][$mem_champ] = ''; // ------------------------------------------------------------------------- $mem_champ='com_codepostal'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Code postal',''); // $this->FxForm_model->fxvaliderequired($mem_champ); // ------------------------------------------------------------------------- $mem_champ='com_adresse'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Adresse',''); // $this->FxForm_model->fxvaliderequired($mem_champ); // ------------------------------------------------------------------------- $mem_champ='com_notes'; $mem_value=($id==0 ? '' : $info->$mem_champ); $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'Notes','','Notes'); $mem_data['validation']=$this->FxForm_model->fxValidation($validation['rule'],$validation['message']); return $mem_data; } }