diff options
Diffstat (limited to 'src/view')
| -rw-r--r-- | src/view/Zenity.php | 32 | ||||
| -rw-r--r-- | src/view/ZenitySetup.php | 37 |
2 files changed, 31 insertions, 38 deletions
diff --git a/src/view/Zenity.php b/src/view/Zenity.php index 858dfa9..9e0fd1c 100644 --- a/src/view/Zenity.php +++ b/src/view/Zenity.php | |||
| @@ -6,12 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | abstract class ZenityCmd | 7 | abstract class ZenityCmd |
| 8 | { | 8 | { |
| 9 | protected $command = 'zenity'; | 9 | protected string $command = 'zenity'; |
| 10 | protected $command_type = ''; | 10 | protected string $command_type; |
| 11 | protected $rows = []; | 11 | protected array $rows; |
| 12 | protected $text = ''; | 12 | protected string $text; |
| 13 | protected $width = 300; | 13 | protected int $width = 300; |
| 14 | protected $height = 200; // recalculée en fonction du contenu, vaut au minimum 150 | 14 | protected int $height = 200; // recalculée en fonction du contenu, vaut au minimum 150 |
| 15 | 15 | ||
| 16 | protected function __construct(string $text, array $rows = []) // $rows est optionnel | 16 | protected function __construct(string $text, array $rows = []) // $rows est optionnel |
| 17 | { | 17 | { |
| @@ -22,15 +22,11 @@ abstract class ZenityCmd | |||
| 22 | $this->command .= ' --text="' . $this->text . '"'; | 22 | $this->command .= ' --text="' . $this->text . '"'; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | public function get() | 25 | public function get(): string |
| 26 | { | 26 | { |
| 27 | //echo $this->command . "\n"; | ||
| 27 | return($this->command); | 28 | return($this->command); |
| 28 | } | 29 | } |
| 29 | // pré-remlir un formulaire zenity --forms | ||
| 30 | //~ public function formSet() | ||
| 31 | //~ { | ||
| 32 | //~ return($this->command); | ||
| 33 | //~ } | ||
| 34 | } | 30 | } |
| 35 | 31 | ||
| 36 | 32 | ||
| @@ -46,7 +42,7 @@ class ZenityList extends ZenityCmd | |||
| 46 | $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text | 42 | $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text |
| 47 | if($this->rows !== []) | 43 | if($this->rows !== []) |
| 48 | { | 44 | { |
| 49 | $this->command .= ' --width=' . $this->width; | 45 | $this->command .= ' --width=' . (string)$this->width; |
| 50 | $this->height = 80 + count($this->rows) * 25; | 46 | $this->height = 80 + count($this->rows) * 25; |
| 51 | $this->command .= ' --height=' . $this->height; | 47 | $this->command .= ' --height=' . $this->height; |
| 52 | $this->fillZenityList(); | 48 | $this->fillZenityList(); |
| @@ -65,8 +61,8 @@ class ZenityList extends ZenityCmd | |||
| 65 | $this->width = $this->columns * 120 * $widen; | 61 | $this->width = $this->columns * 120 * $widen; |
| 66 | $this->height = 91 + count($this->rows) * 25; // inclut les lignes et la barre de défilement horizontale | 62 | $this->height = 91 + count($this->rows) * 25; // inclut les lignes et la barre de défilement horizontale |
| 67 | 63 | ||
| 68 | $this->command .= ' --width=' . $this->width; | 64 | $this->command .= ' --width=' . (string)$this->width; |
| 69 | $this->command .= ' --height=' . $this->height; | 65 | $this->command .= ' --height=' . (string)$this->height; |
| 70 | $this->fillZenityList(); | 66 | $this->fillZenityList(); |
| 71 | } | 67 | } |
| 72 | 68 | ||
| @@ -103,11 +99,11 @@ class ZenityList extends ZenityCmd | |||
| 103 | $this->command .= $output; | 99 | $this->command .= $output; |
| 104 | } | 100 | } |
| 105 | 101 | ||
| 106 | public function cleanCommand() | 102 | /*public function cleanCommand() |
| 107 | { | 103 | { |
| 108 | $this->command = 'zenity'; | 104 | $this->command = 'zenity'; |
| 109 | $this->__construct($this->text); | 105 | $this->__construct($this->text); |
| 110 | } | 106 | }*/ |
| 111 | } | 107 | } |
| 112 | 108 | ||
| 113 | class ZenityQuestion extends ZenityCmd | 109 | class ZenityQuestion extends ZenityCmd |
| @@ -131,7 +127,7 @@ class ZenityForms extends ZenityCmd | |||
| 131 | $this->command_type = ' --forms'; | 127 | $this->command_type = ' --forms'; |
| 132 | parent::__construct($text, $rows); | 128 | parent::__construct($text, $rows); |
| 133 | //$this->height = 80 + count($this->rows) * 25; // à tester, mais devrait produire le rendu attendu | 129 | //$this->height = 80 + count($this->rows) * 25; // à tester, mais devrait produire le rendu attendu |
| 134 | self::entriesZenityForms($this->rows); | 130 | $this->entriesZenityForms($this->rows); |
| 135 | } | 131 | } |
| 136 | 132 | ||
| 137 | private function entriesZenityForms(array $input) | 133 | private function entriesZenityForms(array $input) |
diff --git a/src/view/ZenitySetup.php b/src/view/ZenitySetup.php index 88621bf..956c4f0 100644 --- a/src/view/ZenitySetup.php +++ b/src/view/ZenitySetup.php | |||
| @@ -6,29 +6,24 @@ | |||
| 6 | // $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); | 6 | // $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); |
| 7 | 7 | ||
| 8 | // pense-bête | 8 | // pense-bête |
| 9 | // rassembler les 'text' et 'entrées' | 9 | // améliorer les noms "resultats_recherche" |
| 10 | // ce serait plus logique que ce fichier soit en JSON | 10 | // ce serait plus logique que ce fichier soit en JSON |
| 11 | 11 | ||
| 12 | class ZenitySetup | 12 | class ZenitySetup |
| 13 | { | 13 | { |
| 14 | static public $menu_principal_text = "Gestion d'une micro-entreprise"; | 14 | static public $menu_principal = ['text' => "Gestion d'une micro-entreprise", |
| 15 | static public $menu_principal_entrees = ["Clients et prospects", "Prestations et devis", "Modifier un enregistrement", "Consulter, imprimer un document", "Consulter/analyser les données", "Communication", "Base de données"]; | 15 | 'entrees' => ["Clients et prospects", "Prestations et devis", "Modifier un enregistrement", "Consulter, imprimer un document", "Consulter, analyser les données", "Communication", "Base de données"]]; |
| 16 | static public $type_client = ['text' => "Client ou prospect?", | 16 | static public $menu_enregistrement = ['text' => "Type d\'enregistrement?", |
| 17 | 'entrees' => ["Client", "Prospect"]]; | 17 | 'entrees' => ["Devis", "Facture", "Facture à partir d'un devis", "CESU", "Location", "Prestation non vendue"]]; |
| 18 | static public $menu_enregistrement_text = "Type d\'enregistrement?"; | 18 | static public $menu_documents = ['text' => "Consulter, imprimer un document LaTeX", |
| 19 | static public $menu_enregistrement_entrees = ["Devis", "Facture", "Facture à partir d'un devis", "CESU", "Location", "Prestation non vendue"]; | 19 | 'entrees' => ["Devis", "Facture", "Lettre avec adresse", "Livre des recettes", "Registre des achats", "Bilan annuel"]]; |
| 20 | //~ static public $menu_enregistrement_entrees = ["Devis", "Facture", "CESU", "Location", "Prestation non vendue"]; | 20 | static public $menu_communication = ['text' => "Imprimer un support de communication", |
| 21 | static public $menu_documents_text = "Consulter, imprimer un document LaTeX"; | 21 | 'entrees' => ["Flyer (nécessite gimp)", "Carte de visite (nécessite scribus)", "Explorateur de fichiers"]]; |
| 22 | static public $menu_documents_entrees = ["Devis", "Facture", "Lettre avec adresse", "Livre des recettes", "Registre des achats", "Bilan annuel"]; | 22 | static public $recherche_client = ['text' => "Recherche d'un client avec son nom ou son code client"]; |
| 23 | static public $menu_communication_text = "Imprimer un support de communication"; | 23 | static public $resultats_recherche_client = ['text' => "Résultats de la recherche, sélectionner un client"]; |
| 24 | static public $menu_communication_entrees = ["Flyer (nécessite gimp)", "Carte de visite (nécessite scribus)", "Explorateur de fichiers"]; | 24 | static public $resultats_recherche_presta = ['text' => "Sélectionner une prestation"]; |
| 25 | static public $recherche_client_text = "Recherche d'un client avec son nom ou son code client"; | ||
| 26 | static public $resultats_recherche_client_text = "Résultats de la recherche, sélectionner un client"; | ||
| 27 | static public $resultats_recherche_presta_text = "Sélectionner une prestation"; | ||
| 28 | static public $nouveau_client = ['text' => "Nouveau client", | 25 | static public $nouveau_client = ['text' => "Nouveau client", |
| 29 | 'entrees' => ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]]; | 26 | 'entrees' => ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]]; |
| 30 | //~ static public $nouveau_client_text = "Nouveau client"; | ||
| 31 | //~ static public $nouveau_client_entrees = ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]; | ||
| 32 | static public $calendar = ['section2' => 'Nouvelle prestation étape 1/3 - Choisir une date', | 27 | static public $calendar = ['section2' => 'Nouvelle prestation étape 1/3 - Choisir une date', |
| 33 | 'section3' => 'Choisir une nouvelle date']; | 28 | 'section3' => 'Choisir une nouvelle date']; |
| 34 | static public $formulaire = ['text' => 'Nouvelle prestation 2/3 - Détail des travaux', | 29 | static public $formulaire = ['text' => 'Nouvelle prestation 2/3 - Détail des travaux', |
| @@ -36,11 +31,13 @@ class ZenitySetup | |||
| 36 | 'facture_entrees' => ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement:"], | 31 | 'facture_entrees' => ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement:"], |
| 37 | 'facture_entrees_reduit' => ["Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Mode de paiement:"], | 32 | 'facture_entrees_reduit' => ["Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Mode de paiement:"], |
| 38 | 'cesu_entrees' => ["Tâches effectuées:", "Duree de travail:", "Salaire net:", "Mode de paiement:"], // en fait je pourrais ajouter plein d'autres trucs | 33 | 'cesu_entrees' => ["Tâches effectuées:", "Duree de travail:", "Salaire net:", "Mode de paiement:"], // en fait je pourrais ajouter plein d'autres trucs |
| 39 | 'location_entrees' => ["Désignation du bien:", "Modèle, numéro de série, description:", "Valeur:", "État des lieux du début:", "État des lieux de fin:", "Durée de la location en mois:", "Loyer mensuel:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]]; | 34 | 'location_entrees' => ["Désignation du bien:", "Modèle, numéro de série, description:", "Valeur:", "État des lieux du début:", "Durée de la location en semaines:", "Loyer hebdomadaire:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]]; |
| 40 | static public $commentaire_prestation_text = 'Nouvelle prestation 3/3 - Commentaires'; | 35 | static public $commentaire_prestation = ['text' => 'Nouvelle prestation 3/3 - Commentaires']; |
| 41 | static public $modification_client = ['text' => 'Modifier une information concernant un client', | 36 | static public $modification_client = ['text' => 'Modifier une information concernant un client', |
| 42 | 'service' => "Modifier une prestation"]; | 37 | 'service' => "Modifier une prestation"]; |
| 43 | //'return' => "Retour menu principal"]; | 38 | //'return' => "Retour menu principal"]; |
| 39 | static public $type_client = ['text' => "Client ou prospect?", | ||
| 40 | 'entrees' => ["Client", "Prospect"]]; | ||
| 44 | static public $modification_presta = ['text' => 'Modifier une prestation']; | 41 | static public $modification_presta = ['text' => 'Modifier une prestation']; |
| 45 | //'devis_facture' => "Créer une facture à partir d'un devis"]; | 42 | //'devis_facture' => "Créer une facture à partir d'un devis"]; |
| 46 | //'service' => "Modifier une autre prestation", | 43 | //'service' => "Modifier une autre prestation", |
| @@ -52,5 +49,5 @@ class ZenitySetup | |||
| 52 | static public $fin_section_1 = ['text' => "Client enregistré", | 49 | static public $fin_section_1 = ['text' => "Client enregistré", |
| 53 | 'entrees' => ["Ajouter une prestation pour ce client", "Modifier les informations", "Enregistrer un autre client", "Menu principal"]]; | 50 | 'entrees' => ["Ajouter une prestation pour ce client", "Modifier les informations", "Enregistrer un autre client", "Menu principal"]]; |
| 54 | static public $fin_section_2 = ['text' => "Prestation/devis enregistré(e)", | 51 | static public $fin_section_2 = ['text' => "Prestation/devis enregistré(e)", |
| 55 | 'entrees' => ["Afficher le document", "Modifier les informations", "Enregistrer une autre prestation/devis", "Menu principal"]]; | 52 | 'entrees' => ["Afficher le document", "Modifier les informations", "Enregistrer une autre prestation (même client)", "Enregistrer une autre prestation (autre client)", "Menu principal"]]; |
| 56 | } | 53 | } |
