Add files via upload

Nettoyage code
sitiv_branch
Quentin Marchand 5 months ago committed by GitHub
parent a7dcbf9961
commit 4ab1463f8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      api_user_pleiade/js/api_user_pleiade.js
  2. 3
      datatable_pleiade/css/datatable_pleiade.css
  3. 200
      datatable_pleiade/js/datatable_pleiade.js
  4. 235
      guide_utilisateur_pleiade/guide_utilisateur_pleiade.install
  5. 6
      guide_utilisateur_pleiade/guide_utilisateur_pleiade.links.menu.yml
  6. 6
      guide_utilisateur_pleiade/guide_utilisateur_pleiade.module
  7. 10
      guide_utilisateur_pleiade/guide_utilisateur_pleiade.routing.yml
  8. 55
      guide_utilisateur_pleiade/src/Form/guideUserForm.php
  9. 12
      module_actu_pleiade/css/module_actu_pleiade.css
  10. 35
      module_actu_pleiade/js/module_actu_pleiade.js
  11. 222
      module_actu_pleiade/src/Controller/ActuPleiadeController.php
  12. 165
      module_api_pleiade/src/ApiPleiadeManager.php
  13. 2
      module_general_pleiade/js/module_general_pleiade.js
  14. 8
      module_general_pleiade/module_general_pleiade.module
  15. 14
      module_general_pleiade/src/Form/ModuleGeneralPleiadeConfigForm.php
  16. 1
      module_postit_pleiade/js/post_it_table.js
  17. 1
      notification_module_pleiade/js/notification_module_pleiade.js
  18. 1
      notification_module_pleiade/src/Controller/NotificationModuleController.php

@ -25,8 +25,6 @@
if (created && accessed) {
var createdDate = new Date(created);
var accessedDate = new Date(accessed);
console.log(created)
console.log(accessed)
if (created === accessed) {
// if (Math.abs(createdDate.getTime() - accessedDate.getTime()) <= 60000) {
var steps = [
@ -163,7 +161,6 @@
a_ajouter += '<a href="' + url + '" target="_blank" class="sidebar-link waves-effect waves-dark"><span class="hide-menu px-2">' + titre + '</span></a>'
}
console.log(a_ajouter)
// Ajoutez le contenu de 'a_ajouter' à la fin de la div
mes_apps.insertAdjacentHTML('beforeend', a_ajouter);

@ -108,6 +108,9 @@ body[data-theme=dark] .table-striped > tbody > tr:nth-of-type(even) {
body[data-theme=dark] th.sorting, body[data-theme=dark] th.sorting_disabled{
color: #FFF!important;
}
#reloadDatatable{
border: 0px!important;
}
.voir_tout{
margin-top: 1em;
padding: 0.5em;

@ -48,6 +48,9 @@
<button type="button" class="btn btn-secondary reload-btn" id="reloadDatatable">\
<i class="fa-solid fa-rotate"></i>\
</button>\
<a href="#" id="go_to_pastell" target="_blank">\
<i class="fa-solid fa-eye"></i>\
</a>\
</div>\
<div class="card-body">\
<table class="table table-striped" id="tablealldocs">\
@ -216,7 +219,7 @@
case "reception-partielle":
etat =
'<span class="badge py-2 px-4 bg-warning">Envoyé</span>';
supp_yes = true
supp_yes = false
break;
case "recu-iparapheur":
@ -236,7 +239,12 @@
supp_yes = true
edit_yes = true
break;
case "send-ged-etat":
etat =
'<span class="badge py-2 px-4 bg-info">Versé en GED</span>';
edit_yes = false
supp_yes = false
break;
case "envoi-mail":
etat =
'<span class="badge py-2 px-4 bg-warning">En cours d\'envoi</span>';
@ -493,7 +501,9 @@
</tr>\
</tfoot>\
</table>\
<div id="go_to_pastell" class="w-auto mt-3 py-2"></div>\
<a class="voir_tout float-end" href="' + pastell_url +'/Document/index?id_e=' + previousValue +'" target="_blank">\
<span>Voir l\'historique</span>\
</a>\
</div>\
</div>\
</div>\
@ -505,12 +515,15 @@
document_coll;
}
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/index?id_e=" + previousValue;
link.textContent = "Voir l'historique";
document.getElementById("go_to_pastell").appendChild(link)
// link.textContent = "Voir l'historique";
// document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
}
else {
@ -590,12 +603,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=document-a-signer";
link.textContent = "Voir tous les Documents à signer";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var pastille_actes = document.getElementById('pastille_actes')
@ -606,12 +621,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=actes-ecollectivites";
link.textContent = "Voir tous les actes";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var pastille_flux_financier = document.getElementById('pastille_flux_financier')
@ -623,12 +640,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=helios-ecollectivites";
link.textContent = "Voir tous les Flux Hélios";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var pastille_convocations = document.getElementById('pastille_convocations')
@ -639,28 +658,18 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=convocation";
link.textContent = "Voir toute les convocations";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var pastille_eadministration = document.querySelector('.pastille_eadministration')
if (pastille_eadministration) {
pastille_eadministration.addEventListener("click", function () {
table.search('Erreur').draw();
table.column(1).search("Convocation|Helios|Facture Chorus Pro|Actes|Document à faire signer", true, false).draw();
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
});
}
var lienVoirActes = document.querySelector("#voir_actes");
@ -672,12 +681,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=actes-ecollectivites";
link.textContent = "Voir tous les actes";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var lienVoirConvocations = document.querySelector("#voir_convocs");
@ -689,12 +700,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=convocation";
link.textContent = "Voir toutes les Convocations";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
@ -706,12 +719,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=helios-ecollectivites";
link.textContent = "Voir tous les Flux Hélios";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
@ -724,12 +739,14 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=document-a-signer";
link.textContent = "Voir tous les Documents à signer";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var lienVoirDocument = document.querySelector("#voir_chorus_pro");
@ -741,12 +758,33 @@
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.createElement("a");
link.classList.add("voir_tout");
link.setAttribute("target", "_blank");
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=facture-cpp";
link.textContent = "Voir tous les Flux Chorus";
document.getElementById("go_to_pastell").appendChild(link)
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
var lienVoirUrba = document.querySelector("#voir_urba");
if (lienVoirUrba) {
lienVoirUrba.addEventListener("click", function () {
table.search("Document d'autorisation d'urbanisme", true, true).draw();
table.column(1).search("Document d'autorisation d'urbanisme", true, true).draw();
var offsetTop = document.querySelector("#document_recent_id").offsetTop;
window.scrollTo({ top: offsetTop - 80, behavior: 'smooth' });
document.getElementById("go_to_pastell").innerHTML = "";
var link = document.getElementById("go_to_pastell");
// var link = document.createElement("a");
// link.classList.add("voir_tout");
// link.setAttribute("target", "_blank");
link.href = pastell_url + "Document/list?id_e=" + previousValue + "&type=document-autorisation-urbanisme";
var icon = document.createElement("i");
icon.classList.add("fa-solid", "fa-eye");
link.appendChild(icon);
});
}
setTimeout(function () {
@ -758,7 +796,7 @@
if (inputField.value === "") {
table.search('', true, true).draw();
table.column(1).search("", true, false).draw();
console.log("Le champ est vide !");
//console.log("Le champ est vide !");
}
})
}, 300);
@ -767,7 +805,7 @@
errors = JSON.parse(errors);
var addBadges = document.querySelector(".fa-people-arrows");
var eadministration = document.querySelector(".eadministration");
// var eadministration = document.querySelector(".eadministration");
var actes = document.getElementById("actes");
var convocations = document.getElementById("convocations");
var signature_electronique = document.getElementById("signature_electronique");
@ -788,7 +826,7 @@
var errorDocsDiv = createErrorBadge("ErrorDocsCounts", ErrorDocsCounts, "Nombre d'erreurs sur les documents à faire signer");
// Ajout des divs à la suite d'une div spécifique avec un ID
var eadministration = document.querySelector(".pastille_eadministration");
// var eadministration = document.querySelector(".pastille_eadministration");
var actes = document.getElementById("pastille_actes");
var convocations = document.getElementById("pastille_convocations");
var signature_electronique = document.getElementById("pastille_signature_electronique");
@ -806,9 +844,9 @@
if(flux_financier){
flux_financier.innerHTML = '';
}
if(eadministration){
eadministration.innerHTML = '';
}
// if(eadministration){
// eadministration.innerHTML = '';
// }
if(addBadges){
addBadges.innerHTML = '';
}
@ -816,7 +854,7 @@
if (TotalErrors > 0) {
addBadges.innerHTML = '<span class="position-absolute start-75 translate-middle badge rounded-pill bg-danger error_' + TotalErrors + '">' + TotalErrors + '</span>'
eadministration.appendChild(totalErrorsDiv);
// eadministration.appendChild(totalErrorsDiv);
if (ErrorActeCounts > 0) {
actes.appendChild(errorActeDiv);
}
@ -847,9 +885,9 @@
// Switch case pour déterminer l'URL en fonction du label
var url;
switch (label) {
case "TotalErrors":
url = "/node?goToDatatable=true&type=all&pastille=true";
break;
// case "TotalErrors":
// url = "/node?goToDatatable=true&type=all&pastille=true";
// break;
case "ErrorActeCounts":
url = "/node?goToDatatable=true&type=acte&pastille=true";
break;
@ -904,7 +942,7 @@
setTimeout(function () {
document.querySelector('#document_recent_id').addEventListener('click', function (event) {
console.log(event)
// console.log(event)
// Vérifiez que l'élément cible de l'événement correspond au bouton de rechargement
if (event.target.id === 'reloadDatatable' || event.target.className === 'fa-solid fa-rotate') {
console.log('test');
@ -932,10 +970,10 @@
table.search('Document à faire signer Erreur', true, true).draw();
table.column(1).search("Document à faire signer", true, false).draw();
break;
case 'all':
table.search('Erreur').draw();
table.column(1).search("Convocation|Helios|Facture Chorus Pro|Actes|Document à faire signer", true, false).draw();
break;
// case 'all':
// table.search('Erreur').draw();
// table.column(1).search("Convocation|Helios|Facture Chorus Pro|Actes|Document à faire signer", true, false).draw();
// break;
default:
break;
}

@ -0,0 +1,235 @@
<?php
function guide_utilisateur_pleiade_install()
{
$existing_type = \Drupal\node\Entity\NodeType::load('guide_utilisateur');
if (!$existing_type) {
// Le type de contenu n'existe pas, le créer.
$news_type = \Drupal\node\Entity\NodeType::create([
'type' => 'guide_utilisateur',
'name' => 'Guide utilisateur',
'description' => 'liste des guides utilisateurs.',
'display_submitted' => TRUE,
'preview_mode' => 'default',
'help' => '',
]);
$news_type->save();
// Ajouter un champ 'description'.
$field_categorie_du_guide = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_categorie_du_guide',
'entity_type' => 'node',
'type' => 'list_string',
'settings' => [
'allowed_values' => [
'e_administration' => 'E-ADMINISTRATION',
'logiciels_metiers' => 'LOGICIELS METIERS',
'confiance_numerique' => 'CONFIANCE NUMERIQUE',
'ecole_numerique' => 'ECOLE NUMERIQUE',
],
],
]);
$field_categorie_du_guide->save();
$field_categorie_du_guide_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_categorie_du_guide,
'bundle' => 'guide_utilisateur',
'label' => 'Catégorie du guide',
'required' => TRUE,
// Spécifier le format de texte complet HTML.
'settings' => [
'text_processing' => 0,
],
]);
$field_categorie_du_guide_instance->save();
$body = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'body',
'entity_type' => 'node',
'type' => 'text_with_summary', // Utiliser le type 'list_string' pour une liste de chaînes.
]);
$body->save();
$body_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $body,
'bundle' => 'guide_utilisateur',
'label' => 'Description',
'required' => FALSE,
]);
$body_instance->save();
$field_image_du_guide = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_image_du_guide',
'entity_type' => 'node',
'type' => 'image',
]);
$field_image_du_guide->save();
$field_image_du_guide_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_image_du_guide,
'bundle' => 'guide_utilisateur',
'label' => 'Image du guide',
'required' => FALSE,
]);
$field_image_du_guide_instance->save();
$field_nom_editeur = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_nom_editeur',
'entity_type' => 'node',
'type' => 'string',
]);
$field_nom_editeur->save();
$field_nom_editeur_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_nom_editeur,
'bundle' => 'guide_utilisateur',
'label' => "Nom de l'éditeur",
'required' => FALSE,
]);
$field_nom_editeur_instance->save();
$field_pdf_du_guide = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_pdf_du_guide',
'entity_type' => 'node',
'type' => 'file',
]);
$field_pdf_du_guide->save();
$field_pdf_du_guide_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_pdf_du_guide,
'bundle' => 'guide_utilisateur',
'label' => "Pdf du guide",
'required' => FALSE,
]);
$field_pdf_du_guide_instance->save();
$field_sous_categorie_du_guide = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_sous_categorie_du_guide',
'entity_type' => 'node',
'type' => 'list_string',
'settings' => [
'allowed_values' => [
'pastell' => 'PASTELL',
'parapheur' => 'PARAPHEUR',
],
],
]);
$field_sous_categorie_du_guide->save();
$field_sous_categorie_du_guide_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_sous_categorie_du_guide,
'bundle' => 'guide_utilisateur',
'label' => "Sous catégorie du guide (ID LDAP)",
'required' => FALSE,
]);
$field_sous_categorie_du_guide_instance->save();
$field_sous_titre = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_sous_titre',
'entity_type' => 'node',
'type' => 'string',
]);
$field_sous_titre->save();
$field_sous_titre_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_sous_titre,
'bundle' => 'guide_utilisateur',
'label' => "Sous titre",
'required' => FALSE,
]);
$field_sous_titre_instance->save();
$field_type_de_guide = \Drupal\field\Entity\FieldStorageConfig::create([
'field_name' => 'field_type_de_guide',
'entity_type' => 'node',
'type' => 'list_string',
'settings' => [
'allowed_values' => [
'video' => 'Vidéo',
'pdf' => 'PDF',
'texte' => 'Texte',
],
],
]);
$field_type_de_guide->save();
$field_type_de_guide_instance = \Drupal\field\Entity\FieldConfig::create([
'field_storage' => $field_type_de_guide,
'bundle' => 'guide_utilisateur',
'label' => "Type de guide",
'required' => FALSE,
]);
$field_type_de_guide_instance->save();
// Activer les champs sur le formulaire d'affichage du type de contenu.
$entity_display_repository = \Drupal::service('entity_display.repository');
$form_display = $entity_display_repository->getFormDisplay('node', 'guide_utilisateur', 'default');
// Activer l'affichage des champs appropriés.
$form_display->setComponent('field_categorie_du_guide', ['type' => 'options_select']);
$form_display->setComponent('body', ['type' => 'text_textarea_with_summary']);
$form_display->setComponent('field_image_du_guide', ['type' => 'image_image']);
$form_display->setComponent('field_nom_editeur', ['type' => 'string_textfield']);
$form_display->setComponent('field_pdf_du_guide', ['type' => 'file_generic']);
$form_display->setComponent('field_sous_categorie_du_guide', ['type' => 'options_select']);
$form_display->setComponent('field_sous_titre', ['type' => 'string_textfield']);
$form_display->setComponent('field_type_de_guide', ['type' => 'options_select']);
$form_display->save();
// Vider le cache pour appliquer les changements.
drupal_flush_all_caches();
}
}
/**
* Implements hook_uninstall().
*/
function guide_utilisateur_pleiade_uninstall()
{
// Supprimer tous les nœuds de type 'guide_utilisateur'.
$query = \Drupal::entityQuery('node')
->condition('type', 'guide_utilisateur')
->accessCheck(FALSE); // Désactiver les contrôles d'accès pour la désinstallation.
$nids = $query->execute();
foreach ($nids as $nid) {
$node = \Drupal\node\Entity\Node::load($nid);
if ($node) {
$node->delete();
}
}
// Vérifier si les champs existent avant de tenter de les supprimer.
$fields = [
'field_categorie_du_guide',
'body',
'field_image_du_guide',
'field_nom_editeur',
'field_pdf_du_guide',
'field_sous_categorie_du_guide',
'field_sous_titre',
'field_type_de_guide',
];
foreach ($fields as $field_name) {
if ($field_storage = \Drupal\field\Entity\FieldStorageConfig::loadByName('node', $field_name)) {
$field_storage->delete();
}
}
// Supprimer le type de contenu.
if ($node_type = \Drupal::entityTypeManager()->getStorage('node_type')->load('guide_utilisateur')) {
$node_type->delete();
}
// Vider le cache pour appliquer les changements.
\Drupal::entityTypeManager()->clearCachedDefinitions();
drupal_flush_all_caches();
}

@ -0,0 +1,6 @@
guide_utilisateur_pleiade.admin:
title: 'API Pléiade - Paramètres du module Guide Utilisateur'
description: 'Page de configuration du module'
parent: pleiade.group.admin
route_name: guide_utilisateur_pleiade.settings
weight: 2

@ -5,9 +5,13 @@
*/
function guide_utilisateur_pleiade_preprocess_page(&$variables){
$config = \Drupal::config('guide_utilisateur_pleiade.settings');
$guide_on_desktop = $config->get('guide_on_desktop');
//Add the JS library
$variables['#attached']['library'][] = 'guide_utilisateur_pleiade/guide_utilisateur_pleiade_js';
//Add the CSS library
$variables['#attached']['library'][] = 'guide_utilisateur_pleiade/guide_utilisateur_pleiade_css';
$variables['#attached']['drupalSettings']['guide_utilisateur_pleiade']['guide_on_desktop'] = $guide_on_desktop;
}

@ -5,4 +5,12 @@ guide_utilisateur_pleiade.get_guide:
_title: 'moodle Query'
_format: json
requirements:
_access: 'TRUE'
_access: 'TRUE'
guide_utilisateur_pleiade.settings:
path: '/admin/config/guide_utilisateur_pleiade/settings'
defaults:
_form: '\Drupal\guide_utilisateur_pleiade\Form\guideUserForm'
_title: 'Paramètre du module Guide user'
requirements:
_permission: 'administer site configuration'

@ -0,0 +1,55 @@
<?php
namespace Drupal\guide_utilisateur_pleiade\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Configuration form definition for the Module actu Pleiade module.
*/
class guideUserForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'guide_utilisateur_pleiade_config_form';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'guide_utilisateur_pleiade.settings',
];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('guide_utilisateur_pleiade.settings');
$form['guide_on_desktop'] = [
'#type' => 'checkbox',
'#title' => $this->t("activer l'affichage sur le bureau"),
'#default_value' => $config->get('guide_on_desktop'),
'#description' => $this->t("activer l'affichage sur le bureau")
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('guide_utilisateur_pleiade.settings');
$config->set('guide_on_desktop', $form_state->getValue('guide_on_desktop'));
$config->save();
parent::submitForm($form, $form_state);
}
}

@ -75,7 +75,9 @@
{
opacity: .25;
}
.slick-slide {
padding: 0 0.4rem;
}
.slick-prev:before,
.slick-next:before
{
@ -237,4 +239,12 @@ body[data-theme=dark] .sub_menu_eadmin span{
}
#carousel_actualites {
overflow: hidden;
padding: 1em 0 0 0 ;
}
.actualites .voir_tout{
margin-bottom: 30px;
float: right;
}
.actualites .card{
margin-bottom: 0px;
}

@ -14,26 +14,25 @@
xhr.onload = function () {
if (xhr.status === 200) {
var donnees = (xhr.response);
console.log(donnees)
const div = document.querySelector('.actualites');
var blocActu = ""
//<a href="/actualites" class="voir_tout mt-0">Voir toute les actualités</a></div>\
blocActu +=
'<div class="col-lg-12">\
<div>\
<div class="card">\
<div class="card-header rounded-top bg-white rounded-top">\
<span class="card-title text-dark py-2">Dernières actualités</span></div>\
<div class="" id="carousel_actualites">\
'
'<div class="col-lg-12">\
<div>\
<div class="card">\
<div class="card-header d-flex align-items-center justify-content-between rounded-top bg-white rounded-top">\
<h4 class="card-title text-dark py-2">Actualités à la une</h4>\
</div>\
<div class="" id="carousel_actualites">\
'
if (donnees && div) {
for (var i = 0; i < donnees.length; i++) {
if (
donnees[i].title &&
donnees[i].view_node
) {
if ( donnees[i].title && donnees[i].view_node) {
var tag = '';
if (Array.isArray(donnees[i].field_tags)) {
tag = '<span class="tag_btn position-absolute w-auto p-2 text-uppercase">' + donnees[i].field_tags.join(', ') + '</span>';
@ -43,7 +42,7 @@
// Tronquer la description à 50 caractères
blocActu +=
'<a href="' + donnees[i].view_node + '" class="d-flex mb-2 justify-content-center" target="_blank">\
'<a href="' + donnees[i].view_node + '" class="d-flex justify-content-center">\
<div class="card" style="height: 230px; width: 250px;">\
<img src="' + donnees[i].field_image + '" class="card-img-top" alt="Course Image">\
<div class="card-body d-flex flex-column" >' +
@ -57,7 +56,7 @@
}
if (div) {
blocActu += "</div></div></div></div>";
blocActu += '</div></div></div><div class="d-flex justify-content-end"><a href="/actualites" class="voir_tout mt-0">Voir toute les actualités</a></div></div>';
div.innerHTML = blocActu;
} else {
@ -89,12 +88,8 @@
xhr.onloadend = function () {
$('#carousel_actualites').slick({
slidesToShow: 4,
slidesToScroll: 1,
arrows: true,
dots: true,
autoplay: true,
autoplaySpeed: 4000,
slidesToShow: 5,
customPaging: function (slider, i) {
// this example would render "tabs" with titles
return '<i class="fa-solid fa-circle"></i>';

@ -3,11 +3,12 @@
namespace Drupal\module_actu_pleiade\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Drupal\module_api_pleiade\ApiPleiadeManager;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
use Drupal\file\FileConstants;
class ActuPleiadeController extends ControllerBase
{
@ -17,16 +18,16 @@ class ActuPleiadeController extends ControllerBase
$settings_actu = \Drupal::config('module_actu_pleiade.settings');
$autorize_intern_actu = $settings_actu->get('actu_interne');
$flux_rss = $settings_actu->get('flux_rss');
$getArticles = new ApiPleiadeManager();
$articles = $getArticles->getEcollArticles();
if($flux_rss == true){
if ($flux_rss == true) {
$rssXml = simplexml_load_string($articles);
$articles = [];
// Vérifier si le chargement du flux a réussi
if ($rssXml !== false) {
// Parcourir chaque élément <item> du flux RSS
@ -35,9 +36,14 @@ class ActuPleiadeController extends ControllerBase
$pubDateTimestamp = strtotime((string)$item->pubDate);
// Formater la date en dd/mm/YYYY
$formattedDate = date("d/m/Y", $pubDateTimestamp);
$description = (string)$item->description;
$imageUrl = '';
if (preg_match('/<img[^>]+src="([^"]+)"[^>]*>/', $description, $matches)) {
$imageUrl = $matches[1];
}
$article = [
"title" => (string)$item->title,
"field_image" => (string)$rssXml->channel->image->url,
"field_image" => $imageUrl,
// Supposons que les tags sont dans une balise <category>
"field_tags" => (string)$item->category,
"created" => $formattedDate,
@ -49,19 +55,19 @@ class ActuPleiadeController extends ControllerBase
}
$articles = json_encode($articles);
}
if($autorize_intern_actu == true){
if ($autorize_intern_actu == true) {
$nids = \Drupal::entityQuery('node')
->condition('type', 'article')
->condition('status', Node::PUBLISHED)
->sort('created', 'DESC')
->accessCheck(TRUE)
->execute();
->condition('type', 'article')
->condition('status', Node::PUBLISHED)
->sort('created', 'DESC')
->accessCheck(TRUE)
->execute();
$nodes = Node::loadMultiple($nids);
foreach ($nodes as $node) {
$created_date = \Drupal::service('date.formatter')->format($node->getCreatedTime(), 'custom', 'd/m/Y');
if ($node->hasField('field_image') && $node->get('field_image')->entity) {
@ -96,13 +102,13 @@ class ActuPleiadeController extends ControllerBase
}
$tags = implode(', ', $tags);
}
$article = [
$article = [
"title" => $node->label(),
"field_image" => $image_url,
"field_tags" => $tags,
"created" => $created_date,
"view_node" => $node->toUrl('canonical', ['absolute' => TRUE])->toString()
];
];
}
@ -111,30 +117,188 @@ class ActuPleiadeController extends ControllerBase
$articles_obj = json_decode($articles, true);
$result = array_merge([$article_obj], $articles_obj);
$result_json = json_encode($result);
// Étape 1 : Convertir le JSON en tableau PHP
$result_array = json_decode($result_json, true);
// Étape 2 : Trier le tableau par date de publication
usort($result_array, function($a, $b) {
usort($result_array, function ($a, $b) {
return strtotime($b['created']) - strtotime($a['created']);
});
// Étape 3 : Convertir le tableau trié en JSON
$result_json_sorted = json_encode($result_array);
}
else{
} else {
$result_json_sorted = $articles;
}
// Création des nœuds
foreach (json_decode($result_json_sorted, true) as $article_data) {
// Vérifier si l'article existe déjà pour éviter les doublons
$existing_nids = \Drupal::entityQuery('node')
->condition('type', 'article')
->condition('title', $article_data['title'])
->accessCheck(TRUE) // Ajout de la vérification d'accès
->execute();
if (empty($existing_nids)) {
$image_source_path = $article_data['field_image'];
$image_target_path = 'public://images.png';
$image_data = file_get_contents($image_source_path);
$image_alt = 'Image actualité';
$image_object = \Drupal::service('file.repository')
->writeData($image_data, $image_target_path);
// var_dump($image_object->id());
// exit;
$created_timestamp = strtotime($article_data['created']);
if ($created_timestamp === false) {
// Si la date n'a pas pu être parsée, utiliser le timestamp actuel
$created_timestamp = time();
}
$node = Node::create([
'type' => 'article',
'title' => $article_data['title'],
'body' => [
'value' => $article_data['body'], // Conserver le HTML complet
'format' => 'full_html', // Utiliser le format texte complet HTML
],
'field_tags' => $this->getTags($article_data['field_tags']),
'created' => $created_timestamp,
'status' => Node::PUBLISHED,
'uid' => 31,
]);
$node->set('field_image', [
'target_id' => $image_object->id(),
'alt' => $image_alt,
]);
$node->save();
} else {
// Récupération du nœud existant
$nid = reset($existing_nids);
$node = Node::load($nid);
$update_needed = false;
if ($node->getTitle() !== $article_data['title'] || $node->get('body')->value !== $article_data['body']) {
// Vérification des différences et mise à jour si nécessaire
return new JsonResponse(($result_json_sorted), 200, [], true);
}
if ($node->getTitle() !== $article_data['title']) {
$node->setTitle($article_data['title']);
$update_needed = true;
}
if ($node->get('body')->value !== $article_data['body']) {
$node->set('body', [
'value' => $article_data['body'],
'format' => 'full_html',
]);
$update_needed = true;
}
}
// $existing_tags = $node->get('field_tags')->referencedEntities();
// $new_tags = $this->getTags($article_data['field_tags']);
// if (array_diff($existing_tags, $new_tags) || array_diff($new_tags, $existing_tags)) {
// $node->set('field_tags', $new_tags);
// $update_needed = true;
// }
// $existing_image = $node->get('field_image')->entity;
// $new_image_data = file_get_contents($article_data['field_image']);
// if (md5($existing_image->getFileUri()) !== md5($new_image_data)) {
// $image_target_path = 'public://images.png';
// $image_object = \Drupal::service('file.repository')
// ->writeData($new_image_data, $image_target_path);
// $node->set('field_image', [
// 'target_id' => $image_object->id(),
// 'alt' => 'Image actualité',
// ]);
// $update_needed = true;
// }
if ($update_needed) {
$node->save();
}
}
}
}
$nids = \Drupal::entityQuery('node')
->condition('type', 'article')
->condition('status', Node::PUBLISHED)
->sort('created', 'DESC')
->accessCheck(TRUE)
->execute();
$nodes = Node::loadMultiple($nids);
foreach ($nodes as $node) {
if (!$node->get('field_nouveaute')->value) {
continue; // Passer à l'article suivant si 'field_nouveaute' est à false
}
$created_date = \Drupal::service('date.formatter')->format($node->getCreatedTime(), 'custom', 'd/m/Y');
if ($node->hasField('field_image') && $node->get('field_image')->entity) {
$file = \Drupal::service('entity.repository')->loadEntityByUuid('file', $node->get('field_image')->entity->uuid());
if ($file) {
try {
$image_url = \Drupal::service('file_url_generator')->generateAbsoluteString($file->getFileUri());
} catch (InvalidStreamWrapperException $e) {
// Handle exception if needed.
}
}
} else {
// Si aucun fichier n'est associé au champ field_image, récupérer l'image par défaut
$default_image = $node->get('field_image')->getFieldDefinition()->getSetting('default_image');
$file = \Drupal::service('entity.repository')->loadEntityByUuid('file', $default_image['uuid']);
if ($file) {
try {
$image_url = \Drupal::service('file_url_generator')->generateAbsoluteString($file->getFileUri());
} catch (InvalidStreamWrapperException $e) {
// Handle exception if needed.
}
}
}
$tags = $node->get('field_tags')->referencedEntities();
if (empty($tags)) {
$tags = 'Aucun tag';
} else {
$tags = [];
foreach ($node->get('field_tags')->referencedEntities() as $tag) {
$tags[] = $tag->label();
}
$tags = implode(', ', $tags);
}
$article = [
"title" => $node->label(),
"field_image" => $image_url,
"field_tags" => $tags,
"created" => $created_date,
"view_node" => $node->toUrl('canonical', ['absolute' => TRUE])->toString()
];
$articles_alaune[] = $article;
}
}
if ($articles_alaune) {
return new JsonResponse((json_encode($articles_alaune)), 200, [], true);
} else {
return new JsonResponse(($result_json_sorted), 200, [], true);
}
}
private function getTags($tags_string)
{
$tags = [];
foreach (explode(', ', $tags_string) as $tag_name) {
$terms = \Drupal::entityQuery('taxonomy_term')
->condition('vid', 'tags') // Assurez-vous de remplacer 'tags' par le vocabulaire approprié
->condition('name', $tag_name)
->accessCheck(TRUE)
->execute();
if (empty($terms)) {
$term = Term::create([
'vid' => 'tags',
'name' => $tag_name,
]);
$term->save();
$tags[] = $term->id();
} else {
$tags[] = reset($terms);
}
}
return $tags;
}
}

@ -249,43 +249,61 @@ class ApiPleiadeManager
// //
////////////////////////////////////////////////////////
elseif ($application == 'articles_ecoll') {
try {
$response = $this->client->request('GET', 'https://ecollectivites.fr/api/v1/articles', []);
// Vérifier le code de statut
$statusCode = $response->getStatusCode();
if ($statusCode === 200) {
$body = $response->getBody()->getContents();
// Vérifier si la réponse est déjà au format JSON
$jsonData = json_decode($body, true);
if ($jsonData === null && json_last_error() !== JSON_ERROR_NONE) {
// Si la réponse n'est pas au format JSON, convertir en JSON
$jsonData = ['data' => $body];
$body = json_encode($jsonData);
}
return $body;
} else {
$errorMessage = "Erreur: Code de statut $statusCode lors de la récupération des données.";
\Drupal::logger('fetch_articles')->error($errorMessage);
return $errorMessage;
if($this->settings_actu->get('url_site')){
if($this->settings_actu->get('flux_rss') == false){
try {
$response = $this->client->request('GET', $api , []);
// Vérifier le code de statut
$statusCode = $response->getStatusCode();
if ($statusCode === 200) {
$body = $response->getBody()->getContents();
// Vérifier si la réponse est déjà au format JSON
$jsonData = json_decode($body, true);
if ($jsonData === null && json_last_error() !== JSON_ERROR_NONE) {
// Si la réponse n'est pas au format JSON, convertir en JSON
$jsonData = ['data' => $body];
$body = json_encode($jsonData);
}
return $body;
} else {
$errorMessage = "Erreur: Code de statut $statusCode lors de la récupération des données.";
\Drupal::logger('fetch_articles')->error($errorMessage);
return $errorMessage;
}
} catch (RequestException $e) {
// Gérer les exceptions de requête Guzzle
if ($e->hasResponse()) {
$statusCode = $e->getResponse()->getStatusCode();
$errorMessage = "Erreur: Code de statut $statusCode lors de la requête.";
\Drupal::logger('fetch_articles')->error($errorMessage);
return json_encode(['error' => $errorMessage]);
} else {
$errorMessage = "Erreur: " . $e->getMessage();
\Drupal::logger('fetch_articles')->error($errorMessage);
return json_encode(['error' => $errorMessage]);
}
}
}
} catch (RequestException $e) {
// Gérer les exceptions de requête Guzzle
if ($e->hasResponse()) {
$statusCode = $e->getResponse()->getStatusCode();
$errorMessage = "Erreur: Code de statut $statusCode lors de la requête.";
\Drupal::logger('fetch_articles')->error($errorMessage);
return json_encode(['error' => $errorMessage]);
} else {
$errorMessage = "Erreur: " . $e->getMessage();
\Drupal::logger('fetch_articles')->error($errorMessage);
return json_encode(['error' => $errorMessage]);
else
{
// Récupérer le contenu du flux RSS
$rssUrl = $this->settings_actu->get('url_site');
$rssContent = file_get_contents($rssUrl);
if ($rssContent === false) {
// Gérer les erreurs si la récupération du flux a échoué
return "Erreur lors de la récupération du flux RSS.";
} else {
// Retourner le contenu complet du flux RSS
return $rssContent;
}
}
}
}
}
@ -312,36 +330,9 @@ class ApiPleiadeManager
// Retourner une réponse JSON
return Json::decode($body);
} catch (Exception $e) {
return Json::decode($e->getMessage());
}
// $headers = array(
// 'Content-Type: application/json',
// 'Authorization: Bearer ' . $inputs["token"]
// );
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $api);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Désactive la vérification du certificat SSL
// $response = curl_exec($ch);
// $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// curl_close($ch);
// if ($httpCode != 200) {
// // Gérer les erreurs HTTP ici
// $errorMessage = "Request failed with status code: {$httpCode}";
// return Json::decode($errorMessage);
// } else {
// // Retourner la réponse JSON
// return Json::decode($response);
// }
} catch (Exception $e) {
return Json::decode($e->getMessage());
}
}
////////////////////////////////////////////////////////
// //
@ -381,7 +372,6 @@ class ApiPleiadeManager
);
// Set the cURL options
// $url = 'https://idtest.ecollectivites.fr/ocs/v2.php/apps/notifications/api/v2/notifications?format=json';
$ch = curl_init();
// Set the URL to send the request to
curl_setopt($ch, CURLOPT_URL, $apiUrl);
@ -438,19 +428,6 @@ class ApiPleiadeManager
return $this->executeCurl($endpoint, "POST", $inputs, $api, $application);
}
// //////////////////////////////////////////////////////////////
// // //
// // FONCTIONS POUR API HUmHUB //
// // //
// //////////////////////////////////////////////////////////////
// public function getMyNotifications()
// {
// $endpoints = $this->settings_lemon->get('field_lemon_myapps_url'); // Endpoint myapplications de Lemon qui renvoie toutes nos apps
// \Drupal::logger('api_lemon_pleiade')->info('function searchMyApps triggered !');
// return $this->curlGet($endpoints, [], $this->settings_lemon->get('field_lemon_url'), 'lemon');
// }
//////////////////////////////////////////////////////////////
// //
// FONCTIONS POUR API LEMONLDAP APPLICATION + SESSIONTIME //
@ -461,13 +438,13 @@ class ApiPleiadeManager
public function searchMyApps()
{
$endpoints = $this->settings_lemon->get('field_lemon_myapps_url'); // Endpoint myapplications de Lemon qui renvoie toutes nos apps
\Drupal::logger('api_lemon_pleiade')->info('function searchMyApps triggered !');
return $this->curlGet($endpoints, [], $this->settings_lemon->get('field_lemon_url'), 'lemon');
}
public function searchMySession()
{
$endpoints = $this->settings_lemon->get('field_lemon_sessioninfo_url'); // Endpoint myapplications de Lemon qui renvoie les dernières connexions
\Drupal::logger('api_lemon_pleiade')->info('function searchMySession triggered !');
return $this->curlGet($endpoints, [], $this->settings_lemon->get('field_lemon_url'), 'lemon');
}
@ -480,36 +457,36 @@ class ApiPleiadeManager
public function searchMyDocs($id_e)
{
$endpoints = $this->settings_pastell->get('field_pastell_documents_url'); // Endpoint field_pastell_documents_url de Pastell qui renvoi la liste des documents Pastell
\Drupal::logger('api_pastell_pleiade')->debug('function searchMyApps triggered !');
return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_documents_url') . $id_e . '&limit=' . $this->settings_pastell->get('field_pastell_limit_documents'), 'pastell');
}
public function searchMyEntities()
{
\Drupal::logger('api_pastell_pleiade')->debug('function searchMyentities triggered !');
return $this->curlGet([], [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell');
// return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell' );
}
public function searchMyFlux()
{
\Drupal::logger('api_pastell_pleiade')->debug('function searchMyFlux triggered !');
return $this->curlGet([], [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_flux_url'), 'pastell');
// return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell' );
}
public function creationDoc($id_e)
{
\Drupal::logger('api_pastell_pleiade')->debug('function creationDoc triggered !');
return $this->curlGet([], [], $this->settings_pastell->get('field_pastell_url') . "api/create-document.php&id_e=" . $id_e . "&type=document-a-signer", 'pastell');
// return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell' );
}
public function getSousTypeDoc($data)
{
\Drupal::logger('api_pastell_pleiade')->debug('function getSousTypeDoc triggered !');
return $this->curlPost([], $data, $this->settings_pastell->get('field_pastell_url') . "api/external-data.php", 'pastell');
// return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell' );
}
public function postModifDoc($data)
{
\Drupal::logger('api_pastell_pleiade')->debug('function postModifDoc triggered !');
return $this->curlPost([], $data, $this->settings_pastell->get('field_pastell_url') . "/api/modif-document.php", 'pastell');
// return $this->curlGet($endpoints, [], $this->settings_pastell->get('field_pastell_url') . $this->settings_pastell->get('field_pastell_entities_url'), 'pastell' );
}
@ -529,14 +506,14 @@ class ApiPleiadeManager
//////////////////////////////////////////////////////////////
// //
// FONCTIONS POUR R2CUP2RER LES ARTICLES //
// E-COLLECTIVITES //
// FONCTIONS POUR RECUPERER LES ARTICLES //
// //
//////////////////////////////////////////////////////////////
public function getEcollArticles()
{
return $this->curlGet([], [], 'https://ecollectivites.fr/api/v1/artics', 'articles_ecoll');
return $this->curlGet([], [], $this->settings_actu->get('url_site'), 'articles_ecoll');
}
//////////////////////////////////////////////////////////////
// //
@ -566,19 +543,13 @@ class ApiPleiadeManager
public function getNextcloudNotifs()
{
\Drupal::logger('api_nextcloud_pleiade')->info('function getNextcloudNotifs triggered !');
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('api_nextcloud_pleiade')) {
$endpoints = $this->settings_nextcloud->get('nextcloud_endpoint_notifs'); // Endpoint myapplications de Lemon qui renvoie toutes nos apps
return $this->curlGet([], [], $this->settings_nextcloud->get('nextcloud_url') . $endpoints . '?format=json', 'nextcloud');
}
}
//////////////////////////////////////////////////////////////
// //
// FONCTIONS POUR API GLPI //
// //
//////////////////////////////////////////////////////////////
/**
* Function to return first element of the array, compatability with PHP 5, note that array_key_first is only available for PHP > 7.3.

@ -56,14 +56,12 @@
};
dataObject[commune] = infos;
});
console.log(dataObject)
var userCommunes = userGroupsTempstore.split(', ');
userCommunes.forEach(function (commune) {
var siteInternetLink = document.getElementById('url_site_internet');
var GruLink = document.getElementById('url_gru');
if (dataObject.hasOwnProperty(commune)) {
console.log(siteInternetLink)
var communeInfos = dataObject[commune];
if (siteInternetLink) {

@ -18,19 +18,21 @@ function module_general_pleiade_preprocess_page(&$variables)
$colorTheme = $config->get('color_theme');
$numero_telephone_support = $config->get('numero_telephone_support');
$adresse_mail_support = $config->get('adresse_mail_support');
$linkedin = $config->get('linkedin');
$twitter = $config->get('twitter');
$sites_internets = $config->get('sites_internets');
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$sites_internet_current_user = $user->get('field_site_internet')->getValue();
// Add the JS library.
$variables['#attached']['library'][] = 'module_general_pleiade/module_general_pleiade_js';
// Add the CSS library.
// Add the CSS library.
// $variables['#attached']['library'][] = 'module_general_pleiade/module_general_pleiade_css';
$variables['#attached']['drupalSettings']['module_general_pleiade']['color_theme'] = $colorTheme;
$variables['#attached']['drupalSettings']['module_general_pleiade']['numero_telephone_support'] = $numero_telephone_support;
$variables['#attached']['drupalSettings']['module_general_pleiade']['adresse_mail_support'] = $adresse_mail_support;
$variables['#attached']['drupalSettings']['module_general_pleiade']['linkedin'] = $linkedin;
$variables['#attached']['drupalSettings']['module_general_pleiade']['twitter'] = $twitter;
$variables['#attached']['drupalSettings']['module_general_pleiade']['sites_internets'] = $sites_internets;
$variables['#attached']['drupalSettings']['module_general_pleiade']['sites_internet_current_user'] = $sites_internet_current_user;
}

@ -48,6 +48,18 @@ class ModuleGeneralPleiadeConfigForm extends ConfigFormBase {
'#title' => $this->t('Horaires du support'),
'#default_value' => $config->get('horaire_support')
];
$form['linkedin'] = [
'#type' => 'textfield',
'#title' => $this->t('Url du linkedin'),
'#default_value' => $config->get('linkedin'),
'#description' => $this->t('Url du linkedin')
];
$form['twitter'] = [
'#type' => 'textfield',
'#title' => $this->t('Url du twitter'),
'#default_value' => $config->get('twitter'),
'#description' => $this->t('Url du twitter')
];
$form['adresse_mail_support'] = [
'#type' => 'email',
'#title' => $this->t('Adresse mail du support'),
@ -78,6 +90,8 @@ class ModuleGeneralPleiadeConfigForm extends ConfigFormBase {
if ($form_state->getTriggeringElement()['#name'] == 'reset_color') {
$form_state->setValue('color_theme', null);
} else {
$config->set('twitter', $form_state->getValue('twitter'));
$config->set('linkedin', $form_state->getValue('linkedin'));
$config->set('color_theme', $form_state->getValue('color_theme'));
$config->set('numero_telephone_support', $form_state->getValue('numero_telephone_support'));
$config->set('horaire_support', $form_state->getValue('horaire_support'));

@ -137,7 +137,6 @@
items.push(itemObject);
}
if (items) {
console.log(JSON.stringify({ items }))
$.ajax({
url: '/v1/module_postit_pleiade/save_postit', // Mettez à jour avec votre route Drupal
type: 'POST',

@ -31,6 +31,7 @@
if (minutesAgo <= 1) {
notification = "Maintenant";
localStorage.removeItem("notificationStatus");
} else if (minutesAgo <= 60) {
notification = "Il y a " + minutesAgo + " minutes";
} else if (minutesAgo <= 1440) { // 1440 minutes = 24 hours

@ -25,6 +25,7 @@ class NotificationModuleController extends ControllerBase {
$query->condition('type', 'notification');
$query->condition('status', 1); // Published content condition
$query->accessCheck(FALSE);
$query->sort('created', 'DESC');
$entityIds = $query->execute();
$notifications = $entityTypeManager->getStorage('node')->loadMultiple($entityIds);

Loading…
Cancel
Save