function get_adress($courriel) { $sql = "SELECT civilite, nom, prenom, societe, adresse, cp, ville, pays FROM user WHERE email = '" . $courriel . "'"; $user = CBdd::select_row($sql); $adress = CTableCivilite::get_text($user['civilite']); $adress .= "<br />"; $adress .= $user['prenom']. " " . $user['nom']; $adress .= "<br />"; if(trim($user['societe'])) { $adress .= $user['societe']; $adress .= "<br />"; } $adress .= $user['adresse']; $adress .= "<br />"; $adress .= $user['cp']. " " . $user['ville']; $adress .= "<br />"; $adress .= ucwords(CTablePays::get_name($user['pays'])); return ucwords($adress); }
function export($separator = ',') { $id_groupe = $this->table['id']; $nom_groupe = self::get_element($id_groupe); $nom_csv = CFunction::formate_chaine($nom_groupe) . ".csv"; header("Content-Type: application/csv-tab-delimited-table"); header("Content-disposition: filename=" . $nom_csv); $resQuery = CBdd::select("SELECT civilite, nom, prenom, societe, adresse, cp, ville, pays, email, telephone, mobile, web FROM user WHERE id IN (" . implode(",", self::get_array_id_user($id_groupe)) . ")"); if ($resQuery) { // titre des colonnes $fields = mysql_num_fields($resQuery); $i = 0; $field_name = ''; while ($i < $fields) { $field_name .= '"' . mysql_field_name($resQuery, $i).'"'.$separator; $i++; } $field_name = trim($field_name, $separator); echo $field_name . "\r\n"; // donn�es de la table while ($arrSelect = mysql_fetch_array($resQuery, MYSQL_ASSOC)) { $data = ''; foreach($arrSelect as $key=>$elem) { if($key == "civilite") { $elem = CTableCivilite::get_name($elem); } elseif ($key == "pays") { $elem = CTablePays::get_name($elem); } $data .= '"' . html_entity_decode($elem) . '"'.$separator; } $data = trim($data, $separator); echo $data . "\r\n"; } return 1; } else { return 0; } }
$prenom = $row[$_REQUEST['prenom']]; $societe = $row[$_REQUEST['societe']]; $adresse = $row[$_REQUEST['adresse']]; $cp = $row[$_REQUEST['cp']]; $ville = $row[$_REQUEST['ville']]; $email = $row[$_REQUEST['email']]; $telephone = $row[$_REQUEST['telephone']]; $mobile = $row[$_REQUEST['mobile']]; $web = $row[$_REQUEST['web']]; $pays = $row[$_REQUEST['pays']]; $login = CTableUser::create_login($nom); $passe = CFunction::get_password(); //traitement particuliers $code_pays = CTablePays::get_element($pays, 'id'); $id_civilite= CTableCivilite::get_id($civilite); $id_user = CTableUser::get_id_by_phone($telephone, $mobile); if($id_user > 0 && $_REQUEST['update'] == 'yes') { $obj = new CTableUser(array( 'id'=>$id_user, 'nom'=>CFunction::clean_user_input($nom), 'prenom'=>CFunction::clean_user_input($prenom), 'societe'=>CFunction::clean_user_input($societe), 'adresse'=>CFunction::clean_user_input($adresse), 'cp'=>CFunction::clean_user_input($cp), 'ville'=>CFunction::clean_user_input($ville), 'email'=>CFunction::clean_user_input($email), 'telephone'=>CFunction::clean_user_input($telephone), 'mobile'=>CFunction::clean_user_input($mobile),
function export($separator = ',') { $id_groupe = $this->table['id']; $nom_groupe = self::get_element($id_groupe); $nom_csv = CFunction::formate_chaine($nom_groupe) . ".csv"; header("Content-Type: application/csv-tab-delimited-table"); header("Content-disposition: filename=" . $nom_csv); $resQuery = CBdd::select("SELECT nom_ent, categorie_ent, resp_ent, tel_ent, fax_ent, mail_ent, web_ent, descr_ent, rue_adr, cp_adr, actif_ent, dateajout_ent, datecontact_ent, idopportunite, cmtr_ent, paiement_abo, paiement_pre, fin_abo, debut_abo, ent, url, montant_v, montant_pre, type, commune_alias, etatcontact_ent, date_contact FROM entreprise WHERE id_ent IN (" . implode(",", self::get_array_id_user($id_groupe)) . ")"); if ($resQuery) { // titre des colonnes $fields = mysql_num_fields($resQuery); $i = 0; $field_name = ''; while ($i < $fields) { $field_name .= '"' . mysql_field_name($resQuery, $i).'"'.$separator; $i++; } $field_name = trim($field_name, $separator); echo $field_name . "\r\n"; // donn�es de la table while ($arrSelect = mysql_fetch_array($resQuery, MYSQL_ASSOC)) { $data = ''; foreach($arrSelect as $key=>$elem) { if($key == "civilite") { $elem = CTableCivilite::get_name($elem); } elseif ($key == "pays") { $elem = CTablePays::get_name($elem); } $data .= '"' . html_entity_decode($elem) . '"'.$separator; } $data = trim($data, $separator); echo $data . "\r\n"; } return 1; } else { return 0; } }