public function render() { empty($this->data) ? $this->_retrieveData() : null; if ($this->template != null) { $this->template->clearErrors(); $template = $this->template->render(); } $ret = "<div>\n {$template}\n </div>"; return $ret; }
public function render() { $id = "multiform-" . $this->index; $this->setId($id); $attributes = $this->getAttributes(); if ($this->data == null) { $this->_retrieveData(); } if ($this->template != null) { $this->template->clearErrors(); $template = $this->template->render(); $count = 0; foreach ($this->data as $index => $data) { foreach ($data as $key => $dat) { $data[$this->templateName . "." . $key . "[]"] = $dat; } //$this->clearErrors(); $this->template->setData($data); //$retval = $this->template->validate(); $this->template->setId("multiform-content-" . $index); $this->template->getElementById("multi-form-buttons")->buttons[0]->addAttribute("onclick", "fapiMultiFormRemove('{$index}')"); $contents .= "<div id='multi-form-content-{$index}'>" . $this->template->render() . "</div>"; } } $ret = "<div {$attributes} >\n <input type='hidden' id='multiform-numitems-{$this->index}' value='{$count}'/>\n <div id='multiform-contents-{$this->index}'>\n {$contents}\n </div>"; $ret .= $this->getShowField() ? "<div class='fapi-multiform-bar'><span onclick='fapiMultiFormAdd({$this->index})' style='font-size:smaller;cursor:pointer'>Add New</span></div>" : ""; $ret .= "</div>\n <div id='multiform-template-{$this->index}' style='display:none'>\n {$template}\n </div>"; return $ret; }