aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views/default/embed/upload/content.php
blob: a8330bce056edab23770da52588e3e591a23a811 (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
<?php
/**
 * Special upload form
 */
$upload_sections = elgg_extract('upload_sections', $vars, array());
$active_section = get_input('active_upload_section', array_shift(array_keys($upload_sections)));

$options = array();

if ($upload_sections) {
	foreach ($upload_sections as $id => $info) {
		$options[$id] = $info['name'];
	}

	$input = elgg_view('input/dropdown', array(
		'name' => 'download_section',
		'options_values' => $options,
		'internalid' => 'embed_upload',
		'value' => $active_section
	));

	echo "<div class='embed_modal_upload'>";
	echo "<p>" . elgg_echo('embed:upload_type') . "$input</p>";

	if (!$upload_content = elgg_view($upload_sections[$active_section]['view'])) {
		$upload_content = elgg_echo('embed:no_upload_content');
	}

	echo $upload_content . "</div>";

?>
	<?php //@todo: JS 1.8: ugly ?>
	<script type="text/javascript">
	$(document).ready(function() {

		// change for dropdown
		$('#embed_upload').change(function() {
			var upload_section = $(this).val();
			var url = '<?php echo elgg_get_site_url(); ?>pg/embed/embed?active_section=upload&active_upload_section=' + upload_section;
			$('#facebox .body .content').load(url);
		});

	});
	</script>
<?php

} else {
	echo elgg_echo('embed:no_upload_sections');
}