diff options
| author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
| commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
| tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /src/view/Zenity.php | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'src/view/Zenity.php')
| -rw-r--r-- | src/view/Zenity.php | 32 |
1 files changed, 14 insertions, 18 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) |
