Beispiel #1
0
 public function custombox($control)
 {
     $content = array();
     $content[] = $control->toolBar;
     if ($control->caption) {
         $caption = new MLabel($control->caption);
         $caption->setClass('mCustomBoxCaptionLabel');
         $content[] = new MDiv(NULL, $caption, 'mCustomBoxCaption ' . $control->extendClass['title']);
     }
     if ($control->hasItems()) {
         $content[] = new MDiv(NULL, $control->getControls(), 'mCustomBoxContentArea ' . $control->extendClass['content']);
     }
     if ($control->actionBar->hasItems()) {
         $content[] = new MDiv(NULL, $control->actionBar->getControls(), 'mCustomBoxActionBar ' . $control->extendClass['action']);
     }
     $box = new MDiv($control->id, $content);
     $box->setDojoType('Manager.BoxPane');
     $box->addDojoProp('classTitle', $control->extendClass['title']);
     $box->addDojoProp('buttonCancel', 'Fechar');
     $box->addDojoProp('title', $control->caption);
     $box->addDojoProp('toolBar', $control->toolBar->getId());
     $div = new MDiv($control->id . 'Outer', $box);
     $div->cloneStyle($control);
     return $this->div($div);
 }
Beispiel #2
0
 static function colorData($value)
 {
     $control = new MLabel($value);
     $date = Manager::date($value);
     $color = $date->compare('>', '01/10/2011') ? 'blue' : 'red';
     $control->addStyle('color', $color);
     return $control;
 }
 public static function label($column, $i, $row)
 {
     $value = $row[$column->index ?: 0];
     $control = new MLabel($value);
     if ($column->options) {
         $control->setText(($column->grid->showid ? " ({$value})" : '') . $column->options[$value]);
     }
     return $control;
 }
Beispiel #4
0
 public function addAction($label, $image, $action, $params = array())
 {
     $id = md5($params['text']);
     $link = new MImageLinkLabelAction('', '', $action, $image, $this->iconType, $target);
     $link->addEvent('mouseenter', "manager.getElementById('{$id}_hlayout').style.backgroundColor='#EEE';");
     $link->addEvent('mouseout', "manager.getElementById('{$id}_hlayout').style.backgroundColor='white';");
     $bold = new MLabel($label, 'black', true);
     $text = new MLabel($bold->generate() . ': ' . $params['text']);
     $control = new MHContainer($id, array($link, $text));
     $control->setShowLabel(false);
     $class = 'mPanelCell' . ucfirst($this->iconType);
     $link->setClass($class);
     $this->add($control, '', '', '');
 }
Beispiel #5
0
 public function generateInner()
 {
     $this->setRender('hr');
     if ($margin = $this->getMargin()) {
         $this->addStyle('margin-top', "{$margin}");
     }
     if ($this->getText() instanceof MControl) {
         $this->setClass('mSeparator');
         $this->inner = $this->getText()->generate() . $this->render();
     } elseif (trim($this->getText()) != '') {
         $this->setClass('mSeparator');
         $text = new MLabel($this->getText(), $color);
         $this->inner = $text->generate() . $this->render();
     } else {
         $this->setClass('mHr', false);
     }
 }
Beispiel #6
0
 public function generateInner()
 {
     $isFormBase = count($this->actions) || $this->addMenu;
     if ($this->property->base) {
         // this is a FormAction
         if ($this->property->generateBase) {
             $formBase = $this->property->base;
             $path = dirname($this->view->viewFile);
             $base = $this->instance($formBase, $path);
             //new $formBase();
             $base->load();
             $inline = $this->property->inline && !$isFormBase;
             if ($inline) {
                 if (count($base->actions) && !$base->menuAdded) {
                     $this->actions = $base->actions;
                     $title = $this->getTitle();
                     $key = array_search($title, $this->actions);
                     if ($key !== false) {
                         $label = new MLabel($title);
                         $label->setClass('mBoxPaneTitle');
                         $this->actions[$key] = $label;
                     }
                     $this->addMenuBar();
                 }
                 $this->setTitle($base->getTitle());
                 $this->property->base = $base->getBase();
                 $this->property->inline = $base->getInline();
                 $this->property->generateBase = $base->getGenerateBase();
                 $this->inner = $this;
                 return;
             } else {
                 $this->property->generateBase = false;
                 $base->addForm($this);
                 $this->concreteForm = $base;
                 $this->inner = $this->render();
                 return;
             }
         } else {
             if (count($this->actions) && !$this->menuAdded) {
                 $this->addMenuBar();
             }
         }
     } else {
         if (count($this->actions) && !$this->menuAdded) {
             $this->addMenuBar();
         }
     }
     if ($this->page->isWindow()) {
         $this->setClose($this->ui->closeWindow());
     }
     if ($this->property->close == 'modal') {
         if ($this->property->modal) {
             $this->page->onLoad(MUI::closeWindow(''));
         }
         $this->property->close = null;
     }
     parent::generateInner();
     $submit = $this->inner['submit'];
     $body = $this->inner['body'];
     $buttons = $this->inner['buttons'];
     $footer = $this->generateFooter();
     if ($this->property->outerBox) {
         $this->formBox->setCaption($this->property->title);
         if ($this->property->close) {
             $this->formBox->setClose($this->property->close);
         }
         $this->formBox->setControls(array($this->header, $body, $this->footer));
         if ($buttons) {
             $this->formBox->addAction($buttons);
         }
         $this->setClass("mForm");
         if (!is_null($this->align)) {
             $this->addStyle('text-align', $this->align);
         }
     } else {
         $this->formBox = new MContainer($this->getId(), $body);
         if ($buttons) {
             $this->formBox->addControl($buttons);
         }
         if (!is_null($this->align)) {
             $this->formBox->addStyle('text-align', $this->align);
         }
     }
     $form = new MConcreteForm($this->tagId);
     $form->addContent($this->formBox);
     $form->setAction($this->action);
     $form->setEnctype($this->enctype);
     $form->setMethod($this->method);
     if ($this->enterSubmit) {
         $button = $this->buttons[$this->enterSubmit];
         $event = MAction::getOnClick($button->getAction(), $this->enterSubmit);
         $form->addEvent('keypress', "if (event.keyCode==dojo.keys.ENTER) { event.preventDefault();{$event};}", false);
     }
     if ($this->enterAction) {
         $event = MAction::getOnClick($this->enterAction, $this->tagId);
         $form->addEvent('keypress', "if (event.keyCode==dojo.keys.ENTER) { event.preventDefault();{$event};}", false);
     }
     $this->page->onSubmit($submit, $this->tagId);
     $this->concreteForm = $form;
     $this->inner = $this->render();
 }