Exemplo n.º 1
0
 public function generate()
 {
     $div = new MDiv($this->id, ' ', 'mButtonIcon ' . $this->icon);
     $action = MAction::getOnClick($this->value, $this->id);
     $div->addEvent('click', $action);
     return $div->generate();
 }
Exemplo n.º 2
0
 public function generateColumns()
 {
     $p = 0;
     $last = count($this->columns) - 1;
     foreach ($this->columns as $k => $column) {
         $this->dcolumns[$p] = new StdClass();
         $this->dcolumns[$p]->id = $p;
         $this->dcolumns[$p]->field = $column->field ?: 'field' . $p;
         if ($column instanceof MGridAction) {
             if ($column->type == 'select') {
                 $rowCount = count($this->data);
                 $control = new MCheckBox($this->id . "chkAll", 'chkAction', '');
                 $control->addEvent('click', $this->id . ".checkAll({$rowCount});", false);
                 $this->dcolumns[$p]->className = 'select';
             } elseif ($column->type == 'icon') {
                 $control = new MDiv('', '', 'managerIcon');
                 $this->dcolumns[$p]->className = 'actionIcon';
             } elseif ($column->type == 'text') {
                 $control = new MDiv('', '', '');
             }
             $this->dcolumns[$p]->sortable = false;
         } elseif ($column instanceof MGridColumn) {
             if (!$column->visible) {
                 continue;
             }
             $control = new MDiv('', $column->title, '');
             $class = $column->getClass();
             if ($class) {
                 $this->dcolumns[$p]->className = $class;
             }
             $this->dcolumns[$p]->sortable = !$column instanceof MGridControl;
         }
         $this->dcolumns[$p++]->label = $control->generate();
     }
 }
Exemplo n.º 3
0
 public function generate()
 {
     parent::generateAction();
     $div = new MDiv($this->getId(), ' ', 'mButtonFind');
     $div->setAjax($this->getAjax());
     $div->setEvent($this->getEvent());
     $div->setHTMLTitle($this->title);
     return $div->generate();
 }
Exemplo n.º 4
0
 public function generate()
 {
     parent::generateAction();
     $div = new MDiv($this->id, ' ', 'toolIcon toolIcon' . ucfirst($this->icon));
     $div->setAjax($this->getAjax());
     $div->setEvent($this->getEvent());
     $div->setHTMLTitle($this->title);
     return $div->generate();
 }
Exemplo n.º 5
0
 public function generate()
 {
     $div = new MDiv("ddm_{$this->control->id}", $this->control);
     $this->control->setClass("dojoDndItem");
     $js = "ddm_{$this->control->id} = new dojo.dnd.Source('ddm_{$this->control->id}'";
     $js .= $this->options->hasItems() ? ",{" . $this->options->getText(':', ',') . "}" : '';
     $js .= ");";
     $js .= "dojo.parser.parse(\"dojo.byId('ddm_{$this->control->id}')\");";
     $this->page->onLoad($js);
     return $div->generate();
 }
Exemplo n.º 6
0
 public function generate()
 {
     $icon = new MImage('', '', 'managerIcon managerIconCursor managerIcon' . ucfirst($this->icon));
     if ($this->text) {
         $text = new MSpan('', $this->text, 'managerIconText managerIconCursor');
     }
     $div = new MDiv($this->id, array($icon, $text), 'mToolIcon');
     $action = MAction::getOnClick($this->action, $div->id);
     $div->addEvent('click', $action);
     if ($this->title) {
         $div->setHTMLTitle($this->title);
     }
     return $div->generate();
 }
Exemplo n.º 7
0
 public function __construct($name = NULL, $label = NULL, $location = NULL, $attrs = NULL)
 {
     parent::__construct();
     $this->image = new MImage($name, $label, $location, $attrs);
     $this->mlabel = new MLabel($label);
     $this->setClass('mImageCentered');
 }
Exemplo n.º 8
0
 public function init($space = NULL)
 {
     parent::init('', ' ', 'mSpacer');
     if (!is_null($space)) {
         $this->addStyle('line-height', $space);
     }
 }
