diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php
index d3010e2fc..48de8654e 100644
--- a/application/controllers/UserController.php
+++ b/application/controllers/UserController.php
@@ -48,11 +48,9 @@ class UserController extends Zend_Controller_Action
*/
public function indexAction()
{
- $this->view->headLink()
- ->appendStylesheet('/themes/default/styles/form.css', 'all');
+ $this->view->headLink()->appendStylesheet('/themes/default/styles/form.css', 'all');
- $this->view->headScript()
- ->appendFile('/themes/default/scripts/user.js', 'text/javascript');
+ $this->view->headScript()->appendFile('/themes/default/scripts/user.js', 'text/javascript');
$request = $this->getRequest();
@@ -162,6 +160,11 @@ class UserController extends Zend_Controller_Action
}
}
+ public function consoAction()
+ {
+ $this->view->headScript()->appendFile('/themes/default/scripts/conso.js', 'text/javascript');
+ }
+
public function editAction()
{
diff --git a/application/views/default/scripts/user/conso.phtml b/application/views/default/scripts/user/conso.phtml
new file mode 100644
index 000000000..dc8fcf8e1
--- /dev/null
+++ b/application/views/default/scripts/user/conso.phtml
@@ -0,0 +1,27 @@
+
Relevé de consommation
+
+profil == 'SuperAdministrateur'){ ?>
+
+
+
+
+
+
+
+
+
Ok
+
+
\ No newline at end of file
diff --git a/application/views/default/scripts/user/index.phtml b/application/views/default/scripts/user/index.phtml
index 7788a0c45..e3873e1ae 100644
--- a/application/views/default/scripts/user/index.phtml
+++ b/application/views/default/scripts/user/index.phtml
@@ -78,6 +78,13 @@ if ($this->action=='new') {
+options->profil, array('Administrateur', 'SuperAdministrateur'))){
+ echo $this->action('conso', 'user');
+}
+?>
+
Moteur de recherche
diff --git a/public/themes/default/scripts/conso.js b/public/themes/default/scripts/conso.js
new file mode 100644
index 000000000..35a980f35
--- /dev/null
+++ b/public/themes/default/scripts/conso.js
@@ -0,0 +1,51 @@
+$(document).ready(function(){
+ var holdTheInterval;
+ var nbEssai = 25;
+ var essai = 0;
+ var url = '';
+ var postUrl = '';
+ var ConsoAll = 0;
+ var ConsoDetails = 0;
+ var ConsoMois;
+
+ $('#dl').click(function(e) {
+ e.preventDefault();
+ if ($('select[name=ConsoMois]').val() == '-') {
+ $('#dlMsg').html('Vous devez sélectionner une période.');
+ return;
+ }
+ postUrl = $(this).attr('href');
+ ConsoAll = $('input[name=ConsoAll]').attr('checked') ? 1 : 0;
+ ConsoDetails = $('input[name=ConsoAll]').attr('checked') ? 1 : 0;
+ ConsoMois = $('select[name=ConsoMois]').val();
+ 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éessayez.');
+ } else {
+ $('#dlMsg').text('Patientez pendant la construction du fichier ('+ essai +')...');
+ $.post(postUrl, {start: essai, mois: ConsoMois, detail: ConsoDetails, all: ConsoAll, url: url },
+ function (data, textStatus) {
+ if (data != '' && data != 'FALSE') {
+ if (essai == 1) {
+ url = data;
+ if (url == '') { updateInfo('Erreur'); }
+ } else {
+ updateInfo(data);
+ }
+ }
+ });
+ }
+ }
+
+ function updateInfo(data) {
+ $('#dlMsg').html(data);
+ clearInterval(holdTheInterval);
+ essai = 0;
+ }
+});
\ No newline at end of file