public function index() { if (!G::isLoggedIn()) { return Login::controller(Login::DEF); } $crud = new CRUD('tblConfig', ['insDefaults' => ['fldUserID' => G::getUserID()], 'primaryKey' => 'fldKey']); $crud->setColDisplay('fldUserID', CRUD::HIDDEN); $crud->columnAttrib('fldValue', ['size' => 60]); return $crud->index(); }
/** * @return string */ public function index() { $dao = new CronDAO(); $cols = array_flip($dao->objToRel(['command' => 0, 'priority' => 1, 'result' => 2, 'runTime' => 3])); $crud = new CRUD($dao->tableName); $crud->setColDisplay($cols[0], CRUD::DISPLAY); $crud->setColDisplay($cols[1], [CRUD::SELECT, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]); $crud->setColDisplay($cols[2], CRUD::DISPLAY); $crud->setColDisplay($cols[3], CRUD::TIMESTAMP); return $crud->index(); }
public function index($tName = '') { if (($tableName = Request::get('tblName', $tName)) == '') { return ''; } $crud = CRUD::factory($tableName, ['topPager' => false])->copyVarsFromRequest('tblName'); if (preg_match('/^tblMod([A-Z]+[a-z]+)/', $tableName, $matches)) { foreach (Cfg::get('modules', []) as $moduleClass) { eval($moduleClass . '::' . Module::CRUD_MOD . '($crud);'); } } else { switch ($tableName) { case 'tblNextNumber': $crud->setColDisplay('fldTable', [CRUD::SELECT, DBMaintenance::getTableList(), true]); break; case 'tblSecPrivUserMap': $userSql = DB::driver() == DB::MYSQL ? Admin::USER_SQL_MYSQL : Admin::USER_SQL_MYSQL; $crud->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true]); $crud->setColDisplay('fldGroupID', [CRUD::SELECT, Admin::GROUP_SQL, true]); $crud->setColDisplay('fldPrivilegeID', [CRUD::SELECT, Admin::PRIV_SQL, true]); $crud->setColDisplay('fldLevelID', [CRUD::SELECT, Admin::LEVEL_SQL]); break; case 'tblUserGroupMap': $userSql = DB::driver() == DB::MYSQL ? Admin::USER_SQL_MYSQL : Admin::USER_SQL_SQLITE; $crud->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true]); $crud->setColDisplay('fldGroupID', [CRUD::SELECT, Admin::GROUP_SQL, true]); break; case 'tblUser': $crud->setColDisplay('fldLevel', [CRUD::SELECT, Admin::LEVEL_SQL]); $crud->setColDisplay('fldTimeZone', [CRUD::SELECT, Admin::TZ_SQL]); break; } } $resp = Response::factory()->set('tblName', $tableName); return Tag::hTag('b') . 'Editing Table: ' . $tableName . Tag::_hTag('b') . ' ' . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->csv()'), 'CSV') . ' ' . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->xls()'), 'XLS') . $crud->index(); }
protected function getTableMetaData() { $parentMeta = parent::getTableMetaData(); $tab = new DBTable($this->db, $this->gridQuery . ' LIMIT 1', null, DB::FETCH_ASSOC); if (!$tab->ok()) { return false; } foreach (array_keys($tab->getRow(0)) as $col) { if (!isset($this->columnTitles[$col])) { $this->columnTitles[$col] = $this->convertColumnToTitle($col); $this->cellAttributes[$col] = []; } } $displayColumns = array_keys($tab->getRow(0)); $columnNames = array_keys($this->columnTitles); foreach ($columnNames as $columnName) { if (!in_array($columnName, $displayColumns)) { unset($this->columnTitles[$columnName]); unset($this->cellAttributes[$columnName]); unset($this->displayType[$columnName]); } } return true; }
public function manageUsersToGroups() { $key = Request::get('KEY'); if ($key == '') { return 'KEY missing'; } $userSql = DB::driver() == DB::MYSQL ? self::USER_SQL_MYSQL : self::USER_SQL_SQLITE; $row = DB::oneRow(DB::DEF, 'SELECT * FROM tblGroup WHERE fldGroupID=?', $key); return Tag::hTag('h4') . Tag::e('Editing Users in ' . $row['fldName'] . '(' . $row['fldLongName'] . ')') . Tag::_hTag('h4') . CRUD::factory('tblUserGroupMap', ['topPager' => false, 'where' => ['fldGroupID' => $key]])->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true])->setColDisplay('fldGroupID', CRUD::DISPLAY)->copyVarsFromRequest('KEY')->index(); }