Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (3)
- ticket #148110 : Magasin de Thème : Les articles de periodiques sont maintenant affichés, et limités à 20
\ No newline at end of file
......@@ -44,6 +44,12 @@ class Class_Notice_Authors extends Class_Authors {
}
public function displayAllAuthors() : array {
return array_map(function($element){return $element->getLabel();},
$this->getAllAuthors(true));
}
protected function _init($record) {
foreach ($this->_zones as $zone)
$this->_getAuthorsInZone($record, $zone);
......
......@@ -97,7 +97,7 @@ class Class_NoticeHtml {
if ($article['matieres']) {
$first = true;
foreach($article['matiere'] as $sujet) {
foreach($article['matieres'] as $sujet) {
$html .= '<tr>';
$label = '';
......
<?php
/**
* Copyright (c) 2012-2022, 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 Intonation_Library_View_Wrapper_SerialArticle extends Intonation_Library_View_Wrapper_Record {
public function getPicture() {
}
public function getPictureAction() {
}
public function getActions() {
return [];
}
public function getSecondaryLink() {
$object = $this->_model;
$text = sprintf($this->_view->_("paru dans %s %s %s"),
$object->getTitreChapeau(),
$object->getTomeAlpha(),
$object->getCollation());
$headkey = Class_Indexation::getInstance()->serialCodeAlphaChapeau($object->getClefChapeau(),
$object->getTomeAlpha());
$search = Class_Url::relative(['controller' => 'recherche',
'action' => 'simple',
'rech_titres' => $headkey,
'type_doc' => 'per_art']);
return (new Intonation_Library_Link())
->setText($text)
->setUrl($search)
->setTitle($text);
}
public function getDescription() {
$description_length = $this->_widget_context
? $this->_widget_context->getDescriptionLength()
: null;
$description = $this->_view->truncate($this->_model->getResume(),
['class' => 'model_description_' . get_class($this->_model)],
20);
if ($this->_model->getNotes())
$description .= $this->_view->truncate(implode("; ",
array_filter($this->_model->getNotes())),
['class' => 'model_note_' . get_class($this->_model)],
20);
return ($this->_description = $this->getBadges() . $description);
}
public function getFullDescription() {
$description_length = $this->_widget_context
? $this->_widget_context->getDescriptionLength()
: null;
$description = $this->_view->truncate($this->_model->getResume(),
['class' => 'model_description_' . get_class($this->_model)],
20, true);
if ($this->_model->getNotes())
$description .= $this->_view->truncate(implode("; ",$this->_model->getNotes()),
['class' => 'model_note_' . get_class($this->_model)],
20, true);
return ($this->_description = $this->getBadges() . $description);
}
}
<?php
/**
* Copyright (c) 2012-2024, 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 Intonation_View_Notice_ArticlesPeriodiques extends ZendAfi_View_Helper_BaseHelper {
const LIMIT = 20;
public function Notice_ArticlesPeriodiques($notice) {
return $this->_renderArticles($notice);
}
protected function _renderArticles($notice) {
$headkey =
Class_Indexation::getInstance()->serialCodeAlphaChapeau($notice->getClefChapeau(),
$notice->getTomeAlpha());
$count_articles = Class_Notice::countBy(['clef_chapeau' => $headkey,
'type_doc' => Class_TypeDoc::PERIODIQUE_ARTICLE,
'order' => 'id_notice']);
$articles = Class_Notice::findAllBy(['clef_chapeau' => $headkey,
'type_doc' => Class_TypeDoc::PERIODIQUE_ARTICLE,
'limit' => static::LIMIT,
'order' => 'id_notice']);
$articles =
(new Storm_Collection($articles))
->collect(function ($article)
{
return new Intonation_Library_View_Wrapper_SerialArticle($article,
$this->view);
});
$html = $this->view->renderCollection($articles,
[],
(function($item)
{
return $this->view->cardifyOnlyDescription($item);
}));
if ($count_articles > static::LIMIT)
$html .= $this->view->tagAction((new Intonation_Library_Link())
->setText($this->view->_('Voir les %d articles', $count_articles))
->setImage($this->view->templateIco('search_more','library'))
->setTitle($this->view->_('Rechercher dans le catalogue'))
->setUrl(Class_Url::relative(['controller' => 'recherche',
'action' => 'simple',
'rech_titres' => $headkey,
'type_doc' => 'per_art']))
);
return $html;
}
}
......@@ -14,7 +14,7 @@
</annotation>
<import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="http://dublincore.org/schemas/xmls/simpledc20021212.xsd"/>
schemaLocation="simpledc20021212.xsd"/>
<element name="dc" type="oai_dc:oai_dcType"/>
......
......@@ -172,14 +172,111 @@ class SerialsDetailsNoticeAjaxControllerPeriodiqueSerieXsltTest extends SerialsD
class SerialsDetailsInTemplatesTest extends SerialsDetailsWithXsltTestCase {
class SerialsDetailsRecordDescriptionPeriodiqueSerieTest extends SerialsDetailsTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/recherche/viewnotice/id/234/id_profil/21');
$this->_buildTemplateProfil(['id' => 78]);
Storm_Cache::beVolatile();
$this
->onLoaderOfModel(Class_Notice_SerialArticles::class)
->whenCalled('findAllBy')
->answers([]);
$abdelkrim = $this->fixture(Class_CodifAuteur::class,
['id' => 42,
'libelle' => 'Abdelkrim Samir',
'formes'=> 'ABDELKRIMxSAMIR',
'mot_renvois' => '']);
$aberkane = $this->fixture(Class_CodifAuteur::class,
['id' => 43,
'libelle' => 'Aberkane Idriss',
'formes'=> 'ABERKANExIDRISS',
'mot_renvois' => '']);
$this
->onLoaderOfModel(Class_CodifAuteur::class)
->whenCalled('findByCodeAlpha')
->with(['ABDELKRIMxSAMIR'])
->answers([$abdelkrim])
->whenCalled('findByCodeAlpha')
->with(['ABERKANExIDRISS'])
->answers([$aberkane]);
Class_CosmoVar::setValueOf('unimarc_zone_matiere',"610a");
foreach (range(1, 105) as $id)
$this->fixture(Class_Notice::class,
['id' => $id,
'clef_chapeau' => 'FAKIR 58',
'tome_alpha' => '58',
'auteurs' => 'Djamel, Farid',
'description' => 'petite description',
'unimarc' => (new Class_NoticeUnimarc_Fluent())
->zoneWithChildren('200',['a' => "Mon Article $id",
'e' => 'complement titre',
'f' => 'Auteur Article'])
->zoneWithChildren('300',['a' => 'Ma Petite Note'])
->zoneWithChildren('330',['a' => 'Un résumé succinct'])
->zoneWithChildren('215',['a' => sprintf("pp. %d %d",$id,$id+2)])
->zoneWithChildren('610',['a' => 'Sujet Brûlant'])
->zoneWithChildren('461',['t' => 'Fakir', 'v'=>'58'])
->zoneWithChildren('700',['a' => 'Abdelkrim', 'b' => "Samir"])
->zoneWithChildren('701',['a' => 'Aberkane', 'b' => "Idriss"])
->render(),
'type_doc' => Class_TypeDoc::PERIODIQUE_ARTICLE
]);
$this->dispatch('/record/description/id/234/id_profil/78');
}
public function getProfile() {
return $this->_buildTemplateProfil(['id' => 21]);
/** @test */
public function pageShouldContainsMonArticle() {
$this->assertXPathContentContains('//a[@href="/recherche/viewnotice/id/1"]', 'Mon Article 1 : complement titre');
}
/** @test */
public function pageShouldDisplay20Articles() {
$this->assertXPathCount('//div[contains(@class,"card_title_Intonation_Library_View_Wrapper_SerialArticle")]'
,20);
}
/** @test */
public function pageShouldDisplayLinkToRechercheSimpleWithTitleAndTypeDocPerArticle() {
$this->assertXPath('//a[contains(@href,"/simple/rech_titres/FAKIR+58/type_doc/per_art")]');
}
/** @test */
public function LinkToRechercheSimpleShouldDisplayVoirles() {
$this->assertXPathContentContains('//a[contains(@href,"/simple/rech_titres/FAKIR+58/type_doc/per_art")]',
'Voir les 105 articles');
}
public function getElementsToTest() {
return [['note','Ma Petite Note'],
['description', 'Un résumé succinct']];
}
/** @test
@dataProvider getElementsToTest
*/
public function modelElementShouldCorrespondingExpectedString($element, $expected_result) {
$this->assertXPathContentContains('//p[@class="model_'.$element.'_Class_Notice"]',
$expected_result);
}
/** @test */
public function cardTitleShouldContainsParuDansFakir58AndCollation() {
$this->assertXPathContentContains('//div[@class="card-subtitle card_subtitle card_subtitle_Intonation_Library_View_Wrapper_SerialArticle"]',
'paru dans Fakir 58 pp. 1 3');
}
}