protected static function __build__() { $cal = new CalendarComponent($_POST['calendar_init_date'], $_REQUEST['calendar_layout']); $sql = env::replacevariable(self::get_par('sql-query')); $sql = env::parseString($sql); $cal->set_datasource($sql, env::$dba); $cal->set_dimension(self::get_par('width'), self::get_par('height')); $cal->par('form-related', self::get_par('form-related')); self::$form->put($cal, '', '', 100, 10); }
public function build() { foreach($this->get_att() as $k => $v) { if (is_numeric($k)) continue; $this->map->att($k,$v,true); } if (empty($_REQUEST[$this->id.'_center']) && $sql = $this->get_par('datasource-sql')) { $sql = env::replacevariable($sql); $res = env::$dba->exec_query($sql); if (empty($res)){ $res = array(array('lat'=>41.9100711,'lng'=>12.5359979)); } $_REQUEST[$this->id.'_center'] = $res[0]['lat'].','.$res[0]['lng']; } if ($grid = $this->get_par('datagrid-parent')) { $this->map->att('data-datagrid-parent',$grid); } }
public function build() { $form_pkey = array(); if ($form = $this->get_par('form-related')) { $form_pkey = $form_par['pkey']; $str_par = "obj_src=" . $this->id; $frm_par = key_exists('rel_fields', $this->__par) ? explode(',', $this->__par['rel_fields']) : array(); foreach ($frm_par as $fld) { $str_par .= '&' . $fld . '=' . get_global($fld, $_REQUEST); } if (!empty($_REQUEST[$this->id])) { $str_par .= '&pkey[id]=' . $_REQUEST[$this->id]; } $this->att('data-form', $form)->att('data-form-dim', $form_par['width'] . ',' . $form_par['height'])->att('data-form-nam', $form_par['name'])->att('data-form-pag', $form_par['page'])->att('data-form-par', $str_par); } if ($_REQUEST['ajax'] == $this->id) { $this->ajaxResp($form_pkey); return; } elseif (!empty($_REQUEST[$this->id]) && ($sql = $this->get_par('datasource-sql-label'))) { $sql = env::replaceVariable($sql); $this->textBox->value = env::$dba->exec_unique($sql, null, 'NUM'); } }
private function buildBar($raw_data) { $lbl = array_shift($raw_data); $opt = array('inGraphDataShow' => true, 'inGraphDataYPosition' => 3, 'scaleFontSize' => 9, 'inGraphDataFontSize' => 9, 'yAxisMinimumInterval' => 1, 'responsive' => true, 'maintainAspectRatio' => false, 'spaceLeft' => 20, 'spaceRight' => 20, 'spaceTop' => 10, 'spaceBottom' => 10, 'legend' => count($raw_data) > 1 ? true : false, 'legendBorders' => false); if (!$this->get_par('hide-title')) { $opt['graphTitle'] = $this->label; } if ($onmousedownleft = $this->get_par('chartnew-mousedownleft')) { $opt['mouseDownLeft'] = 'function(event,ctx,config,data,other) { ' . PHP_EOL . $onmousedownleft . PHP_EOL . '}'; $opt['annotateDisplay'] = true; } if ($fmt = $this->get_par('ingraphdatatmpl')) { $dataset = array_values($raw_data)[0]; $fmt = env::replacevariable($fmt, $dataset, '\\[(.*)\\]'); $opt['inGraphDataTmpl'] = '\'<%=' . str_replace("'", '"', $fmt) . '%>\''; } $dat = $this->buildDataset($raw_data); return array(array('labels' => $lbl, 'datasets' => $dat), $opt); }