예제 #1
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();
 }
예제 #2
0
 public function generateButton()
 {
     if ($this->value == '') {
         $this->value = $this->text;
     }
     $action = $this->action;
     $this->type = strtoupper($action) == 'RESET' ? 'reset' : 'button';
     // if it has a event registered, it's not necessary calculate $onclick
     if ($this->hasEvent('click') || $this->getAjax() != null) {
         return;
     }
     if ($this->type == 'reset') {
         return;
     }
     parent::generateAction();
 }
예제 #3
0
 public function generate()
 {
     if (!count($this->columnWidth)) {
         return '';
     }
     // default code for row selection
     if ($this->select != '') {
         $select = MActionControl::getHref($this->select);
         $this->addCode("{$this->tableId}.customSelect = function() { " . "var cells = this.get(this.rowSelected);" . "var url = '{$select}'; " . "for (c = 0; c < cells.length; ++c) {" . "   url = url.replace('%' + c + '%', cells[c]);" . "}" . "manager.doLinkButton(url,'','','{$this->tableId}'); " . "};");
     }
     $data = json_encode($this->value);
     $cols = json_encode($this->title);
     foreach ($this->columnStyle as $i => $style) {
         $cssCode .= ".field-" . $this->title[$i] . ' ' . ($style ?: '{}') . ' ';
     }
     $cssCode .= '.dgrid-row-even {background-color: #EEE}';
     Manager::getPage()->addStyleSheetCode($cssCode);
     $template = new MTemplate(__DIR__);
     $template->context('manager', Manager::getInstance());
     $template->context('data', $data);
     $template->context('cols', $cols);
     $template->context('id', $this->id);
     $js = $template->fetch('mtexttable.js');
     $this->page->onLoad($js);
     $div = new MContentpane($this->id);
     $div->setWidth($this->width);
     $div->setHeight($this->scrollHeight);
     return $div->generate();
 }
예제 #4
0
 public function onCreate()
 {
     parent::onCreate();
     $this->setRender('anchor');
 }