Beispiel #1
0
    public function generateInner()
    {
        $js = "!{$this->popupName}.start();";
        $text = $this->getText();
        if ($text == '' || !$text) {
            $button = new MButtonIcon($js);
            $button->setIcon('managerIconButtonNew');
        } else {
            if ($text == 'hidden') {
                $button = new MLabel('');
            } else {
                $button = new MButton('', $text, $js);
            }
        }
        $html = $button->generate();
        $action = MAction::getHref($this->action);
        $jsCode = <<<HERE
        {$this->popupName}.setContext({
             name    : '{$this->popupName}',
             action  : '{$action}',
             related : '{$this->related}',
             filter  : '{$this->filter}',
             field   : '{$this->name}'
        });
HERE;
        $this->page->addJsCode("{$this->popupName} = new Manager.FormPopup();");
        $this->page->addJsCode($jsCode);
        $this->inner = new MDiv('', $html, '');
    }
 public function onCreate()
 {
     parent::onCreate();
     $this->setRender('buttondropdown');
     $this->setAction('');
     $this->menu = new MMenu();
 }
Beispiel #3
0
 public function generateInner()
 {
     if ($this->visible) {
         parent::generateButton();
         $this->value = '';
         $this->inner = $this->generateLabel() . $this->render();
     }
 }
Beispiel #4
0
    private function body()
    {
        $data = $this->model->getData();
        $strTr = "";
        if ($data) {
            if ($this->columns) {
                foreach ($data as $v) {
                    $tmp = '';
                    foreach ($this->columns as $k1 => $v1) {
                        $value = isset($v1['type']) ? app()->formatter->format($v1['type'], $v[$k1], isset($v1['htmlOptions']) ? $v1['htmlOptions'] : array()) : $v[$k1];
                        $tmp .= "<td><span class='{data-{$k1}}'>{$value}</span></td>";
                        $buttonsStr = '';
                    }
                    if ($this->buttons) {
                        $buttonsStr = $this->buttons->render($v);
                    }
                    $strTr .= "<tr>" . $tmp . $buttonsStr . "</tr>";
                }
            } else {
                foreach ($data as $v) {
                    $tmp = '';
                    foreach ($v as $k1 => $v1) {
                        $value = isset($v1['type']) ? app()->formatter->format($v1['type'], $v1, isset($v1['htmlOptions']) ? $v1['htmlOptions'] : array()) : $v1;
                        $tmp .= "<td><span class='{data-{$k1}}'>{$value}</span></td>";
                    }
                    $buttonsStr = '';
                    if ($this->buttons) {
                        $buttonsStr = $this->buttons->render($v);
                    }
                    $strTr .= "<tr>" . $tmp . $buttonsStr . "</tr>";
                }
            }
        }
        return <<<eot
            <tbody>
                {$strTr}
            </tbody>
eot;
    }
Beispiel #5
0
 public function inputFile($control)
 {
     $this->page->addDojoRequire('dojox.form.Uploader');
     $control->addDojoProp('multiple', $control->multiple ? true : false);
     $this->page->onLoad("manager.page.fileUpload = 'yes';");
     $this->page->onLoad("manager.byId('{$control->getId()}').reset();");
     $this->page->addDojoRequire("dojox.form.uploader.plugins.IFrame");
     $this->page->addDojoRequire("dojox.form.Uploader");
     $this->page->addDojoRequire("dojox.form.uploader.FileList");
     $control->setDojoType('dojox.form.Uploader');
     $control->addDojoProp('label', $control->text);
     $inner = $this->inputfield($control);
     $hidden = new MHiddenField("__ISFILEUPLOADPOST[{$control->getId()}]", 'yes');
     $btnClearList = new MButton($control->getId() . "ClearFiles", 'Apagar');
     $btnClearList->setClass('mFileFieldReset');
     $btnClearList->addEvent('click', "manager.byId('{$control->getId()}').reset();");
     if ($control->multiple) {
         $divFiles = new MDiv($control->getId() . "Files");
         $divFiles->setDojoType("dojox.form.uploader.FileList");
         $divFiles->addDojoProp("uploaderId", $control->getId());
         $divFiles->setWidth('445px');
         $divFiles->addDojoProp("headerFilename", "Arquivo");
         $divFiles->addDojoProp("headerType", "Tipo");
         $divFiles->addDojoProp("headerFilesize", "Tamanho");
         $fieldset = new MBaseGroup();
         $fieldset->addControl(new MHContainer('', array($inner, $btnClearList)));
         $fieldset->addControl($divFiles);
         $fieldset->setWidth('450px');
     } else {
         $input = new MDiv($control->getId(), new MLabel($control->text));
         $input->setDojoType('dojox.form.Uploader');
         $input->addDojoProp('showInput', 'after');
         $input->addDojoProp('name', $control->getId());
         $input->addDojoProp('force', 'iframe');
         $fieldset = new MHContainer('', array($input, $btnClearList));
     }
     return $fieldset->generate() . $hidden->generate();
 }
Beispiel #6
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();
 }