Retour action supprimé

This commit is contained in:
Michael RICOIS 2012-08-23 08:03:50 +00:00
parent b86c6aeceb
commit 92e64573a8
2 changed files with 93 additions and 0 deletions

View File

@ -1214,6 +1214,75 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('siret', $siret);
}
public function associationAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$type = $request->getParam('type');
$siren = $request->getParam('siren');
//Téléchargement du fichier
if ( isset($_FILES) && count($_FILES)==1 ) {
$this->_helper->viewRenderer->setNoRender(true);
if ( empty($siren) ) {
echo "Pas d'identifiant!"; exit;
}
$configuration = Zend_Registry::get('configuration');
$path = $configuration->path->data.'/association';
if ( $type=='bilan' ){
$dateCloture = $request->getParam('dateCloture');
if (strlen($dateCloture)!=8) {
echo "Erreur format date cloture"; exit;
}
$path.= '/bilans';
$name = $siren.'_'.$dateCloture;
} elseif ( $type=='acte' ) {
$name = 'ST-'.$siren.'-'.date('Ymd');
$path.= '/actes';
}
$n = $_FILES['fichier']['name'];
$s = $_FILES['fichier']['size'];
$tmp_name = $_FILES['fichier']['tmp_name'];
$extValide = array('pdf');
$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.'/'.$name.'.'.$extension) ){
echo "Fichier envoyé, <a target=\"_blank\" href=\"".$this->view->url(array(
'controller' => 'fichier',
'action' => 'pdfassociation',
'file' => $name.'.'.$extension,
), null , true)."\">Cliquez pour voir le fichier</a>";
} else {
echo "Erreur lors du déplacement du fichier !";
}
//Affichage formulaire
} else {
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.js');
if ( intval($siren)==0 ) {
$session = new SessionEntreprise();
$siren = '';
if ( substr($session->AutreId,0,1)=='W' ) {
$siren = $session->AutreId;
}
}
$this->view->assign('siren', $siren);
$this->view->assign('type', $type);
}
}
public function liasseAction()
{
$request = $this->getRequest();

View File

@ -0,0 +1,24 @@
<form action="<?=$this->url(array('controller'=>'saisie', 'action'=>'association'))?>" method="post" name="sendfile">
<input type="hidden" name="siren" value="<?=$this->siren?>" />
<input type="hidden" name="type" value="<?=$this->type?>" />
<?php if ( $this->type=='bilan' ) {?>
Date Cloture : <input type="text" name="dateCloture" /> (JJMMAAAA)<br/><br/>
Bilan : <input type="file" name="fichier" />
<?php } elseif ($this->type=='acte') {?>
Status : <input type="file" name="fichier" />
<?php } ?>
<input type="submit" name="Envoyer" />
</form>
<i>Uniquement fichier pdf</i>
<div id="output"></div>
<?=$this->inlineScript()?>
<script>
$('form[name=sendfile]').ajaxForm({
beforeSubmit: function() {
$('#output').html('Envoi en cours...');
},
success: function(data) {
$('#output').html('<strong>' + data + '</strong>');
}
});
</script>