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/main_loop.php | |
| 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/main_loop.php')
| -rw-r--r-- | src/sections/main_loop.php | 106 |
1 files changed, 106 insertions, 0 deletions
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 | } | ||
