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()); }
public function getPageLast() { $pageNumber = $this->getPageNumber(); $pageCount = $this->getPageCount(); if ($pageNumber < $pageCount) { $image = new MLink('', ' '); // $image->setAction('!' . $this->grid->name . '.goPage(' . $pageCount . ');'); $this->goPage[] = array('id' => $image->getId(), 'page' => $pageCount); $image->setClass('mGridNavigatorImage mGridNavigatorImageLastOn'); } else { $image = new MDiv('', ' '); $image->setClass('mGridNavigatorImage mGridNavigatorImageLastOff'); } return $image; }
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); }
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; }