Commit b861d1dd authored by Ghislain Loas's avatar Ghislain Loas
Browse files

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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment