From 63365247e23c206bc9eea63a224447543f1ec9b5 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 12 Oct 2026 21:42:42 +0200 Subject: =?UTF-8?q?pr=C3=A9paration=20date=20bulletin=20de=20paie=20des=20?= =?UTF-8?q?CESU,=20relecture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/File.php | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/File.php (limited to 'src/File.php') diff --git a/src/File.php b/src/File.php new file mode 100644 index 0000000..660a2e1 --- /dev/null +++ b/src/File.php @@ -0,0 +1,101 @@ +file_name = $file_name; + $this->path = $path; + } + + // getters + public function getData(): string + { + return $this->data; + } + + // setters + public function setFileName($file_name) + { + $this->file_name = $file_name; + } + + public function setPath($path) + { + $this->path = $path; + } + + public function setData($data) + { + $this->data = $data; + } + + public function setFileRights(int $octal) + { + $this->file_rights($octal); + } + public function setFolderRights(int $octal) + { + $this->folder_rights($octal); + } + + public function setWriteMod(int $mod) + { + $this->write_mod = $mod; + } + + + // fichiers + public function readFile(): string + {} + + public function writeFile() + { + file_put_contents($this->path. $this->file_name, $data); + chmod($this->path, $this->file_rights); + } + + + // dossiers + public function makeFolder() + { + if(!file_exists($this->path)) + { + mkdir($this->path); + chmod($this->path, $this->folder_rights); + } + } +} + +// compilation à partir d'un fichier .tex +class latexToPdf extends File +{ + public function __construct(string $latex_path, string $file_name, string $pdf_path) + {} + + $output_dir = ''; + if($pdf_path !== '') + { + $output_dir = '-output-directory=' . $pdf_path . ' '; + } + + // compilation + //echo 'pdflatex ' . $output_dir . $latex_path . $file_name . "\n"; + exec('pdflatex ' . $output_dir . $latex_path . $file_name); + + // nettoyage + $basename = basename($file_name, '.tex'); + unlink($pdf_path . $basename . '.aux'); + unlink($pdf_path . $basename . '.log'); +} -- cgit v1.2.3