aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views/default/embed/tabs.php
blob: 3f377fee550d04b361a058705e405be8f4ff1d25 (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
<?php
/**
 * Embed tabs
 *
 * @uses $vars['sections']
 * @uses $vars['upload_sections']
 * @uses $vars['actibe_section']
 */

$sections = elgg_extract('sections', $vars, array());
$active_section = elgg_extract('active_section', $vars, array_shift(array_keys($sections)));
$upload_sections = elgg_extract('upload_sections', $vars, array());

$tabs = array();
foreach ($sections as $section_id => $section_info) {
	$tab = array(
		'title' => $section_info['name'],
		'url' => '#',
		'url_class' => 'embed-section',
		'url_id' => $section_id,
	);

	if ($section_id == $active_section) {
		$tab['selected'] = TRUE;
	}
	$tabs[] = $tab;
}

// make sure upload is always the last tab
if ($upload_sections) {
	$tabs[] = array(
		'title' => elgg_echo('embed:upload'),
		'url' => '#',
		'url_class' => 'embed-section',
		'url_id' => 'upload',
		'selected' => ($active_section == 'upload')
	);
}

echo elgg_view('navigation/tabs', array('tabs' => $tabs));