summaryrefslogtreecommitdiff
path: root/src/main_loop.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2023-09-01 12:00:23 +0200
committerpolo <ordipolo@gmx.fr>2023-09-01 12:00:23 +0200
commit45f1b99a1060ee43deb6055faef1f8b16b5d80a2 (patch)
tree2be0c73b839b220433280daaf29d41644ecd4851 /src/main_loop.php
parent6f4cc3afffde36a13618458ffda72e6104624f36 (diff)
downloadAppliGestionPHP-45f1b99a1060ee43deb6055faef1f8b16b5d80a2.zip
section 3 bientôt terminée
Diffstat (limited to 'src/main_loop.php')
-rw-r--r--src/main_loop.php108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/main_loop.php b/src/main_loop.php
new file mode 100644
index 0000000..f68c251
--- /dev/null
+++ b/src/main_loop.php
@@ -0,0 +1,108 @@
1<?php
2// src/sections/main_loop.php
3//
4// -- BOUCLE PRINCIPALE --
5
6require('sections/1_customer.php');
7require('sections/2_service.php');
8require('sections/3_modify_data.php');
9require('sections/4_get_document.php');
10
11$main_loop = true;
12$section = [0, null]; // [code de retour, éventuelles données]
13
14while($main_loop)
15{
16 // -- MENU PRINCIPAL (niveau 1) --
17 if($section[0] === 0)
18 {
19 echo("Menu principal\n");
20 $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees);
21 $choix_niv1 = exec($MenuPrincipal->get());
22 }
23 else
24 {
25 $choix_niv1 = '';
26 }
27
28 // comparaison du retour de $MenuPrincipal->get() avec les noms des entrées du même menu
29
30 // -- SECTION 1: Clients et prospects --
31 if($choix_niv1 === ZenitySetup::$menu_principal_entrees[0] || $section[0] === 1)
32 {
33 echo("choix: ". ZenitySetup::$menu_principal_entrees[0] . "\n");
34 $section = newCustomer();
35 }
36
37 // -- SECTION 2: Prestations et devis --
38 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[1] || $section[0] === 2)
39 {
40 echo("choix: ". ZenitySetup::$menu_principal_entrees[1] . "\n");
41 $section = newService($section[1]); // $section[1] vaut un type Clients ou null
42 }
43
44 // -- SECTION 3: Modifier un enregistrement --
45 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[2] || $section[0] === 3)
46 {
47 echo("choix: " . ZenitySetup::$menu_principal_entrees[2] . "\n");
48 $section = modifyData($section[1]); // $section[1] vaut un type Clients ou null
49 }
50
51 // -- SECTION 4: Consulter, Imprimer un document --
52 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[3] || $section[0] === 4) // = Imprimer un document
53 {
54 echo("choix: ". ZenitySetup::$menu_principal_entrees[3] . "\n");
55 $section = getOrPrintDocument();
56 }
57
58 // -- SECTION 5: Consulter/analyser les données --
59 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[4] || $section[0] === 5)
60 {
61 echo("choix: ". ZenitySetup::$menu_principal_entrees[4] . "\n");
62 // quel affichage? des tableaux avec zenity? LaTeX? une page web? un autre outil servant à faire des tableaux et graphiques
63 }
64
65 // -- SECTION 6: Supports de communication --
66 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[5] || $section[0] === 6) // = Communication
67 {
68 echo("choix: ". ZenitySetup::$menu_principal_entrees[5] . "\n");
69 $MenuCommunication = new ZenityList(ZenitySetup::$menu_communication_text, ZenitySetup::$menu_communication_entrees);
70 $choix_niv2 = exec($MenuCommunication->get());
71 if($choix_niv2 === ZenitySetup::$menu_communication_entrees[0]) // = Flyer (nécessite gimp)
72 {
73 exec(windowAppCommand($image_editor, $flyer));
74 }
75 elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[1]) // = Carte de visite (nécessite scribus)
76 {
77 exec(windowAppCommand($publishing, $business_card));
78 }
79 elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[2]) // = Explorateur de fichiers
80 {
81 exec(windowAppCommand($file_explorer, $pub));
82 }
83 else
84 {
85 // retour menu principal
86 }
87 }
88
89 // -- SECTION 7: BDD --
90 elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[6] || $section[0] === 7) // = Base de données
91 {
92 echo("choix: ". ZenitySetup::$menu_principal_entrees[6] . "\n");
93 if($sqlitebrowser_enable)
94 {
95 exec(windowAppCommand(Config::$sqlite_gui, Config::$db_path));
96 }
97 else
98 {
99 exec($x_term_command . ' ' . $sqlite_cli . ' ' . Config::$db_path); // correpond à priori à: xterm -e sqlite3 ~/ORDIPOLO/Appli_PHP/ordipolo.sqlite
100 }
101 }
102
103 // arrêt
104 else
105 {
106 $main_loop = false;
107 }
108}