blob: 8dac90102237713f2596e6343eb9d5897cb0afb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<?php
// src/main_loop.php
//
// -- BOUCLE PRINCIPALE --
$main_loop = true;
$section = [0, null]; // [code de retour, éventuelles données]
while($main_loop)
{
// -- MENU PRINCIPAL (niveau 1) --
if($section[0] === 0)
{
echo("Menu principal\n");
$MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal['text'], ZenitySetup::$menu_principal['entrees']);
$choix_niv1 = exec($MenuPrincipal->get());
}
else
{
$choix_niv1 = '';
}
// comparaison du retour de $MenuPrincipal->get() avec les noms des entrées du même menu
// -- SECTION 1: Clients et prospects --
if($choix_niv1 === ZenitySetup::$menu_principal['entrees'][0] || $section[0] === 1)
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][0] . "\n");
$section = newCustomer();
}
// -- SECTION 2: Prestations et devis --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][1] || $section[0] === 2)
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][1] . "\n");
$section = newService($section[1]); // $section[1] vaut un type Client ou null
}
// -- SECTION 3: Modifier un enregistrement --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][2] || $section[0] === 3)
{
echo("choix: " . ZenitySetup::$menu_principal['entrees'][2] . "\n");
$section = modifyData($section[1]); // $section[1] vaut un type Client ou null
}
// -- SECTION 4: Consulter, Imprimer un document --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][3] || $section[0] === 4) // = Imprimer un document
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][3] . "\n");
$section = getOrPrintDocument();
}
// -- SECTION 5: Consulter/analyser les données --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][4] || $section[0] === 5)
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][4] . "\n");
// quel affichage? des tableaux avec zenity? LaTeX? une page web? un autre outil servant à faire des tableaux et graphiques
$section = viewData();
}
// -- SECTION 6: Supports de communication --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][5] || $section[0] === 6) // = Communication
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][5] . "\n");
$MenuCommunication = new ZenityList(ZenitySetup::$menu_communication['text'], ZenitySetup::$menu_communication['entrees']);
$choix_niv2 = exec($MenuCommunication->get());
if($choix_niv2 === ZenitySetup::$menu_communication['entrees'][0]) // = Flyer (nécessite gimp)
{
exec(windowAppCommand(Config::$image_editor, $flyer));
}
elseif($choix_niv2 === ZenitySetup::$menu_communication['entrees'][1]) // = Carte de visite (nécessite scribus)
{
exec(windowAppCommand(Config::$publishing, $business_card));
}
elseif($choix_niv2 === ZenitySetup::$menu_communication['entrees'][2]) // = Explorateur de fichiers
{
exec(windowAppCommand($file_explorer, Config::$pub_path));
}
else
{
// retour menu principal
}
}
// -- SECTION 7: BDD --
elseif($choix_niv1 === ZenitySetup::$menu_principal['entrees'][6] || $section[0] === 7) // = Base de données
{
echo("choix: ". ZenitySetup::$menu_principal['entrees'][6] . "\n");
if($sqlitebrowser_enable)
{
exec(windowAppCommand(Config::$sqlite_gui, Config::$db_path));
}
else
{
exec($x_term_command . ' ' . $sqlite_cli . ' ' . Config::$db_path); // correpond à priori à: xterm -e sqlite3 ~/ORDIPOLO/Appli_PHP/ordipolo.sqlite
}
}
// arrêt
else
{
$main_loop = false;
}
}
|