Skip to content

Commit

Permalink
MBS-9361: Refactor terms of use display
Browse files Browse the repository at this point in the history
  • Loading branch information
PhMemmel committed Sep 13, 2024
1 parent 18615ba commit fcd4a65
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
6 changes: 4 additions & 2 deletions ai_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@
$templatepurpose['highlight'] = in_array($purpose, $purposes);
$templatecontext['purposes'][] = $templatepurpose;
}
$termsofuse = get_config('local_ai_manager', 'termsofuse');
if (!empty($termsofuse)) {
$termsofuse = get_config('local_ai_manager', 'termsofuse') ?: '';
$showtermsofuse = !empty($termsofuse);
$templatecontext['showtermsofuse'] = $showtermsofuse;
if ($showtermsofuse) {
$templatecontext['termsofuse'] = $termsofuse;
}
echo $OUTPUT->render_from_template('local_ai_manager/purpose_info', $templatecontext);
Expand Down
31 changes: 18 additions & 13 deletions confirm_ai_usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,25 @@

echo $OUTPUT->header();

$templatecontext = [
'checked' => $userinfo->is_confirmed(),
'description' => $userinfo->is_confirmed() ? get_string('revokeconfirmation', 'local_ai_manager') :
get_string('confirm', 'local_ai_manager'),
'text' => $userinfo->is_confirmed() ? get_string('confirmed', 'local_ai_manager') :
get_string('notconfirmed', 'local_ai_manager'),
'targetwhenchecked' => (new moodle_url('/local/ai_manager/confirm_ai_usage.php',
['confirm' => 0]))->out(false),
'targetwhennotchecked' => (new moodle_url('/local/ai_manager/confirm_ai_usage.php',
['confirm' => 1]))->out(false),
];

$termsofuse = get_config('local_ai_manager', 'termsofuse') ?: '';
$showtermsofuse = !empty($termsofuse);
$templatecontext['showtermsofuse'] = $showtermsofuse;
if ($showtermsofuse) {
$templatecontext['termsofuse'] = $termsofuse;
}

echo $OUTPUT->render_from_template('local_ai_manager/confirm_ai_usage',
[
'checked' => $userinfo->is_confirmed(),
'description' => $userinfo->is_confirmed() ? get_string('revokeconfirmation', 'local_ai_manager') :
get_string('confirm', 'local_ai_manager'),
'text' => $userinfo->is_confirmed() ? get_string('confirmed', 'local_ai_manager') :
get_string('notconfirmed', 'local_ai_manager'),
'targetwhenchecked' => (new moodle_url('/local/ai_manager/confirm_ai_usage.php',
['confirm' => 0]))->out(false),
'targetwhennotchecked' => (new moodle_url('/local/ai_manager/confirm_ai_usage.php',
['confirm' => 1]))->out(false),
'termsofuse' => $termsofuse,
]);
echo $OUTPUT->render_from_template('local_ai_manager/confirm_ai_usage', $templatecontext);

echo $OUTPUT->footer();
4 changes: 3 additions & 1 deletion lang/de/local_ai_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@
$string['preconfiguredmodel'] = 'vorkonfiguriertes Modell';
$string['privacy:metadata'] = 'Das Plugin local_ai_manager speichert keine persönlichen Daten.';
$string['privacy_table_description'] = 'In der unten angeführten Tabelle sehen Sie eine Übersicht über die von Ihrem Tenant konfigurierten KI-Tools. Ihr Tenant-Manager hat gegebenenfalls weitere Hinweise zu den Nutzungsbedingungen und Datenschutzhinweisen des jeweiligen KI-Tools in der Spalte "Infolink" hinterlegt.';
$string['privacy_terms_description'] = 'Im Folgenden finden Sie Hinweise zu Datenschutz und Nutzungsbedingungen in der exakten Form, wie Sie sie vor der Nutzung der KI-Funktionalitäten bestätigt haben/bestätigen müssen.';
$string['privacy_terms_heading'] = 'Datenschutz und Nutzungsbedingungen';
$string['privacy_terms_missing'] = 'Es wurden keine Hinweise zu Datenschutz und Nutzungsbedingungen hinterlegt.';
$string['privacy_terms_missing_enable_anyway'] = 'Aktivieren Sie den folgenden Schalter, um die KI-Funktionalitäten nutzen zu können.';
$string['purpose'] = 'Einsatzzweck';
$string['purposesdescription'] = 'Welches Ihrer konfigurierten KI-Tools soll für welchen Einsatzzweck eingesetzt werden?';
$string['purposesheading'] = 'Einsatzzwecke ({$a->currentcount}/{$a->maxcount} zugewiesen)';
Expand Down Expand Up @@ -195,7 +198,6 @@
$string['use_openai_by_azure_heading'] = 'Verwende OpenAI via Azure';
$string['use_openai_by_azure_name'] = 'Name der Azure-Resource';
$string['userconfig'] = 'Benutzereinstellungen';
$string['userconfirmation_description'] = 'Mit Aktivieren des folgenden Schalters akzeptieren Sie die zusätzlichen Nutzungsbedingungen hinsichtlich der Nutzung der KI-Dienste innerhalb der Moodle-Instanz:';
$string['userconfirmation_headline'] = 'KI-Nutzung bestätigen';
$string['userstatistics'] = 'Benutzerübersicht';
$string['userstatusupdated'] = 'Der Status des Benutzers/der Benutzer wurde aktualisiert';
Expand Down
4 changes: 3 additions & 1 deletion lang/en/local_ai_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@
$string['preconfiguredmodel'] = 'Preconfigured model';
$string['privacy:metadata'] = 'The local ai_manager plugin does not store any personal data.';
$string['privacy_table_description'] = 'In the table below, you can see an overview of the AI tools configured by your school. Your ByCS admin may have provided additional notes on the terms of use and privacy notices of the respective AI tools in the "Info link" column.';
$string['privacy_terms_description'] = 'Following are the notes about data privacy and terms of use in the exact same form like you confirmed or still have to confirm to use the AI functionalities.';
$string['privacy_terms_heading'] = 'Privacy and Terms of Use';
$string['privacy_terms_missing'] = 'No terms of use have been specified.';
$string['privacy_terms_missing_enable_anyway'] = 'Please enable the following switch to be able to use the AI functionalities.';
$string['purpose'] = 'Purpose';
$string['purposesdescription'] = 'Which of your configured AI tools should be used for which purpose?';
$string['purposesheading'] = 'Purposes ({$a->currentcount}/{$a->maxcount} assigned)';
Expand Down Expand Up @@ -195,7 +198,6 @@
$string['use_openai_by_azure_heading'] = 'Use OpenAI via Azure';
$string['use_openai_by_azure_name'] = 'Name of the Azure resource';
$string['userconfig'] = 'User configuration';
$string['userconfirmation_description'] = 'By enabling the switch below you accept the additional terms of use related to the usage of the AI tools.';
$string['userconfirmation_headline'] = 'Confirmation for usage of AI tools';
$string['userstatistics'] = 'User overview';
$string['userstatusupdated'] = 'The user\'s/users\' status has been updated';
Expand Down
9 changes: 7 additions & 2 deletions templates/confirm_ai_usage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@
<div class="local_ai_manager-confirm_ai_usage mt-0 mb-5">
<div class="text-center">
<h2 class="p-2 mb-0 pb-0">{{#str}} userconfirmation_headline, local_ai_manager {{/str}}</h2>
<p>{{{termsofuse}}}</p>
<p class="p-3">{{#str}} userconfirmation_description, local_ai_manager {{/str}}</p>
{{#showtermsofuse}}
<p>{{{termsofuse}}}</p>
{{/showtermsofuse}}
{{^showtermsofuse}}
<p>{{#str}}privacy_terms_missing, local_ai_manager{{/str}}</p>
<p>{{#str}}privacy_terms_missing_enable_anyway, local_ai_manager{{/str}}</p>
{{/showtermsofuse}}
</div>
<div class="d-flex justify-content-center m-5">
{{> local_ai_manager/toggle }}
Expand Down
14 changes: 10 additions & 4 deletions templates/purpose_info.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@
</ul>

<h4>{{#str}}privacy_terms_heading, local_ai_manager{{/str}}</h4>
<p>
{{{termsofuse}}}
</p>
<p>{{#str}}privacy_table_description, local_ai_manager{{/str}}</p>
{{#showtermsofuse}}
<p class="alert alert-info">{{#str}}privacy_terms_description, local_ai_manager{{/str}}</p>
<div class="border border-dark m-3 p-3">
{{{termsofuse}}}
</div>
{{/showtermsofuse}}
{{^showtermsofuse}}
<p>{{#str}}privacy_terms_missing, local_ai_manager{{/str}}</p>
{{/showtermsofuse}}
</div>

<p>{{#str}}privacy_table_description, local_ai_manager{{/str}}</p>
<table class="table table-bordered">
<thead>
<tr>
Expand Down

0 comments on commit fcd4a65

Please sign in to comment.