Example #1
0
 public function generate()
 {
     $content = '';
     if (!is_array($this->message)) {
         $this->message = array($this->message);
     }
     $this->box = new MBox($this->caption, $this->close, '');
     $textBox = new MDiv($this->id . 'BoxText', $this->message);
     $this->box->setControls($textBox);
     $form = $this->form instanceof MBaseForm ? $this->form->getTagId() : '';
     $b = new MButton("{$this->id}HelpButton", 'Fechar', "!manager.byId('{$this->id}Help').hide();");
     $this->box->addAction($b);
     $help = new MDiv("{$this->id}Help", new MDiv("{$this->id}Box", $this->box, "mHelp"));
     $help->addStyle('display', 'none');
     $help->setDojoType('Manager.DialogSimple');
     return $help->generate();
 }
Example #2
0
 public function generate()
 {
     $this->generateData();
     $this->generateJsCode();
     $header = $this->painter->generateToString($this->generateHeader());
     $body = $this->painter->generateToString($this->generateBody());
     $fields = $this->painter->generateToString($this->generateFields());
     $footer = $this->painter->generateToString($this->generateFooter());
     $class = 'mGrid' . ($this->scrollable ? '' : ' mGridNoScroll');
     $grid = new MDiv($this->name . 'Div', array($header, $body, $fields, $footer), $class);
     if ($this->width != '') {
         $grid->addStyle('width', $this->width);
     }
     if ($this->scrollHeight != '') {
         $grid->addStyle('height', $this->scrollHeight);
         $grid->addStyle('overflow', 'auto');
     }
     $this->generateEvent();
     $hasForm = $this->form instanceof MBaseForm || $this->hasForm;
     if (!$hasForm) {
         $this->setForm(new MForm());
         $this->form->setName('form' . ucfirst($this->name));
         $this->form->addField($grid);
         return $this->form->generate();
     } else {
         if ($this->caption != '') {
             $box = new MBox($this->caption, $this->close, '');
             $box->setControls($grid);
         } else {
             $box = $grid;
         }
         return $box->generate();
     }
 }
Example #3
0
 public function generate()
 {
     $internalForm = false;
     if (!is_array($this->message)) {
         $this->message = array($this->message);
     }
     $this->box = new MBox($this->caption, $this->close, '');
     $type = ucfirst($this->promptType);
     $m = new MUnorderedList($this->id . 'Message', $this->message);
     $m->type = 'none';
     $textBox = new MDiv($this->id . 'BoxText', $m, "text");
     $iconBox = new MDiv($this->id . 'BoxIcon', '', "icon icon{$type}");
     $imageTextBox = new MHContainer('', array($iconBox, $textBox));
     $imageTextBox->setClass('mPromptBox');
     $this->box->setControls($imageTextBox);
     if (!$this->form instanceof MBaseForm) {
         $this->form = new MSimpleForm();
         $this->controls[0] = $this->form;
         $internalForm = true;
     }
     if ($this->buttons) {
         foreach ($this->buttons as $button) {
             list($label, $action, $event) = $button;
             $name = $this->name . trim($label);
             $spanLabel = new MDiv('', $label, 'button');
             $b = new MButton($name, $spanLabel->generate());
             $onclick = "manager.byId(\"{$this->id}\").hide();" . ($action ? MAction::getOnClick($action, $this->form->getTagId()) : '');
             $b->addEvent('click', $onclick, true, false);
             $this->box->addAction($b);
         }
     }
     $this->box->setExtendClass("title title{$type}");
     $this->controls[1] = new MDiv("{$this->id}Box", $this->box, "mPrompt");
     $prompt = new MDiv("{$this->id}Pane", $this->controls);
     if (($this->form instanceof MBaseForm and !$internalForm) || !$this->page->isPostBack()) {
         $prompt = new MDiv($this->id, $prompt, '', $this->getStyle());
         $prompt->addStyle('display', 'none');
         $prompt->setDojoType('Manager.DialogSimple');
     }
     return $prompt->generate();
 }