diff --git a/library/Class/ListViewModeDescription/Thesauri.php b/library/Class/ListViewModeDescription/Thesauri.php index c1e814b96b3acb14a6566a728481fc32c50fc71f..c175457defd48f06bb6be7ff3ebd0ca2d56c9744 100644 --- a/library/Class/ListViewModeDescription/Thesauri.php +++ b/library/Class/ListViewModeDescription/Thesauri.php @@ -41,14 +41,8 @@ class Class_ListViewModeDescription_Thesauri { 'model' => $this->_getModel(), 'search_columns' => $this->_getSearchColumns(), - 'categories_description' => function($description, $list_view_mode) - { - return $this->_describeCategoriesIn($description, $list_view_mode); - }, - 'items_description' => function($description, $list_view_mode) - { - return $this->_describeItemsIn($description, $list_view_mode); - }]; + 'categories_description' => [$this, 'describeCategoriesIn'], + 'items_description' => [$this, 'describeItemsIn']]; return $helper->treeCodificationListViewMode($params); } @@ -70,30 +64,25 @@ class Class_ListViewModeDescription_Thesauri { } - protected function _describeCategoriesIn($description, $list_view_mode) { + public function describeCategoriesIn($description, $list_view_mode) { return $description ->addColumn($this->_('Thesaurus'), ['attribute' => 'libelle', - 'callback' => function($model, $attrib) use ($list_view_mode) - { - return $list_view_mode->renderCategory($model, $attrib); - }]) + 'callback' => $list_view_mode->renderCategoryClosure()]) ->addColumn($this->_('Libellé facette'), 'libelle_facette') ->addColumn($this->_('Code facette'), 'facette_index') ->addColumn($this->_('Règle'), 'rules_label'); } - protected function _describeItemsIn($description, $list_view_mode) { + public function describeItemsIn($description, $list_view_mode) { return $description ->addColumn($this->_('Thesaurus'), ['attribute' => 'libelle', - 'callback' => function($model, $attrib) use ($list_view_mode) - { - return $list_view_mode->renderItem($model, $attrib); - }]) + 'callback' => $list_view_mode->renderItemClosure()]) ->addColumn($this->_('Libellé facette'), 'libelle_facette') ->addColumn($this->_('Code facette'), ['attribute' => 'facette_index', 'sort_attribute' => 'id_thesaurus']) - ->addColumn($this->_('Règle'), 'rules_label') + ->addColumn($this->_('Règle'), ['attribute' => 'rules_label', + 'sort_attribute' => 'rules']) ->setSorterServer() ; } diff --git a/library/ZendAfi/Controller/Action/Helper/TreeCodificationListViewMode.php b/library/ZendAfi/Controller/Action/Helper/TreeCodificationListViewMode.php index 84dc6e887687b9182eca903ab46b2c0d08e3208b..2b0233783aacbbbee43de47c7a78595997900ba9 100644 --- a/library/ZendAfi/Controller/Action/Helper/TreeCodificationListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/TreeCodificationListViewMode.php @@ -89,4 +89,18 @@ class ZendAfi_Controller_Action_Helper_TreeCodificationListViewMode extends Zend $callback = $this->getParam('items_description'); return $callback($description, $this); } + + + public function renderCategoryClosure() { + return function($model, $attrib) { + return $this->_renderCategory($model, $attrib); + }; + } + + + public function renderItemClosure() { + return function($model, $attrib) { + return $this->_renderItem($model, $attrib); + }; + } } \ No newline at end of file diff --git a/tests/scenarios/Thesauri/ThesauriTest.php b/tests/scenarios/Thesauri/ThesauriTest.php index 26daaa01b6b9524ba2c9a496a5cdbf872550d8ba..b873bfe16bfe242fa08ada42ae5999621f24245b 100644 --- a/tests/scenarios/Thesauri/ThesauriTest.php +++ b/tests/scenarios/Thesauri/ThesauriTest.php @@ -153,7 +153,7 @@ class ThesauriIndexChildrenSearchTest extends ThesauriTestCase { public function searchShouldRedirect() { $this->postDispatch('/admin/thesauri/index', ['title_search' => 'Docu']); - $this->assertRedirectTo('/admin/thesauri/index/title_search/Docu/page/1/order/libelle'); + $this->assertRedirectTo('/admin/thesauri/index/title_search/Docu/page/1'); }