2009-02-17 13:14:53 +00:00
< ?
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
2009-03-11 07:51:18 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ;
2009-03-25 14:38:22 +00:00
2009-02-17 13:14:53 +00:00
if ( ! $_SESSION [ 'connected' ])
echo ( 'Vous devez <20> tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69> ' );
elseif ( $_SESSION [ 'tabInfo' ][ 'profil' ] <> 'Administrateur' ) {
echo ( 'Vous n\'avez pas les droits n<> cessaires pour utiliser cette fonctionnalit<69> (' . $_SESSION [ 'tabInfo' ][ 'profil' ] . ')' );
$siret = $_REQUEST [ 'siret' ];
}
else {
if ( $_REQUEST [ 'action' ] == 'delete' ) {
$message = 'Erreur lors de la suppression du compte utilisateur !' ;
try {
$tabOptions = array ( 'delete' => true );
$O = $client -> setInfosLogin ( $_REQUEST [ 'login' ], $tabOptions );
//action=delete&login=bpanaccione&idUti=3
if ( $O [ 'result' ] == 1 ) $message = 'Compte "' . $_REQUEST [ 'login' ] . '" supprim<69> !' ;
} catch ( SoapFault $fault ) {
$message = 'Erreur SOAP lors de la suppression du compte utilisateur !' ;
}
} elseif ( $_REQUEST [ 'action' ] == 'activate' ) {
$message = 'Erreur lors de l\'activation du compte utilisateur !' ;
try {
$tabOptions = array ( 'actif' => true );
$O = $client -> setInfosLogin ( $_REQUEST [ 'login' ], $tabOptions );
if ( $O [ 'result' ] == 1 ) $message = 'Compte "' . $_REQUEST [ 'login' ] . '" activ<69> !' ;
} catch ( SoapFault $fault ) {
$message = 'Erreur SOAP lors de l\'activation du compte utilisateur !' ;
}
} elseif ( $_REQUEST [ 'action' ] == 'unactivate' ) {
$message = 'Erreur lors de la d<> sactivation du compte utilisateur !' ;
try {
$tabOptions = array ( 'actif' => false );
$O = $client -> setInfosLogin ( $_REQUEST [ 'login' ], $tabOptions );
if ( $O [ 'result' ] == 1 ) $message = 'Compte "' . $_REQUEST [ 'login' ] . '" d<> sactiv<69> !' ;
} catch ( SoapFault $fault ) {
$message = 'Erreur SOAP lors de la d<> sactivation du compte utilisateur !' ;
}
}
/** Utilisation du WS **/
try {
$O = $client -> getListeUtilisateurs ( $_SESSION [ 'tabInfo' ][ 'login' ]);
$utilisateurs = $O [ 'results' ];
} catch ( SoapFault $fault ) {
2009-02-26 17:16:11 +00:00
include_once ( realpath ( dirname ( __FILE__ ) . '/../../' ) . '/includes/soaperror.php' );
processSoapFault ( $client , $fault , $tabInfo );
2009-02-17 13:14:53 +00:00
die ();
}
?>
2009-07-16 16:12:17 +00:00
< style type = " text/css " >
#utilisateur { border-collapse:collapse; }
#utilisateur tr.titre td { background-color: #D9EEF1; font-weight:bold; }
#utilisateur tr.border td { border:1px dashed #939393; padding:5px; margin:0;}
</ style >
< script type = " text/javascript " >
$ ( document ) . ready ( function (){
var holdTheInterval ;
var nbEssai = 10 ;
var essai = 0 ;
var login ;
var date ;
var url ;
2009-07-17 13:16:09 +00:00
var details ;
2009-07-16 16:12:17 +00:00
$ . ajaxSetup ({ timeout : 4000 });
$ ( '.submitmois' ) . each ( function (){
$ ( this ) . change ( function (){
date = $ ( this ) . val ();
2009-07-17 13:16:09 +00:00
$ ( this ) . val ( '-' );
2009-07-16 16:12:17 +00:00
if ( date != '' && date != '-' ){
2009-07-17 13:16:09 +00:00
login = $ ( 'input[name=utilisateur]' ) . val ();
details = $ ( 'input[name=details]' ) . attr ( 'checked' ) ? true : false ;
2009-07-16 16:12:17 +00:00
checkFile ();
holdTheInterval = setInterval ( checkFile , 4000 );
}
});
});
function checkFile (){
essai ++ ;
if ( essai > nbEssai ){
essai = 0 ;
updateInfo ( 'Le temps maximum d\'attente a <20> t<EFBFBD> atteint. Merci de r<> <72> ssayez.' );
} else if ( essai == 1 ){
$ ( '#message' ) . text ( 'Patientez pendant la construction du fichier (' + essai + ')...' );
$ . post ( 'pages/ajax/conso.php' ,
2009-07-17 13:16:09 +00:00
{ login : login , date : date , details : details , start : essai },
2009-07-16 16:12:17 +00:00
function ( data , textStatus ) { url = data ; }
);
} else {
$ ( '#message' ) . text ( 'Patientez pendant la construction du fichier (' + essai + ')...' );
$ . post ( 'pages/ajax/conso.php' ,
2009-07-17 13:16:09 +00:00
{ login : login , date : date , details : details , start : essai , url : url },
2009-07-16 16:12:17 +00:00
function ( data , textStatus ) { if ( data != '' && data != 'FALSE' ){ updateInfo ( data ); } });
}
2009-02-17 13:14:53 +00:00
}
2009-07-16 16:12:17 +00:00
function updateInfo ( data ){
$ ( '#message' ) . html ( data );
clearInterval ( holdTheInterval );
essai = 0 ;
}
});
</ script >
< table id = " utilisateur " width = " 580 " align = " left " bgcolor = " #FFFFFF " >
2009-07-17 13:16:09 +00:00
< tr >< td colspan = " 6 " >< img src = " ./img/rub_admin.png " width = " 577 " height = " 36 " ></ td ></ tr >
< tr >
2009-07-16 16:12:17 +00:00
< td width = " 2 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 6 " class = " StyleInfoData " align = " center " >< h3 >< div id = " message " >< ? = $message ; ?> </div></h3></td>
2009-07-17 13:16:09 +00:00
</ tr >
< tr >
< td width = " 2 " >& nbsp ; </ td >
< td colspan = " 5 " >
< h3 > Relev<EFBFBD> de consommation complet </ h3 >
</ td >
</ tr >
< tr >
2009-07-16 16:12:17 +00:00
< td width = " 2 " >& nbsp ; </ td >
2009-07-17 13:16:09 +00:00
< td colspan = " 5 " >
2009-07-16 16:12:17 +00:00
< input type = " hidden " name = " utilisateur " value = " " />
2009-07-17 13:16:09 +00:00
< label > D<EFBFBD> tails </ label >< input type = " checkbox " name = " details " value = " 1 " />
2009-07-16 16:12:17 +00:00
< label > S<EFBFBD> lectionnez le mois :</ label >
< select name = " mois " class = " submitmois " >
< option value = " - " >-</ 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 >
</ td >
2009-02-17 13:14:53 +00:00
</ tr >
2009-07-17 13:16:09 +00:00
< tr >< td width = " 580 " colspan = " 5 " class = " StyleInfoLib " >& nbsp ; </ td ></ tr >
2009-02-17 13:14:53 +00:00
< tr >
2009-07-16 16:12:17 +00:00
< td width = " 2 " >& nbsp ; </ td >
2009-07-17 13:16:09 +00:00
< td width = " 550 " colspan = " 5 " class = " StyleInfoLib " >< h3 > Liste des profils utilisateurs </ h3 ></ td >
2009-02-17 13:14:53 +00:00
</ tr >
2009-07-16 16:12:17 +00:00
< tr class = " border titre " >
< td class = " StyleInfoLib " > Login </ td >
< td class = " StyleInfoLib " > Actions </ td >
< td class = " StyleInfoLib " > Actif </ td >
< td class = " StyleInfoLib " > Informations </ td >
< td class = " StyleInfoLib " > R<EFBFBD> f<EFBFBD> rence </ td >
2009-02-17 13:14:53 +00:00
</ tr >
2009-07-16 16:12:17 +00:00
< ?
foreach ( $utilisateurs as $uti ) {
2009-02-17 13:14:53 +00:00
?>
2009-07-16 16:12:17 +00:00
< tr class = " border " >
< td class = " StyleInfoData " >< ? = $uti [ 'login' ] ?> </td>
< td align = " center " valign = " middle " >
< a href = " /?page=moncompte&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?>&login=<?= $uti['login'] ?>&idUti=<?= $uti['idUti'] ?>&referer=administration " >< img src = " /img/edit0.gif " title = " Editer le profil utilisateur " width = " 16 " height = " 16 " /></ a >
< a href = " Javascript:if (confirm('Voulez-vous supprimer le compte de <?= $uti['login'] ?>')) { document.location.href='/?page=administration&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?>&action=delete&login=<?= $uti['login'] ?>&idUti=<?= $uti['idUti'] ?>'} " >< img src = " /img/delete.gif " title = " Supprimer le profil utilisateur " width = " 11 " height = " 11 " /></ a >
</ td >
< td class = " StyleInfoData " >< ?
if ( $uti [ 'actif' ] == 1 ) { ?> <a href="Javascript:if (confirm('Voulez-vous d<> sactiver le compte de <?=$uti['login']?>')){document.location.href='/?page=administration&idEntreprise=<?=$idEntreprise?>&siret=<?=$siret?>&action=unactivate&login=<?=$uti['login']?>&idUti=<?=$uti['idUti']?>'}" title="D<> sactiver le profil utilisateur"><u><font color="green">Oui</font></u></a><? }
else { ?> <a href="Javascript:if (confirm('Voulez-vous activer le compte de <?=$uti['login']?>')) {document.location.href='/?page=administration&idEntreprise=<?=$idEntreprise?>&siret=<?=$siret?>&action=activate&login=<?=$uti['login']?>&idUti=<?=$uti['idUti']?>'}" title="Activer le profil utilisateur"><u><font color="red" >Non</font></u></a><? } ?></td>
< td class = " StyleInfoData " >
< ? = $uti [ 'nom' ] ?> <?=$uti['prenom']?> <br/>
< a href = " mailto:<?= $uti['email'] ?> " >< ? = str_replace ( ';' , '<br/>' , $uti [ 'email' ]) ?> </a>
2009-02-17 13:14:53 +00:00
</ td >
2009-07-16 16:12:17 +00:00
< td class = " StyleInfoData " >< ? = $uti [ 'reference' ] ?> </a></td>
2009-02-17 13:14:53 +00:00
</ tr >
< ?
2009-07-16 16:12:17 +00:00
}
2009-02-17 13:14:53 +00:00
?>
< tr >
2009-07-17 13:16:09 +00:00
< td colspan = " 5 " >& nbsp ; </ td >
2009-02-17 13:14:53 +00:00
</ tr >
< tr >
2009-07-17 13:16:09 +00:00
< td colspan = " 5 " align = " center " >
2009-07-16 16:12:17 +00:00
< form name = " form_admin " action = " ./?page=moncompte&action=new&referer=administration " method = " POST " enctype = " multipart/form-data " >< input type = " submit " value = " Cr<EFBFBD> er un profil utilisateur " /></ form ></ td >
2009-02-17 13:14:53 +00:00
</ tr >
2009-07-16 16:12:17 +00:00
</ table >
2009-02-17 13:14:53 +00:00
< ?
}
2009-07-16 16:12:17 +00:00
?>