Remove import controller

This commit is contained in:
Michael RICOIS 2016-08-02 22:30:07 +02:00
parent 896aa2eeac
commit 8815dfef2a
2 changed files with 0 additions and 96 deletions

View File

@ -1,78 +0,0 @@
<?php
class ImportController extends Zend_Controller_Action
{
public function fileformAction()
{
$this->_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é, <a href=\"".
$this->view->url(array(
'controller' => 'import',
'action' => 'checkfile',
'file' => $idClient.'-'.$name.'.'.$extension,
))."\">Vérifier le format</a>";
} 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);
}
}
}

View File

@ -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 class='progress'></div>");
div.append("<div class='text'> </div>");
$("<span class='text'> </span>").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);