Skip to content
Snippets Groups Projects
Commit 16169611 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #75882 add codif langue

parent 954b5a90
Branches
Tags
3 merge requests!2711Dev#75882 minsoc faire des filtres sur des facettes et des domaines au moment de la recherche s2,!2707Tessadoc lost pass,!2699Dev#75882 minsoc faire des filtres sur des facettes et des domaines au moment de la recherche s2
Pipeline #4378 passed with stage
in 36 minutes and 31 seconds
<?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 Admin_LanguageBrowserController extends ZendAfi_Controller_Action {
public function getPlugins() {
return ['ZendAfi_Controller_Plugin_ResourceDefinition_Language'];
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
* 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
......@@ -16,20 +16,18 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPAC3 : Liste des langues dans cosmogramme
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Class_CodifLangue extends Storm_Model_Abstract {
use Trait_Facetable;
const CODE_FACETTE = 'L';
protected $_table_name = 'codif_langue';
protected $_table_primary = 'id_langue';
public static function getLoader() {
return self::getLoaderFor(__CLASS__);
}
/**
* @param Array langues
......@@ -50,6 +48,9 @@ class Class_CodifLangue extends Storm_Model_Abstract {
public static function allByIdLibelle() {
return self::toIdLibelleArray(self::getLoader()->findAllBy(array('order' => 'libelle')));
}
}
?>
public function getCategorie() {
return;
}
}
......@@ -37,11 +37,15 @@ class ZendAfi_Controller_Action_Helper_CodificationListViewMode
(new Class_CodifEmplacement)
->setLibelle($this->_('Emplacements'))
->setController('location-browser'),
(new Class_CodifLangue)
->setLibelle($this->_('Langues'))
->setController('language-browser'),
(new Class_CodifThesaurus)
->setLibelle($this->_('Thesaurus'))
->setController('thesauri')];
}
public function codificationListViewMode($params) {
$this->_params = $params;
return $this;
......
<?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_Controller_Action_Helper_LanguageListViewMode
extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
public function languageListViewMode($params) {
$this->_params = $params;
return $this;
}
public function direct($params) {
return $this->languageListViewMode($params);
}
protected function _describeCategoriesIn($description) {
return $description;
}
protected function _describeItemsIn($description) {
return $description
->addColumn($this->_('Libellé'), ['attribute' => 'libelle',
'callback' => function($model, $attrib)
{
return $this->_renderItem($model, $attrib);
}])
->addColumn($this->_('Code facette'), ['attribute' => 'facet_code',
'sort_attribute' => 'id_langue'])
->setSorterServer();
}
public function getBreadcrumb() {
return [['url' => ['module' => 'admin',
'controller' => 'codification-browser',
'action' => 'index'],
'label' => $this->_('Racine'),
'options' => []],
['url' => ['module' => 'admin',
'controller' => 'language-browser',
'action' => 'index'],
'label' => $this->_('Langues'),
'options' => []]];
}
public function getBaseUrl() {
return ['module' => 'admin',
'controller' => 'language-browser',
'action' => 'index'];
}
public function getItems() {
$default_params = ['limitPage' => [$this->getPage(), $this->_items_by_page],
'order' => $this->getOrder()];
$params = $this->isSearching()
? $this->getSearchParams()
: [];
return Class_CodifLangue::findAllBy(array_merge($params, $default_params));
}
public function getSearchColumns() {
return ['libelle',
'id_langue'];
}
protected function enabledSorter() {
return false;
}
public function countItemsFor($model) {
return Class_CodifLangue::count();
}
public function getCountSearchResult() {
$params = array_merge($this->getItemsParams(),
$this->getSearchParams());
unset($params['limitPage']);
return Class_CodifLangue::countBy($params);
}
public function getOrder() {
return $this->getParam('order', 'libelle');
}
}
\ No newline at end of file
<?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_Controller_Plugin_ResourceDefinition_Language
extends ZendAfi_Controller_Plugin_ResourceDefinition_Abstract {
public function getDefinitions() {
return
['model' => ['class' => 'Class_CodifLangue',
'name' => 'langue',
'order' => 'libelle'],
'listViewMode' => ['helper_method' => 'languageListViewMode'],
'actions' => ['index' => ['title' => $this->_('Parcourir les langues')]]];
}
public function getActions($model) {
if(!$model)
return [];
return [
['url' => $this->_view->url(['module' => 'opac',
'controller' => 'recherche',
'action' => 'simple',
'facette' => $model->getFacetCode()
],
null,
true),
'icon' => 'view',
'label' => $this->_('Voir les documents qui ont la facette "%s"',$model->getFacetCode()),
'anchorOptions' => ['target' => '_blank']
]];
}
}
\ No newline at end of file
......@@ -35,7 +35,8 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
return [['thesauri', 'Thesaurus'],
['author-browser', 'Auteurs'],
['location-browser', 'Emplacements'],
['site-browser', 'Annexes']];
['site-browser', 'Annexes'],
['language-browser', 'Langues']];
}
......@@ -133,3 +134,12 @@ class CodificationBrowserSiteSimpleIndexTest extends CodificationBrowserSimpleIn
$_model = 'Class_CodifAnnexe',
$_attribs = ['id' => 5, 'libelle' => 'MySuperSite', 'regles' => '784$v=TOTO'];
}
class CodificationBrowserLanguageSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'language-browser',
$_model = 'Class_CodifLangue',
$_attribs = ['id' => 6, 'libelle' => 'MySuperLangue', 'regles' => '784$v=TOTO'];
}
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