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

dev #75882 add codif annexe

parent ff433deb
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 #4376 failed with stage
in 36 minutes and 11 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_SiteBrowserController extends ZendAfi_Controller_Action {
public function getPlugins() {
return ['ZendAfi_Controller_Plugin_ResourceDefinition_Site'];
}
}
\ No newline at end of file
......@@ -50,7 +50,7 @@ class CodifAnnexeLoader extends Storm_Model_Loader {
class Class_CodifAnnexe extends Storm_Model_Abstract {
use Trait_Translator;
use Trait_Translator, Trait_Facetable;
const CODE_FACETTE = 'Y';
......@@ -123,6 +123,11 @@ class Class_CodifAnnexe extends Storm_Model_Abstract {
public function asFacet() {
return static::CODE_FACETTE.$this->getCode();
return static::CODE_FACETTE . $this->getCode();
}
public function getCategorie() {
return;
}
}
......@@ -64,11 +64,10 @@ class ZendAfi_Controller_Action_Helper_CodificationListViewMode extends ZendAfi_
public function getCategories() {
return [
return [(new Class_CodifAnnexe)->setLibelle($this->_('Annexes')),
(new Class_CodifAuteur)->setLibelle($this->_('Auteurs')),
(new Class_CodifEmplacement)->setLibelle($this->_('Emplacements')),
(new Class_CodifThesaurus)->setLibelle($this->_('Thesaurus')),
];
(new Class_CodifThesaurus)->setLibelle($this->_('Thesaurus'))];
}
......@@ -93,6 +92,10 @@ class ZendAfi_Controller_Action_Helper_CodificationListViewMode extends ZendAfi_
return ['module' => 'admin',
'controller' => 'location-browser'];
if($model instanceof Class_CodifAnnexe)
return ['module' => 'admin',
'controller' => 'site-browser'];
return [];
}
}
\ 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_Action_Helper_SiteListViewMode extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
public function siteListViewMode($params) {
$this->_params = $params;
return $this;
}
public function direct($params) {
return $this->siteListViewMode($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_annexe'])
->setSorterServer();
}
public function getBreadcrumb() {
return [['url' => ['module' => 'admin',
'controller' => 'codification-browser',
'action' => 'index'],
'label' => $this->_('Racine'),
'options' => []],
['url' => ['module' => 'admin',
'controller' => 'site-browser',
'action' => 'index'],
'label' => $this->_('Annexes'),
'options' => []]];
}
public function getBaseUrl() {
return ['module' => 'admin',
'controller' => 'site-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_CodifAnnexe::findAllBy(array_merge($params, $default_params));
}
public function getSearchColumns() {
return ['libelle',
'id_annexe'];
}
protected function enabledSorter() {
return false;
}
public function countItemsFor($model) {
return Class_CodifAnnexe::count();
}
public function getCountSearchResult() {
$params = array_merge($this->getItemsParams(),
$this->getSearchParams());
unset($params['limitPage']);
return Class_CodifAnnexe::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_Site extends ZendAfi_Controller_Plugin_ResourceDefinition_Abstract {
public function getDefinitions() {
return
['model' => ['class' => 'Class_CodifAnnexe',
'name' => 'site',
'order' => 'libelle'],
'listViewMode' => ['helper_method' => 'siteListViewMode'],
'actions' => ['index' => ['title' => $this->_('Parcourir les annexes')]]];
}
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
......@@ -34,7 +34,8 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
public function datas() {
return [['thesauri', 'Thesaurus'],
['author-browser', 'Auteurs'],
['location-browser', 'Emplacements']];
['location-browser', 'Emplacements'],
['site-browser', 'Annexes']];
}
......@@ -55,12 +56,16 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
abstract class CodificationBrowserSimpleIndexTestCase extends Admin_AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_item,
$_model, $_attribs, $_controller;
$_model,
$_attribs,
$_controller;
public function setUp() {
parent::setUp();
......@@ -91,6 +96,7 @@ abstract class CodificationBrowserSimpleIndexTestCase extends Admin_AbstractCont
class CodificationBrowserAuthorSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'author-browser',
......@@ -100,6 +106,7 @@ class CodificationBrowserAuthorSimpleIndexTest extends CodificationBrowserSimple
class CodificationBrowserThesauriSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'thesauri',
......@@ -110,9 +117,19 @@ class CodificationBrowserThesauriSimpleIndexTest extends CodificationBrowserSimp
}
class CodificationBrowserLocationSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'location-browser',
$_model = 'Class_CodifEmplacement',
$_attribs = ['id' => 5, 'libelle' => 'MySuperLocation', 'regles' => '784$v=TOTO'];
}
class CodificationBrowserSiteSimpleIndexTest extends CodificationBrowserSimpleIndexTestCase {
protected
$_controller = 'site-browser',
$_model = 'Class_CodifAnnexe',
$_attribs = ['id' => 5, 'libelle' => 'MySuperSite', '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