-
Notifications
You must be signed in to change notification settings - Fork 1
/
dcpDataGrid.php
executable file
·127 lines (103 loc) · 3.41 KB
/
dcpDataGrid.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
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
require_once 'Structures/DataGrid.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 "dcpPage.php";
class dcpDataGrid
{
var $dcpPage;
// functions
function printHeader ($dcp_action)
{
$this->dcpPage =& new dcpPage('PSC DCP Tracker');
// $this->dcpPage->buildPageHeading('http://psc.central.sun.com:9000/dcp/dcp_view_all.php');
$this->dcpPage->buildPageHeading("$dcp_action");
}
function printHeader2 () {
$out = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" ";
$out .= "\"http://www.w3.org/TR/html401/loose.dtd\">\n";
$out .= "<html>\n";
$out .= "<head>\n";
print $out;
// echo <<<END
// <!-- Require the Prototype JS framework from http://www.prototypejs.org -->
// <script type="text/javascript" src="prototype.js"></script>
// <script type="text/javascript">
// function updateGrid(info)
// {
// var url = 'psc.central.sun.com:9000/dcp/dcp_view_all.php';
// var pars = 'page=' + info.page;
// if (info.sort.length > 0) {
// pars += '&orderBy=' + info.sort[0].field + '&direction=' + info.sort[0].direction;
// }
// new Ajax.Updater( 'grid', url, { method: 'get', parameters: pars + '&ajax=table' });
// new Ajax.Updater( 'pager', url, { method: 'get', parameters: pars + '&ajax=pager' });
// // Important: return false to avoid href links
// return false;
// }
// </script>
echo <<< END
<title>PSC DCP Tracker</title>
</head>
END;
}
function printFooter () {
$out = "</body>\n";
$out .= "</html>\n";
print $out;
}
function printLink($params, $args = array())
{
extract($params);
extract($args);
$edit_url = 'http://psc.central.sun.com:9000/dcp/dcp_edit.php';
return '<a href="' . $edit_url . '?sdesk_num=' . $record['sdesk_num'] . '">' . $record['sdesk_num'] . '</a>';
}
function printEditLink($params)
{
$sdesk_num = $record['sdesk_num'];
extract($params);
return '<a href="' . $edit_url . '?dcp_action=view_dcp' . '&sdesk_num=' . $record['sdesk_num'] . '">'. $record['sdesk_num'] . '</a>';
}
function printFullOS($params)
{
extract($params);
return $record['os_name'] . ' ' . $record['os_version_name'];
}
function printDesc($params, $args = array())
{
extract($params);
extract($args);
if (strlen($record[$fieldName]) > $length) {
return nl2br(substr($record[$fieldName], 0, $length)) . '...';
} else {
return nl2br($record[$fieldName]);
}
}
function printCheckbox($params)
{
extract($params);
return '<input type="checkbox" name="idList[]" value="' . $record['id'] . '">';
}
function printRoleSelector($params)
{
global $roleList;
extract($params);
$html = '<select name="role_id">';
foreach ($roleList as $roleId => $roleName) {
$html .= "<option value=\"$roleId\">$roleName</option>\n";
}
$html .= '</select>';
return $html;
}
// set up user-defined error handler
function errHandler($e) {
die($e->getMessage());
}
function formatRowNumber($params, $recordNumberStart)
{
return $params['currRow'] + $recordNumberStart;
}
}
?>