Skip to content
Snippets Groups Projects
Commit a0295735 authored by llaffont's avatar llaffont
Browse files

OsmPlayer peut être utilisé pour autre chose que les albums

parent 4882456f
Branches
Tags
No related merge requests found
......@@ -2215,6 +2215,7 @@ library/ZendAfi/View/Helper/Album/BookJsonVisitor.php -text
library/ZendAfi/View/Helper/Album/BookJsonVisitorAbstract.php -text
library/ZendAfi/View/Helper/Album/BookMonoJsonVisitor.php -text
library/ZendAfi/View/Helper/Album/JsonVisitor.php -text
library/ZendAfi/View/Helper/Album/OsmPlayer.php -text
library/ZendAfi/View/Helper/Album/RssFeedVisitor.php -text
library/ZendAfi/View/Helper/Album/XspfPlaylistVisitor.php -text
library/ZendAfi/View/Helper/AlbumRessourceInfos.php -text
......
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 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).
*
* AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Album_OsmPlayer extends Zend_View_Helper_HtmlElement {
public function album_osmPlayer($album) {
$div_id = 'osmplayer'.$album->getId();
$xspf_url = $this->view->url(['module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'album-xspf-playlist',
'id' => $album->getId()]);
$podcast_url = $this->view->url(['module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'album-rss-feed',
'id' => $album->getId()]);
$this->view->osmPlayer('#'.$div_id,
['playlist' => $xspf_url.'.xml',
'height' => '500px']);
return '<ul>'
.'<li>'.$this->view->tagAnchor($this->view->absoluteUrl($xspf_url.'.xspf'),
$this->view->_('Téléchargez la playlist (VLC, WinAmp)'),
['data-ajax' => 'false']).'</li>'
.'<li>'.$this->view->tagAnchor($this->view->absoluteUrl($podcast_url.'.xml'),
$this->view->_('Podcastez l\'album (iTunes, Lecteur RSS)'),
['data-ajax' => 'false']).'</li>'
.'</ul>'
.'<div id="'.$div_id.'"></div>';
}
}
?>
\ No newline at end of file
......@@ -20,10 +20,24 @@
*/
class ZendAfi_View_Helper_OsmPlayer extends Zend_View_Helper_HtmlElement {
public function osmPlayer($album) {
$loader = Class_ScriptLoader::getInstance();
$div_id = 'osmplayer'.$album->getId();
/**
* Exemple:
* $this->osmPlayer("audio.mytag", ['width' => '100%', 'height' => '200px']);
* Voir: http://mediafront.org/osmplayer/index.html
*/
public function osmPlayer($selector, $options) {
$options = array_merge($options,
['swfplayer' => URL_ADMIN_JS.'osmplayer/minplayer/flash/minplayer.swf',
'logo' => URL_ADMIN_JS.'osmplayer/logo.png']);
$this->loadJS()->addJQueryReady(sprintf('$("%s").osmplayer(%s)',
$selector,
json_encode($options)));
}
public function loadJS() {
$loader = Class_ScriptLoader::getInstance();
foreach(['compatibility', 'flags', 'async', 'plugin', 'display'] as $js)
$loader->addAdminScript('osmplayer/minplayer/src/minplayer.'.$js);
......@@ -45,37 +59,6 @@ class ZendAfi_View_Helper_OsmPlayer extends Zend_View_Helper_HtmlElement {
foreach(['controller', 'pager', 'playLoader', 'playlist', 'teaser'] as $template)
$loader->addAdminScript('osmplayer/templates/default/js/osmplayer.'.$template.'.default.js');
$xspf_url = $this->view->url(['module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'album-xspf-playlist',
'id' => $album->getId()]);
$podcast_url = $this->view->url(['module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'album-rss-feed',
'id' => $album->getId()]);
$loader
->addStyleSheet(URL_ADMIN_JS.'osmplayer/templates/default/css/osmplayer_default.css')
->addJQueryReady(sprintf('$("#%s").osmplayer(%s)',
$div_id,
json_encode(['playlist' => $xspf_url.'.xml',
'height' => '500px',
'swfplayer' => URL_ADMIN_JS.'osmplayer/minplayer/flash/minplayer.swf',
'logo' => URL_ADMIN_JS.'osmplayer/logo.png'])
));
return '<ul>'
.'<li>'.$this->view->tagAnchor($this->view->absoluteUrl($xspf_url.'.xspf'),
$this->view->_('Téléchargez la playlist (VLC, WinAmp)'),
['data-ajax' => 'false']).'</li>'
.'<li>'.$this->view->tagAnchor($this->view->absoluteUrl($podcast_url.'.xml'),
$this->view->_('Podcastez l\'album (iTunes, Lecteur RSS)'),
['data-ajax' => 'false']).'</li>'
.'</ul>'
.'<div id="'.$div_id.'"></div>';
return $loader->addStyleSheet(URL_ADMIN_JS.'osmplayer/templates/default/css/osmplayer_default.css');
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class ZendAfi_View_Helper_RenderAlbum extends Zend_View_Helper_HtmlElement {
return $this->view->tagSlideshow($album);
if ($album->isDiaporama())
return $this->view->osmPlayer($album);
return $this->view->album_OsmPlayer($album);
if ($album->isGallica())
return $this->view->gallicaPlayer($album);
......
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