diff options
| author | polo <ordipolo@gmx.fr> | 2022-12-02 15:29:02 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-12-02 15:29:02 +0100 |
| commit | 6b55446d12a5c39d5a4a4584bfabc7507c2f9b74 (patch) | |
| tree | 8e2e337b93391225d5e702a553314164f6139d86 /php/ZenityClasses.php | |
| parent | 473ee4ec50a6bfdfa5c145471b077b7e3749beeb (diff) | |
| download | AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.tar.gz AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.tar.bz2 AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.zip | |
date<->timestamp, ===, renommage, latex
Diffstat (limited to 'php/ZenityClasses.php')
| -rw-r--r-- | php/ZenityClasses.php | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/php/ZenityClasses.php b/php/ZenityClasses.php deleted file mode 100644 index 7965012..0000000 --- a/php/ZenityClasses.php +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | // php/ZenityClasses.php | ||
| 3 | // | ||
| 4 | // commande système zenity | ||
| 5 | |||
| 6 | abstract class Zenity_cmd | ||
| 7 | { | ||
| 8 | protected $command = 'zenity'; | ||
| 9 | protected $command_type = ''; | ||
| 10 | protected $rows = []; | ||
| 11 | private $title = 'ORDIPOLO'; | ||
| 12 | private $text = ''; | ||
| 13 | protected $width = 300; | ||
| 14 | protected $height = 200; // recalculée en fonction du contenu, vaut au minimum 150 | ||
| 15 | |||
| 16 | protected function __construct($text, array $rows = []) // $rows est optionnel | ||
| 17 | { | ||
| 18 | $this->text = $text; | ||
| 19 | $this->rows= $rows; | ||
| 20 | $this->command .= $this->command_type; | ||
| 21 | $this->command .= ' --title="' . $this->title . '"'; | ||
| 22 | $this->command .= ' --text="' . $this->text . '"'; | ||
| 23 | } | ||
| 24 | |||
| 25 | public function get() | ||
| 26 | { | ||
| 27 | return($this->command); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | class Zenity_list extends Zenity_cmd | ||
| 33 | { | ||
| 34 | public function __construct($text, array $rows) | ||
| 35 | { | ||
| 36 | $this->command_type = ' --list'; | ||
| 37 | parent::__construct($text, $rows); | ||
| 38 | $this->height = 80 + count($this->rows) * 25; | ||
| 39 | $this->command .= ' --width=' . $this->width; | ||
| 40 | $this->command .= ' --height=' . $this->height; | ||
| 41 | $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text | ||
| 42 | self::one_column_zenity_list($this->rows); | ||
| 43 | } | ||
| 44 | |||
| 45 | public function set_entries($rows_set) // variable renseignée après la construction | ||
| 46 | { | ||
| 47 | $this->rows = $rows_set; | ||
| 48 | } | ||
| 49 | |||
| 50 | private function one_column_zenity_list($rows) | ||
| 51 | { | ||
| 52 | $output = ' --column=""'; | ||
| 53 | foreach($rows as $entry) | ||
| 54 | { | ||
| 55 | $output .= ' "' . $entry . '"'; // forme: ' "choix 1" "choix 2"' | ||
| 56 | } | ||
| 57 | $this->command .= $output; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | class Zenity_question extends Zenity_cmd | ||
| 62 | { | ||
| 63 | public function __construct($text) | ||
| 64 | { | ||
| 65 | $this->command_type = ' --question'; | ||
| 66 | parent::__construct($text); | ||
| 67 | $this->command .= ' && echo $?'; | ||
| 68 | // la sortie de "zenity --question" est le statut de sortie "$?" | ||
| 69 | // $? vaut 0 pour oui, 1 pour non, à ceci près que pour non zenity ne renvoie rien | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | class Zenity_forms extends Zenity_cmd | ||
| 74 | { | ||
| 75 | public function __construct($text, array $rows) | ||
| 76 | { | ||
| 77 | $this->command_type = ' --forms'; | ||
| 78 | parent::__construct($text, $rows); | ||
| 79 | //$this->height = 80 + count($this->rows) * 25; // à tester, mais devrait produire le rendu attendu | ||
| 80 | self::entries_zenity_forms($this->rows); | ||
| 81 | } | ||
| 82 | |||
| 83 | private function entries_zenity_forms($entries) | ||
| 84 | { | ||
| 85 | $output = ''; | ||
| 86 | foreach($entries as $one_entry) | ||
| 87 | { | ||
| 88 | $output .= ' --add-entry="' . $one_entry . '"'; // forme: ' "choix 1" "choix 2"' | ||
| 89 | } | ||
| 90 | $this->command .= $output; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | class Zenity_calendar extends Zenity_cmd | ||
| 95 | { | ||
| 96 | public function __construct($text) | ||
| 97 | { | ||
| 98 | $this->command_type = ' --calendar'; | ||
| 99 | parent::__construct($text); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | class Zenity_entry extends Zenity_cmd | ||
| 104 | { | ||
| 105 | public function __construct($text) | ||
| 106 | { | ||
| 107 | $this->command_type = ' --entry'; | ||
| 108 | parent::__construct($text); | ||
| 109 | } | ||
| 110 | } | ||
