summaryrefslogtreecommitdiff
path: root/src/Latex.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-18 12:19:52 +0200
committerpolo <ordipolo@gmx.fr>2026-10-18 12:19:52 +0200
commit983384a9be62eb694a8e1cf640685973c2a23ec2 (patch)
tree5e4c8c6f2862a4eec289de634851108fcc165ce4 /src/Latex.php
parent10c5064932f417e3ca38176224178bb6a1b9ab55 (diff)
downloadAppliGestionPHP-983384a9be62eb694a8e1cf640685973c2a23ec2.tar.gz
AppliGestionPHP-983384a9be62eb694a8e1cf640685973c2a23ec2.tar.bz2
AppliGestionPHP-983384a9be62eb694a8e1cf640685973c2a23ec2.zip
nouveau File.php, suppression de files.php, contenu déplacé dans Latex.php et File.php
Diffstat (limited to 'src/Latex.php')
-rw-r--r--src/Latex.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/Latex.php b/src/Latex.php
index f49fdea..c638264 100644
--- a/src/Latex.php
+++ b/src/Latex.php
@@ -57,6 +57,36 @@ abstract class Latex
57 // puis la mémoire est libérée à la fin de la fonction 57 // puis la mémoire est libérée à la fin de la fonction
58 // le PHP inséré fait donc partie de cette "mémoire" 58 // le PHP inséré fait donc partie de cette "mémoire"
59 } 59 }
60
61 public function makeTexAndPdf(): void // document polymorphe
62 {
63 if(get_class($this) !== 'EnveloppeVersoLatex')
64 {
65 File::makeFolder($this->latex_path);
66 File::makeFolder($this->pdf_path);
67 }
68 File::makeFile($this->latex_path, $this->file_name, $this->latex); // fichier .tex
69 $this->latexToPdf();
70 }
71
72 // commande système pdflatex
73 private function latexToPdf(): void
74 {
75 // paramètre optionnel
76 $output_dir = '';
77 if($this->pdf_path !== '')
78 {
79 $output_dir = '-output-directory=' . $this->pdf_path;
80 }
81
82 // compilation
83 exec('pdflatex ' . $output_dir . ' ' . $this->latex_path . $this->file_name);
84
85 // nettoyage
86 $basename = basename($this->file_name, '.tex');
87 unlink($this->pdf_path . $basename . '.aux');
88 unlink($this->pdf_path . $basename . '.log');
89 }
60 90
61 // getters 91 // getters
62 public function getFileName(): string 92 public function getFileName(): string
@@ -109,8 +139,8 @@ abstract class PrestaLatex extends Latex
109 { 139 {
110 $this->file_name = $Object->getCodePresta() . '.tex'; 140 $this->file_name = $Object->getCodePresta() . '.tex';
111 $this->date_array = explode('-', $Object->getdate()); 141 $this->date_array = explode('-', $Object->getdate());
112 $this->latex_path = Config::$latex_path . $this->date_array[0] . '/'; 142 $this->latex_path = Config::$latex_path . $this->date_array[0] . DIRECTORY_SEPARATOR;
113 $this->pdf_path = Config::$pdf_path . $this->date_array[0] . '/'; 143 $this->pdf_path = Config::$pdf_path . $this->date_array[0] . DIRECTORY_SEPARATOR;
114 } 144 }
115 145
116 return $this; // pour chainer les méthodes 146 return $this; // pour chainer les méthodes