diff options
| author | polo <ordipolo@gmx.fr> | 2022-12-19 02:51:03 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-12-19 02:51:03 +0100 |
| commit | dedbe2f5cee33431c1299c7f0dbef4e247dc2447 (patch) | |
| tree | 4d2481ca044aae30886a9879acd53c4777c180bc /src/functions.php | |
| parent | ff14091476a35de16a9ea3208501040cfae93a06 (diff) | |
| download | AppliGestionPHP-dedbe2f5cee33431c1299c7f0dbef4e247dc2447.tar.gz AppliGestionPHP-dedbe2f5cee33431c1299c7f0dbef4e247dc2447.tar.bz2 AppliGestionPHP-dedbe2f5cee33431c1299c7f0dbef4e247dc2447.zip | |
nouveau client main.php en cours
Diffstat (limited to 'src/functions.php')
| -rw-r--r-- | src/functions.php | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/src/functions.php b/src/functions.php index d67a05e..6ddbae0 100644 --- a/src/functions.php +++ b/src/functions.php | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | // php/functions.php | 2 | // src/functions.php |
| 3 | // | 3 | // |
| 4 | // gros fourre-tout, il faudra le ranger plus tard | 4 | // gros fourre-tout, à ranger plus tard |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | // commande pour lancer une application graphique en ouvrant un fichier | 7 | // commande pour lancer une application graphique en ouvrant un fichier |
| 8 | function window_app_command(string $app, string $path = ''): string | 8 | function windowAppCommand(string $app, string $path = ''): string |
| 9 | { | 9 | { |
| 10 | // attention, la syntaxe utilisée est la plus simple: "app fichier" | 10 | // attention, la syntaxe utilisée est la plus simple: "app fichier" |
| 11 | // ça fonctionne avec les logiciels choisis: gimp, scribus | 11 | // ça fonctionne avec les logiciels choisis: gimp, scribus |
| @@ -22,7 +22,7 @@ function window_app_command(string $app, string $path = ''): string | |||
| 22 | return $command; | 22 | return $command; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | function recherche_client(string $saisie): array | 25 | function rechercheClient(string $saisie): array |
| 26 | { | 26 | { |
| 27 | $resultats = []; | 27 | $resultats = []; |
| 28 | 28 | ||
| @@ -32,8 +32,50 @@ function recherche_client(string $saisie): array | |||
| 32 | return($resultats); | 32 | return($resultats); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | // NOTE 1: les objets sont passés aux fonctions par référence par défaut, toutefois ce n'est pas entièrement vrai | ||
| 36 | // NOTE 2: PHP n'a pas de pointeur mais des références, une référence est un alias qui ne contient pas l'objet lui-même | ||
| 37 | // NOTE 3: la variable créée lors d'un "new" est elle-même une référence contenant un identifiant (= le pointeur?) | ||
| 38 | // NOTE 4: l'objet est détruit lorsque la dernière référence est supprimée | ||
| 39 | |||
| 40 | function enregistrementNouveauClient(Clients $Client, ZenityForms $NouveauClient) | ||
| 41 | { | ||
| 42 | $entry = exec($NouveauClient->get()); | ||
| 43 | if($entry !== '') | ||
| 44 | { | ||
| 45 | $tableau = explode('|', $entry); | ||
| 46 | if(count($tableau) === 4) | ||
| 47 | { | ||
| 48 | $Client->newRow($tableau); | ||
| 49 | return true; | ||
| 50 | } | ||
| 51 | else | ||
| 52 | { | ||
| 53 | echo "debug: mauvais tableau, il doit avoir 4 cases\n"; | ||
| 54 | return false; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | else | ||
| 58 | { | ||
| 59 | echo "debug: pas de données saisies\n"; | ||
| 60 | return false; | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | function getLatexFromTemplate(string $template) | ||
| 65 | { | ||
| 66 | // variables à injecter | ||
| 67 | $nom_client = "M. Duchmol"; | ||
| 68 | |||
| 69 | // on obtient la variable $latex avec ob_get_clean() | ||
| 70 | include('latex_templates/' . $template . '.php'); | ||
| 71 | |||
| 72 | // on retourne le buffer | ||
| 73 | // normallement le code PHP inséré avec include est nettoyé en quittant la fonction | ||
| 74 | return($latex); | ||
| 75 | } | ||
| 76 | |||
| 35 | // compilation à partir d'un fichier .tex | 77 | // compilation à partir d'un fichier .tex |
| 36 | function latexToPdf(string $fileName, string $latexPath, string $pdfPath) | 78 | function latexToPdf(string $latexPath, string $fileName, string $pdfPath) |
| 37 | { | 79 | { |
| 38 | $outputDir = ''; | 80 | $outputDir = ''; |
| 39 | if($pdfPath !== '') | 81 | if($pdfPath !== '') |
