From 8815dfef2af31e481f5218a17cc0019cc40d4a6e Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 2 Aug 2016 22:30:07 +0200 Subject: [PATCH] Remove import controller --- application/controllers/ImportController.php | 78 ------------------- public/themes/default/js/jqueryprogressbar.js | 18 ----- 2 files changed, 96 deletions(-) delete mode 100644 application/controllers/ImportController.php delete mode 100644 public/themes/default/js/jqueryprogressbar.js diff --git a/application/controllers/ImportController.php b/application/controllers/ImportController.php deleted file mode 100644 index 3d1c3df5..00000000 --- a/application/controllers/ImportController.php +++ /dev/null @@ -1,78 +0,0 @@ -_helper->layout()->disableLayout(); - - $this->view->inlineScript()->appendFile('/scripts/jquery.form.js'); - $this->view->inlineScript()->appendFile('/scripts/jqueryprogressbar.js'); - - $this->view->assign('filesize', ini_get('upload_max_filesize')); - - $request = $this->getRequest(); - $idClient = $request->getParam('idClient', null); - $login = $request->getParam('login', null); - - $this->view->assign('idClient', $idClient); - $this->view->assign('login', $login); - } - - public function fileuploadAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $request = $this->getRequest(); - $idClient = $request->getParam('idClient'); - $login = $request->getParam('login'); - - $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path'); - $path = realpath($config->data).'/validation'; - if(!file_exists($path)) mkdir($path); - - if ( isset($_FILES) && count($_FILES)==1 ){ - $n = $_FILES['fichier']['name']; - $s = $_FILES['fichier']['size']; - $tmp_name = $_FILES['fichier']['tmp_name']; - - $extValide = array('csv'); - $extension = strrchr($n,'.'); - $extension = substr($extension,1); - //Vérifier l'extension du fichier - if(!in_array($extension, $extValide)){ - echo "Extension de fichier incorrect !"; - } elseif (move_uploaded_file($tmp_name, $path.'/'.$idClient.'-'.$name.'.'.$extension)){ - echo "Fichier envoyé, view->url(array( - 'controller' => 'import', - 'action' => 'checkfile', - 'file' => $idClient.'-'.$name.'.'.$extension, - ))."\">Vérifier le format"; - } else { - echo "Erreur : ".$_FILES['fichier']['error']; - } - } - } - - /** - * Etat de progression de l'upload du fichier - */ - public function fileprogressAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $request = $this->getRequest(); - $key = $request->getParam('key', ''); - if (!empty($key)) { - //$rep sera égal à false si la clef n'existe pas dans le cache apc - $rep = apc_fetch('upload_'.$key); - echo json_encode($rep); - } - } - - - -} \ No newline at end of file diff --git a/public/themes/default/js/jqueryprogressbar.js b/public/themes/default/js/jqueryprogressbar.js deleted file mode 100644 index a63eea59..00000000 --- a/public/themes/default/js/jqueryprogressbar.js +++ /dev/null @@ -1,18 +0,0 @@ -(function($){ - $.fn.reportprogress = function(val,maxVal){ - var max=100; if(maxVal) max=maxVal; - return this.each(function(){ - var div=$(this); - var innerdiv=div.find(".progress"); - if(innerdiv.length!=1){ - innerdiv=$("
"); - div.append("
"); - $(" ").css("width",div.width()).appendTo(innerdiv); - div.append(innerdiv); - } - var width=Math.round(val/max*100); - innerdiv.css("width",width+"%"); - div.find(".text").html(width+" %") - ;}) - ;} -;})(jQuery); \ No newline at end of file