Commit b861d1dd authored by Ghislain Loas's avatar Ghislain Loas

work on bootstrap

parent 8a48710a
Pipeline #8091 passed with stage
in 34 minutes and 47 seconds
......@@ -248,4 +248,74 @@ class BibController extends ZendAfi_Controller_Action {
$this->view->titre = $this->_('Carte des bibliothèques');
$this->view->libraries = Class_Bib::findAllWithCoordinates();
}
public function enLirePlusAction() {
$this->_initLibrary();
}
public function ouverturesAction() {
$this->_initLibrary();
}
public function informationsAction() {
$this->_initLibrary();
}
public function carteAction() {
$this->_initLibrary();
}
public function equipeAction() {
$this->_initLibrary();
}
public function agendaAction() {
$this->_initLibrary();
}
public function avisProAction() {
$this->_initProUser();
}
public function articlesProAction() {
$this->_initProUser();
}
public function selectionsProAction() {
$this->_initProUser();
}
protected function _initProUser() {
$this->_initLibrary();
if (!$pro = Class_Users::find($this->_getParam('pro_id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
if (!$pro->canAccessBackend()) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
$this->view->pro = $pro;
}
protected function _initLibrary() {
if (!$this->view->library = Class_Bib::find($this->_getParam('id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
}
}
\ No newline at end of file
......@@ -226,15 +226,34 @@ class CmsController extends ZendAfi_Controller_Action {
public function calendarAction() {
$viewRenderer = $this->getHelper('ViewRenderer');
if ($this->_getParam('render') === 'ajax')
$viewRenderer->setLayoutScript('empty.phtml');
$this->_initCalendarAndPreferences();
$id_module = $this->_getParam("id_module");
if ($this->_getParam('render') === 'ajax') {
$content = $this->view->calendarContent($this->view->calendar,
$this->view->preferences);
$script_loader = Class_ScriptLoader::getInstance();
$scripts = $script_loader
->addAdminScript('onload_utils')
->addJQueryReady('setupAnchorsTarget();')
->html();
$this->_helper->HTMLAjaxResponse($scripts . $content);
}
}
protected function _initCalendarAndPreferences() {
$id_module = $this->_getParam('id_module');
if (false !== strpos($id_module, 'library'))
return $this->_loadLibraryAgenda((int) filter_var($id_module, FILTER_SANITIZE_NUMBER_INT));
$module = Class_Profil::getCurrentProfil()->getModuleAccueilPreferences($id_module, 'CALENDAR');
$module_calendrier = new Class_Systeme_ModulesAccueil_Calendrier();
$preferences = array_merge($module_calendrier->getDefaultValues(),
Class_Profil::getCurrentProfil()->getModuleAccueilPreferences($id_module, 'CALENDAR'));
$module);
$preferences['ID_MODULE'] = $id_module;
$preferences['SELECT_ID_CAT'] = $preferences['display_cat_select']
? $this->_getParam('select_id_categorie')
......@@ -249,6 +268,16 @@ class CmsController extends ZendAfi_Controller_Action {
}
protected function _loadLibraryAgenda($id) {
$wrapper = new Intonation_Library_View_Wrapper_Library_RichContent_Agenda;
$wrapper
->setModel(Class_Bib::find($id))
->setView($this->view);
$this->view->preferences = $wrapper->getPreferences();
$this->view->calendar = $wrapper->getCalendar($this->_request->getParams());
}
/**
* @param int $id_module
......
<?php
echo $this->library_Agenda($this->library);
<?php
echo $this->library_ProArticles($this->library, $this->pro);
<?php
echo $this->library_ProReviews($this->library, $this->pro);
<?php
echo $this->library_Map($this->library);
<?php
echo $this->library($this->library);
<?php
echo $this->library_Team($this->library);
<?php
echo $this->library_Details($this->library);
<?php
echo $this->library_Openings($this->library);
<?php
echo $this->library_SelectionsPro($this->library, $this->pro);
......@@ -45,5 +45,4 @@
| icon slideshow by Javier Cabezas | CCBY | | editeur d'articles | | https://thenounproject.com/term/slideshow/6517/ |
| PHP-Parser | BSD-3-Clauses | - | validation de fichiers php (formulaires de recherche) | | https://github.com/nikic/PHP-Parser |
| Jquery Notification | MIT ? | | barre bleue de notification | oui (barre en bas) | n'existe plus |
| leaflet.fullscreen | MIT | | bouton plein écran sur la carte des bibliothèques | | https://github.com/brunob/leaflet.fullscreen |
......@@ -36,6 +36,7 @@ class ArticleLoader extends Storm_Model_Loader {
/** @var bool */
protected $_published;
protected $_display_mode;
protected $_all_articles;
/**
* @return ArticleLoader
......@@ -893,6 +894,11 @@ class Class_Article extends Storm_Model_Abstract {
}
public function getTypeDocLabel() {
return Class_TypeDoc::getLabelFor($this->getTypeDocId());
}
/**
* @param string $str_date
* @return bool
......
......@@ -330,7 +330,8 @@ class Class_Bib extends Storm_Model_Abstract {
'id_lieu' => 0,
'rewrite_url' => '',
'link_to_profil_id' => 0,
'gln' => ''],
'gln' => '',
'url_web' => ''],
$_file_uploaded = false,
$_uploadHandler;
......@@ -1008,4 +1009,14 @@ class Class_Bib extends Storm_Model_Abstract {
return $e->getMessage();
}
}
public function getPictureUrl() {
if (!$picture = $this->getPhoto())
return '';
return (false === strpos($picture, 'userfiles'))
? USERFILESURL . static::BASE_PATH . $picture
: BASE_URL . $picture;
}
}
......@@ -79,7 +79,6 @@ class Class_Calendar {
$this->id_bib = Class_Profil::getCurrentProfil()->getIdSite();
$this->preferences['nb_events'] = (int)$this->preferences['nb_events'];
if (!array_isset('display_cat_select', $this->preferences))
$this->preferences['display_cat_select'] = false;
......@@ -153,7 +152,9 @@ class Class_Calendar {
protected function _loadArticles($extra_prefs) {
$prefs = array_merge(['display_order' => $this->preferences['display_order'],
$prefs = array_merge(['display_order' => (isset($this->preferences['display_order'])
? $this->preferences['display_order']
: $this->preferences['order']),
'id_categorie' => $this->_getCategoriesIds(),
'events_only' => true,
'event_date' => $this->date,
......@@ -217,12 +218,12 @@ class Class_Calendar {
$articles = $this->_loadArticles($prefs);
if (count($articles) < $this->preferences['nb_events']
if (count($articles) < $this->_getSize()
&& $this->preferences['event_filter'] == 'none') {
$next_articles = $this->_loadArticles(['event_start_after' => $this->date,
'event_date' => '',
'event_end_after' => '',
'limit' => $this->preferences['nb_events']]);
'limit' => $this->_getSize()]);
$articles = array_merge($articles,
Class_Article::filterByLocaleAndWorkflow($next_articles));
}
......@@ -231,6 +232,17 @@ class Class_Calendar {
}
protected function _getSize() {
if (isset($this->preferences['size']))
return (int) $this->preferences['size'];
if (isset($this->preferences['nb_events']))
return (int) $this->preferences['nb_events'];
return 3;
}
public function getAdminSelectedCategories() {
if (isset($this->admin_selected_categories))
return $this->admin_selected_categories;
......@@ -252,7 +264,7 @@ class Class_Calendar {
? $this->_loadArticles(['event_date' => $this->day])
: $this->_getNextEvents();
return array_slice($articles, 0, $this->preferences['nb_events']);
return array_slice($articles, 0, $this->_getSize());
}
......@@ -277,7 +289,9 @@ class Class_Calendar {
public function getDisplayFullPage() {
return $this->preferences['display_full_page'];
return isset($this->preferences['display_full_page'])
? $this->preferences['display_full_page']
: false;
}
......
......@@ -58,6 +58,23 @@ class NewsletterLoader extends Storm_Model_Loader {
return Class_Newsletter::findAllBy(['draft' => 0,
'order' => 'titre']);
}
public function getPublishedNewslettersForLibrary($library) {
if (!$groups = Class_UserGroup::findAllBy(['id_bib' => $library->getId()]))
return [];
if (!$newsletters = $this->getPublishedNewsletters())
return [];
$newsletters_for_library = [];
foreach ($newsletters as $newsletter)
if ($newsletter->doesRecipientsGroupsContains($groups))
$newsletters_for_library [] = $newsletter;
return $newsletters_for_library;
}
}
......@@ -181,6 +198,9 @@ class Class_Newsletter extends Storm_Model_Abstract {
public function isBlackListed($user) {
if (!$user)
return false;
return Class_Newsletter_Blacklist::isBlackListed($user->getMail(), $this->getId());
}
......@@ -199,6 +219,22 @@ class Class_Newsletter extends Storm_Model_Abstract {
}
public function doesRecipientsGroupsContains($groups) {
if (!$recipients_groups = $this->getRecipientsGroups())
return false;
$recipients_groups_ids = [];
foreach ($recipients_groups as $group)
$recipients_groups_ids [] = $group->getId();
$goups_ids = [];
foreach ($groups as $group)
$groups_ids [] = $group->getId();
return !empty(array_intersect($recipients_groups_ids, $groups_ids));
}
public function getReceivers($recipient_size) {
return Class_Users::getNewslettersReceivers($this->getId(), $recipient_size);
}
......
......@@ -135,6 +135,7 @@ class Class_PanierNotice extends Storm_Model_Abstract {
'unique' => true]],
$_default_attribute_values = ['notices' => '',
'date_maj' => '',
'libelle' => '',
'integration_hash' => ''];
......
......@@ -163,6 +163,8 @@ class Class_ScriptLoader {
return $this
->addAdminScript('leaflet-0.7.7/leaflet.js')
->addOPACPluginScript('leaflet-ajax-gh-pages/dist/leaflet.ajax.min.js')
->addOPACPluginScript('leaflet.fullscreen-master/Control.FullScreen.js')
->addOPACPluginStyleSheet('leaflet.fullscreen-master/Control.FullScreen.css')
->addStyleSheet(URL_ADMIN_JS . 'leaflet-0.7.7/leaflet.css');
}
......
......@@ -287,6 +287,9 @@ class Class_UserGroup extends Storm_Model_Abstract {
public function hasUser($user) {
if (!$user)
return false;
if ($this->isManual())
return in_array($user->getId(), $this->getUsersIdsOptimized());
......
......@@ -1926,6 +1926,20 @@ class Class_Users extends Storm_Model_Abstract {
}
public function numberOfPublishedArticles() {
return count($this->getPublishedArticles());
}
public function getPublishedArticles() {
return Class_Article::findAllBy(['id_user' => $this->getId(),
'status' => Class_Article::STATUS_VALIDATED,
'debut not' => 'null',
'events_fin not' => 'null',
'order' => 'events_debut desc']);
}
public function hasToBeDelete() {
return static::STATUT_TO_BE_DELETED == $this->getStatut();
}
......
......@@ -355,7 +355,9 @@ class ZendAfi_Form extends Zend_Form {
if(!$element = $this->getElement($element_id))
return $this;
$this->_elements[$element_id] = $this->createElement($config[0], $config[1], $config[2]);
$with_id = $config[1];
$this->_elements[$element_id] = $this->createElement($config[0], $with_id, $config[2]);
foreach ($this->_displayGroups as $group) {
if (null == $group->getElement($element_id))
continue;
......@@ -365,6 +367,9 @@ class ZendAfi_Form extends Zend_Form {
$group->setElements($elements);
}
if ($element_id != $with_id)
$this->renameElement($element_id, $with_id);
return $this;
}
......
......@@ -211,17 +211,26 @@ class ZendAfi_View_Helper_Calendar_Table extends ZendAfi_View_Helper_BaseHelper
protected function getTableCalendarHeader() {
$attribs = [];
$attribs['class'] = implode(' ',
array_filter(['calendar_title_month_clickable',
$this->_getAjaxClass()]));
$attribs['class'] = implode(' ', array_filter(['calendar_title_month_clickable',
$this->_getAjaxClass()]));
$next = $this->view->tagAnchor($this->getUrl('NEXT_MONTH'),
'&nbsp;&raquo;',
array_merge($attribs,
['title' => $this->_('Mois suivant')]));
$next = $this->view->tagAnchor($this->getUrl('NEXT_MONTH'), '&nbsp;&raquo;', $attribs);
$previous = $this->view->tagAnchor($this->getUrl('LAST_MONTH'), '&laquo;&nbsp;', $attribs);
$previous = $this->view->tagAnchor($this->getUrl('LAST_MONTH'),
'&laquo;&nbsp;',
array_merge($attribs,
['title' => $this->_('Mois précédent')]));
$current = $this->view->tagAnchor($this->getUrl('MONTH'),
$this->MONTHS[$this->month-1] .
strftime(' %Y', mktime(5,0,0, $this->month, 1, $this->year)),
$attribs);
array_merge($attribs,
['title' => $this->_('Mois courant')]));
return $this->_tag('tr',
......@@ -331,7 +340,10 @@ class ZendAfi_View_Helper_Calendar_Table extends ZendAfi_View_Helper_BaseHelper
return $this->view
->tagAnchor($this->getUrl('EVENTS', $day, $month),
$this->_isTimestampToday($time) ? $this->_tag('b', $day) : $day,
['class' => implode(' ', $classes)]);
['title' => $this->_('Voir les événements du %s/%s',
$day,
$month),
'class' => implode(' ', $classes)]);
}
......
......@@ -55,7 +55,11 @@ class ZendAfi_View_Helper_CalendarContent extends ZendAfi_View_Helper_BaseHelper
* N'est affiché que si l'option administrateur est cochée param["DISPLAY_CAT_SELECT"]
*/
protected function rendSelectionCategories() {
if (!$this->param["display_cat_select"]) return;
if (!isset($this->param["display_cat_select"]))
return;
if (!$this->param["display_cat_select"])
return;
$cats = $this->calendar->getAdminSelectedCategories();
......@@ -98,6 +102,9 @@ class ZendAfi_View_Helper_CalendarContent extends ZendAfi_View_Helper_BaseHelper
protected function rendDateSelection() {
if (!isset($this->param['display_calendar']))
return;
if (!$mode = (int)$this->param['display_calendar'])
return '';
......
......@@ -25,7 +25,8 @@ abstract class ZendAfi_View_Helper_Filters_Element extends ZendAfi_View_Helper_B
$_custom_field_id,
$_filter_key,
$_active_filters,
$_model_label;
$_model_label,
$_settings;
public static function forFilter($filter) {
......@@ -83,6 +84,27 @@ abstract class ZendAfi_View_Helper_Filters_Element extends ZendAfi_View_Helper_B
}
public function init($settings) {
$this->_settings = $settings;
$this->_active_filters = $settings->getActiveFilters();
$this->_url_params = $settings->getUrlParams();
$this->_model_label = $settings->getModelLabel();
$this->_available_filters = $settings->getAvailableFilters();
return $this;
}
public function getContent() {
return $this->_getFilterStrategy()->getContent($this->_settings);
}
public function getTitle() {
return $this->_getFilterStrategy()->getTitle($this->_settings);
}
protected function _getFilterStrategy() {
return ZendAfi_View_Helper_Filters_Strategy_Abstract::newFor($this);
}
......
......@@ -86,6 +86,18 @@ abstract class ZendAfi_View_Helper_Filters_Strategy_Abstract extends ZendAfi_Vie
}
public function getContent($settings) {
$this->_settings = $settings;
return $this->_renderContent();
}
public function getTitle($settings) {
$this->_settings = $settings;
return $this->_renderTitle();
}
protected function _getUrlParams() {
return $this->_filter_elements->getUrlParams();
}
......
......@@ -45,8 +45,11 @@ class ZendAfi_View_Helper_Filters_Strategy_Facet extends ZendAfi_View_Helper_Fil
$url = $this->view->url($url_params, null, true);
return $this->_tag('li',
$this->_tag('a', $label, ['title' => $label,
'href' => $url]),
$this->_tag('a',
$label,
['title' => $this->_('Filtrer la liste par %s',
$label),
'href' => $url]),
$selected ? ['class' => 'selected'] : []);
}
}
......@@ -178,6 +178,7 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper
return '';
$label = $this->_('Supprimer la boite "%s"', $this->_title);
$url = $this->view->url(['module' => 'admin',
'controller' => 'widget',
'action' => 'delete',
......@@ -186,10 +187,11 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper
'id_profil' => $this->_getIdProfil()],
null, true);
$onclick = "return confirm('"
. htmlspecialchars($this->_('Êtes-vous sur de vouloir supprimer la boite "%s" ?',
$this->_title))
. "');";
$title = str_replace(['\'', '"'], '\\\'', $this->_title);
$onclick = sprintf("return confirm('%s');",
htmlspecialchars($this->_('Êtes-vous sûr de vouloir supprimer la boite %s ?',
$title)));
$img = $this->_current_skin->renderActionIconOn('delete', $this->view,
['alt' => $label]);
......
......@@ -21,16 +21,9 @@
class ZendAfi_View_Helper_LibraryPicture extends ZendAfi_View_Helper_BaseHelper {
public function libraryPicture($library) {
if (!$picture = $library->getPhoto())
return '';
$url = (false === strpos($picture, 'userfiles'))
? USERFILESURL . Class_Bib::BASE_PATH . $picture
: BASE_URL . $picture;
return $this->view->tagImg($url,
['class' => 'bibview_image']);
return ($url = $library->getPictureUrl())
? $this->view->tagImg($url,
['class' => 'bibview_image'])
: '';
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -187,7 +187,4 @@ class ZendAfi_View_Helper_RenderLibrary extends ZendAfi_View_Helper_BaseHelper {
protected function _escapeInfo($info) {
return str_replace('BR', '<br>', urldecode(str_replace('%0D%0A','BR', $info)));
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -276,7 +276,7 @@ pre {
}
[class*="carousel-control"] {
margin: 30% 0;
margin: 30% 0 40% 0;
width: auto;
}
......
......@@ -250,7 +250,7 @@ class Intonation_Library_FormCustomizer_Abstract {
->addElement('checkbox',
$this->_template->withNameSpace('visibility_cms'),
['label' => $this->_('Articles et agenda'),
['label' => $this->_('Articles, agenda, bibliothèque'),
'value' => 1])
->addElement('checkbox',
......
......@@ -118,17 +118,11 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'span class search_axe_operator_prefix' => 'col-4 col-sm-2',
'span class search_axe_label' => 'col-6 col-sm-3 pl-3',
'span class search_axe_input' => 'col-12 col-sm-7',
'p class opened' => 'text-white bg-success p-1 rounded d-inline-block',
'p class closed' => 'text-white bg-danger p-1 rounded d-inline-block',
],
'icons_map_doc_types' => ['0' => 'class far fa-question-circle',
'1' => 'class fas fa-book',
'2' => 'class fas fa-newspaper',
'3' => 'class fas fa-compact-disc',
'4' => 'class fas fa-video',
'5' => 'class fas fa-keyboard',
'8' => 'class fas fa-bullhorn',
'9' => 'class fas fa-rss-square',
'10' => 'class fas fa-link'],
'icons_map_doc_types' => [],
'icons_map_library' => ['author' => 'class fas fa-user',
'search_more' => 'class fas fa-list',
......@@ -141,6 +135,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'to_not_read' => 'class far fa-bookmark',
'return-date' => 'class fas fa-dolly',
'place' => 'class fas fa-map-signs',
'map' => 'class fas fa-map-marked-alt',