Exemplo n.º 9
0
 public function generate()
 {
     $onclick = MAction::getOnClick($this->action, $this->property->id);
     $this->addEvent('click', $onclick);
     $this->setContent($this->label);
     return parent::generate();
 }
Exemplo n.º 10
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();
 }
Exemplo n.º 11
0
 public function init($text = NULL, $margin = '', $color = '', $height = '1px')
 {
     parent::init();
     $this->setText($text);
     $this->setColor($color);
     $this->setMargin($margin);
     $this->setHeight($height);
 }
Exemplo n.º 12
0
 public function generateLink($text)
 {
     $spanClass = 'mImageLinkLabel';
     if ($this->imageType == 'normal') {
         $spanClass .= ' mImageLabel';
     }
     $span = new MSpan('label' . $this->getId(), $this->getLabel(), $spanClass);
     if ($this->imageType == 'icon') {
         $span->setClass('mImageLinkLabelIcon');
         $text .= $span->generate();
     } else {
         $text .= $span->generate();
         if ($this->getSource()) {
             $text = new MDiv('', $text);
             $text->setClass('mImageSource');
         }
     }
     return new MLink('link' . $this->getId(), '', $this->getAction(), $text, $this->getTarget());
 }
Exemplo n.º 13
0
 public function generate()
 {
     $this->setId(uniqid());
     if ($this->useStore) {
     } else {
         $onclick = MAction::getOnClick($this->action, $this->getId());
         $this->addEvent('click', $onclick);
     }
     $this->setContent(MUtil::detectUTF8($this->label) ? $this->label : utf8_encode($this->label));
     return parent::generate();
 }
Exemplo n.º 14
0
 public static function icon($action, $i, $row)
 {
     $value = $action->value;
     $image = 'managerIcon managerIcon' . ucfirst($value) . ($action->enabled ? 'On' : 'Off');
     if ($action->enabled) {
         $actionLink = $action->generateLink($row);
         $action->id = uniqid($action->grid->currentRow);
         $control = $action->grid->linkType == 'hyperlink' ? new MImageLink($action->id, $action->alt, $image) : new MImageButton($action->id, $action->alt, $image);
         $actionAjax = $action->getAjax();
         if ($actionAjax) {
             $ajax = clone $actionAjax;
             $ajax->url = $actionLink;
             $control->setAjax($ajax);
         } else {
             $control->setAction($actionLink);
         }
     } else {
         $control = new MDiv('', $action->alt, $image);
     }
     $control->setHTMLTitle(ucfirst($value));
     return $control;
 }
Exemplo n.º 15
0
 public function onCreate()
 {
     parent::onCreate();
     $this->setRender('menuseparator');
 }
Exemplo n.º 16
0
 public function onCreate()
 {
     parent::onCreate();
     $this->setRender('concreteform');
 }
Exemplo n.º 17
0
 public function generate()
 {
     $this->generateInner();
     if ($this->getScrollable()) {
         $f[] = new MDiv('', $this->getCaption(), 'mScrollableLabel');
         $html = $this->getInnerToString();
         $f[] = $div = new MDiv('', $html, 'mScrollableField');
         $div->height = $this->getScrollHeight();
     } elseif ($this->property->fieldset) {
         $this->setClass('mBaseGroup', false);
         $f = $this->render();
     } else {
         $f = $this->inner;
     }
     $outer = new MDiv('', $f);
     return $outer->generate();
 }
Exemplo n.º 18
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();
 }
Exemplo n.º 19
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();
     }
 }
Exemplo n.º 20
0
 public function generate()
 {
     $div = new MDiv('', $this->object . ': ' . $this->target, 'mContentHeader');
     return $div->generate();
 }
