Kiosque.php 2.83 KB
Newer Older
1 2 3 4
<?php
/**
 * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
 *
Laurent's avatar
Laurent committed
5
 * BOKEH is free software; you can redistribute it and/or modify
6 7 8 9 10 11
 * 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).
 *
Laurent's avatar
Laurent committed
12
 * BOKEH is distributed in the hope that it will be useful,
13 14 15 16 17
 * 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
Laurent's avatar
Laurent committed
18
 * along with BOKEH; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
20 21
 */
class ZendAfi_View_Helper_Telephone_Kiosque extends ZendAfi_View_Helper_Accueil_Base {
Patrick Barroca's avatar
Patrick Barroca committed
22 23 24 25 26
  protected function _renderHeadScriptsOn($script_loader) {
    $script_loader
      ->addScript(BASE_URL . '/public/opac/mobile/js/kiosque-slideshow')
      ->addJQueryReady('$(\'#slideshow\').kiosqueSlideshow()')
      ->addInlineStyle('
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#slideshow {
  width: 100%;
  overflow: hidden;
  position: relative; /* or absolute, but not static */
}
#slideshow ul {
  list-style:none;
  width:9999%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  padding:0;
}
#slideshow li {
  height: 100%;
  float: left;
  margin: 0 2px; /* spacing between items */
}
#slideshow li a {
  display:block;
  overflow:hidden;
}

');
Patrick Barroca's avatar
Patrick Barroca committed
52
  }
53 54


Patrick Barroca's avatar
Patrick Barroca committed
55 56
  public function getHtml() {
    $this->titre = $this->preferences['titre'];
57

Patrick Barroca's avatar
Patrick Barroca committed
58
    $notices = $this->_getNotices();
59

Patrick Barroca's avatar
Patrick Barroca committed
60 61
    if (0 == count($notices))
      return $this->getHtmlArray();
62

Patrick Barroca's avatar
Patrick Barroca committed
63
    $_SESSION["recherche"]["retour_liste"] = $_SERVER["REQUEST_URI"];
64

Patrick Barroca's avatar
Patrick Barroca committed
65 66 67 68 69 70 71 72
    $this->contenu .= '<div id="slideshow" style="height:' . $this->preferences['op_hauteur_img'] . 'px"><ul>';
    foreach ($notices as $notice) {
      $this->contenu .= sprintf('<li><a href="%s"><img src="%s" width="%s" title="%s"></a></li>',
                                $this->view->url(['controller' => 'recherche',
                                                  'action' => 'viewnotice',
                                                  'id' => $notice->getId(),
                                                  'type_doc' => $notice->getTypeDoc()],
                                                 null, true),
73
                                $notice->fetchUrlLocalVignette(),
Patrick Barroca's avatar
Patrick Barroca committed
74 75 76
                                $this->preferences["op_largeur_img"],
                                htmlentities($notice->getTitrePrincipal()));
    }
77

Patrick Barroca's avatar
Patrick Barroca committed
78 79 80
    $this->contenu .= '</ul></div>';
    return $this->getHtmlArray();
  }
81 82


Patrick Barroca's avatar
Patrick Barroca committed
83 84 85
  protected function _getNotices() {
    return Class_Catalogue::getLoader()->getNoticesByPreferences($this->preferences, 'url');
  }
86
}