Module User
This commit is contained in:
parent
25b1e33dff
commit
bd4fc76509
487
application/modules/user/controllers/IdentityController.php
Normal file
487
application/modules/user/controllers/IdentityController.php
Normal file
@ -0,0 +1,487 @@
|
||||
<?php
|
||||
class User_IdentityController extends Zend_Controller_Action
|
||||
{
|
||||
protected $theme;
|
||||
|
||||
/**
|
||||
* 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 init()
|
||||
{
|
||||
// --- Theme
|
||||
$this->theme = Zend_Registry::get('theme');
|
||||
|
||||
require_once 'Scores/WsScores.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche le fomulaire d'edition des paramètres utilisateur
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->headLink()->appendStylesheet($this->theme->pathStyle.'/user.css', 'all');
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
if (!$user->checkPerm('MONPROFIL')){
|
||||
$this->_forward('perms', 'error');
|
||||
}
|
||||
|
||||
$this->view->assign('device_type', $user->getBrowserInfo()->mobile);
|
||||
$this->view->assign('browser_info', $user->getBrowserInfo()->name.' '.$user->getBrowserInfo()->version);
|
||||
|
||||
$this->view->headScript()->appendFile($this->theme->pathScript.'/user.js', 'text/javascript');
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$messages = '';
|
||||
$isProfilUpdated = false;
|
||||
$isPasswordUpdated = false;
|
||||
$updateResult = false;
|
||||
|
||||
$login = $request->getParam('login', '');
|
||||
$op = $request->getParam('op');
|
||||
|
||||
//Récupération des informations de l'identité
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
|
||||
//Save data
|
||||
if ( $request->isPost() ) {
|
||||
$options = $request->getParam('frmOptions', '');
|
||||
$action = $options['action'];
|
||||
|
||||
if ($login=='') $login = $options['login'];
|
||||
|
||||
//Enregistrement des données new & update
|
||||
if (in_array($action, array('new','update'))) {
|
||||
|
||||
if ( $options['changepwd'] != 1 ) {
|
||||
$options['password'] = '';
|
||||
}
|
||||
|
||||
if ( in_array($options['profil'], array('Administrateur', 'SuperAdministrateur'))
|
||||
&& !in_array('monprofil', $options['droits']) ) {
|
||||
$options['droits'][] = 'monprofil';
|
||||
}
|
||||
|
||||
if( !isset($options['profil']) ) {
|
||||
$options['profil'] = 'Utilisateur';
|
||||
}
|
||||
$ws = new WsScores();
|
||||
$reponse = $ws->setInfosLogin($login, $action, $options);
|
||||
|
||||
$isProfilUpdated = true;
|
||||
$message = 'Erreur lors de la mise à jour du compte !';
|
||||
if (is_string($reponse)) {
|
||||
$message = $reponse;
|
||||
} elseif ($reponse){
|
||||
$updateResult = true;
|
||||
$message = 'Compte mis à jour.';
|
||||
}
|
||||
}
|
||||
|
||||
// --- Write change in session
|
||||
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
|
||||
// --- Modification lors du changement de mot de passe
|
||||
if ($options['changepwd']==1 && $updateResult) {
|
||||
$identity->password = md5($login.'|'.$options['password']);
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
// --- Mise à jour du profil
|
||||
if ($isProfilUpdated && $updateResult) {
|
||||
$ws = new Scores_Ws_Client('gestion', '0.3');
|
||||
$adressIp = $_SERVER['REMOTE_ADDR'];
|
||||
$parameters = new stdClass();
|
||||
$parameters->login = $identity->username;
|
||||
$parameters->ipUtilisateur = $adressIp;
|
||||
$parameters->from = null;
|
||||
$InfosLogin = $ws->getInfosLogin($parameters);
|
||||
$identity = $user->updateProfil($InfosLogin);
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
// --- Gestion mode edition en SESSION
|
||||
if ($action=='update') {
|
||||
$modeEdition = $request->getParam('modeEdition', false);
|
||||
if ( $modeEdition ) {
|
||||
$identity->modeEdition = true;
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $isProfilUpdated || $isPasswordUpdated ) {
|
||||
$this->view->assign('message', $message);
|
||||
}
|
||||
|
||||
$isAdmin = false;
|
||||
if ( $identity->profil == 'Administrateur'
|
||||
|| $identity->profil == 'SuperAdministrateur' ) {
|
||||
$isAdmin = true;
|
||||
}
|
||||
$this->view->assign('isAdmin', $isAdmin);
|
||||
|
||||
$isSuperAdmin = false;
|
||||
if ($identity->profil == 'SuperAdministrateur') {
|
||||
$isSuperAdmin = true;
|
||||
}
|
||||
$this->view->assign('isSuperAdmin', $isSuperAdmin);
|
||||
|
||||
if ($op=='new')
|
||||
{
|
||||
$idClient = $request->getParam('idClient', '');
|
||||
if ($idClient == '') {
|
||||
$idClient = $identity->idClient;
|
||||
}
|
||||
$ws = new WsScores();
|
||||
$reponse = $ws->getNextLogin($idClient);
|
||||
$options->idClient = $idClient;
|
||||
if ($identity->idClient!=1 && $identity->profil!='SuperAdministrateur') {
|
||||
$options->profil = 'Utilisateur';
|
||||
}
|
||||
$this->view->assign('options', $options);
|
||||
|
||||
$this->view->assign('password', $this->randomPassword(10, 3));
|
||||
$this->view->assign('loginNew', $reponse->result->racine);
|
||||
$this->view->assign('droitsClients', explode(' ', strtolower($reponse->result->droitsClients)));
|
||||
$this->view->assign('action', 'new');
|
||||
$this->view->assign('pref', array());
|
||||
}
|
||||
elseif (!empty($op) || $op!='new')
|
||||
{
|
||||
if ( !empty($login) && $identity->username != $login ) {
|
||||
$ws = new Scores_Ws_Client('gestion', '0.3');
|
||||
$adressIp = $_SERVER['REMOTE_ADDR'];
|
||||
$parameters = new stdClass();
|
||||
$parameters->login = $login;
|
||||
$parameters->ipUtilisateur = $adressIp;
|
||||
$parameters->from = null;
|
||||
$reponse = $ws->getInfosLogin($parameters);
|
||||
$this->view->assign('options', $reponse->result);
|
||||
$this->view->assign('loginVu', $reponse->result->login);
|
||||
$this->view->assign('droits', explode(' ', strtolower($reponse->result->droits)));
|
||||
$this->view->assign('droitsClients', explode(' ', strtolower($reponse->result->droitsClients)));
|
||||
} else {
|
||||
$this->view->assign('options', $identity);
|
||||
$this->view->assign('loginVu', $identity->username);
|
||||
$this->view->assign('droits', explode(' ', strtolower($identity->droits)));
|
||||
$this->view->assign('droitsClients', explode(' ', strtolower($identity->droitsClients)));
|
||||
}
|
||||
$this->view->assign('loginNew', '');
|
||||
$this->view->assign('action', 'update');
|
||||
$this->view->assign('pref', explode(' ',$identity->pref));
|
||||
}
|
||||
|
||||
$ws = new WsScores();
|
||||
//Liste des catégories des accès
|
||||
$reponse = $ws->getCategory();
|
||||
$wscategory = $reponse->item;
|
||||
$this->view->assign('wscategory', $wscategory);
|
||||
|
||||
//Liste de tous les droits
|
||||
$listeDroits = $ws->getListeDroits();
|
||||
$droitsLib = array();
|
||||
foreach($listeDroits->item as $droit) {
|
||||
$droitsLib[strtoupper($droit->code)] = $droit->desc;
|
||||
}
|
||||
$this->view->assign('droitsLib', $droitsLib);
|
||||
|
||||
//Liste de toutes les préférences
|
||||
$listePrefs = $ws->getListePrefs();
|
||||
$prefsLib = array();
|
||||
foreach($listePrefs->item as $pref) {
|
||||
$prefsLib[strtoupper($pref->code)] = $pref->desc;
|
||||
}
|
||||
$this->view->assign('prefsLib', $prefsLib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display box to enter emails
|
||||
* One main email and two secondary
|
||||
* Email length 80 * 3 = 240
|
||||
* 255 chars is the length to store emails (email1;email2;email3)
|
||||
*/
|
||||
public function emailAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$check = $request->getParam('check');
|
||||
$email = $request->getParam('q');
|
||||
|
||||
if ( $check == 1) {
|
||||
|
||||
$this->view->assign('checkemail', true);
|
||||
|
||||
$valid = false;
|
||||
|
||||
$this->view->assign('msg', 'Email invalide !');
|
||||
|
||||
if (null !== $email) {
|
||||
$validateur = new Zend_Validate_EmailAddress();
|
||||
$valid = $validateur->isValid($email);
|
||||
|
||||
if ( $valid ) {
|
||||
$this->view->assign('msg', 'Modification effectué.');
|
||||
$this->view->assign('email', $email);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->view->assign('email', $email);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function emailsecondaryAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$mode = $request->getParam('mode');
|
||||
$this->view->assign('mode', $mode);
|
||||
$email = $request->getParam('email');
|
||||
$login = $request->getParam('login', $user->getLogin());
|
||||
$this->view->assign('login', $login);
|
||||
|
||||
$idClient = $request->getParam('client', $user->getIdClient());
|
||||
|
||||
if ( $mode === null ) {
|
||||
|
||||
$ws = new WsScores();
|
||||
$result = $ws->getGestionEmail($login);
|
||||
$emails = array();
|
||||
if (count($result->item)>0) {
|
||||
$emails = $result->item;
|
||||
}
|
||||
$this->view->assign('emails', $emails);
|
||||
|
||||
} elseif ( $mode == 'set' ) {
|
||||
|
||||
$this->view->assign('msg', 'Email invalide !');
|
||||
|
||||
if (null !== $email) {
|
||||
$validateur = new Zend_Validate_EmailAddress();
|
||||
$valid = $validateur->isValid($email);
|
||||
|
||||
if ( $valid ) {
|
||||
$ws = new WsScores();
|
||||
$result = $ws->setGestionEmail($email, $login);
|
||||
if ( $result ) {
|
||||
$this->view->assign('msg', 'Modification effectué.');
|
||||
$this->view->assign('email', $email);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} elseif ( $mode == 'del' ) {
|
||||
|
||||
$this->view->assign('msg', 'Erreur lors de la suppression !');
|
||||
|
||||
$id = $request->getParam('id');
|
||||
|
||||
$ws = new WsScores();
|
||||
$result = $ws->setGestionEmail($email, $login, $id, $mode);
|
||||
if ( $result ) {
|
||||
$this->view->assign('msg', 'Adresse email supprimé.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Téléchargement de la consommation au format CSV
|
||||
*/
|
||||
public function consoAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile($this->theme->pathScript.'/conso.js', 'text/javascript');
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idClient = $request->getParam('idClient', $user->getIdClient());
|
||||
$login = $request->getParam('login', '');
|
||||
|
||||
$this->view->assign('idClient', $idClient);
|
||||
$this->view->assign('login', $login);
|
||||
$this->view->assign('profil', $user->getProfil());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi vers le formulaire utilisateur avec les paramètres de la requete
|
||||
*/
|
||||
public function editAction()
|
||||
{
|
||||
$params = $this->getRequest()->getParams();
|
||||
$this->_forward('index', 'user', null, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression d'un utilisateur
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$login = $request->getParam('login');
|
||||
$action = 'delete';
|
||||
$ws = new WsScores();
|
||||
$ws->setInfosLogin($login, $action);
|
||||
//Redirect
|
||||
$this->forward('liste');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activation d'un utilisateur
|
||||
*/
|
||||
public function enableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$login = $request->getParam('login');
|
||||
$action = 'enable';
|
||||
$ws = new WsScores();
|
||||
$ws->setInfosLogin($login, $action);
|
||||
//Redirect
|
||||
$this->_forward('liste');
|
||||
}
|
||||
|
||||
/**
|
||||
* Désactivation d'un utilisateur
|
||||
*/
|
||||
public function disableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$login = $request->getParam('login');
|
||||
$action = 'disable';
|
||||
$ws = new WsScores();
|
||||
$ws->setInfosLogin($login, $action);
|
||||
//Redirect
|
||||
$this->_forward('liste');
|
||||
}
|
||||
|
||||
/**
|
||||
* Méthode AJAX pour modifier le password d'un utilisateur
|
||||
*/
|
||||
public function changepwdAction()
|
||||
{
|
||||
//Redirect
|
||||
}
|
||||
|
||||
/**
|
||||
* Mettre à jour le mode edition en session sans refresh de la page
|
||||
*/
|
||||
public function editionsessionAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$mode = $request->getParam('mode', 'false');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
if ($identity->idClient == 1) {
|
||||
if ($mode == 'false') {
|
||||
$identity->modeEdition = false;
|
||||
echo 0;
|
||||
} else {
|
||||
$identity->modeEdition = true;
|
||||
echo 1;
|
||||
}
|
||||
$auth->getStorage()->write($identity);
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changer la langue de l'utilisateur
|
||||
*/
|
||||
public function langAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$lang = $this->getRequest()->getParam('lang', null);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
|
||||
$identity->langtmp = $lang;
|
||||
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changer le theme de l'utilisateur
|
||||
*/
|
||||
public function changethemeAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$nom = $request->getParam('nom', 'default');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
|
||||
$identity->theme = $nom;
|
||||
|
||||
$auth->getStorage()->write($identity);
|
||||
|
||||
//Rediriger vers l'écran de recherche
|
||||
$this->_redirect('/');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display browser informations on a simple page
|
||||
*/
|
||||
public function browserAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
//Load bootstrap
|
||||
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
|
||||
|
||||
//Get useragent and device informations
|
||||
$userAgent = $bootstrap->getResource('useragent');
|
||||
$device = $userAgent->getDevice();
|
||||
|
||||
//Display
|
||||
echo "<pre>";
|
||||
print_r(get_browser());
|
||||
print_r($device->getAllFeatures());
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
5
application/modules/user/controllers/OrderController.php
Normal file
5
application/modules/user/controllers/OrderController.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class User_OrderController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<div class="infoData">
|
||||
<?php if ($this->profil == 'SuperAdministrateur' && empty($this->login) ){ ?>
|
||||
<label title="Renvoi les logs de tous les utilisateurs du client. Avec le détail le téléchargement peut être long.">
|
||||
Tous les utilisateurs</label>
|
||||
<input type="checkbox" name="ConsoAll" value="1" class="noborder"/>
|
||||
<?php }?>
|
||||
|
||||
<label>Détails</label>
|
||||
<input type="checkbox" name="ConsoDetails" value="1" class="noborder"/>
|
||||
|
||||
<select name="ConsoMois">
|
||||
<option value="-">Mois/Année</option>
|
||||
<?php
|
||||
for ($i = 0; $i <= 12; ++$i) {
|
||||
$date = date('m', mktime(0, 0, 0, date('m') - $i, 1, date('Y'))).'/'.
|
||||
date('Y', mktime(0, 0, 0, date('m') - $i, 1, date('Y')));
|
||||
echo '<option value="'.$date.'">'.$date.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="<?=$this->url(array(
|
||||
'controller' => 'telechargement',
|
||||
'action' => 'consommation',
|
||||
'login' => $this->login,
|
||||
'idClient' => $this->idClient,
|
||||
))?>" id="dl">Ok</a>
|
||||
</div>
|
||||
<div class="infoTitle StyleInfoLib"></div><div id="dlMsg" class="infoData last"></div>
|
@ -0,0 +1,54 @@
|
||||
<?php if ( $this->checkemail ) {?>
|
||||
|
||||
<strong><?=$this->msg?></strong>
|
||||
<input type="hidden" name="email" value="<?=$this->email?>"/>
|
||||
|
||||
<?php if ($this->email!='') {?>
|
||||
<p><i>Enregistrer les modifications en cliquant sur "Sauver", en bas de la page, après avoir fermer la fenêtre.</i></p>
|
||||
<?php }?>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Fermer", click: function() {
|
||||
var email = $('#dialog input[name=email]').val();
|
||||
if (email!='') {
|
||||
$('div#email').html('<span>'+email+'</span>');
|
||||
$('input[name="frmOptions[email]"]').val(email);
|
||||
}
|
||||
$(this).dialog('close');
|
||||
} }
|
||||
]});
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<style>
|
||||
#bloc-addemail { display:none; }
|
||||
</style>
|
||||
|
||||
<p>Email principal associé au compte utilisateur</p>
|
||||
|
||||
<form name="email" action="<?=$this->url(array('controller'=>'user', 'action'=>'email'), 'default', true)?>" method="post">
|
||||
|
||||
<label>Adresse Email principal :</label><br/>
|
||||
<input type="text" size="50" maxlength="80" name="q" value="<?=$this->email?>"/>
|
||||
<input type="hidden" name="check" value="1"/>
|
||||
|
||||
</form>
|
||||
|
||||
<p><i>L'email principal est utilisé pour toutes communications avec Scores & Decisions. Il doit donc être valide.</i></p>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
$.post($('form[name=email]').attr('action'), $('form[name=email]').serialize(), function(data){
|
||||
$('#dialog').html(data);
|
||||
}).fail(function() {
|
||||
$('#dialog').html('<strong>Unknown error</strong>');
|
||||
});
|
||||
} },
|
||||
{ text: "Quitter", click: function() { $(this).dialog('close'); } }
|
||||
]});
|
||||
</script>
|
||||
|
||||
<?php }?>
|
@ -0,0 +1,67 @@
|
||||
<style>
|
||||
#bloc-addemail { display:none; }
|
||||
</style>
|
||||
|
||||
<p>Modification des emails associés au compte</p>
|
||||
|
||||
<form>
|
||||
|
||||
<div>
|
||||
<label>Adresse Email principal :</label><br/>
|
||||
<input type="text" size="50" maxlength="80" name="email1" value="<?=$this->email1?>"/>
|
||||
<span id="email1-response"></span>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<a href="#" id="addemail">Ajouter des adresses emails secondaires</a>
|
||||
|
||||
<div id="bloc-addemail">
|
||||
<label>Email 1 :</label><br/>
|
||||
<input type="text" size="50" maxlength="80" name="email2" value="<?=$this->email2?>"/>
|
||||
<span id="email2-response"></span>
|
||||
<br/><br/>
|
||||
<label>Email 2 :</label><br/>
|
||||
<input type="text" size="50" maxlength="80" name="email3" value="<?=$this->email3?>"/>
|
||||
<span id="email3-response"></span>
|
||||
</div>
|
||||
|
||||
<div id="response"></div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('a#addemail').click(function(){
|
||||
$display = $('div#bloc-addemail').css('display');
|
||||
if ($display == 'block') {
|
||||
$('div#bloc-addemail').css('display', 'none');
|
||||
} else {
|
||||
$('div#bloc-addemail').css('display', 'block');
|
||||
}
|
||||
});
|
||||
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
var flagAllValid = true;
|
||||
var emails = [];
|
||||
var source = ['email1', 'email2', 'email3'];
|
||||
$.each( source, function( key, value ) {
|
||||
var email = $('input[name='+value+']').val();
|
||||
if (email!='') {
|
||||
$.post('/user/emailvalid', {q: email}, function(data){
|
||||
if(data.valid==false) {
|
||||
flagAllValid = false;
|
||||
$('#dialog span#'+value+'-response').html('<strong>Email invalide !</strong>');
|
||||
}
|
||||
}, 'json');
|
||||
emails.push(email);
|
||||
}
|
||||
});
|
||||
if(flagAllValid) {
|
||||
$('input[name="frmOptions[email]"]').val(emails.join(';'));
|
||||
$(this).dialog("close");
|
||||
}
|
||||
} },
|
||||
{ text: "Quitter", click: function() { $(this).dialog("close"); } }
|
||||
]});
|
||||
|
||||
</script>
|
@ -0,0 +1,65 @@
|
||||
<?php if ( $this->msg ) {?>
|
||||
|
||||
<?=$this->msg?>
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Fermer", click: function() { $(this).dialog('close'); } }
|
||||
]});
|
||||
</script>
|
||||
|
||||
<?php } elseif( $this->mode == 'add' ) {?>
|
||||
|
||||
<form name="email" action="<?=$this->url(array('controller'=>'user', 'action'=>'emailsecondary'), 'default', true)?>">
|
||||
<label>Saisisez l'email à ajouter : </label><br/>
|
||||
<input type="text" size="50" maxlength="80" name="email" value=""/>
|
||||
<input type="hidden" name="login" value="<?=$this->login?>">
|
||||
<input type="hidden" name="mode" value="set">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
$.post($('form[name=email]').attr('action'), $('form[name=email]').serialize(), function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
} },
|
||||
{ text: "Fermer", click: function() { $(this).dialog('close'); } }
|
||||
]});
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<p>Emails secondaires associés au compte <strong><?=$this->login?></strong></p>
|
||||
|
||||
<?php if ( count($this->emails)>0 ) {?>
|
||||
<ul>
|
||||
<?php foreach ($this->emails as $email) {?>
|
||||
<li><?=$email->value?> (<a class="email-delete" href="<?=$this->url(array(
|
||||
'controller'=>'user', 'action'=>'emailsecondary', 'login'=>$this->login,
|
||||
'id'=>$email->id, 'email'=>$email->value, 'mode'=>'del'), 'default', true)?>">supprimer</a>)
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php } else {?>
|
||||
<strong>Aucun email secondaire.</strong>
|
||||
<?php }?>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Associer une nouvelle adresse email", click: function() {
|
||||
$.post('<?=$this->url(array('controller'=>'user', 'action'=>'emailsecondary', 'mode'=> 'add', 'login' => $this->login), 'default', true)?>', function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
} },
|
||||
{ text: "Fermer", click: function() { $(this).dialog('close'); } }
|
||||
]});
|
||||
|
||||
$('a.email-delete').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$.post($(this).attr('href'), function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php }?>
|
@ -0,0 +1,3 @@
|
||||
|
||||
<strong><?=$this->msg?></strong>
|
||||
<input type="hidden" name="email" value="<?=$this->email?>"/>
|
@ -0,0 +1,314 @@
|
||||
<div id="center">
|
||||
<?php if (!empty($this->message)) { ?>
|
||||
<div style="margin:5px; padding: 5pt 0.7em;" class="ui-state-highlight ui-corner-all">
|
||||
<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
|
||||
<?=$this->message?>
|
||||
</p></div>
|
||||
<?php } ?>
|
||||
|
||||
<h1 class="titre">PROFIL UTILISATEUR</h1>
|
||||
|
||||
<div class="paragraph">
|
||||
|
||||
<form id="moncompte" name="moncompte" action="/user" method="post">
|
||||
<input type="hidden" name="login" value="<?=$this->loginVu?>"/>
|
||||
<input type="hidden" name="frmOptions[idClient]" value="<?=$this->options->idClient?>"/>
|
||||
<input type="hidden" name="frmOptions[action]" value="<?=$this->action?>"/>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Identifiant utilisateur</div>
|
||||
<div class="infoData">
|
||||
<?php if ($this->action != 'new') { echo $this->loginVu; } else { ?>
|
||||
<input type="text" size="20" maxlength="80" name="frmOptions[login]" value="<?=$this->loginNew?>"/>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Identité (NOM/Prénom)</div>
|
||||
<div class="infoData">
|
||||
<?php if ($this->isAdmin) { ?>
|
||||
<input type="text" size="20" maxlength="80" name="frmOptions[nom]" value="<?=$this->options->nom?>"/>
|
||||
<input type="text" size="20" maxlength="80" name="frmOptions[prenom]" value="<?=$this->options->prenom?>"/>
|
||||
<?php
|
||||
} else { echo $this->options->nom.' '.$this->options->prenom; } ?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Réf. facturation (service, etc...)</div>
|
||||
<div class="infoData">
|
||||
<?php if ($this->isAdmin) { ?>
|
||||
<input type="text" size="20" maxlength="80" name="frmOptions[reference]" value="<?=$this->options->reference?>"/>
|
||||
<? } else { echo $this->options->reference; } ?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Adresse e-mail</div>
|
||||
<div class="infoData" id="email">
|
||||
<?php $emails = explode(';', $this->options->email); ?>
|
||||
<?php foreach ( $emails as $email ) {?>
|
||||
<span><?=$email?></span><br/>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div style="float:left;">
|
||||
<button id="user-emails" data-href="<?=$this->url(array(
|
||||
'controller' => 'user', 'action' => 'email',
|
||||
'q' => $this->options->email,
|
||||
))?>">Editer e-mail du compte</button>
|
||||
<button id="user-emailsecondary" data-href="<?=$this->url(array('controller' => 'user', 'action' => 'emailsecondary',
|
||||
'idClient' => $this->options->idClient, 'login' => $this->loginVu,))?>">
|
||||
Voir ou associer des e-mails secondaires</button>
|
||||
<script>
|
||||
$('button#user-emails').button({ icons: { primary: "ui-icon-pencil" }, text: false}).click(function(e) {
|
||||
e.preventDefault();
|
||||
var title = $(this).text();
|
||||
var href = $(this).data('href');
|
||||
var dialogOpts = {
|
||||
bgiframe: true,
|
||||
title: title,
|
||||
width: 500,
|
||||
height: 300,
|
||||
modal: true,
|
||||
open: function(event, ui) {
|
||||
$(this).html('Chargement...');
|
||||
$(this).load(href);
|
||||
},
|
||||
buttons: {
|
||||
Quitter: function() { $(this).dialog('close'); }
|
||||
},
|
||||
close: function() { $('#dialog').remove(); }
|
||||
};
|
||||
$('<div id="dialog"></div>').dialog(dialogOpts);
|
||||
return false;
|
||||
|
||||
});
|
||||
$('button#user-emailsecondary').button({icons: { primary: "ui-icon-plusthick" }, text: false}).click(function(e) {
|
||||
e.preventDefault();
|
||||
var title = $(this).text();
|
||||
var href = $(this).data('href');;
|
||||
var dialogOpts = {
|
||||
bgiframe: true,
|
||||
title: title,
|
||||
width: 500,
|
||||
height: 300,
|
||||
modal: true,
|
||||
open: function(event, ui) {
|
||||
$(this).html('Chargement...');
|
||||
$(this).load(href);
|
||||
},
|
||||
buttons: {
|
||||
Quitter: function() { $(this).dialog('close'); }
|
||||
},
|
||||
close: function() { $('#dialog').remove(); }
|
||||
};
|
||||
$('<div id="dialog"></div>').dialog(dialogOpts);
|
||||
return false;
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="frmOptions[email]" value="<?=$this->options->email?>"/>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">
|
||||
Numéros de téléphone<br/><i>(Fixe, Fax, Mobile)</i>
|
||||
</div>
|
||||
<div class="infoData">
|
||||
<input type="text" size="10" maxlength="15" name="frmOptions[tel_fix]" value="<?=$this->options->tel?>"/>
|
||||
<input type="text" size="10" maxlength="15" name="frmOptions[tel_fax]" value="<?=$this->options->fax?>"/>
|
||||
<input type="text" size="10" maxlength="15" name="frmOptions[tel_mob]" value="<?=$this->options->mobile?>"/>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Mot de passe</div>
|
||||
<div class="infoData last">
|
||||
<?php
|
||||
if ($this->action=='new') {
|
||||
$typeChamp = 'text';
|
||||
$changePassword = 1;
|
||||
} else {
|
||||
$typeChamp = 'hidden';
|
||||
$changePassword = 0;
|
||||
?>
|
||||
<a href="#" id="password">Modifier le mot de passe.</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="<?=$typeChamp?>" name="frmOptions[password]" value="<?=$this->password?>"/>
|
||||
<input type="hidden" name="frmOptions[changepwd]" value="<?=$changePassword?>"/>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Relevé de consommation</div>
|
||||
<?php
|
||||
//Consomation
|
||||
if ( $this->isAdmin || $this->isSuperAdmin ) {
|
||||
echo $this->action('conso', 'user', null, array('login'=>$this->loginVu, 'idClient'=>$this->options->idClient));
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Langue de l'interface par défaut</div>
|
||||
<div class="infoData">
|
||||
<select name="frmOptions[lang]">
|
||||
<?php
|
||||
$lngOpts = array('fr' => 'Français', 'en' => 'English');
|
||||
foreach($lngOpts as $lngKey => $lngVal)
|
||||
{
|
||||
$selected = '';
|
||||
if($lngKey == $this->options->lang) $selected = 'selected';
|
||||
?><option value="<?=$lngKey?>" <?=$selected?>><?=$lngVal?></option><?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Informations</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Type d'appareil actuel</div>
|
||||
<div class="infoData">
|
||||
<?=($this->device_type==0) ? 'Poste de travail': 'Mobile'?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Résolution d'écran actuel</div>
|
||||
<div class="infoData">
|
||||
<script type=text/javascript>document.write(screen.width+'x'+screen.height);</script>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Navigateur actuel</div>
|
||||
<div class="infoData"><?=$this->browser_info?></div>
|
||||
</div>
|
||||
|
||||
<h2>Moteur de recherche</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Résultats par page</div>
|
||||
<div class="infoData">
|
||||
<select name="frmOptions[nbReponses]">
|
||||
<?php
|
||||
$opts = array(10, 20, 30, 40, 50, 100, 150, 200);
|
||||
foreach($opts as $opt)
|
||||
{
|
||||
$selected = '';
|
||||
if($opt == $this->options->nbReponses) $selected = 'selected';
|
||||
?><option value="<?=$opt?>" <?=$selected?>><?=$opt?></option><?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Inclure</div>
|
||||
<div class="infoData last">
|
||||
<input type="checkbox" name="frmOptions[rech_limites][]" value="assocs" checked disabled class="noborder"/> les associations<br/>
|
||||
<input type="checkbox" name="frmOptions[rech_limites][]" value="actifs" checked disabled class="noborder"/> les actifs<br/>
|
||||
<input type="checkbox" name="frmOptions[rech_limites][]" value="radies" checked disabled class="noborder"/> les radiés<br/>
|
||||
<input type="checkbox" name="frmOptions[rech_limites][]" value="sieges" checked disabled class="noborder"/> les établissements secondaires
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<h2>Surveillance</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Supports pour les alertes</div>
|
||||
<div class="infoData last">
|
||||
<input type="checkbox" name="frmOptions[alertes][]" value="sms" disabled class="noborder"/> SMS<br/>
|
||||
<input type="checkbox" name="frmOptions[alertes][]" value="fax" disabled class="noborder"/> Fax<br/>
|
||||
<input type="checkbox" name="frmOptions[alertes][]" value="mail" checked disabled class="noborder"/> Mail<br/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<h2>Gestion des droits</h2>
|
||||
<div class="paragraph">
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Type de profil</div>
|
||||
<div class="infoData">
|
||||
<?php if ($this->isSuperAdmin){ ?>
|
||||
<select name="frmOptions[profil]">
|
||||
<?php
|
||||
$profil = array('Utilisateur', 'Administrateur', 'SuperAdministrateur');
|
||||
foreach ($profil as $item){
|
||||
$select = '';
|
||||
if ($this->options->profil == $item){
|
||||
$select = ' selected';
|
||||
}
|
||||
?>
|
||||
<option value="<?=$item?>"<?=$select?>><?=$item?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="frmOptions[profil]" value="<?=$this->options->profil?>" />
|
||||
<?=$this->options->profil?>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Droits d'accès</div>
|
||||
<div class="infoData">
|
||||
<?php foreach($this->wscategory as $category) {?>
|
||||
<fieldset>
|
||||
<legend><?=$category->desc?></legend>
|
||||
<?php
|
||||
foreach($category->droits->item as $droit) {
|
||||
$droit = strtolower($droit);
|
||||
if (in_array($droit, $this->droitsClients)) {
|
||||
$check = '';
|
||||
if ( count($this->droits)>0 && in_array($droit, $this->droits) ) {
|
||||
$check = ' checked';
|
||||
}
|
||||
$disable = '';
|
||||
if ( !$this->isAdmin ) {
|
||||
$disable = ' disabled';
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="frmOptions[droits][]" value="<?=$droit?>"<?=$check?><?=$disable?> class="noborder"/>
|
||||
<?=$this->droitsLib[strtoupper($droit)]?><br/>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Préférences</div>
|
||||
<div class="infoData last">
|
||||
<?php
|
||||
foreach ($this->prefsLib as $code => $lib) {
|
||||
$check = '';
|
||||
if (in_array(strtolower($code), $this->pref)) {
|
||||
$check = ' checked';
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="frmOptions[pref][]" value="<?=strtolower($code)?>"<?=$check?> class="noborder"/>
|
||||
<?=$lib?><br/>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( $this->options->idClient == 1 && !in_array('edition',$this->droits) ) { ?>
|
||||
<h2>Mode spéciaux</h2>
|
||||
<div class="paragraph">
|
||||
<div class="infoTitle StyleInfoLib">Mode Edition</div>
|
||||
<div class="infoData last">
|
||||
<?php
|
||||
$check = '';
|
||||
if ( $this->options->modeEdition==true ) {
|
||||
$check = ' checked';
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="modeEdition" value="1"<?=$check?> class="noborder"/>
|
||||
<span id="msgModeEdition"></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<div class="submit"><p class="submit-button"><input type="submit" class="button" value="Sauver"/></p></div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="dialog-password" title="Modifier le mot de passe">
|
||||
<form>
|
||||
<label for="npass1">Nouveau mot de passe</label><br/>
|
||||
<input type="password" name="npass1" size="15" maxlength="32"/><br/>
|
||||
<label for="npass2">Répéter le nouveau mot de passe</label><br/>
|
||||
<input type="password" name="npass2" size="15" maxlength="32"/><br/>
|
||||
<span id="form-message"></span>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<div class="infoData"></div>
|
Loading…
Reference in New Issue
Block a user