1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13:
14:
15: 16: 17: 18: 19:
20: class NImageButton extends NSubmitButton
21: {
22:
23: 24: 25: 26:
27: public function __construct($src = NULL, $alt = NULL)
28: {
29: parent::__construct();
30: $this->control->type = 'image';
31: $this->control->src = $src;
32: $this->control->alt = $alt;
33: }
34:
35:
36:
37: 38: 39: 40:
41: public function getHtmlName()
42: {
43: $name = parent::getHtmlName();
44: return strpos($name, '[') === FALSE ? $name : $name . '[]';
45: }
46:
47:
48:
49: 50: 51: 52:
53: public function loadHttpData()
54: {
55: $path = $this->getHtmlName(); 56: $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
57: $this->setValue(NArrayTools::get($this->getForm()->getHttpData(), $path) !== NULL);
58: }
59:
60: }
61: