[insert_php]
global $wpdb;
$nom=strtoupper($_GET[‘nom’]);
$prenom=$_GET[‘prenom’];
$positions = array ();
$positions[‘mc’] = ‘Assistant professor’;
$positions[‘dr’] = ‘Research director’;
$positions[‘pr’] = ‘Professor’;
$positions[‘cr’] = ‘Research fellow’;
$positions[‘ie’] = “Engineer”;
$positions[‘cdi’] = ‘Permanent contract’;
$positions[‘cdd’] = ‘Fixed-term contract’;
$positions[‘tch’] = ‘Technician’;
$positions[‘pu-ph’] = ‘University professor – Hospital practitioner’;
$positions[‘ph’] = ‘Hospital practitioner’;
$positions[‘ai’] = ‘Assistant engineer’;
$positions[‘phu’] = ‘Hospital-university practitioner’;
$positions[‘ajt’] = ‘Assistant’;
$positions[‘stagiaire’] = ‘Trainee student’;
$positions[‘doc’] = ‘PhD student’;
$positions[‘agt’] = ‘Technical Assistant’;
$positions[‘t’] = ‘Technician’;
$positions[‘at’] = ‘Technical Assistant’;
$positions[‘ahu’] = ‘Hospital-university assistant’;
$positions[‘mcu’] = ‘Assistant professor’;
$equipes = array();
$equipes[‘prabi’] = ‘PRABI Pole’;
$equipes[‘fdtc’] = ‘Skin function and dynamics’;
$equipes[‘hdt2’] = ‘Skin function and dynamics’;
$equipes[‘admns’] = ‘Colloidal vectors and tissue transport’;
$equipes[‘bic’] = ‘Cartilage biology and engineering’;
$equipes[‘icert’] = ‘Cell/microenvironment cross-talk and tissue repair’;
$equipes[‘rockfeller’] = ‘Rockfeller Pole’;
$equipes[‘gest-lbti’] = ‘Administrator’;
$equipes[‘m2rm’] = ‘Metaloproteinases and tissue remodeling’;
$equipes[‘pinv’] = ‘Skin function and dynamics’;
$mydb = new wpdb(‘www_lbti’,’4HmFjjL9jwf2ftiuiB’,’publi_lbti’,’mysql-db.ibcp.fr’);
$sql = “SELECT * FROM minicv WHERE nom ='”.$nom.”‘ and prenom ='”.$prenom.”‘”;
$query = $mydb->get_results($sql);
$ds=ldap_connect(“elledap.ibcp.fr”,389);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_start_tls($ds);
$r=ldap_bind($ds);
$search=ldap_search($ds, “ou=people, dc=ibcp, dc=fr”, “(&(o=dyhtit)(sn=$nom)(givenName=$prenom)(st=*))”, array(“cn”,”mail”,”telephoneNumber”,”facsimileTelephoneNumber”,”jpegPhoto”,”st”, “sn”, “givenName”,”employeeType”,”fdPhotoVisible”));
//ldap_sort($ds, $search, “sn”);
$entry = ldap_first_entry($ds, $search);
while ($entry) {
$data = ldap_get_attributes($ds, $entry);
$data_jpg = ldap_get_values_len($ds, $entry, “jpegphoto”);
$data = ldap_get_attributes($ds, $entry);
$nom=$data[“sn”][0];
$prenom=$data[“givenName”][0];
$prenom_short=strtolower(substr($prenom,0,1));
print “
“.$data[“cn”][0].”
“;
if ($data[“fdPhotoVisible”]) {
print “
“;
}
foreach($query as $res){
print $res->texte.”
“;
}
print “Team : “.$equipes[$data[“st”][0]].”
“;
print “Mail : “.$data[“mail”][0].”
“;
print “Phone : “.$data[“telephoneNumber”][0].”
“;
print “Status : “.$positions[$data[“employeeType”][0]].”
“;
print “
“;
$entry = ldap_next_entry($ds, $entry);
}
$sql = “SELECT * FROM publi WHERE”;
if (preg_match(“/-/”,$nom)){
$noms=explode(‘-‘,$nom);
$sql .= ” auteurs LIKE ‘%”.strtolower($noms[0]).” “.strtolower(substr($prenom,0,1)).”%’ OR”;
$sql .= ” auteurs LIKE ‘%”.strtolower($noms[1]).” “.strtolower(substr($prenom,0,1)).”%’ OR”;
}
if ($nom == “LIU LO”) {
$nom = “LIU”;
$prenom_short = “KL”;
}
if ($nom == “BONOD”) {
$sql = “SELECT * FROM publi WHERE auteurs like ‘% bonod c%’ or auteurs like ‘%bonod-bidaud c%’ ORDER BY annee DESC, auteurs ASC”;
}
else {
$sql .= ” auteurs LIKE ‘%”.$nom.” “.$prenom_short.”%’ ORDER BY annee DESC, auteurs ASC”;
}
$query = $mydb->get_results($sql);
$an = -1;
$nbpubli = count($query);
foreach($query as $res) {
if ($an != $res->annee) {
$an = $res->annee;
print “
annee.”\”>”.$res->annee.”
“;
}
print ‘‘.$nbpubli.’. ‘;
print ‘‘.$res->titre.’ ‘;
print ‘
‘;
print ucwords(strtolower($res->auteurs));
print “
“;
print ‘(‘.$res->annee.’) ‘;
print ‘‘.ucwords(strtolower($res->journal)).’ ‘;
print ‘‘.$res->volume.’ :’;
print $res->pages;
if ($res->pubmed != “”) {
print ‘ ‘;
}
print ‘
‘;
$nbpubli–;
}
[/insert_php]