Commit d017705d authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#99489_magasin_de_themes_bases_sur_bootstrap' into 'master'

on theme store

See merge request !3402
parents b6d91308 61fc1bc0
Pipeline #9468 passed with stage
in 43 minutes and 2 seconds
......@@ -995,7 +995,12 @@ class AbonneController extends ZendAfi_Controller_Action {
}
$this->_helper->notify($this->_('Suggestion d\'achat enregistrée'));
return $this->_redirect(Class_Url::absolute($this->view->url(['action' => 'suggestion-achat'])));
$action = Class_Template::current()->isLegacy()
? 'suggestion-achat'
: 'suggestions';
return $this->_redirect(Class_Url::absolute($this->view->url(['action' => $action])));
}
......@@ -1508,15 +1513,23 @@ class AbonneController extends ZendAfi_Controller_Action {
}
$allowed_paths = explode(';', Class_AdminVar::getValueOrDefault('USER_PROFILE_IMAGES'));
if (!in_array($image->getPath(), $allowed_paths)) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Votre image de profil n\'a pas été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
$allowed_images = [];
(new Class_User_Settings($this->_user))->setProfileImage($image->getPath());
$this->_user->save();
foreach ($allowed_paths as $path)
if ($image_var = Class_FileManager::find($path))
$allowed_images [] = $image_var;
foreach ($allowed_images as $allowed_image) {
if ($image->getId() == $allowed_image->getId()) {
(new Class_User_Settings($this->_user))->setProfileImage($image->getPath());
$this->_user->save();
$this->_helper->notify($this->_('Votre image de profil a bien été modifiée.'));
$this->_helper->notify($this->_('Votre image de profil a bien été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
}
$this->_helper->notify($this->_('Une erreur c\'est produite. Votre image de profil n\'a pas été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
......@@ -1529,6 +1542,10 @@ class AbonneController extends ZendAfi_Controller_Action {
}
public function suggestionsAction() {
}
public function selectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) {
return $this->_redirectClose($this->_getReferer());
......
......@@ -1020,6 +1020,12 @@ class RechercheController extends ZendAfi_Controller_Action {
}
public function clearLastSearchSessionAction() {
$this->_helper->getHelper('viewRenderer')->setNoRender();
Zend_Registry::get('session')->last_search = null;
}
protected function newCriteresRecherches($params) {
$criteres = (new Class_CriteresRecherche())
->setParams($params);
......
......@@ -284,4 +284,12 @@ class RssController extends ZendAfi_Controller_Action {
$notice->getAnnee(),
$this->view->absoluteUrl($notice->fetchUrlLocalVignette()));
}
public function renderItemsAction() {
if (!$this->view->rss = Class_Rss::find($this->_getParam('id', null)))
return $this->getHelper('ViewRenderer')->setNoRender();
$this->getHelper('ViewRenderer')->setLayoutScript('subModal.phtml');
}
}
<?php
$this->openBoite($this->_('Suggérer un achat'));
$send_form_button = '';
if ($this->records) {
echo $this->tag('p', $this->_('Les documents suivants sont dans le catalogue.'));
echo $this->tag('p', $this->_('Votre suggestion en fait-elle partie ?'));
echo $this->button(new Class_Entity(['Text' => $this->_('Oui'),
'Url' => $this->url(['action' => 'suggestion-achat']),
'Attribs' => ['title' => $this->_('Annuler et revenir à la liste des suggestions.')]]));
$send_form_button = new Class_Entity(['Text' => $this->_('Non'),
'Attribs' => ['title' => $this->_('Envoyer la suggestion'),
'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]);
echo $this->button($send_form_button);
$send_form_button->setText($this->_('Envoyer'));
echo $this->ListeNotices_Mur($this->records);
$submit = $this->form->getElement('submit');
$submit
->setLabel($this->_('Relancer la recherche'))
->setAttribs(['title' => $this->_('Relance la recherche ou envoie la suggestion en cas de recherche infructueuse')]);
}
if (trim($this->preferences['help-text']))
echo $this->tag('div',
$this->preferences['help-text'],
['class' => 'help-text']);
echo $this->renderForm($this->form);
if ($send_form_button)
echo $this->button($send_form_button);
$this->closeBoite();
?>
echo $this->abonne_NewSuggestion($this->form, $this->preferences, $this->records);
<?php
echo $this->abonne_SuggestionsBoard($this->user);
<?php
echo $this->rss_RenderItems($this->rss);
......@@ -41,13 +41,29 @@ class Class_RssModelFlux extends BaseItem {
}
class RssLoader extends Storm_Model_Loader {
public function getRssFrom($categories, $ids) {
$rss = [];
foreach($categories as $category)
$rss = array_merge($rss, Class_Rss::findAllBy(['id_cat' => $category,
'order' => 'titre']));
foreach($ids as $id)
$rss [] = Class_Rss::find($id);
return array_filter($rss);
}
/**
* @param array $id_feeds
* @param array $id_categories
* @return array
*/
public function getFluxFromIdsAndCategories($id_feeds, $id_categories) {
$feeds = array();
$feeds = [];
foreach ($id_feeds as $id_feed) {
if ($id_feed)
......
......@@ -16,7 +16,7 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
......@@ -45,6 +45,11 @@ class Class_RssItem {
}
public function getPubDate() {
return trim($this->_wrapped_item->pubDate());
}
public function getDate() {
$date = '';
if ($item_date = trim($this->_wrapped_item->pubDate())) {
......
......@@ -52,6 +52,23 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
}
public function getStatus() {
return '';
}
public function getResponse() {
return '';
}
public function getLibrary() {
return ($library = Class_Bib::findFirstBy(['id_site' => $this->getBibId()]))
? $library->getLibelle()
: '';
}
public function validate() {
$this
->validateTitleOrComment()
......@@ -136,7 +153,6 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
}
public function getIdabon() {
if ($this->hasUser() && $this->getUser()->isAbonne())
return $this->getUser()->getIdabon();
......
......@@ -19,7 +19,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Systeme_ModulesAccueil_Rss extends Class_Systeme_ModulesAccueil_Null {
const CODE = 'RSS';
const
CODE = 'RSS',
ORDER_SELECTION = 'selection',
ORDER_RANDOM = 'random',
ORDER_ALPHA = 'titre';
protected
$_group = Class_Systeme_ModulesAccueil::GROUP_INFO,
......
......@@ -49,6 +49,11 @@ class Class_User_Cards extends Storm_Model_Collection {
}
public function getSuggestions() {
return $this->_decorateOperationFrom(function($card) { return new Storm_Collection($card->getSuggestionAchat()); });
}
public function countWaitingToBePulled() {
return $this->injectInto(0,
function($count, $card)
......
......@@ -64,6 +64,7 @@ class Class_WebService_SIGB_Koha_RestfulService
trim($json)));
return (new Class_WebService_SIGB_Koha_SuggestionsReader())
->setUser($user)
->parse($json);
}
......
......@@ -23,6 +23,15 @@
class Class_WebService_SIGB_Koha_SuggestionsReader {
use Trait_Translator;
protected $_user;
public function setUser($user) {
$this->_user = $user;
return $this;
}
public function parse($json) {
return ($datas = json_decode($json)) ?
array_map([$this, '_parseOne'], $datas) : [];
......@@ -31,6 +40,7 @@ class Class_WebService_SIGB_Koha_SuggestionsReader {
protected function _parseOne($data) {
return (new Class_WebService_SIGB_Suggestion())
->setUser($this->_user)
->setTitle(trim($data->title))
->setAuthor(trim($data->author))
->setPublicationYear($this->_publicationYearFor($data))
......
......@@ -20,6 +20,7 @@
*/
class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIGB_AbstractILSDIPatronInfoReader{
protected
$_user,
$_suggests = [],
$_item_priorities = [],
$_current_suggest;
......@@ -32,6 +33,12 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
}
public function setUser($user) {
$this->_user = $user;
return $this;
}
public function startHold($attributes) {
parent::startHold($attributes);
$this->_item_priorities = [];
......@@ -195,7 +202,8 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
public function startSuggest() {
$this->_current_suggest = new Class_WebService_SIGB_Nanook_Suggestion();
$this->_current_suggest = (new Class_WebService_SIGB_Nanook_Suggestion)
->setUser($this->_user);
}
......
......@@ -333,9 +333,10 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
public function suggestionsOf($user) {
return $this->getSuggestionsFromilsdiPatronInfo(['patronId' => $user->getIdSigb()],
Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance());
return
$this->getSuggestionsFromilsdiPatronInfo(['patronId' => $user->getIdSigb()],
Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance()
->setUser($user));
}
......
......@@ -28,6 +28,7 @@ class Class_WebService_SIGB_Nanook_Suggestion extends Class_WebService_SIGB_Sugg
$this->_attribs = array_merge($this->_attribs, ['url' => '']);
}
public function acceptVisitor($visitor) {
$visitor
->visitField($this->_('Isbn/Ean'), $this->getIsbn())
......
......@@ -86,4 +86,24 @@ class Class_WebService_SIGB_Suggestion extends Class_Entity {
public function getAuteur() {
return $this->getAuthor();
}
public function getTypeDoc() {
return null;
}
public function getDateCreation() {
return $this->getDate();
}
public function getCommentaire() {
return $this->getNote();
}
public function getDescriptionUrl() {
return $this->getUrl();
}
}
\ No newline at end of file
<?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 ZendAfi_View_Helper_Abonne_NewSuggestion extends ZendAfi_View_Helper_BaseHelper {
public function abonne_NewSuggestion($form, $preferences, $records = []) {
$html = [$this->view->openBoiteContent($this->_('Suggérer un achat'))];
$send_form_button = '';
if ($records) {
$html [] = $this->view->tag('p', $this->_('Les documents suivants sont dans le catalogue.'));
$html [] = $this->view->tag('p', $this->_('Votre suggestion en fait-elle partie ?'));
$html [] = $this->view->button(new Class_Entity(['Text' => $this->_('Oui'),
'Url' => $this->view->url(['action' => 'suggestion-achat']),
'Attribs' => ['title' => $this->_('Annuler et revenir à la liste des suggestions.')]]));
$send_form_button = new Class_Entity(['Text' => $this->_('Non'),
'Attribs' => ['title' => $this->_('Envoyer la suggestion'),
'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]);
$html [] = $this->view->button($send_form_button);
$send_form_button->setText($this->_('Envoyer'));
$html [] = $this->view->ListeNotices_Mur($records);
$submit = $form->getElement('submit');
$submit
->setLabel($this->_('Relancer la recherche'))
->setAttribs(['title' => $this->_('Relance la recherche ou envoie la suggestion en cas de recherche infructueuse')]);
}
if (trim($preferences['help-text']))
$html [] = $this->view->tag('div',
$preferences['help-text'],
['class' => 'help-text']);
$html [] = $this->view->renderForm($form);
if ($send_form_button)
$html [] = $this->view->button($send_form_button);
$html [] = $this->view->closeBoiteContent();
return implode($html);
}
}
\ No newline at end of file
......@@ -418,8 +418,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
}
.jumbotron .nav-link div {
font-size: 11px;
max-width: 100px;
font-size: 10px;
}
.modal_image {
......@@ -738,4 +737,8 @@ dl.row {
.menu_admin_front a[class*="deactivate"][style*="inline"] {
display: block !important;
}
.description dd a + a {
display: block;
}
\ No newline at end of file
......@@ -68,26 +68,34 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
public function getDescription() {
$html = [$this->getBadges()];
if (!$this->_model->getNoticeOPAC())
return '';
return implode($html);
$wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view)
->setModel($this->_model->getNoticeOPAC());
return $wrapper->getDescription();
$html [] = $wrapper->getDescription();
return implode($html);
}
public function getFullDescription() {
$html = [$this->getBadges()];
if (!$this->_model->getNoticeOPAC())
return '';
return implode($html);
$wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view)
->setModel($this->_model->getNoticeOPAC());
return $wrapper->getFullDescription();
$html [] = $wrapper->getFullDescription();
return implode($html);
}
......@@ -167,30 +175,49 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
public function getBadges() {
if (!$this->_model->getNoticeOPAC())
return null;
$badges = [
((new Intonation_Library_Badge)
->setTag('span')
->setClass('secondary')
->setClass('success')
->setText($this->_model->isWaitingToBePulled() ? $this->_('Prêt !') : '')
->setTitle($this->_('Votre réservation %s est prête', $this->_model->getTitre()))),
((new Intonation_Library_Badge)
->setTag('span')
->setClass($this->_model->isWaitingToBePulled() ? 'success' : 'secondary')
->setImage(Class_Template::current()->getIco($this->_view,
'library',
'library'))
->setText($this->_model->getBibliotheque())
->setTitle($this->_('Bibliothèque de l\'emprunt: %s', $this->_model->getBibliotheque())))
];
->setText($this->_model->getPickupLocationLabel())
->setTitle($this->_('Récupérer la réservation à %s', $this->_model->getPickupLocationLabel()))),
$wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view)
->setModel($this->_model->getNoticeOPAC());
((new Intonation_Library_Badge)
->setTag('span')
->setClass('secondary')
->setText($this->_model->getEtat())
->setTitle($this->_('État de la réservation: %s', $this->_model->getEtat()))),
((new Intonation_Library_Badge)
->setTag('span')
->setClass('secondary')
->setText($this->_model->getRang())
->setTitle($this->_('Rang de la réservation: %s', $this->_model->getRang())))
];
return $this->_view->renderBadges($badges) . $wrapper->getBadges();
return $this->_view->renderBadges($badges);
}
public function getActions() {
return [];
return [ new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'reservations',
'id_delete' => $this->_model->getId()]),
'Text' => $this->_('Supprimer'),
'Image' => Class_Template::current()->getIco($this->_view,
'delete',
'utils'),
'Title' => $this->_('Supprimer la réservation %s',
$this->_model->getTitre())])];
}
......
......@@ -133,6 +133,7 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr
((new Intonation_Library_Badge)
->setTag('a')
->setClass('primary text-light')
->setText(str_replace([' ', '.', ','], ' ', $this->_model->getTelephone()))
->setUrl(sprintf('tel:%s',
str_replace([' ', '.', ',',], '', $this->_model->getTelephone())))
->setImage(Class_Template::current()->getIco($this->_view,
......
......@@ -145,14 +145,14 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
((new Intonation_Library_Badge)
->setTag('span')
->setClass('info')
->setClass('warning')
->setImage(Class_Template::current()->getIco($this->_view,
'thumbtack',
'library'))
->setText(($this->_model->getOnHold()
? $this->_('Réservé')
->setText(($this->_model->getBookedByOthers()
? $this->_('Déjà réservé')
: ''))
->setTitle($this->_('Exemplaire réservé'))),
->setTitle($this->_('Exemplaire déjà réservé par d\'autres'))),