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> ' );
2009-09-10 15:31:37 +00:00
elseif ( $_SESSION [ 'tabInfo' ][ 'profil' ] != 'Administrateur' && $_SESSION [ 'tabInfo' ][ 'profil' ] != 'SuperAdministrateur' ) {
2009-02-17 13:14:53 +00:00
echo ( 'Vous n\'avez pas les droits n<> cessaires pour utiliser cette fonctionnalit<69> (' . $_SESSION [ 'tabInfo' ][ 'profil' ] . ')' );
$siret = $_REQUEST [ 'siret' ];
}
2009-09-10 15:31:37 +00:00
else
{
2009-02-17 13:14:53 +00:00
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-07-21 07:17:54 +00:00
require_once 'soaperror.php' ;
2009-02-26 17:16:11 +00:00
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 " >
2009-09-10 15:31:37 +00:00
#utilisateur { border-collapse:collapse; margin:0 5px;}
2009-07-16 16:12:17 +00:00
#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-09-10 15:31:37 +00:00
var details = false ;
var all = false ;
2009-08-21 14:10:53 +00:00
var dl = false ;
2009-07-16 16:12:17 +00:00
2009-09-10 15:31:37 +00:00
$ . ajaxSetup ({ timeout : 4001 });
2009-07-16 16:12:17 +00:00
2009-08-21 14:10:53 +00:00
$ ( '#submitmois' ) . click ( function (){
//On disable tout les champs
2009-09-10 15:31:37 +00:00
$ ( 'input[name=details]:checkbox' ) . attr ( 'disabled' , true );
2009-08-21 14:10:53 +00:00
$ ( 'select[name=mois]' ) . attr ( 'disabled' , true );
2009-09-10 15:31:37 +00:00
$ ( 'input[name=all]:checkbox' ) . attr ( 'disabled' , true );
2009-08-21 14:10:53 +00:00
//Valeur de la date
date = $ ( 'select[name=mois]' ) . val ();
//V<> rification
if ( date != '' && date != '-' ){
login = $ ( 'input[name=utilisateur]' ) . val ();
2009-09-10 15:31:37 +00:00
details = $ ( 'input[name=details]' ) . attr ( 'checked' ) ? true : false ;
all = $ ( 'input[name=all]' ) . attr ( 'checked' ) ? true : false ;
2009-08-21 14:10:53 +00:00
checkFile ();
holdTheInterval = setInterval ( checkFile , 4000 );
}
2009-07-16 16:12:17 +00:00
});
2009-08-21 14:10:53 +00:00
2009-09-10 15:31:37 +00:00
$ ( 'input[name=details]:checkbox' ) . click ( function (){
if ( $ ( 'input[name=all]:checkbox' ) . attr ( 'checked' ) && $ ( 'input[name=details]:checkbox' ) . attr ( 'checked' ) ){
var ok = confirm ( 'Le D<> tail et l\'option Tous les clients ont <20> t<EFBFBD> selectionn<6E> es, le t<> l<EFBFBD> chargement risque d\'<27> tre long. Voulez-vous continuez ?' );
if ( ! ok ){ $ ( 'input[name=details]:checkbox' ) . attr ( 'checked' , false ); }
}
})
2009-07-16 16:12:17 +00:00
function checkFile (){
essai ++ ;
if ( essai > nbEssai ){
essai = 0 ;
updateInfo ( 'Le temps maximum d\'attente a <20> t<EFBFBD> atteint. Merci de r<> <72> ssayez.' );
2009-09-10 15:31:37 +00:00
$ ( 'input[name=details]:checkbox' ) . removeAttr ( 'disabled' );
2009-08-21 14:10:53 +00:00
$ ( 'select[name=mois]' ) . removeAttr ( 'disabled' );
2009-09-10 15:31:37 +00:00
$ ( 'input[name=all]:checkbox' ) . removeAttr ( 'disabled' );
2009-07-16 16:12:17 +00:00
} else if ( essai == 1 ){
$ ( '#message' ) . text ( 'Patientez pendant la construction du fichier (' + essai + ')...' );
$ . post ( 'pages/ajax/conso.php' ,
2009-09-10 15:31:37 +00:00
{ login : login , date : date , details : details , all : all , 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-09-10 15:31:37 +00:00
{ login : login , date : date , details : details , all : all , 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-09-10 15:31:37 +00:00
2009-07-16 16:12:17 +00:00
function updateInfo ( data ){
$ ( '#message' ) . html ( data );
clearInterval ( holdTheInterval );
2009-09-10 15:31:37 +00:00
$ ( 'input[name=details]:checkbox' ) . removeAttr ( 'disabled' );
2009-08-21 14:10:53 +00:00
$ ( 'select[name=mois]' ) . removeAttr ( 'disabled' );
2009-09-10 15:31:37 +00:00
$ ( 'input[name=all]:checkbox' ) . removeAttr ( 'disabled' );
2009-07-16 16:12:17 +00:00
essai = 0 ;
}
});
</ script >
2009-09-10 15:31:37 +00:00
< div id = " center " >
< h1 > ADMINISTRATION </ h1 >
< h2 > Relev<EFBFBD> de consommation complet </ h2 >
< table >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td >
2009-07-16 16:12:17 +00:00
< input type = " hidden " name = " utilisateur " value = " " />
2009-09-10 15:31:37 +00:00
< ? php
if ( $_SESSION [ 'tabInfo' ][ 'profil' ] == 'SuperAdministrateur' )
{
?>
< label title = " Renvoi les logs de tous les clients. Avec le d<> tails le t<> l<EFBFBD> chargement peut <20> tre long. " > Tous les clients </ label >< input type = " checkbox " name = " all " value = " 1 " />
< ? php
}
?>
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 >
2009-08-21 14:10:53 +00:00
< a href = " # " id = " submitmois " > Ok </ a >
2009-07-16 16:12:17 +00:00
</ td >
2009-09-10 15:31:37 +00:00
</ tr >
< tr >< td width = " 30 " >& nbsp ; </ td >< td >< div id = " message " ></ div ></ td ></ tr >
</ table >
< h2 > Liste des profils utilisateurs </ h2 >
< table id = " utilisateur " >
< ? php
if ( isset ( $message ) && $message != '' )
{
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 5 " class = " StyleInfoData " align = " center " >< h3 >< ? = $message ; ?> </h3></td>
</ tr >
< ? php
}
?>
< tr class = " border titre " >
2009-07-16 16:12:17 +00:00
< 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-09-10 15:31:37 +00:00
</ tr >
< ? php
foreach ( $utilisateurs as $uti )
{
?>
< tr class = " border " >
2009-07-16 16:12:17 +00:00
< td class = " StyleInfoData " >< ? = $uti [ 'login' ] ?> </td>
< td align = " center " valign = " middle " >
2009-09-10 15:31:37 +00:00
< 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 >
2009-07-16 16:12:17 +00:00
</ 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-09-10 15:31:37 +00:00
< ? php
}
?>
< tr >< td colspan = " 5 " >& nbsp ; </ td ></ 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-09-10 15:31:37 +00:00
</ tr >
2009-07-16 16:12:17 +00:00
</ table >
2009-09-10 15:31:37 +00:00
< ? php
if ( $_SESSION [ 'tabInfo' ][ 'profil' ] == 'SuperAdministrateur' )
{
?>
< h2 > Gestion des clients </ h2 >
< table >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td >< a href = " ./index.php?page=administration_client " > Liste des clients </ a ></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td >< a href = " ./index.php?page=administration_client&action=new " > Cr<EFBFBD> ation d ' un nouveau client </ a ></ td >
</ tr >
</ table >
< ? php
}
?>
2009-02-17 13:14:53 +00:00
< ?
}
2009-09-10 15:31:37 +00:00
?>
</ div >