Commit 7cb93c66 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#64573_55_templates_pour_l_interface_publique_libraire_bootstrap' into 'master'

dev#64573 bootstrap

See merge request !3142
parents 9ba76db1 ff444c11
Pipeline #7151 passed with stage
in 35 minutes and 51 seconds
...@@ -147,9 +147,6 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -147,9 +147,6 @@ class AbonneController extends ZendAfi_Controller_Action {
} }
public function viewavisAction(){ public function viewavisAction(){
$this->_forward('viewauteur', 'blog', 'opac', ['id' => $this->_user->getId()]); $this->_forward('viewauteur', 'blog', 'opac', ['id' => $this->_user->getId()]);
} }
...@@ -1355,7 +1352,7 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -1355,7 +1352,7 @@ class AbonneController extends ZendAfi_Controller_Action {
return $this->_forward('popup-login', 'auth', 'opac'); return $this->_forward('popup-login', 'auth', 'opac');
if(!$this->_request->isPost()) if(!$this->_request->isPost())
return $this->_redirectToReferer(); return $this->_redirectClose($this->_getReferer());
$form = new ZendAfi_Form_Review; $form = new ZendAfi_Form_Review;
...@@ -1379,7 +1376,7 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -1379,7 +1376,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$rating->setModerationNOK(); $rating->setModerationNOK();
if (!$form->isValidModelAndArray($rating, $post)) if (!$form->isValidModelAndArray($rating, $post))
return $this->_redirectToReferer(); return $this->_redirectClose($this->_getReferer());
if (!$rating->save()) if (!$rating->save())
return false; return false;
...@@ -1388,7 +1385,37 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -1388,7 +1385,37 @@ class AbonneController extends ZendAfi_Controller_Action {
$this->_getPost('note'), $this->_getPost('note'),
5)); 5));
return $this->_redirectToReferer(); return $this->_redirectClose($this->_getReferer());
}
public function editReviewAction() {
if (!$review = Class_AvisNotice::find($this->_getParam('id', null)))
return $this->_redirectClose($this->_getReferer());
$this->view->titre = $this->_('Modifier l\'avis');
$this->view->review = $review;
}
public function deleteReviewAction() {
if (!$review = Class_AvisNotice::find($this->_getParam('id', null)))
return $this->_redirectClose($this->_getReferer());
$this->view->titre = $this->_('Supprimer l\'avis');
$this->view->review = $review;
if ($this->_getParam('redirect'))
return $this->_redirectClose($this->_getReferer());
if ($this->_getParam('delete')) {
$review->delete();
$this->_helper->notify($this->_('L\'avis a bien été supprimé'),
['status' => 'delete']);
return $this->_redirectClose($this->_getReferer());
}
} }
......
<?php
$wrapper = (new Intonation_Library_View_Wrapper_Review)
->setModel($this->review)
->setView($this);
$html = [$this->div(['class' => 'col-10 p-2 m-2 text-left'],
$this->cardifyFullDescription($wrapper)),
$this->div(['class' => 'col-10'],
$this->tag('h3',
$this->_('Supprimer l\'avis'),
['class' => 'pt-2 mx-2 border-top border-danger'])),
$this->div(['class' => 'col-10'],
$this->div(['class' => 'm-2 p-2 btn-group text-white'],
$this->tagAnchor(['redirect' => '1'],
$this->_('Non'),
['class' => 'btn btn-info'])
. $this->tagAnchor(['delete' => '1'],
$this->_('Oui'),
['class' => 'btn btn-danger'])))];
echo $this->grid(implode($html), [], ['class' => 'justify-content-center']);
<?php
echo $this->div(['class' => 'p-3 m-3'],
$this->renderReviewForm($this->review));
...@@ -518,4 +518,12 @@ class Class_AvisNotice extends Storm_Model_Abstract { ...@@ -518,4 +518,12 @@ class Class_AvisNotice extends Storm_Model_Abstract {
public function getHumanDate() { public function getHumanDate() {
return Class_Date::humanDate($this->getDateAvis(), 'd MMMM yyyy HH:mm'); return Class_Date::humanDate($this->getDateAvis(), 'd MMMM yyyy HH:mm');
} }
public function isMine() {
if (!$user = Class_Users::getIdentity())
return false;
return $user == $this->getUser();
}
} }
\ No newline at end of file
...@@ -842,6 +842,17 @@ class Class_ScriptLoader { ...@@ -842,6 +842,17 @@ class Class_ScriptLoader {
} }
public function addSearchInputToContainer($container, $input, $toggle_selectors) {
$options = json_encode(['input' => $input,
'fixed_display' => $toggle_selectors]);
$jquery = sprintf('$("%s").search_input(%s);', $container, $options);
return $this->addOPACPluginScript('search_input/search_input.js')
->addJQueryReady($jquery);
}
public function formToTabs($node) { public function formToTabs($node) {
return $this->addOPACPluginScript('form_to_tabs/form_to_tabs.js') return $this->addOPACPluginScript('form_to_tabs/form_to_tabs.js')
->addJQueryReady(sprintf('$("%s").form_to_tabs();', ->addJQueryReady(sprintf('$("%s").form_to_tabs();',
......
...@@ -46,26 +46,70 @@ class Class_User_BookmarkedSearch extends Storm_Model_Abstract { ...@@ -46,26 +46,70 @@ class Class_User_BookmarkedSearch extends Storm_Model_Abstract {
'notified' => 0, 'notified' => 0,
'creation_date' => '', 'creation_date' => '',
'criterias' => '', 'criterias' => '',
'id_user' => ''] 'id_user' => ''],
;
$_search_result = null,
$_records = [];
public function getUnserializedCriterias() { public function getUnserializedCriterias() {
if(!$criterias = unserialize($this->getCriterias())) $criterias = $this->getCriterias();
if (is_object($criterias))
return $criterias
->unsetParam('tri')
->unsetParam('page')
->unsetParam('liste_format')
->unsetParam('page_size');
if(!$criterias = unserialize($criterias))
return null; return null;
return $criterias->unsetParam('page');
if (is_object($criterias))
return $criterias
->unsetParam('tri')
->unsetParam('page')
->unsetParam('liste_format')
->unsetParam('page_size');
return null;
} }
public function getCriteriasUrl() { public function getCriteriasUrl() {
if (!$criterias = $this->getUnserializedCriterias()) if (!$criterias = $this->getUnserializedCriterias())
return '/recherche/simple'; return ['controller'=>'recherche',
'action' => 'simple'];
return $criterias->getUrlCriteresWithFacettes(); return $criterias->getUrlCriteresWithFacettes();
} }
public function belongsTo($user) { public function belongsTo($user) {
return $this->getIdUser() == $user->getId(); if ($this->getIdUser() == $user->getId())
return true;
return $this->getExistingFor($user) ? true : false;
}
public function getExistingFor($user) {
foreach($user->getBookmarkedSearches() as $search)
if ($search->getCriteriasUrl() == $this->getCriteriasUrl())
return $search;
return null;
}
public function getExistingIdFor($user) {
if (!$user)
return null;
if (!$search = $this->getExistingFor($user))
return null;
return $search->getId();
} }
...@@ -89,6 +133,27 @@ class Class_User_BookmarkedSearch extends Storm_Model_Abstract { ...@@ -89,6 +133,27 @@ class Class_User_BookmarkedSearch extends Storm_Model_Abstract {
} }
public function getSearchResult() {
if ($this->_search_result)
return $this->_search_result;
if (!$criterias = $this->getUnserializedCriterias())
return new Class_MoteurRecherche_Result;
return $this->_search_result =
Class_MoteurRecherche::getInstance()
->lancerRecherche($criterias);
}
public function getRecords() {
if ($this->_records)
return $this->_records;
return $this->_records = $this->getSearchResult()->fetchRecords();
}
public function beforeSave() { public function beforeSave() {
if ($this->isNew()) if ($this->isNew())
$this->setCreationDate($this->getCurrentDateTime()); $this->setCreationDate($this->getCurrentDateTime());
......
...@@ -56,6 +56,4 @@ class ZendAfi_Controller_Action_Helper_FlashMessenger_Notification { ...@@ -56,6 +56,4 @@ class ZendAfi_Controller_Action_Helper_FlashMessenger_Notification {
public function getActions() { public function getActions() {
return $this->hasActions() ? $this->_params[self::ACTIONS] : []; return $this->hasActions() ? $this->_params[self::ACTIONS] : [];
} }
} }
\ No newline at end of file
?>
\ No newline at end of file
...@@ -39,9 +39,13 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr ...@@ -39,9 +39,13 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr
protected function _getCriterias() { protected function _getCriterias() {
if (!$searches = (new Class_SearchHistory())->getHistory()) $criteria = (new Class_CriteresRecherche)
return null; ->setParams($this->_request->getParams());
if (!empty($criteria->getCriteres()))
return serialize($criteria);
$searches = (new Class_SearchHistory())->getHistory();
return array_pop($searches); return array_pop($searches);
} }
...@@ -64,7 +68,7 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr ...@@ -64,7 +68,7 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr
protected function _redirectToIndex() { protected function _redirectToIndex() {
return $this->_redirectClose('abonne/settings'); return $this->_redirectClose($this->_getReferer());
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
class ZendAfi_View_Helper_Div extends ZendAfi_View_Helper_BaseHelper { class ZendAfi_View_Helper_Div extends ZendAfi_View_Helper_BaseHelper {
public function div($attributes = [], $content = []) { public function div($attributes = [], $content = '') {
return $this->_tag('div', return $this->_tag('div',
$content, $content,
$attributes); $attributes);
......
...@@ -24,6 +24,6 @@ class ZendAfi_View_Helper_Notice_Articles extends ZendAfi_View_Helper_BaseHelper ...@@ -24,6 +24,6 @@ class ZendAfi_View_Helper_Notice_Articles extends ZendAfi_View_Helper_BaseHelper
public function Notice_Articles($record) { public function Notice_Articles($record) {
$articles = $record->getArticlesPeriodique($record->getId()); $articles = $record->getArticlesPeriodique($record->getId());
$notice_html = new Class_NoticeHtml(); $notice_html = new Class_NoticeHtml();
return $this->_sendResponseWithScripts($notice_html->getArticlesPeriodique($periodiques)); return $notice_html->getArticlesPeriodique($periodiques);
} }
} }
\ No newline at end of file
...@@ -444,4 +444,8 @@ header.col { ...@@ -444,4 +444,8 @@ header.col {
.opac .bouton.back { .opac .bouton.back {
display: none; display: none;
}
.card .card-columns {
column-gap: 0.05rem;
} }
\ No newline at end of file
...@@ -74,12 +74,12 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { ...@@ -74,12 +74,12 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'div class boutons' => 'row justify-content-around my-3', 'div class boutons' => 'row justify-content-around my-3',
'label' => 'col-12 col-sm-5 col-form-label col-form-label-sm pr-1', 'label' => 'col-12 col-sm-5 col-form-label col-form-label-sm pr-1',
'label class multi-element-label' => 'col-form-label col-form-label-sm', 'label class multi-element-label' => 'col-form-label col-form-label-sm',
'input' => 'mb-2 form-control form-control-sm', 'input' => 'mb-2 form-control',
'input data-spambots true' => '', 'input data-spambots true' => '',
'input type checkbox' => 'form-check-input form-check-input-sm mr-1', 'input type checkbox' => 'form-check-input form-check-input-sm mr-1',
'input type submit' => 'btn btn-sm btn-primary', 'input type submit' => 'btn btn-sm btn-primary',
'textarea' => 'form-control form-control-sm', 'textarea' => 'form-control',
'select' => 'form-control form-control-sm custom-select', 'select' => 'form-control form-control custom-select',
'button' => 'btn btn-secondary', 'button' => 'btn btn-secondary',
'button class btn' => '', 'button class btn' => '',
'button class accessibility' => 'btn btn-light', 'button class accessibility' => 'btn btn-light',
...@@ -106,7 +106,9 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { ...@@ -106,7 +106,9 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'a class list-group-item' => '', 'a class list-group-item' => '',
'a class account-loans' => 'btn btn-sm list-group-item-info', 'a class account-loans' => 'btn btn-sm list-group-item-info',
'ul' => 'list-unstyled', 'ul' => 'list-unstyled',
'div class _notify' => 'alert-warning',
'div class success_notify' => 'alert-success', 'div class success_notify' => 'alert-success',
'div class delete_notify' => 'alert-danger',
'form class indent-form' => 'px-4 py-1', 'form class indent-form' => 'px-4 py-1',
'div class card_article' => 'col-12 mb-3', 'div class card_article' => 'col-12 mb-3',
'h1 class content_title' => 'p-3 m-1', 'h1 class content_title' => 'p-3 m-1',
...@@ -145,8 +147,12 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { ...@@ -145,8 +147,12 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'date-edition' => 'class fas fa-file-signature', 'date-edition' => 'class fas fa-file-signature',
'settings' => 'class fas fa-user-cog', 'settings' => 'class fas fa-user-cog',
'selection' => 'class fas fa-heart', 'selection' => 'class fas fa-heart',
'no-selection' => 'class far fa-heart',
'subscription' => 'class fas fa-euro-sign', 'subscription' => 'class fas fa-euro-sign',
'card-number' => 'class fas fa-barcode', 'card-number' => 'class fas fa-barcode',
'read-document' => 'class far fa-arrow-alt-circle-right',
'read-review' => 'class far fa-comment-dots',
], ],
'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png', 'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png',
......
...@@ -65,9 +65,20 @@ abstract class Intonation_Library_View_Wrapper_Abstract { ...@@ -65,9 +65,20 @@ abstract class Intonation_Library_View_Wrapper_Abstract {
} }
public function getContentForJSSearch() {
return $this->_view->dNone(implode(' ', [$this->getMainTitle(),
$this->getSecondaryTitle(),
$this->getDescription(),
$this->getBadges(),
'%s']));
}
abstract public function getMainTitle(); abstract public function getMainTitle();
abstract public function getMainLink(); abstract public function getMainLink();
abstract public function getEmbedMedia();
abstract public function getHtmlPicture();
abstract public function getPicture(); abstract public function getPicture();
abstract public function getPictureAction(); abstract public function getPictureAction();
......
...@@ -78,7 +78,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr ...@@ -78,7 +78,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
public function getDescriptionTitle() { public function getDescriptionTitle() {
return $this->_('Résumé de l\'article "%s"', $this->getTitle()); return $this->_('Résumé de l\'article "%s"', $this->_model->getTitre());
} }
...@@ -103,4 +103,14 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr ...@@ -103,4 +103,14 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
public function getActions() { public function getActions() {
return []; return [];
} }
public function getEmbedMedia() {
return '';
}
public function getHtmlPicture() {
return '';
}
} }
\ No newline at end of file
...@@ -86,7 +86,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ...@@ -86,7 +86,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
public function getMainLink() { public function getMainLink() {
if (!$this->_model->getNoticeOPAC()) if (!$this->_model->getNoticeOPAC())
return ''; return null;
$wrapper = (new Intonation_Library_View_Wrapper_Record) $wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view) ->setView($this->_view)
...@@ -95,7 +95,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ...@@ -95,7 +95,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
return $wrapper->getMainLink(); return $wrapper->getMainLink();
if (!$this->_model->isRenewable()) if (!$this->_model->isRenewable())
return ''; return null;
return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'prolongerPret', 'action' => 'prolongerPret',
...@@ -169,4 +169,14 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ...@@ -169,4 +169,14 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
public function getActions() { public function getActions() {
return []; return [];
} }
public function getEmbedMedia() {
return '';
}
public function getHtmlPicture() {
return '';
}
} }
...@@ -147,4 +147,14 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp ...@@ -147,4 +147,14 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
public function getActions() { public function getActions() {
return []; return [];
} }
public function getEmbedMedia() {
return '';
}
public function getHtmlPicture() {
return '';
}
} }
...@@ -45,7 +45,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ...@@ -45,7 +45,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
->setView($this->_view) ->setView($this->_view)
->setModel($this->_model->getNoticeOPAC()); ->setModel($this->_model->getNoticeOPAC());
return $wrapper->getAuthor(); return $wrapper->getSecondaryTitle();
} }
...@@ -74,7 +74,8 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ...@@ -74,7 +74,8 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
->setView($this->_view) ->setView($this->_view)
->setModel($this->_model->getNoticeOPAC()); ->setModel($this->_model->getNoticeOPAC());
return $wrapper->getDescription(); return $this->getBadges()
. $wrapper->getDescription();
} }
...@@ -85,7 +86,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ...@@ -85,7 +86,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
public function getMainLink() { public function getMainLink() {
if (!$this->_model->getNoticeOPAC()) if (!$this->_model->getNoticeOPAC())
return ''; return null;
$wrapper = (new Intonation_Library_View_Wrapper_Record) $wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view) ->setView($this->_view)
...@@ -144,14 +145,48 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ...@@ -144,14 +145,48 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
public function getBadges() { public function getBadges() {
if (!$this->_model->getNoticeOPAC()) $issue_date = $this->_model->getIssueDate();
return null; $return_date = $this->_model->getDateRetour();
$wrapper = (new Intonation_Library_View_Wrapper_Record) $badges = [
->setView($this->_view) ['tag' => 'span',
->setModel($this->_model->getNoticeOPAC()); 'class' => 'info',
'text' => Class_Template::current()->getIco($this->_view,
return $wrapper->getBadges(); 'loan',
'library')
. $issue_date,
'title' => $this->_('Date d\'emprunt : %s', $issue_date)],
['tag' => 'span',
'class' => ($this->_model->isLate()
? 'danger'
: 'success'),
'text' => Class_Template::current()->getIco($this->_view,
'return-date',
'library')
. $return_date,
'title' => $this->_('Date de retour : %s', $return_date)],
['tag' => 'span',
'class' => 'info',
'text' => ($this->_model->getOnHold()
? (Class_Template::current()->getIco($this->_view,
'thumbtack',
'library')
. $this->_('Réservé'))
: ''),
'title' => $this->_('Exemplaire réservé')],
['tag' => 'span',
'class' => 'info',
'text' => ($this->_model->getRenewals()
? (Class_Template::current()->getIco($this->_view,
'available',
'library')
. $this->_('Déjà prolongé')) : ''),
'title' => $this->_('Exemplaire déjà prolongé')]];
return $this->_view->renderBadges($badges);
} }
...@@ -166,4 +201,14 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ...@@ -166,4 +201,14 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
'Title' => $this->_('Prolonger l\'emprunt %s', 'Title' => $this->_('Prolonger l\'emprunt %s',
$this->_model->getTitre())])]; $this->_model->getTitre())])];
} }
public function getEmbedMedia() {
return '';
}
public function getHtmlPicture() {
return '';
}
} }
...@@ -27,6 +27,27 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View ...@@ -27,6 +27,27 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View
public function getMainLink() { public function getMainLink() {
$params = $this->_model->hasRecipient(Class_Users::getIdentity())
? ['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'unsubscribe-newsletter',
'id' => $this->_model->getId()]),
'Text' => $this->_view->_("Me désinscrire"),
'Title' => $this->_view->_("Me désinscrire à la lettre d'information %s", $this->_model->getTitre()),
'Image' => Class_Template::current()->getIco($this->_view,
'selection',