aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/ui/submenu.php
blob: d7a156417b4f72f91f85fc831743dd496f7fde25 (plain)
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
<?php
/**
 * 1.8 submenu test.
 *
 * Submenu needs to be able to support being added out of order.
 * Children can be added before parents.
 * 	Children of parents never defined are never shown.
 *
 * Test against:
 * 	different contexts
 * 	different groups
 * 	old add_submenu_item() wrapper.
 *
 */

require_once('../../start.php');

$url = "{$CONFIG->url}engine/tests/ui/submenu.php";

$items = array(
	array(
		'text' => 'Upper level 1',
		'url' => "$url?upper_level_1",
		'id' => 'ul1'
	),
		array(
			'text' => 'CD (No link)',
			'parent_id' => 'cup',
			'id' => 'cd',
		),
			array(
				'text' => 'Sub CD',
				'url' => "$url?sub_cd",
				'parent_id' => 'cd'
			),
	array(
		'text' => 'Cup',
		'url' => "$url?cup",
		'id' => 'cup'
	),
		array(
			'text' => 'Phone',
			'url' => "$url?phone",
			'id' => 'phone',
			'parent_id' => 'cup'
		),
			array(
				'text' => 'Wallet',
				'url' => "$url?wallet",
				'id' => 'wallet',
				'parent_id' => 'phone'
			),
	array(
		'text' => 'Upper level',
		'url' => "$url?upper_level",
		'id' => 'ul'
	),
		array(
			'text' => 'Sub Upper level',
			'url' => "$url?sub_upper_level",
			'parent_id' => 'ul'
		),
	array(
		'text' => 'Root',
		'url' => $url,
	),

	array(
		'text' => 'I am an orphan',
		'url' => 'http://google.com',
		'parent_id' => 'missing_parent'
	),

	array(
		'text' => 'JS Test',
		'url' => 'http://elgg.org',
		'vars' => array('js' => 'onclick="alert(\'Link to \' + $(this).attr(\'href\') + \'!\'); return false;"')
	)
);

foreach ($items as $item) {
	elgg_add_submenu_item($item, 'main');
}

add_submenu_item('Old Onclick Test', 'http://elgg.com', NULL, TRUE);
add_submenu_item('Old Selected Test', 'http://elgg.com', NULL, '', TRUE);


elgg_add_submenu_item(array('text' => 'Not Main Test', 'url' => "$url?not_main_test"), 'not_main', 'new_menu');
elgg_add_submenu_item(array('text' => 'Not Main C Test', 'url' => "$url?not_main_c_test"), 'not_main', 'new_menu');

elgg_add_submenu_item(array('text' => 'All test', 'url' => "$url?all"), 'all');

//set_context('not_main');

$body = elgg_view_layout('one_column_with_sidebar', 'Look right.');
page_draw('Submenu Test', $body);