431 lines
15 KiB
PHP
431 lines
15 KiB
PHP
<?php
|
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1;
|
|
require_once 'user/user.php';
|
|
|
|
if (!$_SESSION['connected'])
|
|
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
|
elseif ($_SESSION['tabInfo']['profil']!='Administrateur' &&
|
|
$_SESSION['tabInfo']['profil']!='SuperAdministrateur' &&
|
|
!hasPerm('monprofil')) {
|
|
echo ('Vous n\'avez pas les droits nécessaires pour utiliser cette fonctionnalité ('.$_SESSION['tabInfo']['profil'].' '.$_SESSION['tabInfo']['droits'].')');
|
|
}
|
|
else {
|
|
|
|
$tabInfo = $_SESSION['tabInfo'];
|
|
$message = '';
|
|
|
|
if (isset($_REQUEST['login']) && $_REQUEST['login']!='' &&
|
|
$_REQUEST['login']!=$_SESSION['tabInfo']['login'] &&
|
|
($_SESSION['tabInfo']['profil']=='Administrateur' ||
|
|
$_SESSION['tabInfo']['profil']=='SuperAdministrateur') ){
|
|
$loginVu=$_REQUEST['login'];
|
|
}elseif (isset($tabOptions) && $tabOptions['action']=='new'){
|
|
$loginVu=$tabOptions['login'];
|
|
}else{
|
|
$loginVu=$_SESSION['tabInfo']['login'];
|
|
//On affecte la valeur en session de mode edition d'après le résultat du formulaire
|
|
if(isset($tabOptions) && !isset($tabOptions['mode_edition']) && $tabOptions['action']=='save'){
|
|
$_SESSION['tabInfo']['mode_edition']=0;
|
|
}
|
|
}
|
|
if (isset($tabOptions) &&
|
|
($tabOptions['action']=='save' || $tabOptions['action']=='new')){
|
|
$message = 'Erreur lors de la mise à jour du compte !';
|
|
|
|
$tabOptions['nom'] = preg_replace('/[^0-9A-Z\'-]/i', ' ', strtoupper(strtr(stripslashes($tabOptions['nom']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')));
|
|
$tabOptions['prenom'] = ucwords(strtolower(preg_replace('/[^0-9A-Z\'-]/i', ' ', strtoupper(strtr(stripslashes($tabOptions['prenom']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')))));
|
|
$tabOptions['reference'] = preg_replace('/[^0-9A-Z\'-]/i', ' ', strtoupper(strtr(stripslashes($tabOptions['reference']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')));
|
|
|
|
$firephp->log($loginVu, 'loginVu');
|
|
$firephp->log($tabOptions, 'tabOptions');
|
|
try {
|
|
$O = $client->setInfosLogin($loginVu, $tabOptions);
|
|
if ($O['result']==1) $message='Compte mis à jour !';
|
|
} catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
$message = 'Erreur SOAP lors de la mise à jour du compte !';
|
|
}
|
|
|
|
if ($_REQUEST['referer']=='administration') {
|
|
?>
|
|
<script language="javascript">
|
|
$(document).ready(function(){
|
|
alert("Le profil <?=$loginVu?> a été mis à jour !");
|
|
$(location).attr('href','/?page=administration&id=<?=$idEntreprise?>&siret=<?=$siret?>');
|
|
});
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
if ($_REQUEST['frmOptions']['changepwd']==1 &&
|
|
$loginVu==$_SESSION['tabInfo']['login'] &&
|
|
$tabOptions['action']=='save' ){
|
|
?>
|
|
<script language="javascript">
|
|
$(document).ready(function(){
|
|
alert("La modification de votre mot de passe nécessite votre déconnexion !");
|
|
$(location).attr('href','/?page=main&action=logout');
|
|
});
|
|
</script>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
/** Utilisation du WS **/
|
|
try {
|
|
if (!isset($_REQUEST['action']) || $_REQUEST['action']!='new') {
|
|
$O = $client->getInfosLogin($loginVu);
|
|
$login=$O['result'];
|
|
} else {
|
|
$O = $client->getNextLogin($loginVu);
|
|
$loginNew=$O['result']['racine'];
|
|
$idClient=$O['result']['idClient'];
|
|
}
|
|
} catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
die();
|
|
}
|
|
|
|
$admin = false;
|
|
if ($_SESSION['tabInfo']['profil']=='Administrateur' ||
|
|
$_SESSION['tabInfo']['profil']=='SuperAdministrateur'){
|
|
$admin = true;
|
|
}
|
|
?>
|
|
<style type="text/css">
|
|
#center p { margin:5px; padding:5px;}
|
|
div.submit{ margin-left:200px; padding-left:0px; margin-top:1em; }
|
|
div.submit p.submit-button{margin-top:0;}
|
|
div.submit p.details{font-size:85%;color:#666;margin:0;}
|
|
div.submit p.required-note{margin-top:1em;}
|
|
div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertical-align:top;}
|
|
.noborder {border:none;}
|
|
.infoTitle {clear:both; float:left; width:180px; margin-left:30px; padding:0 10px 5px 0;}
|
|
.infoData {float:left; width:320px; margin:2px 0;}
|
|
.last {margin-bottom:10px;}
|
|
#message {margin-left:30px;}
|
|
#dialog { display:none; }
|
|
</style>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
var holdTheInterval;
|
|
var nbEssai = 25;
|
|
var essai = 0;
|
|
var login;
|
|
var date;
|
|
var url;
|
|
var details = false;
|
|
var all = false;
|
|
var dl = false;
|
|
|
|
//$.ajaxSetup({timeout: 4001});
|
|
|
|
$('#submitmois').click(function(){
|
|
//On disable tout les champs
|
|
$('input[name=details]:checkbox').attr('disabled', true);
|
|
$('select[name=mois]').attr('disabled', true);
|
|
$('input[name=all]:checkbox').attr('disabled', true);
|
|
//Valeur de la date
|
|
date = $('select[name=mois]').val();
|
|
//Vérification
|
|
if(date!='' && date!='-'){
|
|
login = $('input[name=utilisateur]').val();
|
|
details = $('input[name=details]').attr('checked') ? true : false ;
|
|
all = $('input[name=all]').attr('checked') ? true : false ;
|
|
checkFile();
|
|
holdTheInterval = setInterval(checkFile, 4000);
|
|
}
|
|
});
|
|
|
|
function checkFile(){
|
|
essai++;
|
|
if(essai>nbEssai){
|
|
essai = 0;
|
|
updateInfo('Le temps maximum d\'attente a été atteint. Merci de rééssayez.');
|
|
$('input[name=details]:checkbox').removeAttr('disabled');
|
|
$('select[name=mois]').removeAttr('disabled');
|
|
$('input[name=all]:checkbox').removeAttr('disabled');
|
|
}else if(essai==1){
|
|
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
|
$.post( 'pages/ajax/conso.php',
|
|
{ login: login, date: date, details: details, all: all, start: essai},
|
|
function (data, textStatus) { url = data; }
|
|
);
|
|
}else{
|
|
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
|
$.post( 'pages/ajax/conso.php',
|
|
{ login: login, date: date, details: details, all: all, start: essai, url: url},
|
|
function (data, textStatus) { if( data!='' && data!='FALSE' ){ updateInfo(data); } });
|
|
}
|
|
}
|
|
|
|
function updateInfo(data){
|
|
$('#message').html(data);
|
|
clearInterval(holdTheInterval);
|
|
$('input[name=details]:checkbox').removeAttr('disabled');
|
|
$('select[name=mois]').removeAttr('disabled');
|
|
$('input[name=all]:checkbox').removeAttr('disabled');
|
|
essai = 0;
|
|
}
|
|
|
|
$("#dialog").dialog({
|
|
bgiframe: true,
|
|
autoOpen: false,
|
|
height: 180,
|
|
modal: true,
|
|
buttons: {
|
|
'Modifier': function() {
|
|
var pass = $('input[name=npass1]').val();
|
|
if( pass!=$('input[name=npass2]').val() ){
|
|
$('#form-message').html('Mots de passe différents.');
|
|
}else{
|
|
$('input[name=frmOptions[changepwd]]').val('1');
|
|
$('input[name=frmOptions[password]]').val(pass);
|
|
$('#password').html('Sauver pour enregistrer la modification du mot de passe');
|
|
$(this).dialog('close');
|
|
}
|
|
},
|
|
'Annuler': function() {
|
|
$(this).dialog('close');
|
|
}
|
|
}
|
|
});
|
|
|
|
$('#password').click(function(){
|
|
$("#dialog").dialog('open');
|
|
});
|
|
|
|
});
|
|
</script>
|
|
|
|
<div id="center">
|
|
|
|
<div id="dialog" 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épeter le nouveau mot de passe</label><br/>
|
|
<input type="password" name="npass2" size="15" maxlength="32"/><br/>
|
|
<span id="form-message"></span>
|
|
</form>
|
|
</div>
|
|
|
|
<?
|
|
if ($message<>'') {
|
|
?>
|
|
<p><?=$message;?></p>
|
|
<?php
|
|
}
|
|
?>
|
|
<h1 class="titre">PROFIL UTILISATEUR</h1>
|
|
|
|
<form name="form_moncompte" action="./?page=moncompte" method="POST" enctype="multipart/form-data">
|
|
<?php
|
|
if (isset($_REQUEST['action']) && $_REQUEST['action']=='new') {
|
|
?>
|
|
<input type="hidden" name="frmOptions[action]" value="new"/>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<input type="hidden" name="frmOptions[action]" value="save"/>
|
|
<?php
|
|
}
|
|
?>
|
|
<input type="hidden" name="siret" value="<?=$siret?>"/>
|
|
<input type="hidden" name="id" value="<?=$idEntreprise?>"/>
|
|
<input type="hidden" name="login" value="<?=$loginVu?>"/>
|
|
<input type="hidden" name="frmOptions[idClient]" value="<?=$idClient?>"/>
|
|
<input type="hidden" name="referer" value="<?=$_REQUEST['referer']?>"/>
|
|
|
|
<div class="infoTitle StyleInfoLib">Identifiant utilisateur</div>
|
|
<div class="infoData">
|
|
<?php
|
|
if (!isset($_REQUEST['action']) || $_REQUEST['action']!='new'){
|
|
echo (isset($loginVu) ? $loginVu : '' );
|
|
} else {
|
|
?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[login]" value="<?=isset($loginNew) ? $loginNew : '';?>"/>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Identité (NOM/Prénom)</div>
|
|
<div class="infoData">
|
|
<?php
|
|
if ($admin)
|
|
{
|
|
?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[nom]" value="<?=(is_array($login) && isset($login['nom']))? $login['nom'] : '';?>"/>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[prenom]" value="<?=(is_array($login) && isset($login['prenom']))? $login['prenom'] : '';?>"/>
|
|
<?php
|
|
} else { ?> <?=$login['nom'].' '.$login['prenom']?> <? } ?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Réf. facturation (service, etc...)</div>
|
|
<div class="infoData">
|
|
<?php
|
|
if ($admin)
|
|
{
|
|
?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[reference]" value="<?=(is_array($login) && isset($login['reference']))? $login['reference'] : '';?>"/>
|
|
<? } else { ?> <?=$login['reference']?><? } ?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Adresse e-mail</div>
|
|
<div class="infoData">
|
|
<input type="text" size="30" maxlength="80" name="frmOptions[email]" value="<?=(is_array($login) && isset($login['email']))? $login['email'] : '';?>"/>
|
|
</div>
|
|
|
|
<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="<?=(is_array($login) && isset($login['tel']))? $login['tel'] : '';?>"/>
|
|
<input type="text" size="10" maxlength="15" name="frmOptions[tel_fax]" value="<?=(is_array($login) && isset($login['fax']))? $login['fax'] : '';?>"/>
|
|
<input type="text" size="10" maxlength="15" name="frmOptions[tel_mob]" value="<?=(is_array($login) && isset($login['mobile']))? $login['mobile'] : '';?>"/>
|
|
<!--<br/><input type="checkbox" name="frmOptions[copie_sms]" value="<?=$_SESSION['tabInfo']['copieParSms']?>"/> Recevoir une copie de mes messages de surveillance par SMS-->
|
|
</div>
|
|
<br/>
|
|
<div class="infoTitle StyleInfoLib">Mot de passe</div>
|
|
<div class="infoData last">
|
|
<a href="#" id="password">Modifier le mot de passe.</a>
|
|
<input type="hidden" name="frmOptions[changepwd]" value="0"/>
|
|
<input type="hidden" name="frmOptions[password]" value="oqsrihgwslglm"/>
|
|
<?php
|
|
/*
|
|
<input type="password" size="15" maxlength="32" name="frmOptions[password]" value="oqsrihgwslglm" onkeypress="document.form_moncompte.changepwd.checked=1"/>
|
|
<input name="frmOptions[changepwd]" id="changepwd" type="checkbox" value="1" class="noborder"/> Réinitialiser le mot de passe
|
|
*/
|
|
?>
|
|
</div>
|
|
|
|
<?php
|
|
if( $tabInfo['profil']=='Administrateur' ||
|
|
$tabInfo['profil']=='SuperAdministrateur' )
|
|
{
|
|
?>
|
|
<div class="infoTitle StyleInfoLib">Relevé de consommation</div>
|
|
<div class="infoData">
|
|
<input type="hidden" name="utilisateur" value="<?=$loginVu?>"/>
|
|
<label>Détails</label>
|
|
<input type="checkbox" name="details" value="1" class="noborder"/>
|
|
<select name="mois">
|
|
<option value="-">Mois/Année</option>
|
|
<?php
|
|
for($i=1; $i<=12; $i++ ){
|
|
$date = date('m', mktime(0, 0, 0, date("m")-$i, date("d"), date("Y"))).'/'.
|
|
date('Y', mktime(0, 0, 0, date("m")-$i, date("d"), date("Y")));
|
|
echo '<option value="'.$date.'">'.$date.'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
<a href="#" id="submitmois">Ok</a>
|
|
</div>
|
|
<div id="message" class="infoData last"></div>
|
|
<?php
|
|
}
|
|
?>
|
|
<h2>Moteur de recherche</h2>
|
|
<div class="infoTitle StyleInfoLib">Résultats par page</div>
|
|
<div class="infoData">
|
|
<select name="frmOptions[rech_nbrep]">
|
|
<?
|
|
$opts = array(10, 20, 30, 40, 50, 100, 150, 200);
|
|
|
|
foreach($opts as $opt)
|
|
{
|
|
$selected = '';
|
|
if($opt == $login['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>
|
|
|
|
<h2>Surveillance</h2>
|
|
|
|
<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>
|
|
<?php
|
|
if ($_SESSION['tabInfo']['login']=='ylenaour')
|
|
{
|
|
$formatMail=$login['formatMail'];
|
|
?>
|
|
|
|
<div class="infoTitle StyleInfoLib">Format des emails</div>
|
|
<div class="infoData last">
|
|
<select name="frmOptions[formatMail]">
|
|
<optgroup label="Sans pièce jointe">
|
|
<option value="txt1" <?if($formatMail=='txt1') echo 'selected';?>>1 annonce/mail en texte</option>
|
|
<option value="txt2" <?if($formatMail=='txt2') echo 'selected';?>>1 mail/jour en texte</option>
|
|
<!--<option value="htm1" <?if($formatMail=='htm1') echo 'selected';?>>Mail format Html</option>-->
|
|
</optgroup>
|
|
<optgroup label="Avec pièce jointe">
|
|
<!--<option value="pdf" <?if($formatMail=='pdf') echo 'selected';?>>Pdf en pièce jointe</option>-->
|
|
<option value="pdf1" <?if($formatMail=='pdf1') echo 'selected';?>>Pdf (1 annonce/page)</option>
|
|
<!--<option value="csv" <?if($formatMail=='csv') echo 'selected';?>>Pièce jointe CSV</option>-->
|
|
<option value="xls" <?if($formatMail=='xls') echo 'selected';?>>Pièce jointe Excel</option>
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<h2>Gestion des droits</h2>
|
|
<div class="infoTitle StyleInfoLib">Type de profil</div>
|
|
<div class="infoData">
|
|
<?=(is_array($login) && isset($login['profil']))?
|
|
$login['profil'] : 'Utilisateur';?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Droits d'accès</div>
|
|
<div class="infoData">
|
|
<?php
|
|
FB::log($login, 'login');
|
|
?>
|
|
<?=formElementPerm($login)?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Préférences</div>
|
|
<div class="infoData last">
|
|
<?=formElementPref($login)?>
|
|
</div>
|
|
|
|
<?php
|
|
if(checkModeEdition($loginVu))
|
|
{
|
|
?>
|
|
<h2>Edition</h2>
|
|
<div class="infoTitle StyleInfoLib">Mode actuel</div>
|
|
<div class="infoData last">
|
|
<? print formElementModeEdition(); ?>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div class="submit"><p class="submit-button"><input type="submit" value="Sauver"/></p></div>
|
|
</form>
|
|
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|