extranet/includes/customRapport/customRapport.php
Damien LASSERRE 255ae2059e
2011-05-17 06:35:18 +00:00

93 lines
3.8 KiB
PHP

<?php
if($_REQUEST['upload'])
{
require_once 'print/print.php';
ob_start();
echo '<link rel="stylesheet" href="css/rsynthese.css">';
echo '<link rel="stylesheet" href="css/main.css">';
echo '<style>';
echo '.confidentiel {display:none}';
echo '#center h1{background-color:'.$_POST['couleurh1'].';color:'.$_POST['texth1'].'}';
if($_POST['logo_background'])
echo '#center {background-image:url(./img/customRapport/logo_background.jpg);background-repeat:repeat-y}';
echo '#center h2{background-color:'.$_POST['couleurh2'].';color:'.$_POST['texth2'].'}';
echo '</style>';
echo '<img src="./img/customRapport/logo.jpg" width="12%" style="float:'.$_POST['image'].'" />';
echo $_POST['coordonnees'];
$siret = $_GET['siret'];
$siren = substr($_GET['siret'], 0, 9);
$idEntreprise = $_GET['idEntreprise'];
include('pages/rsynthese.php');
echo $_POST['content'];
$content = ob_get_contents();
$file_put = str_replace('<a href', '<a title', $content);
$file_put = str_replace('logo_indiscore.png', '', $file_put);
ob_end_clean();
file_put_contents('../cache/pages/rapport-'.$siren.'.html', $file_put);
wkhtmltopdf('../cache/pages/rapport-'.$siren.'.html');
} else {
?>
<div align="center" style="height:305px;background-image:url('./img/customRapport/logo.jpg');background-repeat:no-repeat;background-position:center">
<form name="uploadForm" id="uploadForm" method="POST" action="./?page=customRapport&siret=<?php echo $_GET['siret'];?>&idEntreprise=<?php echo $_GET['idEntreprise'];?>">
<table style="margin-top:30px" id="remove">
<tr>
<td align="center" id="uploadOutput"></td>
</tr>
<tr>
<td><b>Coordonnées adresse</b></td>
</tr>
<tr>
<td><input style="width:377px" type="text" name="coordonnees" value="<b>Order to Cash</b><br /> 70 AVENUE DE LA MARNE <b><br />92600 ASNIERES SUR SEINE</b>"/></td>
</tr>
<tr>
<td valign="top"><b>Contenu diver en fin de rapport</b></td>
</tr>
<tr>
<td><textarea style="width:377px;height:60px" name="content" value="Entrer un texte..."></textarea></td>
</tr>
<tr>
<td><b>Logo en fond ecran : </b><input type="checkbox" name="logo_background" value="true" /></td>
</tr>
<tr>
<td><b>Logo à :</b> Gauche <input checked="checked" type="radio" name="image" value="left"/> Droite<input value="right" type="radio" name="image" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><b>couleur des grands titres</b></td>
</tr>
<tr>
<td>Fond : <input value="#DFDB00" type="text" name="couleurh1" /> Texte <input value="black" type="text" name="texth1" /> ex : black</td>
</tr>
<tr>
<td><b>couleur des sous titres</b></td>
</tr>
<tr>
<td>Fond : <input value="#EFED9A" type="text" name="couleurh2" /> Texte <input value="black" type="text" name="texth2" /> ex : black</td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="upload" value="Envoyer" /></td>
</tr>
</table>
</form>
</div>
<?php }?>
<script type="text/javascript" src="js/jquery.form.js">
</script type="text/javascript">
<script>
$('#uploadForm').ajaxForm({
beforeSubmit: function() {
$('#uploadOutput').html('<b style="color:green">Votre document est en cours de chargement...</b>');
},
success: function(data) {
$('#remove').html('<center>Votre fichier est prêt pour être téléchargé !<br /><a target="_blank" href="./servefile.php?q=customRapport/<?php echo 'rapport-'.$siren.'.pdf';?>">Télécharger</a></center>');
$('#uploadOutput').html('<strong>' + data + '</strong>');
}
});
$('#dialogcustomrapport').dialog({ buttons: [ {
text: "Quitter",
click: function() { $(this).dialog("close"); }
} ] });
</script>