Controller Administration
This commit is contained in:
parent
74cfb9db05
commit
9cde8ef085
@ -1,8 +1,114 @@
|
||||
<?php
|
||||
class AdminController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Return a ramdom password
|
||||
* @param int $length
|
||||
* Length of the string
|
||||
* @param int $strength
|
||||
* $strength = 1:- 0-9
|
||||
* $strength = 2:- A-Z0-9
|
||||
* $strength = 3:- A-Za-z0-9
|
||||
* $strength = 4:- A-Za-z0-9 and # $ % &
|
||||
* $strength = 5:- A-Za-z0-9 and # $ % & = > ? @
|
||||
* @return string
|
||||
*/
|
||||
protected function randomPassword($length,$strength)
|
||||
{
|
||||
$char_sets=array('48-57','65-90','97-122','35-38','61-64');
|
||||
$new_password='';
|
||||
srand(microtime()*10000000);
|
||||
for($i=0;$i<$length;$i++){
|
||||
$random=rand(0,$strength-1);
|
||||
list($start,$end)=explode('-',$char_sets[$random]);
|
||||
$new_password.=chr(rand($start,$end));
|
||||
}
|
||||
return $new_password;
|
||||
}
|
||||
|
||||
public function indexAction(){}
|
||||
/**
|
||||
* Page de présentation
|
||||
* Liste des services
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$clientId = $user->getIdClient();
|
||||
|
||||
$ws = new Scores_Ws_Client('gestion', '0.4');
|
||||
$response = $ws->getClientServices($clientId);
|
||||
|
||||
if ($response !== false) {
|
||||
$this->view->Nom = $response->Nom;
|
||||
$this->view->Siren = $response->Siren;
|
||||
$this->view->Nic = $response->Nic;
|
||||
$this->view->Test = $response->Test;
|
||||
|
||||
if (count($response->Services->item) > 0) {
|
||||
$this->view->Services = $response->Services->item;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Affichage des caractéristiques des services
|
||||
*/
|
||||
public function serviceAction(){}
|
||||
|
||||
/**
|
||||
* Liste des utilisateurs d'un service
|
||||
* Edition
|
||||
* Activation
|
||||
* Suppression
|
||||
*/
|
||||
public function usersAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$clientId = $user->getIdClient();
|
||||
$serviceCode = $request->getParam('service');
|
||||
|
||||
$ws = new Scores_Ws_Client('gestion', '0.4');
|
||||
//$response = $ws->getUsers(null, $serviceCode, $clientId);
|
||||
$params = new stdClass();
|
||||
$params->actif = null;
|
||||
$params->service = $serviceCode;
|
||||
$params->client = $clientId;
|
||||
$response = $ws->getUsers($params);
|
||||
|
||||
if ($response !== false) {
|
||||
$this->view->Users = $response->item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Edition d'un utilisateur
|
||||
*/
|
||||
public function userAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$userId = $request->getParam('id');
|
||||
|
||||
$ws = new Scores_Ws_Client('gestion', '0.4');
|
||||
$params = new stdClass();
|
||||
$params->id = $userId;
|
||||
$response = $ws->getUser($params);
|
||||
|
||||
if ($response !== false) {
|
||||
$this->view->User = $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function userenableAction(){}
|
||||
|
||||
public function userdeleteAction(){}
|
||||
|
||||
}
|
44
application/views/bootstrap/scripts/admin/index.phtml
Normal file
44
application/views/bootstrap/scripts/admin/index.phtml
Normal file
@ -0,0 +1,44 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
|
||||
<h2>Information client</h2>
|
||||
<div class="paragraph">
|
||||
<p>Nom : <?=$this->Nom?></p>
|
||||
<p>Siret : <?=$this->Siren?> <i><?=$this->Nic?></i></p>
|
||||
<p>Test : <?=$this->Test?></p>
|
||||
</div>
|
||||
|
||||
<h2>Liste des services</h2>
|
||||
<div class="paragraph">
|
||||
<p>Les services ou groupes d'utilisateurs sont paramétrés suivant le contrat établi entre votre société et Scores & Decisions.
|
||||
Pour ajouter des services, vous pouvez en faire la demande auprès du support ou de votre commercial.</p>
|
||||
<?php if (count($this->Services) > 0) {?>
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th colspan="2">Action</th>
|
||||
<th>Actif</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->Services as $item) {?>
|
||||
<?php
|
||||
$trStyle = "";
|
||||
if ($item->Editable == 0){
|
||||
$trStyle = ' style="background-color:#cccccc;"';
|
||||
}
|
||||
?>
|
||||
<tr<?=$trStyle?>>
|
||||
<td><?=$item->Label?></td>
|
||||
<td><a href="<?=$this->url(array('controller'=>'admin', 'action' => 'users', 'service'=>$item->Code), 'default', true)?>">Liste des utilisateurs</a></td>
|
||||
<td><a href="#">Paramètrage</a></td>
|
||||
<td><?=$item->Active?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
||||
</div>
|
1
application/views/bootstrap/scripts/admin/service.phtml
Normal file
1
application/views/bootstrap/scripts/admin/service.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
55
application/views/bootstrap/scripts/admin/user.phtml
Normal file
55
application/views/bootstrap/scripts/admin/user.phtml
Normal file
@ -0,0 +1,55 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
<h2>Gestion utilisateur <span style="color:red;"><?=$this->User->Login?></span></h2>
|
||||
|
||||
<div class="paragraph">
|
||||
<h3><?=$this->User->Civilite?>. <?=$this->User->Nom?> <?=$this->User->Prenom?></h3>
|
||||
</div>
|
||||
|
||||
<h2>Identité</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<tr><td>Identifiant :</td><td><?=$this->User->Login?></td></tr>
|
||||
<tr><td>Courriel :</td><td><?=$this->User->Email?></td></tr>
|
||||
<tr><td>Actif :</td><td><?=$this->User->Enable?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Service</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<tr><td>Nom :</td><td><?=$this->User->ServiceLabel?></td></tr>
|
||||
<tr><td>Adresse IP :</td>
|
||||
<td>
|
||||
<?php foreach ($this->User->IP as $ip) {?>
|
||||
<?=$ip?></br>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Accès</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<?php foreach($this->User->Acces->item as $acces) {?>
|
||||
<tr>
|
||||
<td><?=$acces->Label?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
36
application/views/bootstrap/scripts/admin/users.phtml
Normal file
36
application/views/bootstrap/scripts/admin/users.phtml
Normal file
@ -0,0 +1,36 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
<h2>Informations service</h2>
|
||||
<div class="paragraph">
|
||||
<p>Afficher les caratéristiques du service</p>
|
||||
<p><a href="#">Créer un utilisateur</a></p>
|
||||
</div>
|
||||
|
||||
<h2>Liste des utilisateurs</h2>
|
||||
<div class="paragraph">
|
||||
<?php if (count($this->Users) > 0) {?>
|
||||
<table class="data">
|
||||
<thead>
|
||||
<th>Identifiant</th>
|
||||
<th>Identité</th>
|
||||
<th>Actif</th>
|
||||
<th>Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->Users as $item) {?>
|
||||
<tr>
|
||||
<td><?=$item->Login?></td>
|
||||
<td><?=$item->Civilite?>. <?=$item->Nom?> <?=$item->Prenom?></td>
|
||||
<td><?=$item->Enable?></td>
|
||||
<td>
|
||||
<a href="<?=$this->url(array('controller'=> 'admin', 'action'=>'user', 'id'=>$item->id),
|
||||
'default', true)?>">Voir</a> - <a href="<?=$this->url(array('controller'=> 'admin', 'action'=>'user', 'mode'=>'edit', 'id'=>$item->id),
|
||||
'default', true)?>">Editer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
44
application/views/default/scripts/admin/index.phtml
Normal file
44
application/views/default/scripts/admin/index.phtml
Normal file
@ -0,0 +1,44 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
|
||||
<h2>Information client</h2>
|
||||
<div class="paragraph">
|
||||
<p>Nom : <?=$this->Nom?></p>
|
||||
<p>Siret : <?=$this->Siren?> <i><?=$this->Nic?></i></p>
|
||||
<p>Test : <?=$this->Test?></p>
|
||||
</div>
|
||||
|
||||
<h2>Liste des services</h2>
|
||||
<div class="paragraph">
|
||||
<p>Les services ou groupes d'utilisateurs sont paramétrés suivant le contrat établi entre votre société et Scores & Decisions.
|
||||
Pour ajouter des services, vous pouvez en faire la demande auprès du support ou de votre commercial.</p>
|
||||
<?php if (count($this->Services) > 0) {?>
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th colspan="2">Action</th>
|
||||
<th>Actif</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->Services as $item) {?>
|
||||
<?php
|
||||
$trStyle = "";
|
||||
if ($item->Editable == 0){
|
||||
$trStyle = ' style="background-color:#cccccc;"';
|
||||
}
|
||||
?>
|
||||
<tr<?=$trStyle?>>
|
||||
<td><?=$item->Label?></td>
|
||||
<td><a href="<?=$this->url(array('controller'=>'admin', 'action' => 'users', 'service'=>$item->Code), 'default', true)?>">Liste des utilisateurs</a></td>
|
||||
<td><a href="#">Paramètrage</a></td>
|
||||
<td><?=$item->Active?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
||||
</div>
|
1
application/views/default/scripts/admin/service.phtml
Normal file
1
application/views/default/scripts/admin/service.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
55
application/views/default/scripts/admin/user.phtml
Normal file
55
application/views/default/scripts/admin/user.phtml
Normal file
@ -0,0 +1,55 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
<h2>Gestion utilisateur <span style="color:red;"><?=$this->User->Login?></span></h2>
|
||||
|
||||
<div class="paragraph">
|
||||
<h3><?=$this->User->Civilite?>. <?=$this->User->Nom?> <?=$this->User->Prenom?></h3>
|
||||
</div>
|
||||
|
||||
<h2>Identité</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<tr><td>Identifiant :</td><td><?=$this->User->Login?></td></tr>
|
||||
<tr><td>Courriel :</td><td><?=$this->User->Email?></td></tr>
|
||||
<tr><td>Actif :</td><td><?=$this->User->Enable?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Service</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<tr><td>Nom :</td><td><?=$this->User->ServiceLabel?></td></tr>
|
||||
<tr><td>Adresse IP :</td>
|
||||
<td>
|
||||
<?php foreach ($this->User->IP as $ip) {?>
|
||||
<?=$ip?></br>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Accès</h2>
|
||||
<div class="paragraph">
|
||||
<table class="data">
|
||||
<tbody>
|
||||
<?php foreach($this->User->Acces->item as $acces) {?>
|
||||
<tr>
|
||||
<td><?=$acces->Label?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
36
application/views/default/scripts/admin/users.phtml
Normal file
36
application/views/default/scripts/admin/users.phtml
Normal file
@ -0,0 +1,36 @@
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
<h2>Informations service</h2>
|
||||
<div class="paragraph">
|
||||
<p>Afficher les caratéristiques du service</p>
|
||||
<p><a href="#">Créer un utilisateur</a></p>
|
||||
</div>
|
||||
|
||||
<h2>Liste des utilisateurs</h2>
|
||||
<div class="paragraph">
|
||||
<?php if (count($this->Users) > 0) {?>
|
||||
<table class="data">
|
||||
<thead>
|
||||
<th>Identifiant</th>
|
||||
<th>Identité</th>
|
||||
<th>Actif</th>
|
||||
<th>Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->Users as $item) {?>
|
||||
<tr>
|
||||
<td><?=$item->Login?></td>
|
||||
<td><?=$item->Civilite?>. <?=$item->Nom?> <?=$item->Prenom?></td>
|
||||
<td><?=$item->Enable?></td>
|
||||
<td>
|
||||
<a href="<?=$this->url(array('controller'=> 'admin', 'action'=>'user', 'id'=>$item->id),
|
||||
'default', true)?>">Voir</a> - <a href="<?=$this->url(array('controller'=> 'admin', 'action'=>'user', 'mode'=>'edit', 'id'=>$item->id),
|
||||
'default', true)?>">Editer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user