1 |
cvsjoko |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
// ====================================================== |
4 |
|
|
class HTMLWidgetFactory_ListView { |
5 |
|
|
|
6 |
|
|
// -------------------------------------------------------- |
7 |
|
|
function Main( $args ) { |
8 |
|
|
|
9 |
|
|
// get args to local variables |
10 |
|
|
$php_data =& $args['php_data']; |
11 |
|
|
$columns = $args['columns']; |
12 |
|
|
$columns_show = $args['columns_show']; |
13 |
|
|
isset($args['column_itemid']) && ($column_itemid = $args['column_itemid']); |
14 |
|
|
isset($args['column_nodeid']) && ($column_nodeid = $args['column_nodeid']); |
15 |
|
|
$column_link = $args['column_link']; |
16 |
|
|
|
17 |
|
|
// array of callbacks |
18 |
|
|
$php_callbacks = $args['php_callbacks']; |
19 |
|
|
|
20 |
|
|
|
21 |
|
|
// call callback-function |
22 |
|
|
if (isset($args['php_callbacks']['begin'])) { |
23 |
|
|
call_user_func($args['php_callbacks']['begin']); |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
if (isset($args['php_callbacks']['draw_begin'])) { |
27 |
|
|
call_user_func($args['php_callbacks']['draw_begin']); |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
global $tracking; |
32 |
|
|
|
33 |
|
|
$cfg_maxentries = 20; |
34 |
|
|
$cfg_maxcellchars = 30; |
35 |
|
|
|
36 |
|
|
$php_data->setPage(0, $cfg_maxentries); |
37 |
|
|
|
38 |
|
|
print '<table cellpadding="0" cellspacing="0">'; |
39 |
|
|
while($item =& $php_data->next()) { |
40 |
|
|
print "<tr>"; |
41 |
|
|
reset($columns); |
42 |
|
|
while($column = current($columns)) { |
43 |
|
|
|
44 |
|
|
$cellvalue = $item->get($column); |
45 |
|
|
$celldisplay = $cellvalue; |
46 |
|
|
if (strlen($celldisplay) > $cfg_maxcellchars) { |
47 |
|
|
$celldisplay = substr($celldisplay, 0, $cfg_maxcellchars) . " ..."; |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
$cellcontent = ''; |
51 |
|
|
|
52 |
|
|
// is this column the "link"-column? |
53 |
|
|
if ($column == $column_link) { |
54 |
|
|
$linkargs = array( |
55 |
|
|
'caption' => $celldisplay, |
56 |
|
|
//'href' => '?', |
57 |
|
|
'html_class' => 'acontent', |
58 |
|
|
// 'target' => 'page', |
59 |
|
|
'target' => '_self', |
60 |
|
|
'title' => $celldisplay, |
61 |
|
|
); |
62 |
|
|
isset($column_itemid) && ($linkargs['item_id'] = $item->get($column_itemid)); |
63 |
|
|
isset($column_nodeid) && ($linkargs['node_id'] = $item->get($column_nodeid)); |
64 |
|
|
|
65 |
|
|
$cellcontent = $tracking->getLink_ByArgs($linkargs); |
66 |
|
|
} else { |
67 |
|
|
$cellcontent = $celldisplay; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
// show this column? |
71 |
|
|
if (in_array($column, $columns_show)) { |
72 |
|
|
print "<td>"; |
73 |
|
|
print "- " . $cellcontent; |
74 |
|
|
print "</td>"; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
next($columns); |
78 |
|
|
} |
79 |
|
|
print "</tr>"; |
80 |
|
|
} |
81 |
|
|
print "</table>"; |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
if (isset($args['php_callbacks']['draw_end'])) { |
85 |
|
|
call_user_func($args['php_callbacks']['draw_end']); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
if (isset($args['php_callbacks']['end'])) { |
90 |
|
|
call_user_func($args['php_callbacks']['end']); |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
?> |