Skip to content

Commit 5f9a109

Browse files
author
Dave MacFarlane
committed
[candidate_list] Translate RegistrationProject on candidate_list page
Add the ability to translate the registrationProject on the candidate_list page.
1 parent 32213db commit 5f9a109

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

modules/candidate_list/php/candidatelistrowprovisioner.class.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ class CandidateListRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisio
122122
throw new \Exception("Unhandled DoB format: $this->dobFormat");
123123
}
124124
}
125+
$row['RegistrationProject'] = dgettext(
126+
"Project",
127+
$row['RegistrationProject']
128+
);
125129
unset($row['RegistrationCenterID']);
126130
unset($row['RegistrationProjectID']);
127131
return new CandidateListRow($row, $cid, $pid);

modules/candidate_list/php/options.class.inc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ class Options extends \LORIS\Http\Endpoint
6363
}
6464

6565
// get the list of projects
66-
// $list_of_projects = \Utility::getProjectList();
6766
$list_of_projects = $user->getProjectNames();
68-
$project_options = [];
69-
foreach (array_values($list_of_projects) as $name) {
70-
$project_options[$name] = $name;
71-
}
7267

7368
// get the list of cohorts
7469
$list_of_cohorts = \Utility::getCohortList();
@@ -88,7 +83,7 @@ class Options extends \LORIS\Http\Endpoint
8883
return [
8984
'visitlabel' => $visit_label_options,
9085
'site' => $site_options,
91-
'project' => $project_options,
86+
'project' => array_combine($list_of_projects, $list_of_projects),
9287
'cohort' => $cohort_options,
9388
'participantstatus' => $participant_status_options,
9489
'useedc' => $config->getSetting("useEDC"),

php/libraries/User.class.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,12 @@ class User extends UserPermissions implements
335335
if ($projects === '') {
336336
return [];
337337
}
338-
return explode(';', $projects);
338+
339+
$translated = [];
340+
foreach (explode(';', $projects) as $project) {
341+
$translated[$project] = dgettext("Project", $project);
342+
}
343+
return $translated;
339344
}
340345

341346
/**

0 commit comments

Comments
 (0)