1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22:
23: namespace picon;
24:
25: 26: 27: 28: 29: 30:
31: class ModalWindow extends Panel
32: {
33: private $dialog;
34: private $style = 'dispaly:none;';
35: private $wrapper;
36: private $panel;
37:
38: public function __construct($id)
39: {
40: parent::__construct($id);
41: $this->wrapper = new MarkupContainer('wrapper');
42: $this->wrapper->setOutputMarkupId(true);
43: $this->add($this->wrapper);
44: $this->dialog = new DialogBehavior();
45: $this->dialog->setModal(true);
46: $this->dialog->setAutoOpen(false);
47: $this->setOutputMarkupId(true);
48: $this->setContent(new EmptyPanel($this->getContentId()));
49: $this->add($this->dialog);
50: }
51:
52: protected function onComponentTag(ComponentTag $tag)
53: {
54: $tag->setName('div');
55: parent::onComponentTag($tag);
56: }
57:
58: public function getContentId()
59: {
60: return 'content-panel';
61: }
62:
63: public function setContent(Panel $panel)
64: {
65: $this->wrapper->addOrReplace($panel);
66: }
67:
68: public function show(AjaxRequestTarget $target)
69: {
70: $target->add($this->wrapper);
71: $target->executeScript(sprintf("$('#%s').dialog('open');", $this->getMarkupId()));
72: }
73:
74: public function hide(AjaxRequestTarget $target)
75: {
76: $target->executeScript(sprintf("$('#%s').dialog('close');", $this->getMarkupId()));
77: }
78:
79: public function setHeight($height)
80: {
81: Args::isNumeric($height, 'height');
82: $this->dialog->setHeight($height);
83: }
84:
85: public function setWidth($width)
86: {
87: Args::isNumeric($width, 'width');
88: $this->dialog->setWidth($width);
89: }
90:
91: public function __get($name)
92: {
93: return $this->$name;
94: }
95:
96: public function __set($name, $value)
97: {
98: $this->$name = $value;
99: }
100: }
101:
102: ?>
103: