aqsz
This commit is contained in:
parent
ee25952839
commit
d3faeae7a7
108
Controleur/ControleurAjaxhabilitation.php
Normal file
108
Controleur/ControleurAjaxhabilitation.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
require_once 'Framework/Controleur.php'; // OK
|
||||
require_once 'Modele/Utilisateur.php';
|
||||
|
||||
class ControleurAjaxhabilitation extends Controleur
|
||||
{
|
||||
private $utilisateur;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->utilisateur = new Utilisateur();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
|
||||
$menus_accessibles = $this->utilisateur->getMenusAccessiblesProfilRh($codeProfil);
|
||||
|
||||
$menus_non_accessibles = $this->utilisateur->getMenusNonAccessiblesProfilRh($codeProfil);
|
||||
|
||||
$this->genererVueAjax(array('menus_accessibles' => $menus_accessibles, 'menus_non_accessibles' => $menus_non_accessibles));
|
||||
}
|
||||
|
||||
|
||||
public function ajouterunmenuprofilrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeMenu = $this->requete->getParametreFormulaire("codeMenu");
|
||||
|
||||
$this->utilisateur->ajouterunmenuprofilrh($codeProfil, $codeMenu);
|
||||
}
|
||||
|
||||
|
||||
public function retirerunmenuprofilrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeMenu = $this->requete->getParametreFormulaire("codeMenu");
|
||||
|
||||
$this->utilisateur->retirerunmenuprofilrh($codeProfil, $codeMenu);
|
||||
}
|
||||
|
||||
|
||||
public function ajoutertousmenusprofilrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
|
||||
$this->utilisateur->ajoutertousmenusprofilrh($codeProfil);
|
||||
}
|
||||
|
||||
|
||||
public function retirertousmenuprofilrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
|
||||
$this->utilisateur->retirertousmenuprofilrh($codeProfil);
|
||||
}
|
||||
|
||||
|
||||
public function afficheraccessousmenus()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeVue = $this->requete->getParametreFormulaire("codeVue");
|
||||
|
||||
$menus_accessibles = $this->utilisateur->getSousMenusAccessiblesVue($codeProfil, $codeVue);
|
||||
$menus_non_accessibles = $this->utilisateur->getSousMenusNonAccessiblesVue($codeProfil,$codeVue);
|
||||
|
||||
$this->genererVueAjax(array(
|
||||
'menus_accessibles' => $menus_accessibles,
|
||||
'menus_non_accessibles' => $menus_non_accessibles
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function ajoutertoussousmenusrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeVue = $this->requete->getParametreFormulaire("codeVue");
|
||||
|
||||
$this->utilisateur->ajoutertoussousmenusrh($codeProfil, $codeVue);
|
||||
}
|
||||
|
||||
public function retirertoussousmenusrh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeVue = $this->requete->getParametreFormulaire("codeVue");
|
||||
|
||||
$this->utilisateur->retirertoussousmenusrh($codeProfil, $codeVue);
|
||||
}
|
||||
|
||||
public function ajouterunsousmenurh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeVue = $this->requete->getParametreFormulaire("codeVue");
|
||||
$codeMenu = $this->requete->getParametreFormulaire("codeMenu");
|
||||
|
||||
$this->utilisateur->ajouterunsousmenurh($codeProfil, $codeVue, $codeMenu);
|
||||
}
|
||||
|
||||
public function retirerunsousmenurh()
|
||||
{
|
||||
$codeProfil = $this->requete->getParametreFormulaire("codeProfil");
|
||||
$codeVue = $this->requete->getParametreFormulaire("codeVue");
|
||||
$codeMenu = $this->requete->getParametreFormulaire("codeMenu");
|
||||
|
||||
$this->utilisateur->retirerunsousmenurh($codeProfil, $codeVue, $codeMenu);
|
||||
}
|
||||
}
|
||||
|
|
@ -44944,4 +44944,48 @@ function reinitpaswd_user_rh(codeUtilisateur)
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function afficher_menu_principal_profil_rh()
|
||||
{
|
||||
codeProfil=$("#codeProfil").val();
|
||||
|
||||
if (codeProfil<=" ")
|
||||
{
|
||||
v_msg="Veuillez sélectionner un profil!";
|
||||
v_msgEng="Please select a user profile!";
|
||||
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
|
||||
$("#codeProfil").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
donnees = 'codeProfil='+codeProfil;
|
||||
|
||||
var div_attente = $('#div_menu_profil');
|
||||
|
||||
div_attente.html(`
|
||||
<div class="d-flex flex-column align-items-center justify-content-center" style="padding-top:80px;">
|
||||
<div class="spinner-border text-primary" role="status" style="width:3rem; height:3rem;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<span class="mt-3 fs-5 fw-bold">
|
||||
Veuillez patienter... / Please wait...
|
||||
</span>
|
||||
</div>
|
||||
`);
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxhabilitation/",
|
||||
type : 'post',
|
||||
data: donnees,
|
||||
error: function(errorData) {
|
||||
},
|
||||
success: function(data) {
|
||||
div_attente.html(data);
|
||||
},
|
||||
complete: function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -291,6 +291,16 @@ class Utilisateur extends Modele {
|
|||
|
||||
}
|
||||
|
||||
public function getMenusAccessiblesProfilRh($codeProfil)
|
||||
{
|
||||
$sql = "call sp_c_get_menus_accessibles_profil_rh(?, ?);";
|
||||
|
||||
$menu = $this->executerRequete($sql, array($_SESSION['codeSociete'], $codeProfil));
|
||||
|
||||
return $menu->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
}
|
||||
|
||||
public function getMenusNonAccessiblesProfil($codeProfil)
|
||||
{
|
||||
$sql = "call sp_r_get_menus_non_accessibles_profil(?, ?);";
|
||||
|
|
@ -301,6 +311,16 @@ class Utilisateur extends Modele {
|
|||
|
||||
}
|
||||
|
||||
public function getMenusNonAccessiblesProfilRh($codeProfil)
|
||||
{
|
||||
$sql = "call sp_c_get_menus_non_accessibles_profil_rh(?, ?);";
|
||||
|
||||
$menu = $this->executerRequete($sql, array($_SESSION['codeSociete'], $codeProfil));
|
||||
|
||||
return $menu->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
}
|
||||
|
||||
public function ajouterunmenuprincipalprofilassureur($codeProfil, $codeMenu)
|
||||
{
|
||||
$codeSociete = $_SESSION['codeSociete'];
|
||||
|
|
|
|||
131
Vue/Ajaxhabilitation/index.php
Normal file
131
Vue/Ajaxhabilitation/index.php
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<div id="div_menu_profil" class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<div id="div_utilisateur_profil_1" class="col-md-6">
|
||||
<div class="panel panel-danger" style="box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
|
||||
<div class="panel-heading" style="padding: 10px 15px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-9">
|
||||
<strong style="text-transform: uppercase; font-size: 12px;">
|
||||
<span class="glyphicon glyphicon-lock" style="margin-right: 8px;"></span>
|
||||
<?= _("Menus non accessibles") ?>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="col-xs-3 text-right">
|
||||
<span class="badge" style="background-color: #a94442;"><?= count($menus_non_accessibles) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body" style="background-color: #fcf8f2; padding: 8px;">
|
||||
<button type="button" class="btn btn-danger btn-sm btn-block"
|
||||
style="font-weight: bold; text-transform: uppercase; font-size: 11px;"
|
||||
onclick="javascript:ajouter_tous_menus_principal_profil_rh();">
|
||||
<?= _("Tout ajouter") ?> <span class="glyphicon glyphicon-forward" style="margin-left: 5px;"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" style="max-height: 400px; overflow-y: auto; background: white;">
|
||||
<table class="table table-hover table-condensed" style="margin-bottom: 0;">
|
||||
<tbody style="font-size: 13px;">
|
||||
<?php foreach ($menus_non_accessibles as $m):
|
||||
$codeMenu = $m['codeMenu'];
|
||||
$libeleMenu = est_anglophone() ? $m['libelleEng'] : $m['libeleMenu'];
|
||||
?>
|
||||
<tr>
|
||||
<td style="padding-left: 15px; vertical-align: middle; border-top: 1px solid #f2f2f2;"><?= $libeleMenu ?></td>
|
||||
<td class="text-right" style="padding-right: 15px; vertical-align: middle; width: 60px; border-top: 1px solid #f2f2f2;">
|
||||
<button class="btn btn-info btn-xs"
|
||||
style="border-radius: 50%; width: 26px; height: 26px; padding: 0;"
|
||||
title="<?= _("Ajouter") ?>"
|
||||
onClick="javascript:ajouter_un_menu_principal_profil_rh('<?=$codeMenu?>');">
|
||||
<span class="glyphicon glyphicon-chevron-right"></span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="div_utilisateur_profil_2" class="col-md-6">
|
||||
<div class="panel panel-success" style="box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
|
||||
<div class="panel-heading" style="padding: 10px 15px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-9">
|
||||
<strong style="text-transform: uppercase; font-size: 12px;">
|
||||
<span class="glyphicon glyphicon-ok" style="margin-right: 8px;"></span>
|
||||
<?= _("Menus accessibles") ?>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="col-xs-3 text-right">
|
||||
<span class="badge" style="background-color: #3c763d;"><?= count($menus_accessibles) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body" style="background-color: #f2fcf2; padding: 8px;">
|
||||
<button type="button" class="btn btn-success btn-sm btn-block"
|
||||
style="font-weight: bold; text-transform: uppercase; font-size: 11px;"
|
||||
onclick="javascript:retirer_tous_menus_principal_profil_rh();">
|
||||
<span class="glyphicon glyphicon-backward" style="margin-right: 5px;"></span> <?= _("Tout retirer") ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" style="max-height: 400px; overflow-y: auto; background: white;">
|
||||
<table class="table table-hover table-condensed" style="margin-bottom: 0;">
|
||||
<tbody style="font-size: 13px;">
|
||||
<?php foreach ($menus_accessibles as $m):
|
||||
$codeMenu = $m['codeMenu'];
|
||||
$libeleMenu = est_anglophone() ? $m['libelleEng'] : $m['libeleMenu'];
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-left" style="padding-left: 15px; vertical-align: middle; width: 60px; border-top: 1px solid #f2f2f2;">
|
||||
<button class="btn btn-warning btn-xs"
|
||||
style="border-radius: 50%; width: 26px; height: 26px; padding: 0;"
|
||||
title="<?= _("Retirer") ?>"
|
||||
onClick="javascript:retirer_un_menu_principal_profil_rh('<?=$codeMenu?>');">
|
||||
<span class="glyphicon glyphicon-chevron-left"></span>
|
||||
</button>
|
||||
</td>
|
||||
<td style="vertical-align: middle; border-top: 1px solid #f2f2f2;"><?= $libeleMenu ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Simulation de l'animation FadeIn */
|
||||
#div_menu_profil {
|
||||
animation: fadeIn 0.4s ease-in;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
/* Style du scrollbar pour les anciens navigateurs (optionnel) */
|
||||
.table-responsive::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
.table-responsive::-webkit-scrollbar-thumb {
|
||||
background: #ccc;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* Effet simple au survol des boutons circulaires */
|
||||
.btn-xs:hover {
|
||||
opacity: 0.8;
|
||||
transform: scale(1.1);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user