116 lines
3.2 KiB
PHP
116 lines
3.2 KiB
PHP
<?php
|
|
$siren = $_SESSION['tabInfo']['entrep']['siren'];
|
|
(substr($_SESSION['tabInfo']['entrep']['AutreId'],0,1)=='W') ?
|
|
$waldec = $_SESSION['tabInfo']['entrep']['AutreId'] : $waldec = 0;
|
|
$fileUpload = null;
|
|
|
|
if ( isset($_REQUEST['upload']) ){
|
|
if ( count($_FILES)==1 ){
|
|
$n = $_FILES['fichier']['name'];
|
|
$s = $_FILES['fichier']['size'];
|
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
|
//Vérifier que l'extension du fichier est bien correcte
|
|
$extValide = array('pdf');
|
|
$extension = strrchr($n,'.');
|
|
$extension = substr($extension,1);
|
|
if ( in_array($extension, $extValide) ){
|
|
$name = $siren.'-'.$waldec.'.'.$extension;
|
|
if ( move_uploaded_file($tmp_name, PATH_DATA.'/asso/'.$name) ){
|
|
$fileUpload = $name;
|
|
} else {
|
|
echo "<br/>Erreur lors de l'envoi du fichier!";
|
|
exit;
|
|
}
|
|
} else {
|
|
echo "Extension de fichier invalide.";
|
|
exit;
|
|
}
|
|
} else {
|
|
echo "<br/>Erreur.";
|
|
exit;
|
|
}
|
|
}
|
|
|
|
if (isset($_REQUEST['method']) && $_REQUEST['method']=='saveacte') {
|
|
//Renommer le fichier
|
|
//setActeAsso
|
|
print_r($_REQUEST);
|
|
?>
|
|
|
|
<?php
|
|
} elseif (!empty($fileUpload)) {
|
|
?>
|
|
<form id="formEnvoiDoc" name="formEnvoiDoc" method="post" action="./?page=saisieajax">
|
|
<input type="hidden" name="q" value="acte" />
|
|
<input type="hidden" name="method" value="saveacte" />
|
|
<label>Type d'acte</label>
|
|
<select name="type">
|
|
<option value="-">Divers</option>
|
|
<option value="ST">Statut</option>
|
|
</select>
|
|
<br/><br/>
|
|
<label>Libellé : </label>
|
|
<input type="text" name="libelle" value="" size="50" />
|
|
<br/><br/>
|
|
<label>Date de l'acte : </label>
|
|
<input type="text" name="date" value="" size="10" maxlength="10" id="datepicker">
|
|
(JJ/MM/AAAA)
|
|
<br/><br/>
|
|
</form>
|
|
<script type="text/javascript">
|
|
$('#datepicker').datepicker( $.datepicker.regional['fr'] );
|
|
$('#datepicker').datepicker( "option", "dateFormat", 'dd/mm/yy' );
|
|
$('#datepicker').datepicker( "option", "defaultDate", '31/12/<?=date('Y')-1?>' );
|
|
$('#dialogacteupload').dialog({ buttons:
|
|
[
|
|
{
|
|
text: "Valider",
|
|
click: function() {
|
|
var url = $('#formEnvoiDoc').attr('action');
|
|
$.post(url, $('#formEnvoiDoc').serialize(),
|
|
function (data, textStatus) {
|
|
if (textStatus!='success'){
|
|
$('#dialogacteupload').html('Erreur');
|
|
} else {
|
|
$('#dialogacteupload').html(data);
|
|
}
|
|
}
|
|
);
|
|
}
|
|
},
|
|
{ text: "Quitter", click: function() { $(this).dialog("close"); } },
|
|
]
|
|
});
|
|
</script>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<style>
|
|
#progressbar { border:none; }
|
|
.ui-progressbar-value { background-image: url(img/pbar-ani.gif); }
|
|
</style>
|
|
<form id="uploadForm" name="uploadForm" action="./?page=saisieajax" method="post" enctype="multipart/form-data">
|
|
<input type="hidden" name="q" value="acte" />
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="40000000" />
|
|
Votre fichier : <input type="file" name="fichier" />
|
|
<input type="submit" name="upload" value="Envoyer" />
|
|
</form>
|
|
<div id="progressbar"></div>
|
|
<div id="uploadOutput"></div>
|
|
<script type="text/javascript" src="js/jquery.form.js">
|
|
</script type="text/javascript">
|
|
<script>
|
|
$('#uploadForm').ajaxForm({
|
|
beforeSubmit: function() {
|
|
$('#progressbar').progressbar({value: 100});
|
|
$('#uploadOutput').html('Envoi en cours...');
|
|
},
|
|
success: function(data) {
|
|
$('#progressbar').progressbar('destroy');
|
|
$('#dialogacteupload').html(data);
|
|
}
|
|
});
|
|
</script>
|
|
<?php
|
|
}
|
|
?>
|