Skip to content
Snippets Groups Projects
Reviews.php 3.26 KiB
<?php
/**
 * Copyright (c) 2012-2017, 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 ZendAfi_Form_Configuration_Widget_Reviews extends ZendAfi_Form_Configuration_Widget_Base {

  public function init() {
    parent::init();

    $this
      ->addElement('select',
                   'abon_ou_bib',
                   ['label' => $this->_('Origine des critiques'),
                    'value' => 0,
                    'multioptions' => [1 => $this->_('bibliothécaire'),
                                       0 => $this->_('abonné ou utilisateur du site'),
                                       'all' => $this->_('tout le monde')]])
      ->addElement('checkbox',
                   'hierarchical',
                   ['label' => $this->_('Navigation hiérarchique')])

      ->addElement('text',
                   'nb_aff_avis',
                   ['label' => $this->_('Nombre à afficher'),
                    'value' => 2])

      ->addElement('select',
                   'display_order',
                   ['label' => $this->_('Ordre d\'affichage'),
                    'value' => 'Random',
                    'multiOptions' => ['CreationDesc' => $this->_('par date de création (plus récent en premier)'),
                                       'Random' => $this->_('Aléatoire')]])

      ->addElement('text',
                   'nb_words',
                   ['label' => $this->_('Afficher les premiers mots'),
                    'value' => 30])

      ->addElement('select',
                   'only_img',
                   ['label' => $this->_('Filtrer les critiques affichées'),
                    'value' => 1,
                    'multiOptions' => [$this->_('non'),
                                       $this->_('avec une vignette')]]);
  }


  public function populate(array $datas) {
    $this->addElement('domainePanier',
                      'data_source',
                      ['label' => $this->_('Filtrer avec une sélection'),
                       'IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '',
                       'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']);

    $this
      ->addToSelectionGroup(['abon_ou_bib',
                             'only_img',
                             'data_source'])

      ->addToDisplaySettingsGroup(['hierarchical',
                                   'nb_aff_avis',
                                   'display_order',
                                   'nb_words']);

    return parent::populate($datas);
  }
}