Module Admin : gestion des utilisateurs
This commit is contained in:
parent
735d95c1b6
commit
c30ba3a96b
@ -6,24 +6,50 @@ class Admin_UserController extends Zend_Controller_Action
|
||||
$request = $this->getRequest();
|
||||
$code = $request->getParam('code');
|
||||
|
||||
// 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;
|
||||
$serviceResponse = $ws->getService($params);
|
||||
$this->view->Service = $serviceResponse;
|
||||
$this->view->UserSearch = false;
|
||||
|
||||
// Get Users
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->actif = 1;
|
||||
$params->service = $code;
|
||||
$responses = $ws->getUserList($params);
|
||||
$this->view->List = $responses->item;
|
||||
if ($code === null) {
|
||||
$this->view->UserSearch = true;
|
||||
|
||||
} 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;
|
||||
$serviceResponse = $ws->getService($params);
|
||||
$this->view->Service = $serviceResponse;
|
||||
|
||||
// Get Users
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->actif = 1;
|
||||
$params->service = $code;
|
||||
$responses = $ws->getUserList($params);
|
||||
$this->view->List = $responses->item;
|
||||
}
|
||||
}
|
||||
|
||||
public function detailAction(){}
|
||||
public function detailAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->id = $id;
|
||||
$response = $ws->getUser($params);
|
||||
$this->view->Item = $response;
|
||||
|
||||
$responses = $ws->getCategory();
|
||||
$this->view->Categories = $responses->item;
|
||||
|
||||
$responses = $ws->getAccess();
|
||||
$this->view->Access = array();
|
||||
foreach ($responses->item as $item) {
|
||||
$this->view->Access[$item->Code] = $item->Label;
|
||||
}
|
||||
}
|
||||
|
||||
public function formAction()
|
||||
{
|
||||
@ -41,21 +67,25 @@ class Admin_UserController extends Zend_Controller_Action
|
||||
if ( $values['id']===null ) {
|
||||
$data['dateInsert'] = date('Y-m-d H:i:s');
|
||||
try {
|
||||
|
||||
$ws = new Scores_Ws_Client('account', '0.1');
|
||||
$params = new stdClass();
|
||||
$param->data = json_encode($values);
|
||||
$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_Db_Exception $e) {
|
||||
} catch(Zend_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -4,8 +4,74 @@
|
||||
<h1>Utilisateur : {login}</h1>
|
||||
</div>
|
||||
|
||||
<pre>
|
||||
Liste des informations
|
||||
</pre>
|
||||
<h2>Identite</h2>
|
||||
<?php if ($this->Item->Delete == 1) {?>
|
||||
<p class="bg-classes bg-danger">Utilisateur supprimé.</p>
|
||||
<?php }?>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Login</th>
|
||||
<td><?=$this->Item->Login?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Nom / Prénom</th>
|
||||
<td><?=$this->Item->Civilite . ' ' . $this->Item->Nom . ' ' . $this->Item->Prenom?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Courriel</th>
|
||||
<td><?=$this->Item->Email?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Actif</th>
|
||||
<td>
|
||||
<?php if ($this->Item->Enable == 0) {?>
|
||||
<span class="label label-warning">Inactif</span>
|
||||
<?php } else {?>
|
||||
<span class="label label-success">Actif</span>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
</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) {?>
|
||||
<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 }?>
|
||||
|
||||
<?php if (count($this->Item->Acces->item) > 0) {?>
|
||||
<?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->Item->Acces->item as $Access) {
|
||||
$add = 1;
|
||||
if ($Access->Code == $a) {
|
||||
$add = 0;
|
||||
break;
|
||||
}
|
||||
} ?>
|
||||
<li class="list-group-item<?php if ($add == 0) { echo " list-group-item-success"; }?>">
|
||||
<?php if (array_key_exists($a, $this->Access)) {?>
|
||||
<?=$this->Access[$a]?>
|
||||
<?php } else {?>
|
||||
<?=$a?>
|
||||
<?php }?>
|
||||
<?php if ($add == 1) {?><span class="label label-warning pull-right">Inactif</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>
|
||||
<?php }?>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
|
||||
|
||||
</div>
|
@ -7,10 +7,10 @@
|
||||
<div id="content">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Utilisateurs - <small><?=$this->Service->Label?></small></h1>
|
||||
<h1>Ajout d'utilisateurs - <small><?=$this->Service->Label?></small></h1>
|
||||
</div>
|
||||
|
||||
<a href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'index'),
|
||||
<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>
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
@ -28,6 +28,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div id="user-msg"></div>
|
||||
|
||||
<form name="user" class="form-inline" role="form" action="<?=$this->url(array('module'=>'admin', 'controller'=>'user',
|
||||
|
@ -1,9 +1,23 @@
|
||||
<div id="content">
|
||||
|
||||
<?php if ($this->UserSearch) {?>
|
||||
|
||||
<div class="page-header">
|
||||
<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>
|
||||
|
||||
<pre>Formulaire de recherche des utilisateurs</pre>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Utilisateurs - <small><?=$this->Service->Label?></small></h1>
|
||||
</div>
|
||||
|
||||
<?php if ($this->Service->Editable == 1) {?>
|
||||
|
||||
<div class="btn-group">
|
||||
<a href="#" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
Filtre <span class="caret"></span>
|
||||
@ -19,6 +33,10 @@ Filtre <span class="caret"></span>
|
||||
'idService'=>$this->service), 'default', true)?>"
|
||||
class="btn btn-sm btn-default">Nouvel utilisateur</a>
|
||||
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-warning">Les utilisateurs de ce service ne sont pas éditable.</p>
|
||||
<?php }?>
|
||||
|
||||
<?php if (count($this->List) > 0) {?>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
@ -36,20 +54,25 @@ Filtre <span class="caret"></span>
|
||||
<td><?=$l->Civilite . ". " . $l->Nom . " " . $l->Prenom?></td>
|
||||
<td><?=$l->Email?></td>
|
||||
<td>
|
||||
<?php if ($this->Service->Editable == 1) {?>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="false">Action <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="">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 }?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else {?>
|
||||
<p class="bg-classes bg-warning">Aucun utilisateur.</p>
|
||||
<?php }?>
|
||||
|
||||
<?php }?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user