protected function build() { $form = $this->closest('form'); if (is_object($form)) { $form->att('enctype', 'multipart/form-data'); } $label = $this->add(new Tag('label'))->att('class', 'osy-filebox-virtual')->att('for', $this->id); $label->add('<span class="osy-filebox-filename"></span>'); $label->add('<span class="fa fa-cloud-upload osy-filebox-button"></span>'); if (!empty($_REQUEST[$this->id . '_message'])) { $this->add(Tag::create('div'))->att('class', 'osy-filebox-message')->add($_REQUEST[$this->id . '_message']); } }
protected function build() { if ($range = $this->get_par('slider-range')) { $this->att('data-range', $range); $this->add(new HiddenBox($this->id . '_min')); $this->add(new HiddenBox($this->id . '_max')); } else { $this->add(new HiddenBox($this->id)); } $min = $this->get_par('min'); $div_min_max = $this->add(tag::create('div')); $div_min_max->att('class', 'osy-slider-min-max'); $div_min_max->add(' '); if ($min == '0' or !empty($min)) { if ($min[0] == '$') { eval('$min = ' . $min . ';'); } $div_min_max->add('<span class="lbl-min">' . $min . '</span>'); $this->att('data-min', $min); } $bar = $this->add(tag::create('div'))->att('class', 'osy-slider-bar'); if ($max = $this->get_par('max')) { if ($max[0] == '$') { eval('$max = ' . $max . ';'); } $div_min_max->add('<span class="lbl-max">' . $max . '</span>'); $this->att('data-max', $max); } if (!empty($_REQUEST[$this->id . '_min']) && !empty($_REQUEST[$this->id . '_max'])) { $this->att('data-values', $_REQUEST[$this->id . '_min'] . ',' . $_REQUEST[$this->id . '_max']); } $this->add('<script> oslider.onevent("onstop","' . $this->id . '",function(event,ui){ ' . $this->get_par('onstop') . ' }); </script>'); //$this->add('<span class="osy-slider-result"></span>'); }
protected function buildFieldSearch() { if (!empty($_POST['ajax'])) { return; } $div = new Dummy('osy-dataview-2-search'); $div->att('class', "osy-dataview-2-search"); $div->par('colspan', '100', function ($key, $val, $self) { $self->man('onbuild', 'colspan', function ($key, $val, $self) { $cel = $self->closest('td,th'); if (!is_object($cel)) { return; } $cel->att('colspan', '100'); }); }); $this->form->put($div, '', 'bar-search', 2, 1); $div->add("Cerca"); $div->add(new TextBox('search_value'))->att('size', '40'); $div->add(" in "); $select = $div->add(new ComboBox('search_field')); //Tasto ricerca $div->add(new Button('btn_search'))->att('label', 'Ricerca'); //Tasto pulisci filtro $div->add(new Button('btn_search_reset'))->att('label', 'Elimina filtro'); //Contenitore dei filtri attivi $div_flt_cnt = $div->add(tag::create("div"))->att('class', 'filter-active'); if (array_key_exists('filter', $_POST) && is_array($_POST['filter'])) { foreach ($_POST['filter'] as $k => $v) { $div_flt = $div_flt_cnt->add(tag::create('div'))->att("class", "filter"); $div_flt->add(new hidden_box("filter[{$k}]"))->Att('value', $v); switch ($k[0]) { case '!': case '€': case '$': case '#': $k = substr($k, 1); break; case '_': list($a, $k) = explode(',', $k); break; } $div_flt->add("{$k} : {$v}"); } $div->add($div_flt_cnt); } else { $div->par('init-cell', 'hidden', function ($key, $val, $self) { $self->man('onbuild', 'init-cell', function ($key, $val, $self) { $cel = $self->closest('td,th'); if (!is_object($cel)) { return; } $cel->att('class', $val)->att('colspan', '100'); }); }); } $div_flt_cnt->add(tag::create("div"))->att("style", "clear: both"); }
private function buildBranch($dat, $lev = 0) { if (empty($dat)) { return; } $len = count($dat) - 1; $cur_val = get_global($this->name, $_REQUEST); foreach ($dat as $k => $rec) { $val = array(); foreach ($rec as $j => $v) { if (!is_numeric($j)) { continue; } if (count($val) == 2) { continue; } $sta = empty($lev) ? '' : '|'; $end = $len == $k ? "\\" : "|"; $val[] = empty($val) ? $v : str_repeat(' ', $lev * 5) . $v; } $sel = $cur_val == $val[0] ? ' selected' : ''; $opt = $this->add(tag::create('option'))->att('value', $val[0]); $opt->add(nvl($val[1], $val[0])); if ($cur_val == $val[0]) { $opt->att('selected', 'selected'); } if (array_key_exists($val[0], $this->__grp)) { $this->buildBranch($this->__grp[$val[0]], $lev + 1); } } }
private function __cell($content = null, $colspan = null) { if (is_null($content)) { return; } $cel = $this->__crow->add(tag::create($this->__tag[1])); if (!empty($colspan)) { $cel->att('colspan', $colspan); } $cel->add2($content); return $cel; }
private function dataPivot($tr) { $data = array(); $hcol = array(); $hrow = array(); $fcol = null; foreach ($this->__dat as $i => $rec) { $col = $row = null; foreach ($rec as $fld => $val) { if ($fld == '_pivot') { $col = $val; if (!in_array($col, $hcol)) { $hcol[] = $col; } } elseif (is_null($col)) { if (empty($i)) { $hcol[0] = $fld; } $row = $val; if (!in_array($row, $hrow)) { $hrow[] = $row; } } else { $data[$col][$row][] = $val; } } } $data_pivot = array(); ksort($hrow); ksort($hcol); foreach ($hrow as $row) { foreach ($hcol as $i => $col) { if (empty($i)) { $drow[$col] = $row; //Aggiuno la label della riga } else { $drow[$col] = array_key_exists($row, $data[$col]) ? array_sum($data[$col][$row]) : '0'; } } $data_pivot[] = $drow; } $this->__dat = $data_pivot; $ncol = array(); foreach ($hcol as $i => $col) { if (empty($i)) { continue; } $tr->add(tag::create('th'))->att('class', 'no-order')->add($col); } //return ; //Restituisco il record contenente l'header delle colonne in }