Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/timepoint_list/php/timepoint_list.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ class Timepoint_List extends \NDB_Menu
= $timePoint->$getDateMethod();
}
}

$this->tpl_data['timePoints'][$x]['language']
= $timePoint->getLanguage();
$x++;
} // end list

Expand Down
4 changes: 4 additions & 0 deletions modules/timepoint_list/templates/menu_timepoint_list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<th>{dgettext("timepoint_list", "BVL QC")}</th>
<th>{dgettext("timepoint_list", "BVL Exclusion")}</th>
<th>{dgettext("timepoint_list", "Registered By")}</th>
<th>{dgettext("loris", "Language")}</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -154,6 +155,9 @@
<td>
{$timePoints[timepoint].Real_name}
</td>
<td>
{$timePoints[timepoint].language->label}
</td>
</tr>
{sectionelse}
<tr><td colspan="10">{dgettext("timepoint_list", "You do not have access to any timepoints registered for this candidate.")}</td></tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TimepointListIntegrationTest extends LorisIntegrationTestWithCandidate
'',
'',
'',
'Unknown',
];

/**
Expand Down
22 changes: 22 additions & 0 deletions php/libraries/Language.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php declare(strict_types=1);

/**
* A Language object represents the concept of a language that has been
* configured on this LORIS instance.
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
*/
class Language
{
/**
* Construct a Language object
*
* @param string $label The display label for the language
* @param string $code The language code for the language.
*/
public function __construct(
public readonly string $label,
public readonly string $code
) {
}
}
26 changes: 26 additions & 0 deletions php/libraries/TimePoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1386,5 +1386,31 @@ class TimePoint implements \LORIS\StudyEntities\AccessibleResource,
$centerMatch = in_array($this->getCenterID(), $centers);
return $projMatch && $centerMatch;
}

/**
* Get the language for this timepoint.
*
* @return \Language
*/
public function getLanguage() : \Language
{
$db = NDB_Factory::singleton()->database();

$vals = $db->pselectRow(
"SELECT language_label, language_code
FROM language l
JOIN session s ON (l.language_id=s.languageID)
WHERE s.ID=:sid",
['sid' => $this->getSessionID()],
);

if ($vals === null) {
return new \Language("Unknown", "en_CA");
}
return new \Language(
label: $vals['language_label'],
code: $vals['language_code']
);
}
}

Loading