From 945af9fda5146405ab9903d4d268bcb2fe95da25 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 10 Jan 2023 13:08:54 +0100 Subject: enregistrement section 1 --- src/functions.php | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'src/functions.php') diff --git a/src/functions.php b/src/functions.php index bdcd594..0ec280f 100644 --- a/src/functions.php +++ b/src/functions.php @@ -22,42 +22,17 @@ function windowAppCommand(string $app, string $path = ''): string return $command; } -function rechercheClient(string $input, Clients $Client): array -{ - $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre - - $result = $Client->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées - return($result); -} - // NOTE 1: en PHP les objets sont passés aux fonctions par référence par défaut, toutefois ce n'est pas entièrement vrai // 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 // NOTE 3: la variable créée lors d'un "new" est elle-même une référence contenant un identifiant (= le pointeur?) // NOTE 4: l'objet est détruit lorsque la dernière référence est supprimée -function controlFormInput(array $data): bool +function rechercheClient(string $input, Clients $Client): array { - $tableSize = count(StructTablesDB::$structureOfTables[$table]); // int - if($data !== '') - { - $dataArray = explode('|', $data); - - if(count($dataArray) === $tableSize - 1) // nombre de champs sauf ID qui est auto-incrémenté automatiquement - { - - - } - else - { - echo "debug: mauvais tableau, il doit avoir " . $tableSize - 1 . " cases\n"; - return false; - } - } - else - { - echo "debug: pas de données saisies\n"; - return false; - } + $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre + + $result = $Client->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées + return($result); } function getLatexFromTemplate(string $template) -- cgit v1.2.3