protected function build() { $this->add(new HiddenBox($this->id)); $build_tag_from_datasource = false; if ($this->get_par('database-save-parameters')) { $this->att('class', 'osy-taglist-onextab', true); $build_tag_from_datasource = true; } $ul = $this->add(tag::create('ul')); if ($sql = $this->get_par('datasource-sql')) { $sql = HelperOsy::replacevariable($sql); $res = $this->db->exec_query($sql, null, 'NUM'); $datalist = $this->add(tag::create('datalist')); $datalist->att('id', $this->id . '_data'); foreach ($res as $k => $rec) { if ($rec[2] == 1) { $ul->add('<li class="osy-taglist-entry" tid="' . $rec[0] . '"><span class="osy-taglist-entry-text">' . $rec[1] . '</span><a href="#" class="osy-taglist-entry-remove">remove</a></li>'); } $datalist->add(tag::create('option'))->add($rec[1]); } } if (!$build_tag_from_datasource && !empty($_REQUEST[$this->id])) { $item_list = explode(',', $_REQUEST[$this->id]); foreach ($item_list as $k => $v) { $ul->add('<li class="osy-taglist-entry" pos="' . $k . '"><span class="osy-taglist-entry-text">' . $v . '</span><a href="#" class="osy-taglist-entry-remove">remove</a></li>'); } } $txt = $ul->add(tag::create('li'))->att('class', 'listbuilder-entry-text')->add(tag::create('input'))->att('name', $this->id . '_add')->att('type', 'text')->att('class', 'add osy-taglist-input'); if (isset($datalist)) { $txt->att('list', $this->id . '_data'); } $ul->add('<br style="clear: both">'); }