Example #1
0
 public function testGenerate()
 {
     $data = array(array('id' => 1, 'name' => 'jonathan', 'onclick' => '/'));
     $options = array('column_names' => array('id', 'name'), 'id' => 'mytable');
     $html = Table::generate($data, $options);
     $this->assertEquals('<table id="mytable"><thead><tr><th>id</th><th>name</th></tr></thead><tfoot></tfoot><tbody><tr onclick="document.location=\'/\'"><td>1</td><td>jonathan</td></tr></tbody></table>', $html);
 }
Example #2
0
  protected function table_generator ($tcode) {
  
    $table = Table::generate($tcode);

    return $table->html(); 
  
  }
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);
}
Example #7
0
<?php

// This is a dynamic version of index.html that generates a randomized
// table every time the page is loaded. index.html was
// created using this file.
function __autoload($class)
{
    $parts = explode('\\', $class);
    require end($parts) . '.php';
}
$t = new Table();
$table = $t->generate();
?>
<!doctype html>
<html class="" lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Super Table Demo</title>
    <link rel="stylesheet" href="foundation.min.css" />
    <link rel="stylesheet" href="all.css">
</head>
<body>
<div class="row">
    <div class="column medium-12">
        <h1>Super Table Demo</h1>
    </div>
</div>

<div class="row">
    <div class="column medium-12">