Publications LBTI

[insert_php]
global $wpdb;
$mydb = new wpdb(‘www_lbti’,’4HmFjjL9jwf2ftiuiB’,’publi_lbti’,’mysql-db.ibcp.fr’);

$sql = “SELECT * FROM publi ORDER BY annee DESC, auteurs ASC”;
/*$sql = “SELECT * FROM publi WHERE”;
$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)(st=*))”, array(“sn”, “givenName”));
ldap_sort($ds, $search, “sn”);
$entry = ldap_first_entry($ds, $search);
while ($entry) {
$data = ldap_get_attributes($ds, $entry);
$nom=$data[“sn”][0];
$prenom=$data[“givenName”][0];
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”;
}
$sql .= ” auteurs LIKE ‘%”.strtolower($nom).” “.strtolower(substr($prenom,0,1)).”%’ OR”;
$entry = ldap_next_entry($ds, $entry);
}
$sql .= “DER BY annee DESC, auteurs ASC”;*/
$query = $mydb->get_results($sql);

$an = -1;
$year=date(‘Y’);
$nbpubli = count($query);
print $nbpubli.” publications found. Only the last 5 years are printed.

“;

foreach($query as $res) {
if ($an != $res->annee) {
$an = $res->annee;
if ($an==$year-6) {
break;
}
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]