-
Notifications
You must be signed in to change notification settings - Fork 1
/
regtool_test.php
executable file
·114 lines (88 loc) · 3.08 KB
/
regtool_test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
//require 'Structures/DataGrid.php';
require_once 'dcpDataGrid.php';
require_once 'PEAR.php';
define("DB_DATAOBJECT_NO_OVERLOAD",true); /* This is needed for some buggy versions of PHP4 */
require_once "HTML/Table.php";
//require_once "dcpDatabase/MysqlDataSource.php";
require_once "dcpDatabase/RegtoolDataSource.php";
// echo "<h1>we're testing</h1>";
// $datasource = new MysqlDataSource();
// $count = $datasource->count();
// echo "There are $count cats in the farm\n\n";
echo "<hr>";
$datasource = new RegtoolDataSource();
$count = $datasource->count();
echo "<p>There are $count Regtool cats in the farm\n\n";
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'PEAR.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$datasource->dump(0,5);
//$datagrid =& new Structures_DataGrid(10);
$datagrid =& new Structures_DataGrid();
// Enable streaming and set buffer size to 1,000 records
$datagrid->enableStreaming(1000);
$test = $datagrid->bindDataSource($datasource);
if (PEAR::isError($test)) {
echo $test->getMessage();
die('An error occured while fetching the dcpDataObject information.');
}
// $datagrid->addColumn(
// new Structures_DataGrid_Column(
// '#',
// null,
// null,
// array('style' => 'text-align: right;'),
// null,
// array('All_dcps', 'formatRowNumber'),
// $datagrid->getCurrentRecordNumberStart()
// ));
// $datagrid->addColumn(
// new Structures_DataGrid_Column('Hostname', 'primay_hostname', 'primay_hostname')
// );
// $datagrid->addColumn(
// new Structures_DataGrid_Column('Domain', 'primay_domain', 'primay_domain')
// );
// Define the Look and Feel
$tableAttribs = array(
'width' => '100%',
'cellspacing' => '0',
'cellpadding' => '4',
'class' => 'datagrid'
);
$headerAttribs = array(
'bgcolor' => '#CCCCCC'
);
$evenRowAttribs = array(
'bgcolor' => '#FFFFFF'
);
$oddRowAttribs = array(
'bgcolor' => '#EEEEEE'
);
$rendererOptions = array(
'sortIconASC' => '⇑',
'sortIconDESC' => '⇓'
);
// Create a HTML_Table
$table = new HTML_Table($tableAttribs);
$tableHeader =& $table->getHeader();
$tableBody =& $table->getBody();
// Ask the DataGrid to fill the HTML_Table with data, using rendering options
$test = $datagrid->fill($table, $rendererOptions);
if (PEAR::isError($test)) {
echo $test->getMessage();
}
// Set attributes for the header row
$tableHeader->setRowAttributes(0, $headerAttribs);
// Set alternating row attributes
$tableBody->altRowAttributes(0, $evenRowAttribs, $oddRowAttribs, true);
// Output table and paging links
echo $table->toHtml();
// Display paging links
$test = $datagrid->render(DATAGRID_RENDER_PAGER);
if (PEAR::isError($test)) {
echo $test->getMessage();
}
//$datagrid->render();
?>