From a45a3e0345890b9df3c5fa7c82966a64491eca02 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 14 Dec 2022 12:52:11 +0100 Subject: MODEL + reorganisation --- php/Zenity.php | 110 --------------------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 php/Zenity.php (limited to 'php/Zenity.php') diff --git a/php/Zenity.php b/php/Zenity.php deleted file mode 100644 index a04b794..0000000 --- a/php/Zenity.php +++ /dev/null @@ -1,110 +0,0 @@ -text = $text; - $this->rows= $rows; - $this->command .= $this->command_type; - $this->command .= ' --title="' . $this->title . '"'; - $this->command .= ' --text="' . $this->text . '"'; - } - - public function get() - { - return($this->command); - } -} - - -class ZenityList extends ZenityCmd -{ - public function __construct($text, array $rows) - { - $this->command_type = ' --list'; - parent::__construct($text, $rows); - $this->height = 80 + count($this->rows) * 25; - $this->command .= ' --width=' . $this->width; - $this->command .= ' --height=' . $this->height; - $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text - self::one_column_zenity_list($this->rows); - } - - public function set_entries($rows_set) // variable renseignée après la construction - { - $this->rows = $rows_set; - } - - private function one_column_zenity_list($rows) - { - $output = ' --column=""'; - foreach($rows as $entry) - { - $output .= ' "' . $entry . '"'; // forme: ' "choix 1" "choix 2"' - } - $this->command .= $output; - } -} - -class ZenityQuestion extends ZenityCmd -{ - public function __construct($text) - { - $this->command_type = ' --question'; - parent::__construct($text); - $this->command .= ' && echo $?'; - // la sortie de "zenity --question" est le statut de sortie "$?" - // $? vaut 0 pour oui, 1 pour non, à ceci près que pour non zenity ne renvoie rien - } -} - -class ZenityForms extends ZenityCmd -{ - public function __construct($text, array $rows) - { - $this->command_type = ' --forms'; - parent::__construct($text, $rows); - //$this->height = 80 + count($this->rows) * 25; // à tester, mais devrait produire le rendu attendu - self::entries_zenity_forms($this->rows); - } - - private function entries_zenity_forms($entries) - { - $output = ''; - foreach($entries as $one_entry) - { - $output .= ' --add-entry="' . $one_entry . '"'; // forme: ' "choix 1" "choix 2"' - } - $this->command .= $output; - } -} - -class ZenityCalendar extends ZenityCmd -{ - public function __construct($text) - { - $this->command_type = ' --calendar'; - parent::__construct($text); - } -} - -class ZenityEntry extends ZenityCmd -{ - public function __construct($text) - { - $this->command_type = ' --entry'; - parent::__construct($text); - } -} -- cgit v1.2.3