Commit 4a20e1b8 authored by Ghislain Loas's avatar Ghislain Loas

wip on bootstrap

parent 5d74dfe5
Pipeline #9118 passed with stage
in 45 minutes and 28 seconds
......@@ -77,4 +77,25 @@ class Admin_TemplateController extends ZendAfi_Controller_Action {
$this->_helper->notify($this->_('Thème %s mis à jour', $template->getId()));
return $this->_redirectClose($this->_getReferer());
}
public function applyAction() {
if(!$this->view->template = (new Class_Template_Loader)->find($this->_getParam('template'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template'));
return $this->_redirectToIndex();
}
$this->view->titre = $this->_('Appliquer le thème %s à un profil',
$this->view->template->getTitle());
if(!$profile = Class_Profil::find($this->_getParam('on')))
return;
if(!$profile_id = $this->view->template->applyOn($profile)) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'));
return $this->_redirectToIndex();
}
$this->_redirect('/opac/index/index/id_profil/' . $profile_id);
}
}
\ No newline at end of file
<?php
$description = (new Class_TableDescription('profiles'))
->addColumn($this->_('ID'), function($profile)
{
return $profile->getId();
})
->addColumn($this->_('Profil'), function($profile)
{
return $profile->getLibelle();
})
->addColumn($this->_('Thème courant'), function($profile)
{
return $profile->getTemplate();
})
->addRowAction(function($profile) { return $this->renderModelActions($profile,
[
['url' => ['module' => 'admin',
'controller' => 'template',
'action' => 'apply',
'template' => $this->template->getId(),
'on' => '%s',
'render' => ''],
'id' => $profile->getId(),
'icon' => 'validate',
'anchorOptions' => ['target' => '_blank'],
'label' => $this->_('Appliquer le thème sur le profil %s',
$profile->getLibelle())]]);
});
echo $this->renderTable($description, Class_Profil::findTopProfils());
......@@ -119,6 +119,9 @@ class ArticleLoader extends Storm_Model_Loader {
* @return ArticleLoader
*/
protected function _whereEventDateIn($event_date) {
if (!$this->_select)
return $this;
if ($this->_events_only) {
$this->_select->where('EVENTS_DEBUT IS NOT NULL');
$this->_select->where('EVENTS_FIN IS NOT NULL');
......@@ -141,6 +144,9 @@ class ArticleLoader extends Storm_Model_Loader {
* @return ArticleLoader
*/
protected function _whereEventStartAfter($event_date) {
if (!$this->_select)
return $this;
if (!$event_date || (7 > strlen($event_date)))
return $this;
......@@ -155,6 +161,9 @@ class ArticleLoader extends Storm_Model_Loader {
protected function _whereEventEndAfter($event_date) {
if (!$this->_select)
return $this;
if (!$event_date || (10 > strlen($event_date)))
return $this;
......
......@@ -100,6 +100,11 @@ class Class_Template {
}
public function getApplyUrl() {
return Class_Url::relative(sprintf('/admin/template/apply/template/%s', $this->getId()));
}
public function getEditUrl() {
return Class_Url::relative(sprintf('/admin/template/edit/template/%s', $this->getId()));
}
......@@ -136,6 +141,21 @@ class Class_Template {
}
public function applyOn($profile) {
if(!$profile)
return null;
$profile
->setTemplate($this->getId())
->save();
Class_Profil::setCurrentProfil($profile);
$profile = $this->_patchProfile($profile);
$profile->save();
return $profile->getId();
}
public function createFrom($profile) {
if(!$profile)
return null;
......
......@@ -27,7 +27,9 @@ class Class_Template_Loader {
public function getTemplates() {
return [new Historic_Template,
new Intonation_Template,
new MyBibApp_Template];
new MyBibApp_Template,
new TerreDuMilieu_Template
];
}
......
......@@ -34,14 +34,19 @@ class ZendAfi_Controller_Plugin_Manager_Template extends ZendAfi_Controller_Plug
'anchorOptions' => ['data-popup' => true]],
['url' => $model->getResetUrl(),
'icon' => 'reload',
'icon' => 'cancel',
'label' => $this->_('Réinitialiser le thème %s', $model->getTitle()),
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir réinitialiser le thème %s ?', $model->getTitle()))],
['url' => $model->getUpdateUrl(),
'icon' => 'batch',
'label' => $this->_('Mettre à jour le thème %s', $model->getTitle()),
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir mettre à jour le thème %s ?', $model->getTitle()))]
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir mettre à jour le thème %s ?', $model->getTitle()))],
['url' => $model->getApplyUrl(),
'icon' => 'copy_profil',
'label' => $this->_('Appliquer le thème %s sur le profil souhaité', $model->getTitle()),
'anchorOptions' => ['data-popup' => true]]
];
}
......
......@@ -102,50 +102,9 @@ class ZendAfi_View_Helper_Admin_FrontNavEntries extends ZendAfi_View_Helper_Base
protected function _adminActions() {
$actions = [];
if ($this->_isAllowed('profil', 'accueil') && Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::getCurrentProfil())) {
$actions[] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'profil',
'action' => 'edit',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Configuration du profil') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('icons',
'profiles')),
[
'class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer le profil ' . Class_Profil::getCurrentProfil()->getLibelle()),
'data-popup' => 'true']);
$actions[] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'profil',
'action' => 'accueil',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Configuration de la page') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('actions',
'edit')),
['class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer la page ' . Class_Profil::getCurrentProfil()->getLibelle()),
'data-popup' => 'true']);
$actions[] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'widget',
'action' => 'add-from-template',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Ajouter une boîte') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('actions',
'add')),
['class' => 'menu_admin_front_anchor',
'title' => $this->_('Ajouter une boîte à cette page'),
'data-popup' => 'true']);
}
if ($this->_isAllowed('profil', 'accueil') && Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::getCurrentProfil()))
$actions = $this->_profileActions($actions);
$actions []= $this->view->tagAnchor(Class_Url::absolute('/admin/index/clearcache/'),
$this->_('Vider le cache') .
......@@ -179,6 +138,69 @@ class ZendAfi_View_Helper_Admin_FrontNavEntries extends ZendAfi_View_Helper_Base
}
protected function _profileActions($actions) {
if (!Class_Template::current()->isLegacy())
$actions [] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'template',
'action' => 'edit',
'template' => Class_Template::current()->getId()],
null,
true),
$this->_('Configuration du template') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('icons',
'image_cache')),
[
'class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer le template ' . Class_Template::current()->getTitle()),
'data-popup' => 'true']);
$actions [] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'profil',
'action' => 'edit',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Configuration du profil') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('icons',
'profiles')),
[
'class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer le profil ' . Class_Profil::getCurrentProfil()->getLibelle()),
'data-popup' => 'true']);
$actions [] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'profil',
'action' => 'accueil',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Configuration de la page') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('actions',
'edit')),
['class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer la page ' . Class_Profil::getCurrentProfil()->getLibelle()),
'data-popup' => 'true']);
$actions [] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'widget',
'action' => 'add-from-template',
'id_profil' => Class_Profil::getCurrentProfil()->getId()],
null,
true),
$this->_('Ajouter une boîte') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('actions',
'add')),
['class' => 'menu_admin_front_anchor',
'title' => $this->_('Ajouter une boîte à cette page'),
'data-popup' => 'true']);
return $actions;
}
protected function _toggleAnchor($label, $key, $js_on, $js_off) {
$toggleFy = function($function_name, $img) use ($label, $key) {
return $this->_tag('a',
......
......@@ -54,7 +54,7 @@ class ZendAfi_View_Helper_Template_Base extends ZendAfi_View_Helper_BaseHelper {
return $this->_tag('div',
implode($html) . $this->_getAdminTools(),
['id' => 'boite_' . $this->_widget->getId(),
['id' => 'boite_' . $this->_widget->getIdForHtml(),
'class' => sprintf('boite %s %s',
$this->_getClasses(),
$this->_widget->wrapperClasses())]);
......
......@@ -26,7 +26,7 @@ class Intonation_Library_Widget_AdminTools_Form extends ZendAfi_Form_Configurati
$this
->addElement('radio',
'display_mode',
['label' => $this->_('Disposition des outils d\administration'),
['label' => $this->_('Disposition des outils d\'administration'),
'multiOptions' => [Intonation_Library_Widget_AdminTools_Definition::TOGGLE => $this->_('Voir un bouton à bascule'),
Intonation_Library_Widget_AdminTools_Definition::FULL => $this->_('Voir tous les boutons')]])
......
......@@ -61,7 +61,10 @@ class Intonation_Library_Widget_Admintools_View extends Zendafi_View_Helper_Accu
return $this->view->tag('div',
$this->view->tag('button',
$this->_tag('i','', ['class' => 'fas fa-user-cog']),
$this->_tag('i','', ['class' => 'fas fa-user-cog'])
. $this->_tag('span',
$this->_('Administration'),
['class' => 'button_text d-inline']),
['id' => $id,
'data-toggle' => 'dropdown',
'aria-haspopup' => 'true',
......
......@@ -55,7 +55,7 @@ class Intonation_Library_Widget_Carousel_Agenda_View extends Intonation_Library_
protected function _getLinkToAllTitle() {
return '';
return $this->_('Voir tous les événements de la boite %s dans une liste', $this->titre);
}
......
......@@ -39,7 +39,7 @@ class Intonation_Library_Widget_Carousel_Author_View extends Intonation_Library_
protected function _getLinkToAllTitle() {
return '';
return $this->_('Voir tous les auteurs de la boite %s dans une liste', $this->titre);
}
......
......@@ -46,7 +46,7 @@ class Intonation_Library_Widget_Carousel_Domain_View extends Intonation_Library_
protected function _getLinkToAllTitle() {
return '';
return $this->_('Voir tous les domaines de la boite %s dans une liste', $this->titre);
}
......
......@@ -52,7 +52,7 @@ class Intonation_Library_Widget_Carousel_Library_View extends Intonation_Library
protected function _getLinkToAllTitle() {
return '';
return $this->_('Voir toutes les bibliothèques de la boite %s dans une liste', $this->titre);
}
......
......@@ -40,7 +40,7 @@ class Intonation_Library_Widget_Carousel_Newsletter_View extends Intonation_Libr
protected function _getLinkToAllTitle() {
return '';
return $this->_('Voir toutes les lettres d\'informations de la boite %s dans une liste', $this->titre);
}
......
......@@ -108,6 +108,9 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas
protected function _renderPicto($params) {
if (!isset($params['picto']))
return '';
if (!$src = $params['picto'])
return '';
......@@ -169,24 +172,35 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas
->load())
return '';
$label = $this->_renderPicto($child->getLocalSettings()) . $child->getLabel();
$html = $child->isMenu()
? $this->view->tagAnchor('#',
$label
. $this->_tag('span', '', ['class' => 'caret']),
['class' => 'nav-link dropdown-toggle',
'title' => $this->_('Afficher ou masquer le menu "%s"', $child->getLabel()),
'data-toggle' => 'dropdown',
'role' => 'button',
'aria-haspopup' => 'true',
'aria-expanded' => 'false'])
: $this->view->tagAnchor($child->getLink(),
$label,
['title' => $this->_('Accéder à "%s"', $child->getLabel()),
'class' => 'nav-link']);
$label = $this->_renderPicto($child->getLocalSettings()) . $this->_tag('div',
$child->getLabel(),
['class' => 'button_text d-sm-inline text-left']);
$html = $this->_getHtml($child, $label);
return $html
. $this->view->tagEditMenu($id, $this->_profile_id, $parent);
}
protected function _getHtml($instance, $label) {
if ($instance->isMenu())
return $this->view->tagAnchor('#',
$label
. $this->_tag('span', '', ['class' => 'caret']),
['class' => 'nav-link dropdown-toggle',
'title' => $this->_('Afficher ou masquer le menu "%s"', $instance->getLabel()),
'data-toggle' => 'dropdown',
'role' => 'button',
'aria-haspopup' => 'true',
'aria-expanded' => 'false']);
if ($instance->isWidget())
return Class_Template::current()->renderWidget($instance, $this->view);
return $this->view->tagAnchor($instance->getLink(),
$label,
['title' => $this->_('Accéder à "%s"', $instance->getLabel()),
'class' => 'nav-link']);
}
}
......@@ -120,7 +120,7 @@ abstract class IntonationSearchRenderAbstract {
$form
->addElement('hidden',
'tri',
uniqid() . 'tri',
['value' => $this->_getOrder()])
->addElement('search',
......@@ -152,16 +152,30 @@ abstract class IntonationSearchRenderAbstract {
'onclick' => 'var form = $(this).closest(\'form\'); form.attr(\'action\', \'' . $this->_view->url(['controller' => 'recherche', 'action' => 'simple'], null, true) . '\'); form.find(\'.expressionRecherche\').attr(\'value\', \'\'); $(this).hide(); form.find(\'.criteres_recherche\').hide();']);
}])
->addElement('submit',
'search_submit',
['label' => $this->_settings->getSearchButton(),
->addElement('button',
uniqid() . 'search_submit',
['content' => $this->_renderPicto($this->_settings->getSearchButton()),
'title' => $this>_('Rechercher'),
'type' => 'submit',
'escape' => false,
'onclick' => '$(this).parents(\'form\').submit()',
'order' => 10]);
'order' => 10])
->addElement('submit',
uniqid() . 'submit',
['style' => 'display: none !important;']);
return $form;
}
protected function _renderPicto($text) {
return false === strpos($text, ' ')
? $text
: Class_Template::current()->getIco($this->_view, $text);
}
protected function _getForm() {
$form = $this->_getMainForm();
$elements = $this->_getOptionalElements();
......
......@@ -138,7 +138,7 @@ class Intonation_Library_WidgetTemplates {
unset($layout['title']);
$templates [] = ['title' => $title,
'icon' => Class_Template::current()->getId() . '_' . $type . '.jpg',
'icon' => 'TEMPLATE_' . $type . '.jpg',
'type' => $type,
'configuration' => array_merge($layout,
['boite' => $boite])];
......@@ -177,7 +177,7 @@ class Intonation_Library_WidgetTemplates {
}
$templates [] = ['title' => $title,
'icon' => Class_Template::current()->getId() . '_' . $type . '_' . $layout . '.jpg',
'icon' => 'TEMPLATE_' . $type . '_' . $layout . '.jpg',
'type' => $type,
'configuration' => ['rendering' => $rendering,
'layout' => $layout,
......
......@@ -47,6 +47,14 @@ abstract class Intonation_System_Abstract {
}
public function getIdForHtml() {
if (!$parent = $this->getParent())
return $this->getId();
return $parent . '-' . $this->getId();
}
protected function _getViewHelper($view) {
$base = new ZendAfi_View_Helper_Template_Base($this, $view);
......
:root {
--tdm-search-color: #e83a3b;
--tdm-link-color: #f1cb00;
--tdm-button-text-color: #000;
--tdm-footer-link-color: #f9f9f9;
--tdm-main-background: #f9f9f9;
--main-nav-button-background-color: #3dae9a;
--first-division-background-color: #1a6362;
--main-division-background-color: #f9f9f9;
--third-division-background-color: #f2f2f2;
--footer-background-color: #3dae9a;
--footer-widget-background-color: #000;
}
header {
background: url(../images/header.jpg);
background-position: top 3em center;
background-repeat: no-repeat;
background-size: cover;
}
.tdm_search_widget {
padding-bottom: 5em;
}
.tdm_search_widget .form-control,
.tdm_search_widget button {
background-color: rgba(255, 255, 255, 0.90);
font-size: 1.2em;
color: var(--tdm-search-color);
vertical-align: middle;
margin: 0;
}
.tdm_search_widget .form-control {
padding:0;
}
.tdm_search_widget button {
height: 2em;
padding: 0 1em;
border-left: 2px dotted var(--tdm-search-color) !important;
}