Commit 593e11e2 authored by Romain Loth's avatar Romain Loth

php bugfixes + 2 workarounds for DB current state (affiliation = lab and...

php bugfixes + 2 workarounds for DB current state (affiliation = lab and position and affiliation can have a null placeholder)
parent 2038fabb
......@@ -31,6 +31,19 @@ $loop = 0;
// NB this array was prepared in print_directory or print_scholar_directory
foreach ($scholars as $scholar) {
// -----------------------------8<------------------
// alternative null values during DB transition
// TODO remove when DB finalized and refilled by returning users
if (preg_match ('/^ *_NULL *$/', $scholar['position'])) {
$scholar['position'] = null ;
}
if (preg_match ('/^ *_NULL *$/', $scholar['affiliation'])) {
$scholar['affiliation'] = null ;
}
error_log('aff:/'.$scholar['affiliation'].'/');
// -----------------------------8<------------------
// debug
// var_dump($scholar);
......@@ -64,18 +77,19 @@ foreach ($scholars as $scholar) {
' <small> - ' . $scholar['country'] . '</small></h2>';
if (($scholar['position'] != null)||($scholar['lab'] != null)||($scholar['affiliation'] != null)) {
// TODO restore lab // affiliation difference
// if (($scholar['position'] != null)||($scholar['lab'] != null)||($scholar['affiliation'] != null)) {
if (($scholar['position'] != null)||($scholar['affiliation'] != null)) {
$content .= '<dl>';
}
if ($scholar['position'] != null) {
$content .= '<dt>' . $scholar['position'] . '</dt>';
$content .= '<dt>' . $scholar['position'] . '</dt>';
}
$affiliation = '';
// TODO restore lab vs org ---------------------------------------------8<-----------
// new way: already merged in data retrievam in print_*
// new way: already merged in data retrieval in print_*
if ($scholar['affiliation'] != null) {
$affiliation = $scholar['affiliation'];
$lab_list[]=$scholar['affiliation_id'];
......@@ -138,7 +152,9 @@ foreach ($scholars as $scholar) {
// }
// }
if (($scholar['position'] != null)||($scholar['lab'] != null)||($scholar['affiliation'] != null)) {
//TODO restore difference lab // affiliation
// if (($scholar['position'] != null)||($scholar['lab'] != null)||($scholar['affiliation'] != null)) {
if (($scholar['position'] != null)||($scholar['affiliation'] != null)) {
$content .= '</dl>';
}
......@@ -149,7 +165,7 @@ foreach ($scholars as $scholar) {
if ($scholar['interests'] != null) {
$content .= '<div>';
$content .= '<h4>Research</h4>';
$content .= '<p>' . $scholar['interests'] . '</p>';
$content .= '<p>' . str_replace('%%%', '<br/>', $scholar['interests']) . '</p>';
$content .= '</div>';
}
......
......@@ -105,7 +105,8 @@ foreach ($scholars as $row) {
// traitement des organismes de rattachement
$affiliation = trim($row["affiliation"] ?? "");
if (strcmp($affiliation, "") == 0) {
// TODO RESTORE NON NULL affiliation
if (strcmp($affiliation, "") == 0 || $affiliation == "_NULL") {
$missing_affiliation+=1;
} else {
......@@ -212,8 +213,10 @@ $title_data.=']';
$organizations_data = "data: [";
foreach ($organizations_list as $key => $value) {
if ($value > min(9, count($organizations_list) / 10)) {
$organizations_data.='["' . $key . '",' . $value . '],';
$htmlsafe_key = htmlspecialchars($key, ENT_XML1 | ENT_COMPAT, 'UTF-8');
if ($value > min(9, count($organizations_list) / 15)) {
$organizations_data.='["' . $htmlsafe_key . '",' . $value . '],';
} else {
$other_organization+=$value;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment