From 55a0e265de825e3044f10dd269558bbd3198d3d1 Mon Sep 17 00:00:00 2001
From: efalcy <efalcy@afi-sa.fr>
Date: Wed, 27 Sep 2017 16:17:32 +0200
Subject: [PATCH] dev #65027 : Skilleos : missing files

---
 .../Skilleos/View/Helper/Album.php            | 47 +++++++++++++++++++
 .../Skilleos/tests/token.json                 |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 library/digital_resources/Skilleos/View/Helper/Album.php
 create mode 100644 library/digital_resources/Skilleos/tests/token.json

diff --git a/library/digital_resources/Skilleos/View/Helper/Album.php b/library/digital_resources/Skilleos/View/Helper/Album.php
new file mode 100644
index 00000000000..9acc1c8e527
--- /dev/null
+++ b/library/digital_resources/Skilleos/View/Helper/Album.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
+ * the Free Software Foundation.
+ *
+ * There are special exceptions to the terms and conditions of the AGPL as it
+ * is applied to this software (see README file).
+ *
+ * BOKEH is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * along with BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+class Skilleos_View_Helper_Album extends ZendAfi_View_Helper_TagRessourceNumerique {
+  protected $_album;
+
+  public function album($album) {
+    $this->_album = $album;
+
+    $url = $this->view->url(['module' => 'opac',
+                             'controller' => 'modules',
+                             'action' => 'skilleos',
+                             'album_id' => $album->getId()], null, true);
+
+    if (!$this->canAccessRessourceNumerique())
+      return $this->_tag('p',
+                         $this->view->tagAnchor($url,
+                                                $this->_('Vous devez être connecté sous un compte avec abonnement valide pour pouvoir accéder aux cours')));
+
+    return $this->view->tagAnchor($url,
+                                  $this->_('Accéder à "%s" dans un nouvel onglet', $album->getTitre()),
+                                  ['target' => '_blank']);
+  }
+
+
+  protected function hasRightAccesRessourcesNumeriques($user) {
+    return Skilleos_Config::getInstance()->hasRightAccess($user);
+  }
+}
\ No newline at end of file
diff --git a/library/digital_resources/Skilleos/tests/token.json b/library/digital_resources/Skilleos/tests/token.json
new file mode 100644
index 00000000000..bc06046b824
--- /dev/null
+++ b/library/digital_resources/Skilleos/tests/token.json
@@ -0,0 +1 @@
+{"access_token":"YTEzMDA1M2Q1ZGRmYmE0YjJkNWQ3MGY3ZGUyYTI3ZWJkMjBjOGI2NzIzMDIzMDc0MDAyYTE0NGJjMTRmMzkzMg","expires_in":3600,"token_type":"bearer","scope":null}
-- 
GitLab