public function __construct($table, $rowid = 'new') { global $view; $this->option = $view; $this->table = $table; $this->cols = dbfn::_getfields($table); $this->rowid = $rowid; $this->prikey = dbfn::_getprimary($table); $this->popup = req::_('popup'); $this->editing = req::_('editing'); $this->params = array(); foreach ($this->cols as $col) { $oTemp = new colparams($this->table, $col); $this->params[$col] = $oTemp->_getvalues(); } }
public function __construct($table) { $_SESSION['rows_per_page'] = req::_('rows_per_page', 10, '_SESSION'); $this->table = $table; $this->order = req::_('order', dbfn::_getprimary($table)); $this->order_dir = req::_('dir', 'ASC'); $this->page = req::_('page', '1'); $this->rows_per_page = $_SESSION['rows_per_page'] = req::_('rows_per_page', $_SESSION['rows_per_page']); $this->filter_field = req::_('filter_field'); $this->filter_group = req::_('filter_group', -1); $this->filter_group = is_array($this->filter_group) ? implode(',', $this->filter_group) : $this->filter_group; $this->first_record = req::_chk('page') ? (req::_('page') - 1) * $this->rows_per_page + 1 : 1; $this->last_record = $this->first_record + $this->rows_per_page - 1; $this->limit = $this->first_record - 1 . "," . $this->rows_per_page; $this->q = req::_('q') == 'Search Records...' ? '' : req::_('q'); $this->where = $this->q != '' ? dbfn::_buildwhere($table, $this->q) : 1; $this->where .= $this->filter_group != -1 ? " AND `{$this->filter_field}` IN ({$this->filter_group})" : ''; }
$option = req::_('option', 'default'); $view = req::_('view', $option); $frm_name = req::_('frm_name'); /** ** ** ** ** ** ** ** ** ** * PROCESS FORM */ switch ($frm_name) { case 'frm_tableparam': $oParams = new colparams(req::_('_table'), req::_('_col')); $oParams->_set($_POST); $output = $oParams->_store(); break; case 'frm_editor': $table = req::_('table_name'); // table name $prikey = dbfn::_getprimary($table); // get primary key name of table $id = req::_($prikey); // get id of record $oEditor = new editor($table, $id); $oEditor->_getData(); $oEditor->_setData($_POST); $output = $oEditor->_storeData(); break; case 'frm_storetabs': $tabs = req::_('Tabs', ''); $oResult = aimsys::_storeTabs($tabs); $output = $oResult->ret; break; case 'frm_gettabs': $t = aimsys::_getTabs();
public static function _get_sel_menu($field, $table, $k, $v, $sel, $first_value = '', $first_label = '', $multiple = false) { $selected = strpos($sel, ",") !== false ? explode(',', $sel) : array($sel); $pri = dbfn::_getprimary($table); $query = "SELECT * FROM `{$table}` ORDER BY `{$pri}` ASC"; $oDB = new db($query); $r = $oDB->rows; $return = $multiple ? "<select multiple=\"multiple\" class=\"jquery-multiselect\" id=\"{$field}\" name=\"" . $field . "[]\" >\n" : "<select class=\"jquery-singleselect\" name=\"" . $field . "\" >\n"; $return .= $first_label != '' ? "<option value=\"{$first_value}\">{$first_label}</option>" : ''; foreach ($r as $key => $value) { $return .= in_array($value[$v], $selected) ? "<option value=\"" . $value[$v] . "\" selected=\"selected\"> " . $value[$k] . "</option>\n" : "<option value=\"" . $value[$v] . "\"> " . $value[$k] . "</option>\n"; } $return .= "</select>\n"; return $return; }