Skip to content

Commit

Permalink
[Examiner] Redmine-11798 Clean up Examiner list (#2545)
Browse files Browse the repository at this point in the history
This regroups certifications into a single row, as done before LORIS 17.0
  • Loading branch information
kongtiaowang authored and driusan committed Feb 3, 2017
1 parent 1b5a651 commit 0f66c59
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions modules/examiner/php/NDB_Menu_Filter_Form_examiner.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,47 @@ class NDB_Menu_Filter_Form_Examiner extends NDB_Menu_Filter_Form
$useCertification = false;
}

// base query
$query = " FROM examiners e LEFT JOIN psc ON (e.centerID=psc.CenterID)";
if ($this->useCertification == '1') {
$query .= " LEFT JOIN certification c ON
(c.examinerID=e.examinerID and c.pass = 'certified')
LEFT JOIN test_names tn ON (tn.ID = c.testID) ";
}
$query .= " WHERE 1=1 ";
$user = User::singleton();
$centerID = $DB->quote($user->getData('CenterID'));

if ($user->hasPermission('examiner_multisite')) {
$query = "
FROM
examiners e LEFT JOIN psc ON
(e.centerID=psc.CenterID)
LEFT JOIN certification c ON
(c.examinerID=e.examinerID and c.pass = 'certified')
LEFT JOIN test_names tn ON (tn.ID = c.testID) WHERE 1=1 ";
} else {

$query = "
FROM
examiners e LEFT JOIN psc ON
(e.centerID=psc.CenterID)
LEFT JOIN certification c ON
(c.examinerID=e.examinerID and c.pass = 'certified')
LEFT JOIN test_names tn ON (tn.ID = c.testID)
WHERE e.centerID =".$centerID." ";

$user = User::singleton();
if (!$user->hasPermission('examiner_multisite')) {
$query .= " AND e.CenterID=" . $DB->quote($user->getData('CenterID'));
}

// set the class variables
$this->columns = array(
'e.full_name as Examiner',
'e.examinerID as ID',
'psc.Name as Site',
'e.radiologist as Radiologist',
);
if ($this->useCertification == '1') {
array_push($this->columns, 'tn.Full_name');
}
$this->columns = array(
'e.full_name as Examiner',
'e.examinerID as ID',
'psc.Name as Site',
'e.radiologist as Radiologist',
'GROUP_CONCAT(tn.full_name) as Certification',
);
$this->group_by = "e.full_name,psc.Name";
$this->query = $query;
$this->order_by = 'e.full_name';
$this->headers = array(
'Examiner',
'ID',
'Site',
'Radiologist',
'Certification',
);
$this->validFilters = array(
'e.full_name',
Expand All @@ -102,10 +112,14 @@ class NDB_Menu_Filter_Form_Examiner extends NDB_Menu_Filter_Form
// If certification is turned on, update the class variables to include
// certification information
if ($this->useCertification == '1') {
array_push($this->headers, 'Certification');
}
$this->tpl_data['hiddenHeaders'] = json_encode(['ID']);

$this->tpl_data['hiddenHeaders'] = json_encode(['ID']);

} else {

$this->tpl_data['hiddenHeaders'] = json_encode(['ID', 'Certification']);

}
return true;
}

Expand Down

0 comments on commit 0f66c59

Please sign in to comment.