diff --git a/modules/conflict_resolver/locale/conflict_resolver.pot b/modules/conflict_resolver/locale/conflict_resolver.pot index 4dfcfe868b..2d946110ff 100644 --- a/modules/conflict_resolver/locale/conflict_resolver.pot +++ b/modules/conflict_resolver/locale/conflict_resolver.pot @@ -28,6 +28,10 @@ msgstr[0] "" msgid "Unresolved Conflicts" msgstr "" +msgid "% conflict resolved" +msgid_plural "% conflicts resolved" +msgstr[0] "" + msgid "Number of Conflicts" msgstr "" diff --git a/modules/conflict_resolver/locale/fr/LC_MESSAGES/conflict_resolver.po b/modules/conflict_resolver/locale/fr/LC_MESSAGES/conflict_resolver.po index 81f99f438f..a3448c4186 100644 --- a/modules/conflict_resolver/locale/fr/LC_MESSAGES/conflict_resolver.po +++ b/modules/conflict_resolver/locale/fr/LC_MESSAGES/conflict_resolver.po @@ -33,6 +33,11 @@ msgstr[1] "Conflits de saisie des données" msgid "Unresolved Conflicts" msgstr "Conflits non résolus" +msgid "% conflict resolved" +msgid_plural "% conflicts resolved" +msgstr[0] "% conflit résolu" +msgstr[1] "% conflits résolus" + #, fuzzy msgid "Number of Conflicts" msgstr "Nombre de conflits" diff --git a/modules/conflict_resolver/locale/hi/LC_MESSAGES/conflict_resolver.po b/modules/conflict_resolver/locale/hi/LC_MESSAGES/conflict_resolver.po index 5a31e0f6bc..94f5b5e2c5 100644 --- a/modules/conflict_resolver/locale/hi/LC_MESSAGES/conflict_resolver.po +++ b/modules/conflict_resolver/locale/hi/LC_MESSAGES/conflict_resolver.po @@ -27,6 +27,11 @@ msgstr "डेटा प्रविष्टि टकराव" msgid "Unresolved Conflicts" msgstr "असुलझे टकराव" +msgid "% conflict resolved" +msgid_plural "% conflicts resolved" +msgstr[0] "% टकराव सुलझा" +msgstr[1] "% टकराव सुलझे" + msgid "Unresolved" msgstr "असुलझा" diff --git a/modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.po b/modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.po index 31764d2271..c679f12e1c 100644 --- a/modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.po +++ b/modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.po @@ -27,6 +27,10 @@ msgstr "データ入力の競合" msgid "Unresolved Conflicts" msgstr "未解決の紛争" +msgid "% conflict resolved" +msgid_plural "% conflicts resolved" +msgstr[0] "解決済みの競合 %" + msgid "Number of Conflicts" msgstr "競合の数" diff --git a/modules/conflict_resolver/locale/zh/LC_MESSAGES/conflict_resolver.po b/modules/conflict_resolver/locale/zh/LC_MESSAGES/conflict_resolver.po index d9204611e9..348bcaf04d 100644 --- a/modules/conflict_resolver/locale/zh/LC_MESSAGES/conflict_resolver.po +++ b/modules/conflict_resolver/locale/zh/LC_MESSAGES/conflict_resolver.po @@ -28,6 +28,10 @@ msgstr "数据输入冲突" msgid "Unresolved Conflicts" msgstr "未解决的冲突" +msgid "% conflict resolved" +msgid_plural "% conflicts resolved" +msgstr[0] "已解决冲突 %" + msgid "Number of Conflicts" msgstr "冲突数量" diff --git a/modules/conflict_resolver/php/module.class.inc b/modules/conflict_resolver/php/module.class.inc index 168161c2d2..f932ae874a 100644 --- a/modules/conflict_resolver/php/module.class.inc +++ b/modules/conflict_resolver/php/module.class.inc @@ -179,6 +179,96 @@ class Module extends \Module 1, ) ]; + case 'study-progression': + $factory = \NDB_Factory::singleton(); + $baseURL = $factory->settings()->getBaseURL(); + $DB = $factory->database(); + + $query = "SELECT + p.ProjectID, + CAST(ROUND( + 100 * SUM( + CASE WHEN conflict_status.status = 'resolved' + THEN 1 + ELSE 0 + END + ) / COUNT(*) + ) AS SIGNED) AS count, + CONCAT('$baseURL/conflict_resolver/?Project=', p.Name) + AS url, + p.Name AS ProjectName + FROM ( + SELECT CommentId1, 'unresolved' AS status + FROM conflicts_unresolved + UNION ALL + SELECT CommentId1, 'resolved' AS status + FROM conflicts_resolved + ) conflict_status + LEFT JOIN flag f ON (conflict_status.CommentId1=f.CommentID) + LEFT JOIN session s ON (f.SessionID=s.ID) + LEFT JOIN candidate c ON (s.CandidateID=c.ID) + LEFT JOIN Project p ON (s.ProjectID=p.ProjectID) + WHERE s.Active='Y' + AND c.Active='Y' + AND s.CenterID <> 1"; + $params = []; + + if (!$user->hasPermission('access_all_profiles')) { + $siteIDs = array_map( + fn($centerID) => (string)$centerID, + $user->getCenterIDs() + ); + $projectIDs = array_map( + fn($projectID) => (string)$projectID, + $user->getProjectIDs() + ); + + if (count($siteIDs) === 0 || count($projectIDs) === 0) { + return []; + } + + $sitePlaceholders = []; + foreach ($siteIDs as $index => $siteID) { + $placeholder = "site$index"; + $sitePlaceholders[] = ':' . $placeholder; + $params[$placeholder] = $siteID; + } + + $projectPlaceholders = []; + foreach ($projectIDs as $index => $projectID) { + $placeholder = "project$index"; + $projectPlaceholders[] = ':' . $placeholder; + $params[$placeholder] = $projectID; + } + + $query .= " + AND s.CenterID IN (" . implode(', ', $sitePlaceholders) . ") + AND s.ProjectID IN (" + . implode(', ', $projectPlaceholders) + . ")"; + } + + $query .= " + GROUP BY p.ProjectID, p.Name"; + + $data = $DB->pselectWithIndexKey( + $query, + $params, + 'ProjectID' + ); + + return [ + new \LORIS\dashboard\DataWidget( + new \LORIS\GUI\LocalizableString( + "conflict_resolver", + "% conflict resolved", + "% conflicts resolved" + ), + $data, + "", + 'rgb(255, 235, 235)', + ) + ]; } return []; diff --git a/modules/electrophysiology_browser/locale/electrophysiology_browser.pot b/modules/electrophysiology_browser/locale/electrophysiology_browser.pot index bccee2be13..d9ee633967 100644 --- a/modules/electrophysiology_browser/locale/electrophysiology_browser.pot +++ b/modules/electrophysiology_browser/locale/electrophysiology_browser.pot @@ -22,6 +22,10 @@ msgstr "" msgid "Electrophysiology Browser" msgstr "" +msgid "EEG Recording" +msgid_plural "EEG Recordings" +msgstr[0] "" + msgid "Links" msgstr "" diff --git a/modules/electrophysiology_browser/locale/fr/LC_MESSAGES/electrophysiology_browser.po b/modules/electrophysiology_browser/locale/fr/LC_MESSAGES/electrophysiology_browser.po index c247dac37a..5df81a3f76 100644 --- a/modules/electrophysiology_browser/locale/fr/LC_MESSAGES/electrophysiology_browser.po +++ b/modules/electrophysiology_browser/locale/fr/LC_MESSAGES/electrophysiology_browser.po @@ -24,6 +24,11 @@ msgstr "" msgid "Electrophysiology Browser" msgstr "Navigateur d'électrophysiologie" +msgid "EEG Recording" +msgid_plural "EEG Recordings" +msgstr[0] "Enregistrement EEG" +msgstr[1] "Enregistrements EEG" + msgid "Links" msgstr "Liens" diff --git a/modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po b/modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po index fe255896f0..fc3afc55d2 100644 --- a/modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po +++ b/modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po @@ -22,6 +22,10 @@ msgstr "" msgid "Electrophysiology Browser" msgstr "電気生理学ブラウザ" +msgid "EEG Recording" +msgid_plural "EEG Recordings" +msgstr[0] "EEG記録" + msgid "Links" msgstr "リンク" diff --git a/modules/electrophysiology_browser/locale/zh/LC_MESSAGES/electrophysiology_browser.po b/modules/electrophysiology_browser/locale/zh/LC_MESSAGES/electrophysiology_browser.po index 3f405ef2a0..3bdd0582b3 100644 --- a/modules/electrophysiology_browser/locale/zh/LC_MESSAGES/electrophysiology_browser.po +++ b/modules/electrophysiology_browser/locale/zh/LC_MESSAGES/electrophysiology_browser.po @@ -22,6 +22,10 @@ msgstr "" msgid "Electrophysiology Browser" msgstr "电生理学浏览器" +msgid "EEG Recording" +msgid_plural "EEG Recordings" +msgstr[0] "EEG 记录" + msgid "Links" msgstr "链接" diff --git a/modules/electrophysiology_browser/php/module.class.inc b/modules/electrophysiology_browser/php/module.class.inc index ca7657d988..f7ea39a8d5 100644 --- a/modules/electrophysiology_browser/php/module.class.inc +++ b/modules/electrophysiology_browser/php/module.class.inc @@ -64,4 +64,108 @@ class Module extends \Module { return dgettext("electrophysiology_browser", "Electrophysiology Browser"); } + + /** + * {@inheritDoc} + * + * @param string $type The type of widgets to get. + * @param \User $user The user widgets are being retrieved for. + * @param array $options A type dependent list of options to provide + * to the widget. + * + * @return \LORIS\GUI\Widget[] + */ + public function getWidgets(string $type, \User $user, array $options) : array + { + switch ($type) { + case 'study-progression': + $factory = \NDB_Factory::singleton(); + $baseURL = $factory->settings()->getBaseURL(); + $DB = $factory->database(); + + $query = "SELECT + Project.ProjectID, + COUNT(ppf.PhysiologicalFileID) AS count, + CONCAT( + '$baseURL/electrophysiology_browser/?project=', + Project.Name + ) AS url, + Project.Name AS ProjectName + FROM physiological_parameter_file ppf + LEFT JOIN physiological_file pf + USING (PhysiologicalFileID) + LEFT JOIN physiological_output_type pot + USING (PhysiologicalOutputTypeID) + LEFT JOIN Project + ON ppf.ProjectID = Project.ProjectID + LEFT JOIN session s + ON pf.SessionID = s.ID + WHERE ParameterTypeID = ( + SELECT ParameterTypeID + FROM parameter_type + WHERE Name = 'RecordingDuration' + ) + AND Project.showSummaryOnLogin = 1"; + $params = []; + + if (!$user->hasPermission('electrophysiology_browser_view_allsites')) { + $siteIDs = array_map( + fn($centerID) => (string)$centerID, + $user->getCenterIDs() + ); + $projectIDs = array_map( + fn($projectID) => (string)$projectID, + $user->getProjectIDs() + ); + + if (count($siteIDs) === 0 || count($projectIDs) === 0) { + return []; + } + + $sitePlaceholders = []; + foreach ($siteIDs as $index => $siteID) { + $placeholder = "site$index"; + $sitePlaceholders[] = ':' . $placeholder; + $params[$placeholder] = $siteID; + } + + $projectPlaceholders = []; + foreach ($projectIDs as $index => $projectID) { + $placeholder = "project$index"; + $projectPlaceholders[] = ':' . $placeholder; + $params[$placeholder] = $projectID; + } + + $query .= " + AND s.CenterID IN (" . implode(', ', $sitePlaceholders) . ") + AND Project.ProjectID IN (" + . implode(', ', $projectPlaceholders) + . ")"; + } + + $query .= " + GROUP BY Project.ProjectID, Project.Name"; + + $data = $DB->pselectWithIndexKey( + $query, + $params, + 'ProjectID' + ); + + return [ + new \LORIS\dashboard\DataWidget( + new \LORIS\GUI\LocalizableString( + "electrophysiology_browser", + "EEG Recording", + "EEG Recordings" + ), + $data, + "", + 'rgb(255, 224, 171)', + ) + ]; + } + + return []; + } } diff --git a/modules/publication/locale/en/LC_MESSAGES/publication.po b/modules/publication/locale/en/LC_MESSAGES/publication.po index 0f624fdfc9..bc07b7dfe8 100644 --- a/modules/publication/locale/en/LC_MESSAGES/publication.po +++ b/modules/publication/locale/en/LC_MESSAGES/publication.po @@ -18,6 +18,9 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Publication" +msgstr "Publication" + msgid "helpFindingVariables" msgstr "For help finding variables of interest, consult the Data Dictionary" diff --git a/modules/publication/locale/fr/LC_MESSAGES/publication.po b/modules/publication/locale/fr/LC_MESSAGES/publication.po index 0af112c697..82519affae 100644 --- a/modules/publication/locale/fr/LC_MESSAGES/publication.po +++ b/modules/publication/locale/fr/LC_MESSAGES/publication.po @@ -22,6 +22,9 @@ msgstr "" msgid "Publications" msgstr "Publications" +msgid "Publication" +msgstr "Publication" + msgid "File to upload" msgstr "Sélectionner un fichier à téléverser" diff --git a/modules/publication/locale/hi/LC_MESSAGES/publication.po b/modules/publication/locale/hi/LC_MESSAGES/publication.po index 78c98e8a15..81438f24cb 100644 --- a/modules/publication/locale/hi/LC_MESSAGES/publication.po +++ b/modules/publication/locale/hi/LC_MESSAGES/publication.po @@ -21,6 +21,9 @@ msgstr "" msgid "Publications" msgstr "प्रकाशन" +msgid "Publication" +msgstr "प्रकाशन" + msgid "Submit" msgstr "जमा करें" diff --git a/modules/publication/locale/ja/LC_MESSAGES/publication.po b/modules/publication/locale/ja/LC_MESSAGES/publication.po index c01a354231..537e621f74 100644 --- a/modules/publication/locale/ja/LC_MESSAGES/publication.po +++ b/modules/publication/locale/ja/LC_MESSAGES/publication.po @@ -21,6 +21,9 @@ msgstr "" msgid "Publications" msgstr "出版物" +msgid "Publication" +msgstr "出版物" + msgid "Submit" msgstr "提出する" diff --git a/modules/publication/locale/publication.pot b/modules/publication/locale/publication.pot index 09e91c039c..b9d78b29c7 100644 --- a/modules/publication/locale/publication.pot +++ b/modules/publication/locale/publication.pot @@ -21,6 +21,9 @@ msgstr "" msgid "Publications" msgstr "" +msgid "Publication" +msgstr "" + msgid "Submit" msgstr "" diff --git a/modules/publication/locale/zh/LC_MESSAGES/publication.po b/modules/publication/locale/zh/LC_MESSAGES/publication.po index 3dddb14ccc..c666e00412 100644 --- a/modules/publication/locale/zh/LC_MESSAGES/publication.po +++ b/modules/publication/locale/zh/LC_MESSAGES/publication.po @@ -22,6 +22,9 @@ msgstr "" msgid "Publications" msgstr "刊物" +msgid "Publication" +msgstr "刊物" + msgid "Submit" msgstr "提交" diff --git a/modules/publication/php/module.class.inc b/modules/publication/php/module.class.inc index 544b58fc5a..330ef54bfb 100644 --- a/modules/publication/php/module.class.inc +++ b/modules/publication/php/module.class.inc @@ -64,4 +64,68 @@ class Module extends \Module { return dgettext("publication", "Publications"); } + + /** + * {@inheritDoc} + * + * @param string $type The type of widgets to get. + * @param \User $user The user widgets are being retrieved for. + * @param array $options A type dependent list of options to provide + * to the widget. + * + * @return \LORIS\GUI\Widget[] + */ + public function getWidgets(string $type, \User $user, array $options) : array + { + switch ($type) { + case 'study-progression': + $factory = \NDB_Factory::singleton(); + $baseURL = $factory->settings()->getBaseURL(); + $DB = $factory->database(); + + $query = "SELECT + pr.ProjectID, + COUNT(*) AS count, + CONCAT('$baseURL/publication/?project=', pr.Name) AS url, + pr.Name AS ProjectName + FROM publication p + JOIN Project pr ON (p.project=pr.ProjectID)"; + $params = []; + + if (!($user->hasPermission('publication_view') + || $user->hasPermission('publication_propose') + || $user->hasPermission('publication_approve')) + ) { + $query .= " + JOIN publication_users_edit_perm_rel puepr + ON (puepr.PublicationID=p.PublicationID) + WHERE puepr.UserID=:userID"; + $params['userID'] = $user->getId(); + } + + $query .= " + GROUP BY pr.ProjectID, pr.Name"; + + $data = $DB->pselectWithIndexKey( + $query, + $params, + 'ProjectID' + ); + + return [ + new \LORIS\dashboard\DataWidget( + new \LORIS\GUI\LocalizableString( + "publication", + "Publication", + "Publications" + ), + $data, + "", + 'rgb(209, 195, 255)', + ) + ]; + } + + return []; + } }