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

dev #75882 add codif section

parent 16169611
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 #4379 passed with stage
in 35 minutes and 58 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_SectionBrowserController extends ZendAfi_Controller_Action {
public function getPlugins() {
return ['ZendAfi_Controller_Plugin_ResourceDefinition_Section'];
}
}
\ No newline at end of file
......@@ -25,5 +25,4 @@ class Cosmo_SectionController extends ZendAfi_Controller_Action {
return ['ZendAfi_Controller_Plugin_ResourceDefinition_Section',
'ZendAfi_Controller_Plugin_Manager_Section'];
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -56,4 +56,9 @@ class Class_CodifSection extends Storm_Model_Abstract {
protected $_table_primary = 'id_section';
protected $_default_attribute_values = ['invisible' => 0];
}
public function getCategorie() {
return;
}
}
\ No newline at end of file
......@@ -31,15 +31,23 @@ class ZendAfi_Controller_Action_Helper_CodificationListViewMode
$this->_categories = [(new Class_CodifAnnexe)
->setLibelle($this->_('Annexes'))
->setController('site-browser'),
(new Class_CodifAuteur)
->setLibelle($this->_('Auteurs'))
->setController('author-browser'),
(new Class_CodifEmplacement)
->setLibelle($this->_('Emplacements'))
->setController('location-browser'),
(new Class_CodifLangue)
->setLibelle($this->_('Langues'))
->setController('language-browser'),
(new Class_CodifSection)
->setLibelle($this->_('Sections'))
->setController('section-browser'),
(new Class_CodifThesaurus)
->setLibelle($this->_('Thesaurus'))
->setController('thesauri')];
......
<?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_SectionListViewMode
extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
public function sectionListViewMode($params) {
$this->_params = $params;
return $this;
}
public function direct($params) {
return $this->sectionListViewMode($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_section'])
->setSorterServer();
}
public function getBreadcrumb() {
return [['url' => ['module' => 'admin',
'controller' => 'codification-browser',
'action' => 'index'],
'label' => $this->_('Racine'),
'options' => []],
['url' => ['module' => 'admin',
'controller' => 'section-browser',
'action' => 'index'],
'label' => $this->_('Sections'),
'options' => []]];
}
public function getBaseUrl() {
return ['module' => 'admin',
'controller' => 'section-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_CodifSection::findAllBy(array_merge($params, $default_params));
}
public function getSearchColumns() {
return ['libelle',
'id_section'];
}
protected function enabledSorter() {
return false;
}
public function countItemsFor($model) {
return Class_CodifSection::count();
}
public function getCountSearchResult() {
$params = array_merge($this->getItemsParams(),
$this->getSearchParams());
unset($params['limitPage']);
return Class_CodifSection::countBy($params);
}
public function getOrder() {
return $this->getParam('order', 'libelle');
}
}
\ No newline at end of file
......@@ -32,5 +32,4 @@ class ZendAfi_Controller_Plugin_Manager_Section extends ZendAfi_Controller_Plugi
'icon' => 'delete',
'label' => $this->_('Supprimer')]];
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -315,7 +315,9 @@ abstract class ZendAfi_Controller_Plugin_ResourceDefinition_Abstract extends Zen
protected function _isListViewModeEnabled() {
return isset($this->_attribs['listViewMode']) && $this->_attribs['listViewMode'];
return isset($this->_attribs['listViewMode'])
&& $this->_attribs['listViewMode']
&& ('cosmo' != $this->_request->getModuleName());
}
......
......@@ -28,11 +28,31 @@ class ZendAfi_Controller_Plugin_ResourceDefinition_Section extends ZendAfi_Contr
'order' => 'libelle',
'model_id' => 'id_section'],
'listViewMode' => ['helper_method' => 'sectionListViewMode'],
'messages' => ['successful_save' => $this->_('La section "%s" a été modifée'),
'successful_add' => $this->_('La section "%s" a été ajoutée'),
'successful_delete' => $this->_('La section "%s" a été suppriméee')],
'form_class_name' => 'ZendAfi_Form_Admin_Section'];
}
}
?>
\ No newline at end of file
public function getActions($model) {
if( (!$model) || ('cosmo' == $this->_request->getModuleName()))
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
......@@ -36,7 +36,8 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
['author-browser', 'Auteurs'],
['location-browser', 'Emplacements'],
['site-browser', 'Annexes'],
['language-browser', 'Langues']];
['language-browser', 'Langues'],
['section-browser', 'Sections']];
}
......@@ -141,5 +142,14 @@ class CodificationBrowserLanguageSimpleIndexTest extends CodificationBrowserSimp
protected
$_controller = 'language-browser',
$_model = 'Class_CodifLangue',
$_attribs = ['id' => 6, 'libelle' => 'MySuperLangue', 'regles' => '784$v=TOTO'];
$_attribs = ['id' => 6, 'libelle' => 'MySuperLangue'];
}
class CodificationBrowserSectionSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'section-browser',
$_model = 'Class_CodifSection',
$_attribs = ['id' => 6, 'libelle' => 'MySuperSection', '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