350 lines
14 KiB
PHP
350 lines
14 KiB
PHP
<?php
|
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1;
|
|
|
|
if (!$_SESSION['connected'])
|
|
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
|
elseif ($_SESSION['tabInfo']['profil']!='Administrateur' && $_SESSION['tabInfo']['profil']!='SuperAdministrateur' && !preg_match('/MONPROFIL/i', $_SESSION['tabInfo']['droits'])) {
|
|
echo ('Vous n\'avez pas les droits nécessaires pour utiliser cette fonctionnalité ('.$_SESSION['tabInfo']['profil'].' '.$_SESSION['tabInfo']['droits'].')');
|
|
}
|
|
else {
|
|
require_once 'user/user.php';
|
|
$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 ($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['mode_edition']) && $tabOptions['action']=='save'){$_SESSION['tabInfo']['mode_edition']=0;}
|
|
}
|
|
if ($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">
|
|
alert("Le profil <?=$loginVu?> a été mis à jour !");
|
|
document.location.href='/?page=administration&id=<?=$idEntreprise?>&siret=<?=$siret?>';
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
if ($_REQUEST['frmOptions']['changepwd']==1 && $loginVu==$_SESSION['tabInfo']['login'] && $tabOptions['action']=='save' ) {
|
|
?>
|
|
<script language="javascript">
|
|
alert("La modification de votre mot de passe nécessite votre déconnexion !");
|
|
document.location.href='/?page=main&action=logout';
|
|
</script>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
/** Utilisation du WS **/
|
|
try {
|
|
if ($_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 0 0;}
|
|
.infoData {float:left; width:320px; margin:2px 0;}
|
|
.last {margin-bottom:10px;}
|
|
#message {margin-left:30px;}
|
|
|
|
</style>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
var holdTheInterval;
|
|
var nbEssai = 10;
|
|
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;
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<div id="center">
|
|
<?
|
|
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">
|
|
<? if ($_REQUEST['action']=='new') { ?>
|
|
<input type="hidden" name="frmOptions[action]" value="new"/>
|
|
<? } else { ?>
|
|
<input type="hidden" name="frmOptions[action]" value="save"/>
|
|
<? } ?>
|
|
<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">
|
|
<? if ($_REQUEST['action']<>'new') { ?>
|
|
<?=$loginVu?>
|
|
<? } else { ?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[login]" value="<?=$loginNew?>"/>
|
|
<? } ?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Identité (NOM/Prénom)</div>
|
|
<div class="infoData">
|
|
<? if ($admin) { ?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[nom]" value="<?=$login['nom']?>"/> <input type="text" size="20" maxlength="80" name="frmOptions[prenom]" value="<?=$login['prenom']?>"/>
|
|
<? } else { ?>
|
|
<?=$login['nom'].' '.$login['prenom']?>
|
|
<? } ?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Réf. facturation (service, etc...)</div>
|
|
<div class="infoData">
|
|
<? if ($admin) { ?>
|
|
<input type="text" size="20" maxlength="80" name="frmOptions[reference]" value="<?=$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="<?=$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="<?=$login['tel']?>"/><input type="text" size="10" maxlength="15" name="frmOptions[tel_fax]" value="<?=$login['fax']?>"/><input type="text" size="10" maxlength="15" name="frmOptions[tel_mob]" value="<?=$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>
|
|
|
|
<div class="infoTitle StyleInfoLib">Mot de passe</div>
|
|
<div class="infoData last">
|
|
<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")));
|
|
print '<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]">
|
|
<?
|
|
$opt[10]=$opt[20]=$opt[30]=$opt[50]=$opt[100]=$opt[150]=$opt[200]='';
|
|
if ($login['nbReponses']==10) $opt[10]='selected';
|
|
elseif ($login['nbReponses']==20) $opt[20]='selected';
|
|
elseif ($login['nbReponses']==30) $opt[30]='selected';
|
|
elseif ($login['nbReponses']==50) $opt[50]='selected';
|
|
elseif ($login['nbReponses']==100) $opt[100]='selected';
|
|
elseif ($login['nbReponses']==150) $opt[150]='selected';
|
|
elseif ($login['nbReponses']==200) $opt[200]='selected';
|
|
?> <option value="10" <?=$opt[10]?>>10</option>
|
|
<option value="20" <?=$opt[20]?>>20</option>
|
|
<option value="30" <?=$opt[30]?>>30</option>
|
|
<option value="50" <?=$opt[50]?>>50</option>
|
|
<option value="100" <?=$opt[100]?>>100</option>
|
|
<option value="150" <?=$opt[150]?>>150</option>
|
|
<option value="200" <?=$opt[200]?>>200</option>
|
|
</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"><?=$login['profil']?></div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Droits d'accès</div>
|
|
<div class="infoData">
|
|
<?php $firephp->log($login, 'login'); ?>
|
|
<?php print formElementPerm($login); ?>
|
|
</div>
|
|
|
|
<div class="infoTitle StyleInfoLib">Préférences</div>
|
|
<div class="infoData last">
|
|
<?php print 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
|
|
}
|
|
?>
|