diff options
| author | polo <ordipolo@gmx.fr> | 2023-07-22 12:29:47 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2023-07-22 12:29:47 +0200 |
| commit | 747674b450d6840ce9bd9aecd765cf31445ef8d3 (patch) | |
| tree | 46e47fd65c751e1951d9aa8438aea1b8c2d8aece /src/sections | |
| parent | 9bdfb5196a2ee1cbfc403702e8d2ef88076d366f (diff) | |
| download | AppliGestionPHP-747674b450d6840ce9bd9aecd765cf31445ef8d3.tar.gz AppliGestionPHP-747674b450d6840ce9bd9aecd765cf31445ef8d3.tar.bz2 AppliGestionPHP-747674b450d6840ce9bd9aecd765cf31445ef8d3.zip | |
navigation entre sections, boucle principale, client ou prospect
Diffstat (limited to 'src/sections')
| -rw-r--r-- | src/sections/1_customer.php | 48 | ||||
| -rw-r--r-- | src/sections/2_quotations.php | 9 | ||||
| -rw-r--r-- | src/sections/2_service.php (renamed from src/sections/1_new_service.php) | 118 | ||||
| -rw-r--r-- | src/sections/3_modify_data.php | 9 | ||||
| -rw-r--r-- | src/sections/3_modify_service.php | 9 | ||||
| -rw-r--r-- | src/sections/4_get_document.php | 55 | ||||
| -rw-r--r-- | src/sections/main_loop.php | 106 |
7 files changed, 287 insertions, 67 deletions
diff --git a/src/sections/1_customer.php b/src/sections/1_customer.php new file mode 100644 index 0000000..cdec448 --- /dev/null +++ b/src/sections/1_customer.php | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/1_customer.php | ||
| 3 | // | ||
| 4 | // -- SECTION 1: Fichier clients et propects -- | ||
| 5 | |||
| 6 | function newCustomer(): array | ||
| 7 | { | ||
| 8 | // fenêtres | ||
| 9 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees); | ||
| 10 | //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); | ||
| 11 | $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1_text, ZenitySetup::$fin_section_1_entrees); | ||
| 12 | |||
| 13 | // -- partie 1: client ou prospect? -- | ||
| 14 | $Client = new Clients; | ||
| 15 | if(exec($TypeDeClient->get()) === 'Client') | ||
| 16 | { | ||
| 17 | $Client->setType('client'); | ||
| 18 | } | ||
| 19 | //~ else // | ||
| 20 | //~ { | ||
| 21 | //~ $Client->setType('prospect'); | ||
| 22 | //~ } | ||
| 23 | |||
| 24 | // -- partie 2: saisie des infos -- | ||
| 25 | if(enterCustomer($Client)) | ||
| 26 | { | ||
| 27 | // -- partie 3: on fait quoi maintenant -- | ||
| 28 | $choix_niv2 = exec($FinSection1->get()); | ||
| 29 | if($choix_niv2 === ZenitySetup::$fin_section_1_entrees[0]) | ||
| 30 | { | ||
| 31 | return [2, $Client]; // section 2: newService() | ||
| 32 | } | ||
| 33 | elseif($choix_niv2 === ZenitySetup::$fin_section_1_entrees[1]) | ||
| 34 | { | ||
| 35 | return [3, $Client]; // section 3: modifyData() | ||
| 36 | } | ||
| 37 | elseif($choix_niv2 === ZenitySetup::$fin_section_1_entrees[2]) | ||
| 38 | { | ||
| 39 | return [1, null]; // relancer section 1: newCustomer() | ||
| 40 | } | ||
| 41 | else | ||
| 42 | { | ||
| 43 | return [0, null]; // menu principal | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | return [0, null]; // menu principal | ||
| 48 | } | ||
diff --git a/src/sections/2_quotations.php b/src/sections/2_quotations.php deleted file mode 100644 index 76b66fd..0000000 --- a/src/sections/2_quotations.php +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/2_quotations.php | ||
| 3 | // | ||
| 4 | // -- SECTION 2: Devis -- | ||
| 5 | |||
| 6 | function quotation(): int // code de retour, si 2 aller à la section 2, etc | ||
| 7 | { | ||
| 8 | return(0); // menu principal | ||
| 9 | } | ||
diff --git a/src/sections/1_new_service.php b/src/sections/2_service.php index 6f5a72c..8109b31 100644 --- a/src/sections/1_new_service.php +++ b/src/sections/2_service.php | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | // src/sections/1_new_service.php | 2 | // src/sections/2_service.php |
| 3 | // | 3 | // |
| 4 | // -- SECTION 1: Nouvelle prestation -- | 4 | // -- SECTION 2: Prestation et devis -- |
| 5 | 5 | ||
| 6 | function newService(): int // code de retour, si 0 retour menu principal, si 2 aller à la section 2, etc | 6 | function newService($Client): array // $Client est un Client ou null |
| 7 | { | 7 | { |
| 8 | // fenêtres | 8 | // fenêtres |
| 9 | $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees); | 9 | $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees); |
| @@ -14,14 +14,19 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 14 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); | 14 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); |
| 15 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); | 15 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); |
| 16 | $Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes | 16 | $Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes |
| 17 | $QuestionModifierPrestation = new ZenityQuestion(ZenitySetup::$question_modification_text); | 17 | //$QuestionModifierPrestation = new ZenityQuestion(ZenitySetup::$question_modification_text); |
| 18 | $FinSection2 = new ZenityList(ZenitySetup::$fin_section_2_text, ZenitySetup::$fin_section_2_entrees); | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | // -- partie 1: le client -- | 21 | // -- partie 1: le client -- |
| 21 | $Client = makeObjectCLient(); | 22 | if($Client == null || get_class($Client) !== 'Clients') |
| 22 | if($Client === 0) | ||
| 23 | { | 23 | { |
| 24 | return 0; // menu principal | 24 | $Client = makeObjectClient(); // retourne 0 ou un objet "Clients" |
| 25 | if($Client == 0) | ||
| 26 | { | ||
| 27 | echo "debug: annulation sélection client\n"; | ||
| 28 | return [0, null]; // menu principal | ||
| 29 | } | ||
| 25 | } | 30 | } |
| 26 | 31 | ||
| 27 | 32 | ||
| @@ -32,7 +37,7 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 32 | if($choix_niv2 === '') | 37 | if($choix_niv2 === '') |
| 33 | { | 38 | { |
| 34 | echo "debug: annulation menu enregistrement\n"; | 39 | echo "debug: annulation menu enregistrement\n"; |
| 35 | return 0; // menu principal | 40 | return [0, null]; // menu principal |
| 36 | } | 41 | } |
| 37 | 42 | ||
| 38 | $Presta = new Prestations($Client->getID()); | 43 | $Presta = new Prestations($Client->getID()); |
| @@ -43,7 +48,7 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 43 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" | 48 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" |
| 44 | { | 49 | { |
| 45 | echo "debug: annulation à la saisie d'une date\n"; | 50 | echo "debug: annulation à la saisie d'une date\n"; |
| 46 | return 0; // menu principal | 51 | return [0, null]; // menu principal |
| 47 | } | 52 | } |
| 48 | 53 | ||
| 49 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD | 54 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD |
| @@ -76,7 +81,7 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 76 | break; | 81 | break; |
| 77 | default: // inutile normallement, cas déjà géré avant | 82 | default: // inutile normallement, cas déjà géré avant |
| 78 | echo "debug: sortie du menu enregistrement incorrect\n"; | 83 | echo "debug: sortie du menu enregistrement incorrect\n"; |
| 79 | return 0; | 84 | return [0, null]; |
| 80 | } | 85 | } |
| 81 | 86 | ||
| 82 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre | 87 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre |
| @@ -86,12 +91,12 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 86 | if($input == '') // annulation | 91 | if($input == '') // annulation |
| 87 | { | 92 | { |
| 88 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; | 93 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; |
| 89 | return 0; | 94 | return [0, null]; |
| 90 | } | 95 | } |
| 91 | elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($input, $Presta)) // echec de l'hydratation | 96 | elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($input, $Presta)) // echec de l'hydratation |
| 92 | { | 97 | { |
| 93 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? | 98 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? |
| 94 | return 0; | 99 | return [0, null]; |
| 95 | } | 100 | } |
| 96 | unset($input); | 101 | unset($input); |
| 97 | } | 102 | } |
| @@ -127,6 +132,10 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 127 | $PrestaDetails->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | 132 | $PrestaDetails->setID(); // sans paramètre, exécute un $this->db->lastInsertId() |
| 128 | } | 133 | } |
| 129 | 134 | ||
| 135 | // si encore de type prospect, devient un type client | ||
| 136 | //$Client->setType('client'); // inutile? | ||
| 137 | $Client->updateOneValue('type', 'client'); // modifier le type prospect en client | ||
| 138 | |||
| 130 | 139 | ||
| 131 | // -- partie 3: LaTeX -- | 140 | // -- partie 3: LaTeX -- |
| 132 | 141 | ||
| @@ -141,6 +150,9 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 141 | */ | 150 | */ |
| 142 | // et pour bien faire ajouter aussi une interface | 151 | // et pour bien faire ajouter aussi une interface |
| 143 | 152 | ||
| 153 | //~ function makeLatexSubClass(string $type) | ||
| 154 | //~ {} | ||
| 155 | |||
| 144 | // fabrique d'objets (sans connaître les noms des classes) | 156 | // fabrique d'objets (sans connaître les noms des classes) |
| 145 | $EnveloppeRecto = Latex::makeLatexSubClass('enveloppe_recto'); | 157 | $EnveloppeRecto = Latex::makeLatexSubClass('enveloppe_recto'); |
| 146 | $EnveloppeVerso = Latex::makeLatexSubClass('enveloppe_verso'); | 158 | $EnveloppeVerso = Latex::makeLatexSubClass('enveloppe_verso'); |
| @@ -148,39 +160,40 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 148 | 160 | ||
| 149 | // génération du latex | 161 | // génération du latex |
| 150 | $EnveloppeRecto->setData($Client); | 162 | $EnveloppeRecto->setData($Client); |
| 151 | $EnveloppeRecto->setFileName($Client->getCodeClient() . '.tex'); | 163 | //~ $EnveloppeRecto->setFileName($Client->getCodeClient() . '.tex'); |
| 152 | $EnveloppeRecto->setLatexPath(Config::$latex_path . 'enveloppes_recto/'); | 164 | //~ $EnveloppeRecto->setLatexPath(Config::$latex_path . 'enveloppes_recto/'); |
| 153 | $EnveloppeRecto->setPdfPath(Config::$pdf_path . 'enveloppes_recto/'); | 165 | //~ $EnveloppeRecto->setPdfPath(Config::$pdf_path . 'enveloppes_recto/'); |
| 154 | $EnveloppeRecto->spacesInPostCode(); | 166 | //~ $EnveloppeRecto->spacesInPostCode(); |
| 155 | $EnveloppeRecto->makeLatex(); | 167 | $EnveloppeRecto->makeLatex(); |
| 156 | 168 | ||
| 157 | $EnveloppeVerso->setFileName('enveloppe_verso.tex'); | 169 | //~ $EnveloppeVerso->setFileName('enveloppe_verso.tex'); |
| 158 | $EnveloppeVerso->setLatexPath(Config::$latex_path); | 170 | //~ $EnveloppeVerso->setLatexPath(Config::$latex_path); |
| 159 | $EnveloppeVerso->setPdfPath(Config::$pdf_path); | 171 | //~ $EnveloppeVerso->setPdfPath(Config::$pdf_path); |
| 160 | $EnveloppeVerso->makeLatex(); | 172 | $EnveloppeVerso->makeLatex(); |
| 161 | 173 | ||
| 162 | $DocumentPresta->setData($Client); | 174 | if($DocumentPresta !== null) |
| 163 | $DocumentPresta->setData($Presta); | 175 | { |
| 164 | $DocumentPresta->setData($PrestaDetails); | 176 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); |
| 165 | $DocumentPresta->makeDateInstance($Presta->getDate()); // paramètre = int | 177 | //~ $DocumentPresta->setData($Client); |
| 166 | $DocumentPresta->setFileName($Presta->getCodePresta() . '.tex'); | 178 | //~ $DocumentPresta->setData($Presta); |
| 167 | $DocumentPresta->setLatexPath(Config::$latex_path . $DocumentPresta->getYear() . '/'); | 179 | //~ $DocumentPresta->makeDateInstance($Presta->getDate()); // paramètre = int |
| 168 | $DocumentPresta->setPdfPath(Config::$pdf_path . $DocumentPresta->getYear() . '/'); | 180 | //~ $DocumentPresta->setFileName($Presta->getCodePresta() . '.tex'); |
| 169 | $DocumentPresta->makeLatex(); | 181 | //~ $DocumentPresta->setLatexPath(Config::$latex_path . $DocumentPresta->getYear() . '/'); |
| 182 | //~ $DocumentPresta->setPdfPath(Config::$pdf_path . $DocumentPresta->getYear() . '/'); | ||
| 183 | //~ $DocumentPresta->setData($PrestaDetails); | ||
| 184 | $DocumentPresta->makeLatex(); | ||
| 185 | } | ||
| 170 | 186 | ||
| 171 | // création des fichiers | ||
| 172 | makeFolder($EnveloppeRecto->getLatexPath()); | ||
| 173 | makeFolder($EnveloppeRecto->getPdfPath()); | ||
| 174 | makeFile($EnveloppeRecto->getLatexPath(), $EnveloppeRecto->getFileName(), $EnveloppeRecto->getLatex()); | ||
| 175 | latexToPdf($EnveloppeRecto->getLatexPath(), $EnveloppeRecto->getFileName(), $EnveloppeRecto->getPdfPath()); | ||
| 176 | 187 | ||
| 177 | makeFile($EnveloppeVerso->getLatexPath(), $EnveloppeVerso->getFileName(), $EnveloppeVerso->getLatex()); | 188 | // création des fichiers |
| 178 | latexToPdf($EnveloppeVerso->getLatexPath(), $EnveloppeVerso->getFileName(), $EnveloppeVerso->getPdfPath()); | 189 | // paramètre = Objet enfant de Latex |
| 190 | makeTexAndPdf($EnveloppeRecto); | ||
| 191 | makeTexAndPdf($EnveloppeVerso); | ||
| 179 | 192 | ||
| 180 | makeFolder($DocumentPresta->getLatexPath()); | 193 | if($DocumentPresta !== null) |
| 181 | makeFolder($DocumentPresta->getPdfPath()); | 194 | { |
| 182 | makeFile($DocumentPresta->getLatexPath(), $DocumentPresta->getFileName(), $DocumentPresta->getLatex()); | 195 | makeTexAndPdf($DocumentPresta); |
| 183 | latexToPdf($DocumentPresta->getLatexPath(), $DocumentPresta->getFileName(), $DocumentPresta->getPdfPath()); | 196 | } |
| 184 | 197 | ||
| 185 | 198 | ||
| 186 | // -- partie 4: récapitulatif -- | 199 | // -- partie 4: récapitulatif -- |
| @@ -194,16 +207,23 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 194 | 207 | ||
| 195 | 208 | ||
| 196 | // -- partie 5: on fait quoi maintenant -- | 209 | // -- partie 5: on fait quoi maintenant -- |
| 210 | $choix_niv2 = exec($FinSection2->get()); | ||
| 211 | if($choix_niv2 === ZenitySetup::$fin_section_2_entrees[0]) | ||
| 212 | { | ||
| 213 | return [4, null]; // section 4: getDocument() | ||
| 214 | } | ||
| 215 | elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[1]) | ||
| 216 | { | ||
| 217 | return [3, null]; // section 3: modifyData() | ||
| 218 | } | ||
| 219 | elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[2]) | ||
| 220 | { | ||
| 221 | return [2, null]; // relancer section 2: newService() | ||
| 222 | } | ||
| 223 | else | ||
| 224 | { | ||
| 225 | return [0, null]; // menu principal | ||
| 226 | } | ||
| 197 | 227 | ||
| 198 | // possibilité de modification | 228 | return [0, null]; // menu principal |
| 199 | // zenityQuestion | ||
| 200 | //~ if(exec($QuestionModifierPrestation->get()) == '0') | ||
| 201 | //~ { | ||
| 202 | //~ return 3; // section "Modifier un enregistrement" | ||
| 203 | //~ } | ||
| 204 | //~ else | ||
| 205 | //~ { | ||
| 206 | //~ return 0; // menu principal | ||
| 207 | //~ } | ||
| 208 | return 0; // menu principal | ||
| 209 | } | 229 | } |
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php new file mode 100644 index 0000000..cc95468 --- /dev/null +++ b/src/sections/3_modify_data.php | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/3_modify_data.php | ||
| 3 | // | ||
| 4 | // -- SECTION 3: Modifier un client, un prospect, une prestation, un devis -- | ||
| 5 | |||
| 6 | function modifyData($Objet): array | ||
| 7 | { | ||
| 8 | return [0, null]; // menu principal | ||
| 9 | } | ||
diff --git a/src/sections/3_modify_service.php b/src/sections/3_modify_service.php deleted file mode 100644 index 3147969..0000000 --- a/src/sections/3_modify_service.php +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/3_modify_service.php | ||
| 3 | // | ||
| 4 | // -- SECTION 3: Modifier une prestation -- | ||
| 5 | |||
| 6 | function modifyService(): int // code de retour, si 2 aller à la section 2, etc | ||
| 7 | { | ||
| 8 | return(0); // menu principal | ||
| 9 | } | ||
diff --git a/src/sections/4_get_document.php b/src/sections/4_get_document.php new file mode 100644 index 0000000..e28e526 --- /dev/null +++ b/src/sections/4_get_document.php | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/4_get_document.php | ||
| 3 | // | ||
| 4 | // -- SECTION 4: Afficher, imprimer un document -- | ||
| 5 | |||
| 6 | function getDocument($Objet): array | ||
| 7 | { | ||
| 8 | $MenuDocuments = new ZenityList(ZenitySetup::$menu_documents_text, ZenitySetup::$menu_documents_entrees); | ||
| 9 | |||
| 10 | // -- partie 1: type de document -- | ||
| 11 | |||
| 12 | $choix_niv2 = exec($MenuDocuments->get()); | ||
| 13 | if($choix_niv2 === ZenitySetup::$menu_documents_entrees[0]) | ||
| 14 | { | ||
| 15 | |||
| 16 | } | ||
| 17 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[1]) // = Facture | ||
| 18 | { | ||
| 19 | |||
| 20 | } | ||
| 21 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[2]) // = Lettre avec adresse | ||
| 22 | { | ||
| 23 | |||
| 24 | } | ||
| 25 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[3]) // = Livre des recettes | ||
| 26 | { | ||
| 27 | |||
| 28 | } | ||
| 29 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[4]) // = Registre des achats | ||
| 30 | { | ||
| 31 | |||
| 32 | } | ||
| 33 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[5]) // = Bilan annuel | ||
| 34 | { | ||
| 35 | |||
| 36 | } | ||
| 37 | else | ||
| 38 | { | ||
| 39 | return [0, null]; // menu principal | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | // -- partie 2: régénérer les documents latex et pdf -- | ||
| 44 | |||
| 45 | |||
| 46 | // -- partie 3: afficher -- | ||
| 47 | |||
| 48 | |||
| 49 | // -- partie 4: imprimer -- | ||
| 50 | |||
| 51 | |||
| 52 | // -- partie 5: on fait quoi maintenant -- | ||
| 53 | |||
| 54 | return [0, null]; // menu principal | ||
| 55 | } | ||
diff --git a/src/sections/main_loop.php b/src/sections/main_loop.php new file mode 100644 index 0000000..7dd1af0 --- /dev/null +++ b/src/sections/main_loop.php | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | <?php | ||
| 2 | // src/sections/main_loop.php | ||
| 3 | // | ||
| 4 | // -- BOUCLE PRINCIPALE -- | ||
| 5 | |||
| 6 | require('sections/1_customer.php'); | ||
| 7 | require('sections/2_service.php'); | ||
| 8 | require('sections/3_modify_data.php'); | ||
| 9 | |||
| 10 | $main_loop = true; | ||
| 11 | $returned = [0, null]; // [code de retour, éventuelles données] | ||
| 12 | |||
| 13 | while($main_loop) | ||
| 14 | { | ||
| 15 | // -- MENU PRINCIPAL (niveau 1) -- | ||
| 16 | if($returned[0] === 0) | ||
| 17 | { | ||
| 18 | echo("Menu principal\n"); | ||
| 19 | $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); | ||
| 20 | $choix_niv1 = exec($MenuPrincipal->get()); | ||
| 21 | } | ||
| 22 | else | ||
| 23 | { | ||
| 24 | $choix_niv1 = ''; | ||
| 25 | } | ||
| 26 | |||
| 27 | |||
| 28 | // -- SECTION 1: Clients et prospects -- | ||
| 29 | if($choix_niv1 === ZenitySetup::$menu_principal_entrees[0] || $returned[0] === 1) | ||
| 30 | { | ||
| 31 | echo("choix: ". ZenitySetup::$menu_principal_entrees[0] . "\n"); | ||
| 32 | $returned = newCustomer(); | ||
| 33 | } | ||
| 34 | |||
| 35 | // -- SECTION 2: Prestations et devis -- | ||
| 36 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[1] || $returned[0] === 2) | ||
| 37 | { | ||
| 38 | echo("choix: ". ZenitySetup::$menu_principal_entrees[1] . "\n"); | ||
| 39 | $returned = newService($returned[1]); // $returned[1] vaut un type Clients ou null | ||
| 40 | } | ||
| 41 | |||
| 42 | // -- SECTION 3: Modifier un enregistrement -- | ||
| 43 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[2] || $returned[0] === 3) | ||
| 44 | { | ||
| 45 | echo("choix: " . ZenitySetup::$menu_principal_entrees[2] . "\n"); | ||
| 46 | $returned = modifyData(); | ||
| 47 | } | ||
| 48 | |||
| 49 | // -- SECTION 4: Consulter, Imprimer un document -- | ||
| 50 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[3] || $returned[0] === 4) // = Imprimer un document | ||
| 51 | { | ||
| 52 | echo("choix: ". ZenitySetup::$menu_principal_entrees[3] . "\n"); | ||
| 53 | $returned = getDocument(); | ||
| 54 | } | ||
| 55 | |||
| 56 | // -- SECTION 5: Consulter/analyser les données -- | ||
| 57 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[4] || $returned[0] === 5) | ||
| 58 | { | ||
| 59 | echo("choix: ". ZenitySetup::$menu_principal_entrees[4] . "\n"); | ||
| 60 | // quel affichage? des tableaux avec zenity? LaTeX? une page web? un autre outil servant à faire des tableaux et graphiques | ||
| 61 | } | ||
| 62 | |||
| 63 | // -- SECTION 6: Supports de communication -- | ||
| 64 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[5] || $returned[0] === 6) // = Communication | ||
| 65 | { | ||
| 66 | echo("choix: ". ZenitySetup::$menu_principal_entrees[5] . "\n"); | ||
| 67 | $MenuCommunication = new ZenityList(ZenitySetup::$menu_communication_text, ZenitySetup::$menu_communication_entrees); | ||
| 68 | $choix_niv2 = exec($MenuCommunication->get()); | ||
| 69 | if($choix_niv2 === ZenitySetup::$menu_communication_entrees[0]) // = Flyer (nécessite gimp) | ||
| 70 | { | ||
| 71 | exec(windowAppCommand($image_editor, $flyer)); | ||
| 72 | } | ||
| 73 | elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[1]) // = Carte de visite (nécessite scribus) | ||
| 74 | { | ||
| 75 | exec(windowAppCommand($publishing, $business_card)); | ||
| 76 | } | ||
| 77 | elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[2]) // = Explorateur de fichiers | ||
| 78 | { | ||
| 79 | exec(windowAppCommand($file_explorer, $pub)); | ||
| 80 | } | ||
| 81 | else | ||
| 82 | { | ||
| 83 | // retour menu principal | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | // -- SECTION 7: BDD -- | ||
| 88 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[6] || $returned[0] === 7) // = Base de données | ||
| 89 | { | ||
| 90 | echo("choix: ". ZenitySetup::$menu_principal_entrees[6] . "\n"); | ||
| 91 | if($sqlitebrowser_enable) | ||
| 92 | { | ||
| 93 | exec(windowAppCommand(Config::$sqlite_gui, Config::$db_path)); | ||
| 94 | } | ||
| 95 | else | ||
| 96 | { | ||
| 97 | exec($x_term_command . ' ' . $sqlite_cli . ' ' . Config::$db_path); // correpond à priori à: xterm -e sqlite3 ~/ORDIPOLO/Appli_PHP/ordipolo.sqlite | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | // arrêt | ||
| 102 | else | ||
| 103 | { | ||
| 104 | $main_loop = false; | ||
| 105 | } | ||
| 106 | } | ||
