From 1894fc377e6b938ea34df9980567a1634ec6ef48 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 28 Dec 2022 05:19:55 +0100 Subject: =?UTF-8?q?r=C3=A9organisation=20+=20bient=C3=B4t=20finie=20la=20s?= =?UTF-8?q?ection=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/Zenity.php | 29 ++++++++++++++++------------- src/view/ZenitySetup.php | 30 ++++++++++++++++++++++++++++++ src/view/zenity_setup.php | 37 ------------------------------------- 3 files changed, 46 insertions(+), 50 deletions(-) create mode 100644 src/view/ZenitySetup.php delete mode 100644 src/view/zenity_setup.php (limited to 'src/view') diff --git a/src/view/Zenity.php b/src/view/Zenity.php index 1299d1c..72d5eed 100644 --- a/src/view/Zenity.php +++ b/src/view/Zenity.php @@ -1,7 +1,8 @@ get()); abstract class ZenityCmd { @@ -33,17 +34,17 @@ class ZenityList extends ZenityCmd { private $columns = 1; // tableau simple ou multidimensionnel? - public function __construct(string $text, array $rows = [], int $columns = 1) + public function __construct(string $text, array $rows = []) { $this->command_type = ' --list'; parent::__construct($text, $rows); - $this->columns = $columns; - $this->height = 80 + count($this->rows) * 25; - $this->command .= ' --height=' . $this->height; + $this->columns = 1; $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text if($this->rows !== []) { $this->command .= ' --width=' . $this->width; + $this->height = 80 + count($this->rows) * 25; + $this->command .= ' --height=' . $this->height; $this->fillZenityList(); } } @@ -54,8 +55,10 @@ class ZenityList extends ZenityCmd { $this->rows = $rows; $this->columns = count(StructTablesDB::$structureOfTables[$table]); - $this->width = 600; + $this->width = 800; $this->command .= ' --width=' . $this->width; + $this->height = 80 + count($this->rows) * 25; + $this->command .= ' --height=' . $this->height; $this->fillZenityList(); } @@ -100,7 +103,7 @@ class ZenityList extends ZenityCmd class ZenityQuestion extends ZenityCmd { - public function __construct($text) + public function __construct(string $text) { $this->command_type = ' --question'; parent::__construct($text); @@ -114,7 +117,7 @@ class ZenityQuestion extends ZenityCmd // si on clique sur 'Annuler', renvoie une chaine vide class ZenityForms extends ZenityCmd { - public function __construct($text, array $rows) + public function __construct(string $text, array $rows) { $this->command_type = ' --forms'; parent::__construct($text, $rows); @@ -122,12 +125,12 @@ class ZenityForms extends ZenityCmd self::entriesZenityForms($this->rows); } - private function entriesZenityForms($entries) + private function entriesZenityForms(array $input) { $output = ''; - foreach($entries as $one_entry) + foreach($input as $one_question) { - $output .= ' --add-entry="' . $one_entry . '"'; // forme: ' "choix 1" "choix 2"' + $output .= ' --add-entry="' . $one_question . '"'; // forme: ' "choix 1" "choix 2"' } $this->command .= $output; } @@ -135,7 +138,7 @@ class ZenityForms extends ZenityCmd class ZenityCalendar extends ZenityCmd { - public function __construct($text) + public function __construct(string $text) { $this->command_type = ' --calendar'; parent::__construct($text); @@ -144,7 +147,7 @@ class ZenityCalendar extends ZenityCmd class ZenityEntry extends ZenityCmd { - public function __construct($text) + public function __construct(string $text) { $this->command_type = ' --entry'; parent::__construct($text); diff --git a/src/view/ZenitySetup.php b/src/view/ZenitySetup.php new file mode 100644 index 0000000..e8a3ddb --- /dev/null +++ b/src/view/ZenitySetup.php @@ -0,0 +1,30 @@ +get()); -$MenuPrincipal = new ZenityList($menu_principal_text, $menu_principal_entrees); -$QuestionNouveauClient = new ZenityQuestion($question_nouveau_client_text); -$MenuEnregistrement = new ZenityList($menu_enregistrement_text, $menu_enregistrement_entrees); -$MenuDocuments = new ZenityList($menu_documents_text, $menu_documents_entrees); -$MenuCommunication = new ZenityList($menu_communication_text, $menu_communication_entrees); -$RechercheClient = new zenityEntry($recherche_client_text); -$ResultatsRechercheClient = new ZenityList($resultats_recherche_client_text, [], 2); -$NouveauClient = new ZenityForms($nouveau_client_text, $nouveau_client_entrees); -$Calendrier = new ZenityCalendar($calendar_text); -$FormulairePrestation = new ZenityForms($formulaire_text, $formulaire_entrees); -$CommentairePrestation = new ZenityEntry($commentaire_prestation_text); -- cgit v1.2.3