From b93437f78b031dcc744a5cd6f7345f3aa9be958a Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 1 Dec 2020 17:36:09 +0100 Subject: [PATCH] hotline MT #122827 add more badges to records in chili theme --- VERSIONS_HOTLINE/122827 | 1 + library/Class/AvisNotice.php | 1 + library/Class/CodifLangue.php | 5 + library/Class/Notice.php | 21 +- library/Class/Template.php | 23 ++ library/templates/Chili/Library/Settings.php | 2 + .../Chili/Library/Wrapper/Record.php | 38 ++- .../Wrapper/Record/RichContent/Related.php | 7 +- library/templates/Chili/Template.php | 7 + .../templates/Chili/View/Jumbotron/Record.php | 5 + .../templates/Chili/View/Search/Result.php | 27 ++ .../templates/Intonation/Library/Settings.php | 15 +- .../Intonation/Library/View/Wrapper/Hold.php | 73 ++--- .../Intonation/Library/View/Wrapper/Loan.php | 4 +- .../Library/View/Wrapper/Record.php | 98 +++--- .../User/RichContent/NewSuggestion.php | 5 +- .../Intonation/Library/View/Wrapper/Work.php | 4 +- .../Library/Widget/Carousel/Record/View.php | 10 + library/templates/Intonation/Template.php | 5 + .../Intonation/View/Author/RenderRecords.php | 9 +- .../Intonation/View/Search/Result.php | 7 +- tests/library/Class/DecodageUnimarcTest.php | 24 +- .../Templates/MyBibAppTemplateTest.php | 1 - .../Templates/TemplatesRecordsTest.php | 292 ++++++++++++++++-- .../Templates/TemplatesSearchTest.php | 1 - 25 files changed, 542 insertions(+), 143 deletions(-) create mode 100644 VERSIONS_HOTLINE/122827 create mode 100644 library/templates/Chili/View/Search/Result.php diff --git a/VERSIONS_HOTLINE/122827 b/VERSIONS_HOTLINE/122827 new file mode 100644 index 00000000000..31f612e73da --- /dev/null +++ b/VERSIONS_HOTLINE/122827 @@ -0,0 +1 @@ + - ticket MT #122827 : Magasin de thèmes : ajout des badges langue, édition et format dans les notices du thème Chili \ No newline at end of file diff --git a/library/Class/AvisNotice.php b/library/Class/AvisNotice.php index 05313e7892e..642059ba207 100644 --- a/library/Class/AvisNotice.php +++ b/library/Class/AvisNotice.php @@ -266,6 +266,7 @@ class Class_AvisNotice extends Storm_Model_Abstract { 'date_avis' => null, 'id_notice' => 0, 'type_doc' => null, + 'source_author' => '', 'avis' => '', 'entete' => '', 'note' => 0, diff --git a/library/Class/CodifLangue.php b/library/Class/CodifLangue.php index 51f2117889f..4115ae4f1c0 100644 --- a/library/Class/CodifLangue.php +++ b/library/Class/CodifLangue.php @@ -53,4 +53,9 @@ class Class_CodifLangue extends Storm_Model_Abstract { public function getCategorie() { return; } + + + public function getLabel() { + return $this->hasLibelle() ? $this->getLibelle() : $this->getId(); + } } diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 795bf7ee829..6389e9c7767 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1375,19 +1375,24 @@ class Class_Notice extends Storm_Model_Abstract { public function getLanguesList() { - $codes = $this->getLangueCodes(); - if (0 == count($codes)) - return array(); + if (!$codes = $this->getLangueCodes()) + return []; + + $langues = []; + foreach (Class_CodifLangue::findAllBy(['id_langue' => $codes]) as $langue) + $langues[$langue->getId()] = $langue->getLabel(); - $langues = array(); - foreach ($codes as $code) { - if ($langue = Class_CodifLangue::getLoader()->find($code)) - $langues[] = ($langue->getLibelle()) ? $langue->getLibelle() : $code; - } return $langues; } + public function getLanguages() { + return ($codes = $this->getLangueCodes()) + ? Class_CodifLangue::findAllBy(['id_langue' => $codes]) + : []; + } + + public function getLangueCodes() { if ($this->_langueCodes) return $this->_langueCodes; diff --git a/library/Class/Template.php b/library/Class/Template.php index e69967f90cd..4241c5921a4 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -605,6 +605,29 @@ class Class_Template { } + public function newWrapper($model, $view) { + $map = $this->_getMapWrapper(); + $class_name = $map[get_class($model)]; + return new $class_name($model, $view); + } + + + public function newWrappers($models, $view) { + $elements = array_map(function($model) use($view) + { + return Class_Template::current()->newWrapper($model, $view); + }, + $models); + + return new Storm_Collection($elements); + } + + + protected function _getMapWrapper() { + return []; + } + + /** * Each template can register other classes for menus * Default values : Class_Systeme_ModulesMenu::MODULES_CLASS_DEFINITION diff --git a/library/templates/Chili/Library/Settings.php b/library/templates/Chili/Library/Settings.php index c8a94e506b4..76360860b01 100644 --- a/library/templates/Chili/Library/Settings.php +++ b/library/templates/Chili/Library/Settings.php @@ -87,6 +87,8 @@ class Chili_Library_Settings extends Intonation_Library_Settings { $hydrating_mapping['a class record_facets'] = 'order-5'; $hydrating_mapping['span class record_facets'] = 'order-6'; $hydrating_mapping['a class record_serie'] = 'badge-white no_truncate order-7'; + $hydrating_mapping['span class badge_record_editor'] = 'no_truncate order-5'; + $hydrating_mapping['a class badge_record_language'] = 'order-5'; $hydrating_mapping['div class left_highlight_column'] = 'col-12 col-md-4 col-lg-5 rounded'; $hydrating_mapping['div class left_carousel_columns'] = 'col-12 col-md-8 col-lg-7'; $hydrating_mapping['div class top_highlight_column'] = 'col-12 rounded'; diff --git a/library/templates/Chili/Library/Wrapper/Record.php b/library/templates/Chili/Library/Wrapper/Record.php index 2b79ddf95cb..cd423350df0 100644 --- a/library/templates/Chili/Library/Wrapper/Record.php +++ b/library/templates/Chili/Library/Wrapper/Record.php @@ -18,9 +18,43 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -namespace Chili\Library\Wrapper; -class Record extends \Intonation_Library_View_Wrapper_Record { +class Chili_Library_Wrapper_Record extends Intonation_Library_View_Wrapper_Record { + protected function _addUnimarcBadges($badges) { + $badges = parent::_addUnimarcBadges($badges); + + $editor = array_filter([$this->_model->getFirstEditeur(), + $this->_model->getCollections(true)]); + + $badges [] = + (new Intonation_Library_Badge) + ->setTag('span') + ->setClass('badge_record_editor') + ->setImage(Class_Template::current() + ->getIco($this->_view, + 'editor', + 'library')) + ->setText(implode(' - ', $editor)); + + foreach($this->_model->getLanguages() as $language) { + $badges [] = + (new Intonation_Library_Badge) + ->setTag('a') + ->setClass('badge_record_language language_' . $language->getId()) + ->setImage(Class_Template::current() + ->getIco($this->_view, + 'language', + 'library')) + ->setText($language->getLabel()) + ->setTitle($this->_('Voir les documents en langue %s', $language->getLabel())) + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'simple', + 'facette' => $language->asFacet()], + null, true)); + } + + return $badges; + } } diff --git a/library/templates/Chili/Library/Wrapper/Record/RichContent/Related.php b/library/templates/Chili/Library/Wrapper/Record/RichContent/Related.php index 13b787b9168..34334206d09 100644 --- a/library/templates/Chili/Library/Wrapper/Record/RichContent/Related.php +++ b/library/templates/Chili/Library/Wrapper/Record/RichContent/Related.php @@ -18,16 +18,17 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + namespace Chili\Library\Wrapper\Record\RichContent; use Intonation\Library\View\Wrapper\Record\RichContent\Related as IntonationRelated; -use Chili\Library\Wrapper\Record; class Related extends IntonationRelated { protected function _renderElementCallback() { return function($record) { - return $this->_view->cardify(new Record($record, $this->_view)); + return $this->_view->cardify(\Class_Template::current()->newWrapper($record, $this->_view)); }; } -} +} \ No newline at end of file diff --git a/library/templates/Chili/Template.php b/library/templates/Chili/Template.php index 352597c046b..bae693708b6 100644 --- a/library/templates/Chili/Template.php +++ b/library/templates/Chili/Template.php @@ -113,4 +113,11 @@ class Chili_Template extends Intonation_Template { return $sections; } + + + protected function _getMapWrapper() { + return + array_merge(parent::_getMapWrapper(), + ['Class_Notice' => 'Chili_Library_Wrapper_Record']); + } } \ No newline at end of file diff --git a/library/templates/Chili/View/Jumbotron/Record.php b/library/templates/Chili/View/Jumbotron/Record.php index 1eb69ae25f6..a430349da37 100644 --- a/library/templates/Chili/View/Jumbotron/Record.php +++ b/library/templates/Chili/View/Jumbotron/Record.php @@ -21,6 +21,11 @@ class Chili_View_Jumbotron_Record extends Intonation_View_Jumbotron_Record { + protected function _getWrappedInstance() { + return new Chili_Library_Wrapper_Record; + } + + protected function _getRichContentInstance() { return new Chili_Library_Wrapper_Record_RichContent; } diff --git a/library/templates/Chili/View/Search/Result.php b/library/templates/Chili/View/Search/Result.php new file mode 100644 index 00000000000..cac33441486 --- /dev/null +++ b/library/templates/Chili/View/Search/Result.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright (c) 2012-2020, 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 Chili_View_Search_Result extends Intonation_View_Search_Result { + protected function _getRecordWrapperClass() { + return Chili_Library_Wrapper_Record::class; + } +} diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index f36bc69d2d5..7f58ac4d525 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -248,7 +248,17 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'span class badge_article_draft' => 'badge-danger', 'a class badge_article_library' => 'badge-primary no_truncate', 'span class badge_article_category' => 'badge-info', - 'span class badge_article_location' => 'badge-secondary no_truncate' + 'span class badge_article_location' => 'badge-secondary no_truncate', + 'a class record_doctype' => 'badge-warning fs_1em', + 'a class badge_bookmarked_library' => 'badge-info', + 'a class record_edition_year' => 'badge-dark', + 'a class record_novelty' => 'badge-secondary', + 'span class record_pro_reviews_count' => 'badge-success', + 'span class record_pro_reviews_average_score' => 'badge-success', + 'span class record_borrower_review_count' => 'badge-info', + 'span class record_borrower_review_average_score' => 'badge-info', + 'a class record_facets' => 'badge-primary', + 'a class record_by_work' => 'badge-light', ], @@ -294,7 +304,8 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'agenda' => 'class fas fa-calendar-alt', 'ical' => 'class far fa-calendar-plus', 'novelty' => 'class far fa-sun', - + 'editor' => 'class fas fa-home', + 'language' => 'class fas fa-globe-africa', ], 'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png', diff --git a/library/templates/Intonation/Library/View/Wrapper/Hold.php b/library/templates/Intonation/Library/View/Wrapper/Hold.php index b27dcb29e32..3bf19958318 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Hold.php +++ b/library/templates/Intonation/Library/View/Wrapper/Hold.php @@ -22,6 +22,9 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapper_Abstract { + protected $_wrapper_cache; + + public function getMainTitle() { $desc = $this->_('Réservé par %s %s', $this->_view->tag('span', @@ -33,9 +36,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return $desc . $this->_model->getTitre(); - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $desc . $wrapper->getMainTitle(); } @@ -45,9 +46,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return $this->_model->getAuteur(); - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getSecondaryTitle(); } @@ -57,9 +56,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return ''; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getPicture(); } @@ -76,9 +73,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return implode($html); - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); $html [] = $wrapper->getDescription(); @@ -87,14 +82,12 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp public function getFullDescription() { - $html = [$this->getBadges()]; + $html = [$this->getBadges()]; if (!$this->_model->getNoticeOPAC()) return implode($html); - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); $html [] = $wrapper->getFullDescription(); @@ -111,9 +104,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return null; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getMainLink(); @@ -133,21 +124,17 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return null; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getSecondaryLink(); } - public function getSecondaryIco() { - if (!$this->_model->getNoticeOPAC()) + public function getSecondaryIco() { + if (!$this->_model->getNoticeOPAC()) return null; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getSecondaryIco(); } @@ -157,9 +144,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return null; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getDocType(); } @@ -169,9 +154,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if (!$this->_model->getNoticeOPAC()) return null; - $wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($this->_model->getNoticeOPAC()); + $wrapper = $this->_getWrapper(); return $wrapper->getDocTypeLabel(); } @@ -209,13 +192,13 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp if ($end_availability = $this->_model->getFormattedAvailabilityEndDate()) $badges []= (new Intonation_Library_Badge) - ->setTag('span') - ->setClass('warning') - ->setImage(Class_Template::current()->getIco($this->_view, - 'library', - 'agenda')) - ->setText($end_availability) - ->setTitle($this->_('Expire le: %s', $end_availability)); + ->setTag('span') + ->setClass('warning') + ->setImage(Class_Template::current()->getIco($this->_view, + 'library', + 'agenda')) + ->setText($end_availability) + ->setTitle($this->_('Expire le: %s', $end_availability)); return $this->_view->renderBadges($badges, $this); } @@ -247,4 +230,14 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp public function getOsmData() { return null; } + + + protected function _getWrapper() { + if ( $this->_wrapper_cache) + return $this->_wrapper_cache; + + return $this->_wrapper_cache = + Class_Template::current()->newWrapper($this->_model->getNoticeOPAC(), $this->_view); + + } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Loan.php b/library/templates/Intonation/Library/View/Wrapper/Loan.php index 50dd7a8b68a..a5827a14f81 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Loan.php +++ b/library/templates/Intonation/Library/View/Wrapper/Loan.php @@ -233,9 +233,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp if (!$db_record = $this->_model->getNoticeOPAC()) return $this->_record = null; - return $this->_record = (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($db_record); + return $this->_record = Class_Template::current()->newWrapper($db_record, $this->_view); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 3ee104191cc..726fd7f94e6 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -140,9 +140,10 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getBadges() { if ($this->_badges) return $this->_badges; + $badges = [((new Intonation_Library_Badge) ->setTag('a') - ->setClass('badge-warning fs_1em record_doctype') + ->setClass('record_doctype') ->setUrl($this->_view->url(['controller' => 'recherche', 'action' => 'simple', 'facette' => Class_CodifTypeDoc::CODE_FACETTE. $this->_model->getTypeDoc(), @@ -156,29 +157,13 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $this->_model->getTypeDocLabel(), $this->_model->getTitrePrincipal(' '))))]; - $badges = $this->_addBookmarkedLibraries($badges, $this->_model); + $badges = $this->_addBookmarkedLibraries($badges); - $badges [] = ((new Intonation_Library_Badge) - ->setTag('a') - ->setClass('badge-dark record_edition_year') - ->setUrl($this->_view->url(['controller' => 'recherche', - 'action' => 'simple', - 'annee_debut' => $this->_model->getAnnee(), - 'page' => null])) - ->setImage(($this->_model->getAnnee() - ? (Class_Template::current() - ->getIco($this->_view, - 'date-edition', - 'library')) - : '')) - ->setText($this->_model->getAnnee()) - ->setTitle($this->_('Affiner le résultat avec la date d\'édition du document %s : %d', - $this->_model->getTitrePrincipal(' '), - $this->_model->getAnnee()))); + $badges = $this->_addUnimarcBadges($badges); $badges [] = ((new Intonation_Library_Badge) ->setTag('a') - ->setClass('badge-secondary record_novelty') + ->setClass('record_novelty') ->setImage(($this->_model->isNouveaute() ? (Class_Template::current() ->getIco($this->_view, @@ -195,20 +180,40 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $badges = $this->_injectReviewsBadgesInto($badges); - $codif = Class_Codification::getInstance(); - foreach($this->_getFacets($this->_model) as $facet) - $badges [] = ((new Intonation_Library_Badge) - ->setTag('a') - ->setClass('badge-primary record_facets record_facet_' . strtolower($codif->getNomChamp($facet->getFacetCode()))) - ->setImage(Class_Template::current()->getIco($this->_view, - 'tag', - 'utils')) - ->setText($facet->getLabel()) - ->setTitle($facet->getTitle()) - ->setUrl($facet->getUrlForLink())); + $badges = $this->_addFacetsBadges($badges); $badges = $this->_addSerieBadges($badges); + $badges = $this->_addSearchByWorkBadges($badges); + + return $this->_badges = $this->_view->renderBadges($badges,$this); + } + + + protected function _addUnimarcBadges($badges) { + $badges [] = (new Intonation_Library_Badge) + ->setTag('a') + ->setClass('record_edition_year') + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'simple', + 'annee_debut' => $this->_model->getAnnee(), + 'page' => null])) + ->setImage(($this->_model->getAnnee() + ? (Class_Template::current() + ->getIco($this->_view, + 'date-edition', + 'library')) + : '')) + ->setText($this->_model->getAnnee()) + ->setTitle($this->_('Affiner le résultat avec la date d\'édition du document %s : %d', + $this->_model->getTitrePrincipal(' '), + $this->_model->getAnnee())); + + return $badges; + } + + + protected function _addSearchByWorkBadges($badges) { if (Class_Template::current()->providesSearchByWork() && 1 < Class_Notice::countBy(['clef_oeuvre' => $this->_model->getClefOeuvre()])) $badges[] = (new Intonation_Library_Badge) @@ -217,10 +222,27 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'action' => 'view', 'id' => $this->_model->getClefOeuvre()], null, true)) - ->setClass('white record_serie') + ->setClass('record_by_work') ->setText($this->_('Voir l\'œuvre')); - return $this->_badges = $this->_view->renderBadges($badges,$this); + return $badges; + } + + + protected function _addFacetsBadges($badges) { + $codif = Class_Codification::getInstance(); + foreach($this->_getFacets($this->_model) as $facet) + $badges [] = ((new Intonation_Library_Badge) + ->setTag('a') + ->setClass('record_facets record_facet_' . strtolower($codif->getNomChamp($facet->getFacetCode()))) + ->setImage(Class_Template::current()->getIco($this->_view, + 'tag', + 'utils')) + ->setText($facet->getLabel()) + ->setTitle($facet->getTitle()) + ->setUrl($facet->getUrlForLink())); + + return $badges; } @@ -373,7 +395,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'action' => 'simple', 'facette' => $match->getLibrary()->getFacetCode(), 'page' => null])) - ->setClass('badge-info') + ->setClass('badge_bookmarked_library') ->setImage(Class_Template::current()->getIco($this->_view, 'library', 'library')) @@ -732,8 +754,8 @@ class Intonation_Library_View_Wrapper_RecordProReviewsBadge parent::__construct($model, $view); $this->_count = $model->numberOfAvisBibliothecaire(); $this->_score = $model->getNoteMoyenneAvisBibliothecaires(); - $this->_count_class = 'success record_pro_reviews_count'; - $this->_score_class = 'success record_pro_reviews_average_score'; + $this->_count_class = 'record_pro_reviews_count'; + $this->_score_class = 'record_pro_reviews_average_score'; } @@ -764,8 +786,8 @@ class Intonation_Library_View_Wrapper_RecordUsersReviewsBadge parent::__construct($model, $view); $this->_count = $model->numberOfAvisAbonne(); $this->_score = $model->getNoteMoyenneAvisAbonnes(); - $this->_count_class = 'info record_borrower_review_count'; - $this->_score_class = 'info record_borrower_review_average_score'; + $this->_count_class = 'record_borrower_review_count'; + $this->_score_class = 'record_borrower_review_average_score'; } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php index 1a1c2670e71..214b54c687f 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php @@ -106,10 +106,7 @@ class Intonation_Library_View_Wrapper_User_RichContent_NewSuggestion extends Int return ''; $callback = function ($record) { - $wrapped = - (new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($record); + $wrapped = Class_Template::current()->newWrapper($record, $this->_view); return $this->_view->cardifyHorizontal($wrapped); }; diff --git a/library/templates/Intonation/Library/View/Wrapper/Work.php b/library/templates/Intonation/Library/View/Wrapper/Work.php index 2fd77e42e2e..704e91cde62 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Work.php +++ b/library/templates/Intonation/Library/View/Wrapper/Work.php @@ -25,9 +25,7 @@ class Intonation_Library_View_Wrapper_Work extends Intonation_Library_View_Wrapp protected function _getRecordWrapper() { if (!$this->_record_wrapper) - $this->_record_wrapper = (new Intonation_Library_View_Wrapper_Record) - ->setModel($this->_model->getRecord()) - ->setView($this->_view); + $this->_record_wrapper = Class_Template::current()->newWrapper($this->_model->getRecord(), $this->_view); return $this->_record_wrapper; } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php index d02ec9b8736..e3a625ceb6b 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php @@ -102,4 +102,14 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_ protected function _getWrapper() { return Intonation_Library_View_Wrapper_Record::class; } + + + protected function _wrapElements($elements) { + return array_map(function($element) + { + return Class_Template::current() + ->newWrapper($element, $this->view) + ->setWidgetContext($this); + }, $elements); + } } diff --git a/library/templates/Intonation/Template.php b/library/templates/Intonation/Template.php index f1fc12337ae..b65f80b120d 100644 --- a/library/templates/Intonation/Template.php +++ b/library/templates/Intonation/Template.php @@ -408,4 +408,9 @@ class Intonation_Template extends Class_Template { $modules_definition['ABON_PRETS'] = Intonation_Library_Menu_AbonnePrets_Definition::class; $modules_definition['ABON_RESAS'] = Intonation_Library_Menu_AbonneReservations_Definition::class; } + + + protected function _getMapWrapper() { + return ['Class_Notice' => 'Intonation_Library_View_Wrapper_Record']; + } } diff --git a/library/templates/Intonation/View/Author/RenderRecords.php b/library/templates/Intonation/View/Author/RenderRecords.php index d2d4bcbd61b..042d8b360cd 100644 --- a/library/templates/Intonation/View/Author/RenderRecords.php +++ b/library/templates/Intonation/View/Author/RenderRecords.php @@ -46,14 +46,7 @@ class Intonation_View_Author_RenderRecords extends ZendAfi_View_Helper_BaseHelpe $type_doc->getLibelle(), $author_description->getLabel())] )); - $elements = array_map(function($element) - { - return (new Intonation_Library_View_Wrapper_Record) - ->setView($this->view) - ->setModel($element); - }, $records); - - $elements = new Storm_Collection($elements); + $elements = Class_Template::current()->newWrappers($records, $this->view); $records = $this->view->renderMultipleCarousel($elements, function($record) { diff --git a/library/templates/Intonation/View/Search/Result.php b/library/templates/Intonation/View/Search/Result.php index e1c7118ce78..e2bbf53254f 100644 --- a/library/templates/Intonation/View/Search/Result.php +++ b/library/templates/Intonation/View/Search/Result.php @@ -28,7 +28,7 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { $this->_wrapper_class = $search->isByWork() ? Intonation_Library_View_Wrapper_Work::class - : Intonation_Library_View_Wrapper_Record::class; + : $this->_getRecordWrapperClass(); $records = array_map([$this, '_wrapperFor'], $records); @@ -194,6 +194,11 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { } + protected function _getRecordWrapperClass() { + return Intonation_Library_View_Wrapper_Record::class; + } + + protected function _wrapperFor($model) { $wrapper_class = $this->_wrapper_class; return (new $wrapper_class) diff --git a/tests/library/Class/DecodageUnimarcTest.php b/tests/library/Class/DecodageUnimarcTest.php index 644fd633ab4..3e112d56cd6 100644 --- a/tests/library/Class/DecodageUnimarcTest.php +++ b/tests/library/Class/DecodageUnimarcTest.php @@ -23,25 +23,28 @@ class DecodageUnimarcDVDLaJeuneFilleTest extends ModelTestCase { public function setUp() { parent::setUp(); - Class_CodifLangue::getLoader() - ->newInstanceWithId('bam') - ->setLibelle(''); - $unimarc=file_get_contents(realpath(dirname(__FILE__)).'../../../fixtures/jeune_fille_dvd.uni'); + $this->fixture('Class_CodifLangue', + ['id' => 'bam', 'libelle' => '']); + + $unimarc = file_get_contents(realpath(dirname(__FILE__)).'../../../fixtures/jeune_fille_dvd.uni'); $this->dvd_jeune_fille = Class_Notice::getLoader() ->newFromRow(array('id_notice' => 3, 'unimarc' => $unimarc)) ->setExemplaires(array()); } + public function testNotesSizeIsTwo() { $this->assertEquals(2, count($this->dvd_jeune_fille->getNotes())); } + public function testNotesContainsDateDeSortie1975() { $this->assertContains("Date de sortie du film : 1975.", $this->dvd_jeune_fille->getNotes()); } + public function testNotesContainsFilmEnBambara() { $this->assertContains("Film en bambara sous-titré en français", $this->dvd_jeune_fille->getNotes()); @@ -59,10 +62,12 @@ class DecodageUnimarcDVDLaJeuneFilleTest extends ModelTestCase { $this->dvd_jeune_fille->getAuteurPrincipal()); } + public function testGetAuteursReturnsFourAuteurs() { $this->assertEquals(4, count($this->dvd_jeune_fille->getAuteursUnimarc())); } + public function testCoulibaliInAuteurs() { $auteurs = $this->dvd_jeune_fille->getAuteursUnimarc(); $this->assertContains('Coulibali|Dounamba Dani', $auteurs); @@ -89,11 +94,13 @@ class DecodageUnimarcDVDLaJeuneFilleTest extends ModelTestCase { $this->dvd_jeune_fille->getCollation()); } + public function testEditeurIsPathe() { $this->assertEquals('Pathé', $this->dvd_jeune_fille->getFirstEditeur()); } + public function testResume() { $this->assertEquals("Sékou est renvoyé de l'usine parce qu'il a osé demander une augmentation. Chômeur, il sort avec Ténin, une jeune fille muette ; il ignore qu'elle est la fille de son ancien patron. Ténin, qui sera violée par Sékou lors d'une sortie entre jeunes, se retrouve enceinte et subit la colère de ses parents. Elle se trouve alors confrontée brutalement à la morale de sa famille et à la lâcheté de Sékou, qui refuse de reconnaiîre l'enfant.", $this->dvd_jeune_fille->getResume()); @@ -131,14 +138,13 @@ class DecodageUnimarcLivreCinemaDAnimationTest extends PHPUnit_Framework_TestCas -class DecodageUnimarcLittleSenegalTest extends PHPUnit_Framework_TestCase { +class DecodageUnimarcLittleSenegalTest extends ModelTestCase { public function setUp() { $this->little_senegal = Class_Notice::newInstanceWithId(4); $this->little_senegal->setUnimarc("01494ngm0 2200337 450 0010007000000710012000071000041000191010038000601020007000981150042001052000052001472100035001992150053002343000109002873000071003963050034004673300201005013450027007026060031007296060036007606060043007966060039008397000048008787020043009267020031009697020038010007020035010387020033010738010023011068010027011292371272|0aEDV1441 a20070320i20042001b-ey0frey0103 ba0 afreaengcfrecengjfrejengjger aFR ac093baz|zba||||zz||cb|||||||||||||||1 aLittle SénégalbDVDfRachid Bouchareb, réal. cBlaq outcParamountdcop. 2004 a1 DVD vidéo monoface zone 2 (1 h 33 min)cCoul. aVersion originale franco-anglaise, Version française, avec sous-titrage en français, anglais, allemand aBonus : court-métrage \"Peut-être la mer\" (14 min), bande-annonce aDate de sortie du film : 2001 aUn vieil Africain, guide à la maison des esclaves de l'île de Gorée, part à la rencontre des descendants de ses ancêtres à Harlem... Quête identitaire et exploration d'un fossé culturel... b3333973136023d44,73 ?| 31047449aCinémayAlgérie| 32243366aCinémayFrancez1990-| 32163808aNoirs américainsxAu cinéma| 32243367aCinéma30076549yAfrique 132371273aBoucharebbRachidf1953-43704690 132371260aKouyatébSotiguif1936-4590 132371274aHopebSharon4590 131073585aZembRoschdyf1965-4590 132371277aLorellebOlivier4690 131089718aBoutellabSafy4230 0aFRbADAVc20070320 0aFRbBM Melunc20070510"); - Class_CodifLangue::getLoader() - ->newInstanceWithId('fre')->setLibelle(''); - Class_CodifLangue::getLoader() - ->newInstanceWithId('eng')->setLibelle(''); + + $this->fixture('Class_CodifLangue', ['id' => 'fre', 'libelle' => '']); + $this->fixture('Class_CodifLangue', ['id' => 'eng', 'libelle' => '']); } diff --git a/tests/scenarios/Templates/MyBibAppTemplateTest.php b/tests/scenarios/Templates/MyBibAppTemplateTest.php index 7bef4fdf244..c13b6dac48f 100644 --- a/tests/scenarios/Templates/MyBibAppTemplateTest.php +++ b/tests/scenarios/Templates/MyBibAppTemplateTest.php @@ -327,7 +327,6 @@ class MyBibAppTemplatePostDispatchOauthWithUserAgentTest extends MyBibAppTemplat class MyBibAppTemplateReadedInSerieTest extends MyBibAppTemplateTestCase { - /** @test */ public function badgeReadedShouldContains1on2() { $profile_id = diff --git a/tests/scenarios/Templates/TemplatesRecordsTest.php b/tests/scenarios/Templates/TemplatesRecordsTest.php index 32b904097aa..92c2e615b8f 100644 --- a/tests/scenarios/Templates/TemplatesRecordsTest.php +++ b/tests/scenarios/Templates/TemplatesRecordsTest.php @@ -62,24 +62,48 @@ class TemplatesRecordsWidgetTestCase extends Admin_AbstractControllerTestCase { -class TemplateRecordsWidgetWithDescriptionLengthTest extends AbstractControllerTestCase { +abstract class TemplateRecordsWithDescriptionAndUnimarcTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); - Class_AdminVar::set('TEMPLATING', 1); - ZendAfi_Auth::getInstance()->clearIdentity(); - $profile = $this->fixture('Class_Profil', - ['id' => 34, - 'template' => 'MUSCLE' - ]); + $this->_buildTemplateProfil(['id' => 34, + 'template' => 'CHILI']); - $profile->beCurrentProfil(); + $this->fixture('Class_CodifLangue', + ['id' => 'fre', 'libelle' => 'Français']); + + $notice_unimarc = (new Class_NoticeUnimarc_Fluent) + ->zoneWithChildren('330', ['a' => 'La description s\'arrête ici et pas plus loin.']) + ->zoneWithChildren('210', ['c' => 'Auzou']) + ->zoneWithChildren('225', ['a' => 'Pocket']) + ->zoneWithChildren('101', ['a' => 'fre']); + + $this->fixture('Class_Notice', + ['id' => 2, + 'type_doc' => 1, + 'annee' => '1999', + 'clef_oeuvre' => 'PSYKO', + 'date_creation' => '1999-12-14', + 'unimarc' => $notice_unimarc->render(), + 'titre_principal' => 'Psyko', + 'facettes' => 'G1', + ]); + } +} + + + + +class TemplateRecordsWidgetWithDescriptionLengthTest extends TemplateRecordsWithDescriptionAndUnimarcTest { + + public function setUp() { + parent::setUp(); $profile_patcher = (new Class_Template_ProfilePatcher(null)) - ->setProfile($profile); + ->setProfile(Class_Profil::find(34)); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, @@ -89,17 +113,6 @@ class TemplateRecordsWidgetWithDescriptionLengthTest extends AbstractControllerT 'size' => 1, 'description_length' => 4]); - $notice_unimarc = (new Class_NoticeUnimarc_Fluent); - $notice_unimarc->newZone()->label('330')->addChild('a', - 'La description s\'arrête ici et pas plus loin.'); - - $this->fixture('Class_Notice', - ['id' => 2, - 'clef_oeuvre' => 'PSYKO', - 'unimarc' => $notice_unimarc->render(), - 'titre_principal' => 'Psyko' - ]); - $this->dispatch('/opac/widget/render/widget_id/1/profile_id/34'); } @@ -109,4 +122,243 @@ class TemplateRecordsWidgetWithDescriptionLengthTest extends AbstractControllerT $this->assertXPathContentContains('//div[contains(@class, "kiosque widget")]//p[contains(@class, "model_description")]', 'La description s\'arrête ici …'); } + + + /** @test */ + public function editorAuzouShouldBeInBadgeRecordEditor() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor")]', + 'Auzou - Pocket'); + } + + + /** @test */ + public function editorPictoShouldBeFasFaHome() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor")]//i[contains(@class, "fas fa-home")]'); + } + + + /** @test */ + public function languageFreShouldBeInBadgeRecordLanguage() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language language_fre")][contains(@href, "/recherche/simple/facette/Lfre")]', + 'Français'); + } + + + /** @test */ + public function languagePictoShouldBeFasFaGlobeAfrica() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language")]//i[contains(@class, "fas fa-globe-africa")]'); + } } + + + + +class TemplateRecordsViewnoticeTest extends TemplateRecordsWithDescriptionAndUnimarcTest { + + public function setUp() { + parent::setUp(); + + $this->dispatch('/opac/recherche/viewnotice/id/2/profile_id/34'); + } + + + /** @test */ + public function editorAuzouShouldBeInBadgeRecordEditor() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor")]', + 'Auzou - Pocket'); + } + + + /** @test */ + public function editorPictoShouldBeFasFaHome() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor")]//i[contains(@class, "fas fa-home")]'); + } + + + /** @test */ + public function languageFreShouldBeInBadgeRecordLanguage() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language language_fre")][contains(@href, "/recherche/simple/facette/Lfre")]', + 'Français'); + } + + + /** @test */ + public function languagePictoShouldBeFasFaGlobeAfrica() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language")]//i[contains(@class, "fas fa-globe-africa")]'); + } +} + + + + +class TemplateRecordsRechercheSimpleTest extends TemplateRecordsWithDescriptionAndUnimarcTest { + + public function setUp() { + parent::setUp(); + Zend_Registry::set('sql', + $this->mock() + ->whenCalled('fetchAll') + ->answers([[2, '']])); + $this->dispatch('/opac/recherche/simple/expressionRecherche/pomme/profile_id/34'); + } + + + /** @test */ + public function editorAuzouShouldBeInBadgeRecordEditor() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor")]', + 'Auzou - Pocket'); + } + + + /** @test */ + public function editorPictoShouldBeFasFaHome() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[contains(@class, "badge_record_editor text-left badge no_truncate order-5")]//i[contains(@class, "fas fa-home")]'); + } + + + /** @test */ + public function languageFreShouldBeInBadgeRecordLanguage() { + $this->assertXPathContentContains('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language language_fre")][contains(@href, "/recherche/simple/facette/Lfre")]', + 'Français'); + } + + + /** @test */ + public function languagePictoShouldBeFasFaGlobeAfrica() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[contains(@class, "badge_record_language language_fre text-left badge order-5")]//i[contains(@class, "fas fa-globe-africa")]'); + } +} + + + + +class TemplateRecordsViewnoticeBadgesTest extends TemplateRecordsWithDescriptionAndUnimarcTest { + + public function setUp() { + parent::setUp(); + + Class_Notice::setTimeSource(new TimeSourceForTest('1999-12-08 10:00:00')); + + Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', 1); + Class_AdminVar::set('SEARCH_BY_WORK', 1); + + Class_Profil::find(34)->setTemplate('INTONATION')->assertSave(); + + $this->fixture('Class_Bib', + ['id' => 28, + 'libelle' => 'Cran']); + + $this->fixture('Class_Bib', + ['id' => 20, + 'libelle' => 'Seynod']); + + $this->fixture('Class_Exemplaire', + ['id' => 33, + 'id_notice' => 2, + 'id_bib' => 28]); + + $this->fixture('Class_Users', + ['id' => 34, + 'login' => 'adminportail', + 'password' => 's3cr3t \o/', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL]); + + $this->fixture('Class_Users', + ['id' => 38, + 'login' => 'ggdea', + 'password' => 's3cr3t \o/', + 'id_site' => 28, + 'idabon' => 123, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]); + + $this->fixture('Class_AvisNotice', + ['id' => 78, + 'abon_ou_bib' => 1, + 'clef_oeuvre' => 'PSYKO', + 'note' => 4, + 'id_user' => 34, + 'entete' => 'Excellent']); + + $this->fixture('Class_AvisNotice', + ['id' => 79, + 'abon_ou_bib' => 0, + 'clef_oeuvre' => 'PSYKO', + 'note' => 3, + 'id_user' => 38, + 'entete' => 'Moyen']); + + $this->fixture('Class_CodifGenre', + ['id' => 1, + 'libelle' => 'Roman']); + + $this->fixture('Class_Notice', + ['id' => 3, + 'type_doc' => 1, + 'annee' => '1999', + 'clef_oeuvre' => 'PSYKO', + 'date_creation' => '1999-12-10', + 'titre_principal' => 'Psyko', + 'facettes' => 'G1', + ]); + + $settings = (new Class_User_Settings(Class_Users::getIdentity())) + ->setBookmarkedLibraries(['28']) + ->save(); + + $this->dispatch('/opac/recherche/viewnotice/id/2/profile_id/34'); + } + + + /** @test */ + public function doctypeBadgeShouldHaveClassesBadgeWarningFsOneEm() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[@class = "badge_tag record_doctype text-left badge badge-warning fs_1em"]'); + } + + + /** @test */ + public function bookmarkedLibraryShouldHaveClassesBadgeInfo() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[@class = "badge_tag badge_bookmarked_library text-left badge badge-info"]'); + } + + + /** @test */ + public function editionYearShouldHaveClassesBadgeDark() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[@class = "badge_tag record_edition_year text-left badge badge-dark"]'); + } + + + /** @test */ + public function badgeNoveltyShouldHaveClassesBadgeSecondary() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[@class = "badge_tag record_novelty text-left badge badge-secondary"]'); + } + + + /** @test */ + public function badgeProReviewsCountShouldHaveClassesBadgeSuccess() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[@class = "badge_tag record_pro_reviews_count text-left badge badge-success"]'); + } + + + /** @test */ + public function badgeProReviewsAverageScoreShouldHaveClassesBadgeSuccess() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[@class = "badge_tag record_pro_reviews_average_score text-left badge badge-success"]'); + } + + + /** @test */ + public function badgeBorrowerReviewsCountShouldHaveClassesBadgeInfo() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[@class = "badge_tag record_borrower_review_count text-left badge badge-info"]'); + } + + + /** @test */ + public function badgeBorrowerReviewsAverageScoreShouldHaveClassesBadgeInfo() { + $this->assertXPath('//div[contains(@class, "badge-group")]//span[@class = "badge_tag record_borrower_review_average_score text-left badge badge-info"]'); + } + + + /** @test */ + public function badgeFacetGenreShouldHaveClassesBadgePrimary() { + $this->assertXPath('//div[contains(@class, "badge-group")]//a[@class = "badge_tag record_facets record_facet_genre text-left badge badge-primary"]'); + } +} \ No newline at end of file diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index fd0fbf40363..aa122de1db6 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -620,7 +620,6 @@ class TemplateSearchWithSerieTest extends abstractControllerTestCase { 'type_doc' => Class_TypeDoc::PERIODIQUE, 'resume' => 'Fakir hebdo']); - $fakir_57 = $this->fixture('Class_Notice', ['id' => 2345, 'titre_principal' => 'Fakir 57 septembre-novembre 2012', -- GitLab