Skip to content
Snippets Groups Projects
Commit b026cf48 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Remove deprecated use of translations

parent 95ce1c10
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// default theme // default theme
$this->includeAtTemplateBase('includes/header.php'); $this->includeAtTemplateBase('includes/header.php');
?> ?>
<!-- <h2><?php if (isset($this->data['header'])) { echo $this->t($this->data['header']); } else { echo "Some error occurred"; } ?></h2> -->
<h2><?php echo $this->t('{consentAdmin:consentadmin:consentadmin_header}') ?></h2> <h2><?php echo $this->t('{consentAdmin:consentadmin:consentadmin_header}') ?></h2>
<p> <p>
<?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description1}') ?> </p> <?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description1}') ?> </p>
......
<?php <?php
print $this->t($this->data['res']); echo $res;
{% block content} {% block content}
{{ res|trans }} {{ res }}
{% endblock %} {% endblock %}
...@@ -167,6 +167,9 @@ $hashed_user_id = \SimpleSAML\Module\consent\Auth\Process\Consent::getHashedUser ...@@ -167,6 +167,9 @@ $hashed_user_id = \SimpleSAML\Module\consent\Auth\Process\Consent::getHashedUser
// If a checkbox have been clicked // If a checkbox have been clicked
if ($action !== null && $sp_entityid !== null) { if ($action !== null && $sp_entityid !== null) {
// init template to enable translation of status messages
$template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadminajax.php', 'consentAdmin:consentadmin');
// Get SP metadata // Get SP metadata
$sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote'); $sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote');
...@@ -178,9 +181,9 @@ if ($action !== null && $sp_entityid !== null) { ...@@ -178,9 +181,9 @@ if ($action !== null && $sp_entityid !== null) {
if ($action == 'true') { if ($action == 'true') {
$isStored = $consent_storage->saveConsent($hashed_user_id, $targeted_id, $attribute_hash); $isStored = $consent_storage->saveConsent($hashed_user_id, $targeted_id, $attribute_hash);
if ($isStored) { if ($isStored) {
$res = "added"; $res = $translator->t("added");
} else { } else {
$res = "updated"; $res = $translator->t("updated");
} }
// Remove consent // Remove consent
} else { } else {
...@@ -188,16 +191,14 @@ if ($action !== null && $sp_entityid !== null) { ...@@ -188,16 +191,14 @@ if ($action !== null && $sp_entityid !== null) {
// Got consent, so this is a request to remove it // Got consent, so this is a request to remove it
$rowcount = $consent_storage->deleteConsent($hashed_user_id, $targeted_id); $rowcount = $consent_storage->deleteConsent($hashed_user_id, $targeted_id);
if ($rowcount > 0) { if ($rowcount > 0) {
$res = "removed"; $res = $translator->t("removed");
} }
// Unknown action (should not happen) // Unknown action (should not happen)
} else { } else {
\SimpleSAML\Logger::info('consentAdmin: unknown action'); \SimpleSAML\Logger::info('consentAdmin: unknown action');
$res = "unknown"; $res = $translator->t("unknown");
} }
} }
// init template to enable translation of status messages
$template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadminajax.php', 'consentAdmin:consentadmin');
$template->data['res'] = $res; $template->data['res'] = $res;
$template->show(); $template->show();
exit; exit;
......
<?php <?php
if(!array_key_exists('header', $this->data)) { $this->data['header'] = $this->t('selectidp');
$this->data['header'] = 'selectidp';
}
$this->data['header'] = $this->t($this->data['header']);
$this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE); $this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE);
$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('discopower/style.css') . '" />'; $this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('discopower/style.css') . '" />';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment