Skip to content
Snippets Groups Projects
Commit 22502c76 authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #37440 : fix RT

parent 7e17b93e
Branches
Tags
10 merge requests!1587Master,!1553Master,!1519Master,!1505Stable,!1502Master,!1501Stable,!1491Master,!1490Hotline master,!1489Stable,!1466Dev#37440 lien 1d touch versions
- ticket #37440 : lien 1D Touch : modification de l'url de destination via une variable de configuration
- ticket #37440 : SSO 1DTouch : Prise en charge de la nouvelle adresse de ce fournisseur
......@@ -256,10 +256,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'ONEDTOUCH_URL' => Class_AdminVar_Meta::newDefault($this->_('Adresse du serveur OAI 1D touch'))->bePrivate(),
'ONEDTOUCH_VERSION_URL' => Class_AdminVar_Meta::newCombo( $this->_('Type de SSO OneDTouch'),
['options' => ['selectOptions' => ['label' => $this->_('Version'),
'multioptions' => [Class_OneDTouchLink::NEW_VERSION => 'Nouvelle version',
Class_OneDTouchLink::OLD_VERSION => 'Ancienne version']]]])->bePrivate(),
'multioptions' => (new Class_OneDTouchLink())->getVersionOptions()]]])->bePrivate(),
'ONEDTOUCH_ID' => Class_AdminVar_Meta::newDefault($this->_('Identifiant du portail chez 1D touch'))->bePrivate(),
......
......@@ -21,31 +21,40 @@
class Class_OneDTouchLink {
use Trait_Translator;
const BASE_URL = 'http://music.1dtouch.com/';
const NEW_VERSION='NEW';
const OLD_VERSION='OLD';
public static function urlFor($album) {
if (Class_AdminVar::isOneDTouchSso())
return static::ssoUrlFor($album);
const NEW_VERSION = 'NEW';
const OLD_VERSION = 'OLD';
public function urlFor($album) {
return static::BASE_URL
. (Class_AdminVar::isOneDTouchSso() ? $this->ssoUrlFor($album) : $this->simpleUrlFor($album));
}
return sprintf(static::simpleUrlPattern(), $album->getIdOrigine());
protected function simpleUrlFor($album) {
return 'albums/' . $album->getIdOrigine();
}
public static function ssoUrlFor($album) {
return sprintf(static::ssoUrlPattern(), Class_AdminVar::get('ONEDTOUCH_ID'), $album->getIdOrigine());
protected function ssoUrlFor($album) {
return $this->ssoUrl() . $this->simpleUrlFor($album);
}
public static function simpleUrlPattern() {
return static::BASE_URL . 'albums/%s';
protected function ssoUrl() {
$id = Class_AdminVar::get('ONEDTOUCH_ID');
return (static::OLD_VERSION == Class_AdminVar::get('ONEDTOUCH_VERSION_URL'))
? 'users/auth/' . $id . '?dest='
: 'users/auth/afi?bibid=' . $id. '&dest=';
}
public static function ssoUrlPattern() {
if (Class_AdminVar::get('ONEDTOUCH_VERSION_URL') == self::NEW_VERSION)
return static::BASE_URL . 'users/auth/afi?bibid=%s&dest=albums/%s';
return static::BASE_URL . 'users/auth/%s?dest=albums/%s';
public function getVersionOptions() {
return [static::NEW_VERSION => $this->_('Nouvelle version'),
static::OLD_VERSION => $this->_('Ancienne version')];
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ class ZendAfi_View_Helper_TagOneDTouch extends ZendAfi_View_Helper_BaseHelper {
public function tagOneDTouch($album) {
return $this->_tag('a',
$this->_('Écouter l\'album sur 1DTouch'),
['href' => Class_OneDTouchLink::urlFor($album)]);
['href' => (new Class_OneDTouchLink())->urlFor($album)]);
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment