Gestion affichage utilisateur, service
This commit is contained in:
parent
a93379f5d5
commit
4eb3e053ed
@ -4,19 +4,21 @@ class Admin_UserController extends Zend_Controller_Action
|
||||
public function indexAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$code = $request->getParam('code');
|
||||
$serviceCode = $request->getParam('service');
|
||||
|
||||
$this->view->UserSearch = false;
|
||||
|
||||
if ($code === null) {
|
||||
// Pas de service sélectionner
|
||||
if ($serviceCode === null) {
|
||||
$this->view->UserSearch = true;
|
||||
|
||||
} else {
|
||||
}
|
||||
// Affichage des utilisateurs
|
||||
else {
|
||||
// Get Service Name
|
||||
// Ne pas créer d'utilisateur lorsque Service Editable = 0
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->code = $code;
|
||||
$params->code = $serviceCode;
|
||||
$serviceResponse = $ws->getService($params);
|
||||
$this->view->Service = $serviceResponse;
|
||||
|
||||
@ -24,7 +26,7 @@ class Admin_UserController extends Zend_Controller_Action
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->actif = 1;
|
||||
$params->service = $code;
|
||||
$params->service = $serviceCode;
|
||||
$responses = $ws->getUserList($params);
|
||||
$this->view->List = $responses->item;
|
||||
}
|
||||
@ -65,27 +67,32 @@ class Admin_UserController extends Zend_Controller_Action
|
||||
$values = $request->getPost();
|
||||
|
||||
if ( $values['id']===null ) {
|
||||
$data['dateInsert'] = date('Y-m-d H:i:s');
|
||||
try {
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$data['dateInsert'] = date('Y-m-d H:i:s');
|
||||
try {
|
||||
$params = new stdClass();
|
||||
$param->data = json_encode($values);
|
||||
$params->data = json_encode($values);
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$response = $ws->setUser($params);
|
||||
$data['status'] = 1;
|
||||
$data['login'] = $values['login'];
|
||||
$data['email'] = $values['email'];
|
||||
$data['civilite'] = $values['civilite'];
|
||||
$data['nom'] = $values['nom'];
|
||||
$data['prenom'] = $values['prenom'];
|
||||
} catch(Zend_Exception $e) {
|
||||
$data['prenom'] = $values['prenom'];
|
||||
} catch(Exception $e) {
|
||||
$data['status'] = 0;
|
||||
$data['msg'] = "Erreur lors de la création de l'utilisateur ! ".$e->getMessage();
|
||||
}
|
||||
}
|
||||
$this->view->data = $data;
|
||||
} else {
|
||||
$serviceId = $request->getParam('service');
|
||||
$this->view->serviceId = $serviceId;
|
||||
$serviceCode = $request->getParam('service');
|
||||
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->code = $serviceCode;
|
||||
$serviceResponse = $ws->getService($params);
|
||||
$this->view->Service = $serviceResponse;
|
||||
}
|
||||
}
|
||||
}
|
@ -40,34 +40,46 @@
|
||||
</table>
|
||||
|
||||
<h2>Droits d'accès</h2>
|
||||
<?php if (count($this->Info->Acces->item) > 0) {?>
|
||||
<?php if (count($this->Info->Acces->item) == 0) {?>
|
||||
<p class="bg-classes bg-danger"><strong>Attention !</strong> Aucun paramètre d'accès défini.
|
||||
Les utilisateurs ne pourront pas accèder au service.</p>
|
||||
<?php }?>
|
||||
<?php foreach ($this->Categories as $c => $item) {?>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><?=$item->Label?></div>
|
||||
<ul class="list-group">
|
||||
<?php foreach ($item->Acces->item as $a) {?>
|
||||
<?php foreach ($this->Info->Acces->item as $Access) {
|
||||
$add = 1;
|
||||
$exist = 0;
|
||||
if ($Access->Code == $a) {
|
||||
$add = 0;
|
||||
$exist = 1;
|
||||
break;
|
||||
}
|
||||
} ?>
|
||||
<li class="list-group-item<?php if ($add == 0) { echo " list-group-item-success"; }?>">
|
||||
<li class="list-group-item<?php if ($exist == 1) { echo " list-group-item-success"; }?>">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?php if (array_key_exists($a, $this->Access)) {?>
|
||||
<?=$this->Access[$a]?>
|
||||
<?php } else {?>
|
||||
<?=$a?>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<?php if ($exist == 0) {?>
|
||||
<span class="label label-warning">Désactivé</span>
|
||||
<span class="glyphicon glyphicon-plus pull-right"></span>
|
||||
<?php } else {?>
|
||||
<span class="glyphicon glyphicon-remove pull-right"></span>
|
||||
<?php }?>
|
||||
<?php if ($add == 1) {?><span class="label label-warning pull-right">Inactif</span><?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-danger">Aucun paramètre d'accès défini, vérifier les paramètres aux utilisateurs.</p>
|
||||
<?php }?>
|
||||
|
||||
|
||||
<h2>Restriction IPs</h2>
|
||||
<?php if (count($this->Info->IP->item) > 0) {?>
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
<?php
|
||||
$class = 'active';
|
||||
if ($l->Editable == 0) { $class = ''; } ?>
|
||||
if ($l->Editable == 0) { $class = ''; }
|
||||
?>
|
||||
<tr class="<?=$class?>">
|
||||
<td><?=$l->Label?></td>
|
||||
<td><?=$l->TypeAcces?></td>
|
||||
@ -30,7 +31,7 @@ if ($l->Editable == 0) { $class = ''; } ?>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="<?=$this->url(array('module'=>'admin', 'controller'=>'service', 'action'=>'detail', 'code'=>$l->Code),
|
||||
'default', true)?>">Paramètres</a></li>
|
||||
<li><a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'index', 'code'=>$l->Code),
|
||||
<li><a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'index', 'service'=>$l->Code),
|
||||
'default', true)?>">Utilisateurs</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div id="content">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Utilisateur : {login}</h1>
|
||||
<h1>Utilisateur : <?=$this->Item->Login?></h1>
|
||||
</div>
|
||||
|
||||
<h2>Identite</h2>
|
||||
@ -35,13 +35,16 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Paramètres</h2>
|
||||
<p class="bg-classes bg-info"><strong>Service :</strong> <?=$this->Item->ServiceLabel?></p>
|
||||
<?php if (count($this->Item->Acces->item) > 0) {?>
|
||||
<?php if ($this->Item->AccesOverride === true) {?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<strong>Attention !</strong> Cet utilisateur posséde des paramètres d'accès spécifiques, différent du service auquel il appartient.</div>
|
||||
<?php }?>
|
||||
|
||||
<h2>Paramètres</h2>
|
||||
<p class="bg-classes bg-info"><strong>Service :</strong> <a href="<?=$this->url(array('module'=>'admin',
|
||||
'controller'=>'service', 'action'=>'detail', 'code'=>$this->Item->ServiceCode),
|
||||
'default', true)?>"><?=$this->Item->ServiceLabel?></a></p>
|
||||
|
||||
<?php if (count($this->Item->Acces->item) > 0) {?>
|
||||
<?php foreach ($this->Categories as $c => $item) {?>
|
||||
<div class="panel panel-info">
|
||||
@ -61,14 +64,16 @@
|
||||
<?php } else {?>
|
||||
<?=$a?>
|
||||
<?php }?>
|
||||
<?php if ($add == 1) {?><span class="label label-warning pull-right">Inactif</span><?php }?>
|
||||
<?php if ($add == 1) {?>
|
||||
<span class="label label-warning pull-right">Non autorisé</span>
|
||||
<?php }?>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-danger">Aucun paramètre d'accès défini, vérifier les paramètres aux utilisateurs.</p>
|
||||
<p class="bg-classes bg-danger">Aucun paramètre d'accès défini, vérifier les paramètres du service.</p>
|
||||
<?php }?>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
|
@ -10,15 +10,16 @@
|
||||
<h1>Ajout d'utilisateurs - <small><?=$this->Service->Label?></small></h1>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-sm btn-default" href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'index'),
|
||||
'default', true)?>">Retour à la liste des utilisateurs</a>
|
||||
<a class="btn btn-sm btn-default" href="<?=$this->url(array('module'=>'admin', 'controller'=>'user',
|
||||
'action'=>'index', 'service'=>$this->Service->Code), 'default', true)?>">
|
||||
Retour à la liste des utilisateurs</a>
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<table id="users" class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Identifiant</th>
|
||||
<th>Email</th>
|
||||
<th>Civilité</th>
|
||||
<th>Civilité</th>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th></th>
|
||||
@ -34,7 +35,7 @@
|
||||
|
||||
<form name="user" class="form-inline" role="form" action="<?=$this->url(array('module'=>'admin', 'controller'=>'user',
|
||||
'action'=>'form'), 'default', true)?>" method="post">
|
||||
<input type="hidden" name="idClient" value="<?=$this->client?>" />
|
||||
<input type="hidden" name="idClient" value="<?=$this->Service->IdClient?>" />
|
||||
<input type="hidden" name="idService" value="<?=$this->Service->id?>" />
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" name="login" value="" placeholder="Login" />
|
||||
@ -68,6 +69,7 @@ $('form[name=user]').submit(function(e){
|
||||
var btn = $('button#btnUserSubmit');
|
||||
var btnText = btn.html();
|
||||
btn.html(btn.data('submit-text'));
|
||||
$('#user-msg').html('').removeClass('alert alert-info');
|
||||
var obj = $(this);
|
||||
var url = obj.attr('action');
|
||||
$.post(url, obj.serialize(), function(data){
|
||||
|
@ -6,7 +6,8 @@
|
||||
<h1>Recherche d'utilisateurs</h1>
|
||||
</div>
|
||||
|
||||
<p class="bg-classes bg-info">Pour consulter la liste des utilisateurs d'un service, veuillez sélectionner un service.</p>
|
||||
<p class="bg-classes bg-info">Pour consulter la liste des utilisateurs d'un service,
|
||||
veuillez sélectionner un service.</p>
|
||||
|
||||
<pre>Formulaire de recherche des utilisateurs</pre>
|
||||
|
||||
@ -29,9 +30,9 @@ Filtre <span class="caret"></span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'form', 'idClient'=>$this->client,
|
||||
'idService'=>$this->service), 'default', true)?>"
|
||||
class="btn btn-sm btn-default">Nouvel utilisateur</a>
|
||||
<a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'form',
|
||||
'service'=>$this->Service->Code), 'default', true)?>"
|
||||
class="btn btn-sm btn-default">Création d'utilisateurs</a>
|
||||
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-warning">Les utilisateurs de ce service ne sont pas éditable.</p>
|
||||
@ -60,8 +61,8 @@ Filtre <span class="caret"></span>
|
||||
aria-expanded="false">Action <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'detail', 'id'=>$l->id),
|
||||
'default', true)?>">Fiche</a></li>
|
||||
<li><a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'detail',
|
||||
'id'=>$l->id), 'default', true)?>">Fiche</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-danger">Mode Edition désactivé !</p>
|
||||
<?php }?>
|
||||
|
||||
<?php if (in_array($this->UserProfil, array('Administrateur', 'SuperAdministrateur'))) {?>
|
||||
<?php if ($this->UserModeEdit == 1) {?>
|
||||
<button id="editsession" data-toggle="button" data-loading-text="Enregistrement..." data-url="<?=$this->url(array('module'=>'user',
|
||||
@ -80,7 +81,7 @@ $('#editsession').click(function(e){
|
||||
<?php } else {?>
|
||||
<?=$a?>
|
||||
<?php }?>
|
||||
<?php if ($add == 1) {?><span class="label label-warning pull-right">Inactif</span><?php }?>
|
||||
<?php if ($add == 1) {?><span class="label label-warning pull-right">Non autorisé</span><?php }?>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user