| 1 | <?php |
||
| 5 | class Modal extends AbstractResponder |
||
| 6 | { |
||
| 7 | const OBJECT_IDENTIFIER = 'modal'; |
||
| 8 | |||
| 9 | const OPTION_TYPE = 'type'; |
||
| 10 | const OPTION_HTML = 'html'; |
||
| 11 | const OPTION_CLOSE = 'close'; |
||
| 12 | const OPTION_AUTOREMOVE = 'autoremove'; |
||
| 13 | |||
| 14 | const DEFAULT_TYPE = 'twitterbootstrap'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Constructor |
||
| 18 | * |
||
| 19 | * @param string $html HTML for a new modal or a jquery selector for an |
||
| 20 | * existing modal |
||
| 21 | * @param string $type Type of modal to create |
||
| 22 | * @param bool $autoremove Remove the modal from the dom when it is closed |
||
| 23 | */ |
||
| 24 | public function __construct($html, $type = self::DEFAULT_TYPE, $autoremove = true) |
||
| 25 | { |
||
| 26 | $this->registerOption(self::OPTION_HTML); |
||
| 27 | $this->registerOption(self::OPTION_TYPE); |
||
| 28 | $this->registerOption(self::OPTION_CLOSE); |
||
| 29 | $this->registerOption(self::OPTION_AUTOREMOVE); |
||
| 30 | |||
| 31 | $this->setOption(self::OPTION_HTML, $html); |
||
| 32 | $this->setOption(self::OPTION_TYPE, $type); |
||
| 33 | $this->setOption(self::OPTION_AUTOREMOVE, (bool)$autoremove); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Close modal |
||
| 38 | * |
||
| 39 | * @return Modal |
||
| 40 | */ |
||
| 41 | public function close() |
||
| 47 | } |
||
| 48 |