function page() { global $db, $session; //lets get a user $db->select('users.id,firstname,lastname,email,department_name'); $db->from('users'); $db->join('user_departments', 'users.department_id=user_departments.id'); $db->order_by('lastname'); $users = $db->fetch(); $searchFields[] = array('type' => 'text', 'label' => 'Last Name', 'value' => '', 'field' => 'lastname'); $db->select('id,department_name'); $db->from('user_departments'); $db->order_by('department_name'); $departments = $db->fetch(); $searchFields[] = array('type' => 'select', 'value' => 0, 'label' => 'Department', 'field' => 'department_id', 'options' => $departments, 'option_field' => 'department_name'); // this is the bare minimum implementation; $table = new Table(); $table->setRecordActionBase('/pages/user/user.php'); $table->setData($users); $table->setSearch($searchFields); $table->setNewButton('New User', '/pages/user/user.php'); $actions[] = array('action' => 'list', 'label' => "Permissions", 'url' => '/pages/user/permissions.php'); $actions[] = array('action' => 'list', 'label' => "Groups", 'url' => '/pages/user/groups.php'); $table->setFormActions($actions); $table->generate(); $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $table->tableScripts); }
function page() { global $db, $session; //lets get a user $db->select('id,displayname'); $db->from('core_permission_list'); $db->order_by('displayname'); $permissions = $db->fetch(); $searchFields[] = array('type' => 'text', 'label' => 'Display Name', 'value' => '', 'field' => 'displayname'); // this is the bare minimum implementation; $table = new Table(); $table->setRecordActionBase('/pages/permissions/permissionEdit.php'); $table->setData($permissions); $table->setSearch($searchFields); $table->setNewButton('New Permission', '/pages/permissions/permissionEdit.php'); $table->generate(); $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $table->tableScripts); }
function page() { global $db, $session; //lets get a user $db->select('id,group_name'); $db->from('core_permission_groups'); $db->order_by('group_name'); $groups = $db->fetch(); $searchFields[] = array('type' => 'text', 'label' => 'Group Name', 'value' => '', 'field' => 'group_name'); // this is the bare minimum implementation; $table = new Table(); $table->setRecordActionBase('permissions/groupEdit.php'); $actions[] = array('action' => 'selectpermissions', 'label' => "Permissions", 'url' => 'permissions/groupPermissions.php'); $table->setRecordActions($actions); $table->setData($groups); $table->setSearch($searchFields); $table->setNewButton('New Group', 'permissions/groupEdit.php'); $table->generate(); $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $table->tableScripts); }
function page() { global $db, $session; //lets get a user $db->select('users.id,firstname,lastname,email,department_name'); $db->from('users'); $db->join('user_departments', 'users.department_id=user_departments.id'); $db->order_by('lastname'); $users = $db->fetch(); $searchFields[] = array('type' => 'text', 'label' => 'Last Name', 'value' => '', 'field' => 'lastname'); $searchFields[] = array('type' => 'date', 'label' => 'Start Date', 'value' => '', 'field' => 'last_login'); $db->select('id,department_name'); $db->from('user_departments'); $db->order_by('department_name'); $departments = $db->fetch(); $searchFields[] = array('type' => 'select', 'value' => 0, 'label' => 'Department', 'field' => 'department_id', 'options' => $departments, 'option_field' => 'department_name'); // this is the bare minimum implementation; $table = new Table(); $table->setData($users); $table->setSearch($searchFields); $table->generate(); $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $table->tableScripts); }
</table> <?php /* only print pool status when we have one */ } $table = new Table(); // assemble columns $table->addColumn("IP address", "ip"); $table->addColumn("MAC address", "mac"); $table->addColumn("Hostname", "hostname"); $table->addColumn("Start", "start"); $table->addColumn("End", "end"); $table->addColumn("Online", "online"); $table->addColumn("Lease Type", "act", "listhdr"); // populate table data $table->setData($leases); ?> <p> <table class="sortable" id="sortabletable" name="sortabletable" width="100%" border="0" cellpadding="0" cellspacing="0"> <?php echo $table->getColumnHTML(); foreach ($table->getData() as $data) { if ($data['act'] == "active" || $data['act'] == "static" || $_GET['all'] == 1) { if ($data['act'] != "active" && $data['act'] != "static") { $fspans = "<span class=\"gray\">"; $fspane = "</span>"; } else { $fspans = $fspane = ""; }
/** * Set and normalizes the data for the table. * * Overrides the parent setData to add our blank row to the bottom. * * @param array $data Table data * @return void */ public function setData($data) { if (isset($this->config['grid_blank_row'])) { // Prepend blank row to array instead of prepend so that the DOM // is consistent when loading new data vs loading new data array_unshift($data, array('attrs' => array('class' => 'grid-blank-row hidden'), 'columns' => $this->config['grid_blank_row'])); } parent::setData($data); }