at new admin_table width 100 align center cellspacing cellpadding at-

 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
$at=new admin_table('width=100% align="center" cellspacing="0" cellpadding="3"');
$at->set_link('adminko.php?module=articles&action=view');
$at->set_table_name('articles');
$at->set_key_col('id');
$at->set_items_per_page(10);
$at->set_order_default('id');
$at->add_col('title',array(
'name' => 'title',
'is_ordered'=> true,
'title' => 'Заголовок',
'in_table' => '1',
'handler' => create_function('$id,$value,$data','return "<a href=\'?module=articles&action=edit_&id=$id\' title=\'".strip_tags($data[\'text\'])."\'>$value</a>";'),
'width' => '30%',
));
$at->add_col('cat_id',array(
'name' => 'cat_id',
'is_ordered'=> true,
'title' => 'Категория',
'in_table' => '1',
'handler' => create_function('$id,$value','return get_cats_path($value,1);'),
'width' => '20%',
));
$at->add_col('edit',array(
'name' => 'edit',
'is_ordered'=> false,
'title' => '',
'in_table' => false,
'handler' => create_function('$id,$value','return "<a href=\'?module=articles&action=edit&id=$id\'><img src=\'./images/admin/ico_edit.gif\' alt=\'Редактировать\'></a>";'),
'width' => '20%',
'addition' => 'align="center"'
));
$at->add_col('enabled',array(
'name' => 'enabled',
'is_ordered'=> true,
'title' => 'enabled',
'in_table' => '1',
'handler' => create_function('$id,$value','return make_checkbox("enabled[".$id."]","",$value);'),
'width' => '10%',
'addition' => 'align="center"',
'footer' => make_submit('Обновить','update')
));
$at->add_col('deleted',array(
'name' => 'deleted',
'is_ordered'=> true,
'title' => 'deleted',
'in_table' => '1',
'handler' => create_function('$id,$value','return make_checkbox("deleted[".$id."]","",$value);'),
'width' => '10%',
'addition' => 'align="center"',
'footer' => make_submit('Обновить','delete')
));
$at->process();
print "<form action='?module=articles&action=update' method='post'>";
$at->print_table();
print "<input name='ids' type='hidden' value='".implode(',',array_keys($at->items))."'>";
print "</form>";