-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
44 lines (36 loc) · 1.06 KB
/
test.php
File metadata and controls
44 lines (36 loc) · 1.06 KB
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
<?php
require_once('clui.php');
Clui::init(array(
'cursor' => false,
'color' => true,
'border' => true,
'title' => 'Test Title',
));
// Add the menu
$items = array('Add Cases', 'Add Frozen Cases', 'Mark as Shipped', 'Remove Cases', 'Add to Notes', 'Adjust Product', 'Combo breaker!');
$menu = Clui_List::make($items)
->setColumns(2)
->setParent(Clui::rootView())
->setPadding(1)
->setFrame(0, 0, $autoWidth = true, $autoHeight = true);
// Add the detail view
$columns = array(
'Name::30%' => function($row){ return $row['name']; },
'Address::30%' => function($row){ return $row['address'].', '.$row['city']; },
'Email' => array(
'width' => true,
'value' => function($row){ return $row['email']; },
),
'Phone::12',
);
$detail = Clui_View::make()
->setParent(Clui::rootView())
->setFrame(0, $menu->getHeight(), $autoWidth = true, Clui::getHeight(true)-$menu->getHeight())
->setBorder(true)
->draw();
$menu->setAction(function($i) use ($items, $detail)
{
$detail->clear()->addString(1, 0, 'Selected: '.$items[$i])->draw();
});
$menu->focus();
Clui::end();