Exemplo n.º 21
0
 public function generateLayoutVertical()
 {
     $id = $this->id ?: 'mv' . uniqid();
     list($layout, $hidden) = $this->getLayout();
     $array = array();
     $row = $i = $j = 0;
     foreach ($layout as $control) {
         if ($control->checkAccess()) {
             $label = $hint = NULL;
             $pos = ($i == 0 ? ' firstCell' : ($i == $j ? ' lastCell' : '')) . ' cell' . $i;
             if (!$control instanceof MContainer) {
                 if ($this->isShowLabel()) {
                     $label = $control->generateLabel();
                 }
                 $hint = $control->generateHint();
             }
             if ($this->labelMode == MFieldLabel::LABEL_ABOVE) {
                 $div = new MDiv($id . '_row' . $i, array($label, $control->generate(), $hint), 'mContainerRow' . $pos);
             } else {
                 // MFieldLabel::LABEL_SIDE
                 $div = new MHContainer($id . '_row' . $i, array($label, $control->generate() . $hint));
             }
             $height = $control->getRowHeight();
             if ($height != '') {
                 $div->setHeight($height);
             }
             $array[] = $div;
             $i++;
         }
     }
     $div = new MDiv($id, $array, 'mVContainer');
     $div->cloneStyle($this);
     $div->setClass('mVContainer');
     return array($div, $hidden);
 }
Exemplo n.º 22
0
 public function __construct($object, $target)
 {
     parent::__construct();
     $this->object = $object;
     $this->target = $target;
 }
Exemplo n.º 23
0
 public function __construct()
 {
     $a = 'teste';
     parent::__construct('userBar', $a, 'mUserBar');
 }
Exemplo n.º 24
0
 public function generate()
 {
     $this->page->addDojoRequire("dojo/store/Memory");
     $this->goPage = array();
     $element[] = $this->getPageImagesLinks();
     $element[] = $this->getPageRange();
     $this->generateJsCode();
     $d = new MDiv('', $element, 'mGridNavigation');
     $code = "function(e){var page = {$this->jsId}.getGoPage().get(e.target.id).page; {$this->jsId}.goPage(page);}";
     $d->addEvent("click", "!" . $code);
     return $d;
 }
Exemplo n.º 25
0
 public function __construct()
 {
     parent::__construct('', '', 'mHr');
 }
Exemplo n.º 26
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();
 }
Exemplo n.º 27
0
 public function generateInner()
 {
     $id = $this->getId();
     $value = $this->getValue();
     $numFields = count($this->fields);
     // fields
     $fields = '';
     $n = 1;
     $ref = '';
     $totalWidth = 0;
     foreach ($this->fields as $f) {
         $ref .= ($ref ? ',' : '') . $f->getName();
         $f->form = $this->form;
         $f->setLabel(htmlspecialchars($f->label));
         //$f->formMode = 2;
         $fields[] = $f;
         $totalWidth += $width[] = $f->width ?: '15';
         $n++;
     }
     $btnInsert = new MButton("{$id}_btnInsert", 'Inserir', "!{$id}_ajaxInsert();");
     $actionInsert = MAction::getHref($this->actionInsert);
     $this->page->addJsCode("{$id}_ajaxInsert = function() {  manager.doAjaxText('{$actionInsert}', '{$id}_divGrid', '{$id}_btnInsert') };");
     $fields[] = $btnInsert;
     $field = new MContentPane("{$id}_divGrid");
     $select = $field;
     $btnDelete = new MButton("{$id}_btnDelete", 'Remover selecionados', "!{$id}_ajaxDelete();");
     $actionDelete = MAction::getHref($this->actionDelete);
     $this->page->addJsCode("{$id}_ajaxDelete = function() {  manager.doAjaxText('{$actionDelete}', '{$id}_divGrid', '{$id}_btnDelete') };");
     // layout
     $t = array();
     $array[] = new MDiv('', new MHContainer("{$id}_containerFields", $fields));
     $array[] = new MDiv('', $select);
     $array[] = new MDiv('', $btnDelete);
     $container = new MVContainer('', $array);
     $group = new MBaseGroup('', $this->getCaption(), $container);
     if (strpos($this->actionGrid, Manager::getBaseURL()) !== false) {
         $actionGrid = $this->actionGrid;
     } else {
         $actionGrid = MAction::getHref($this->actionGrid . ($value ? '/' . $value : ''));
     }
     $this->page->onLoad(MUI::set("{$id}_divGrid", 'href', $actionGrid) . ';');
     $div = new MDiv($this->name, $group);
     $div->attributes = clone $this->attributes;
     $div->style = clone $this->style;
     $div->setClass('mGridField');
     $this->inner = array($div);
     return $this->inner;
 }