blob: 7f8b7dec7f753cd9b072b7bd603c7414408a68e2 (
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
|
<?php
/**
* Content filter for river
*
* @uses $vars[]
*/
// create selection array
$options = array();
$options['type=all'] = elgg_echo('river:select', array(elgg_echo('all')));
$registered_entities = elgg_get_config('registered_entities');
if (!empty($registered_entities)) {
foreach ($registered_entities as $type => $subtypes) {
// subtype will always be an array.
if (!count($subtypes)) {
$label = elgg_echo('river:select', array(elgg_echo("item:$type")));
$options["type=$type"] = $label;
} else {
foreach ($subtypes as $subtype) {
$label = elgg_echo('river:select', array(elgg_echo("item:$type:$subtype")));
$options["type=$type&subtype=$subtype"] = $label;
}
}
}
}
$params = array(
'id' => 'elgg-river-selector',
'options_values' => $options,
);
$selector = $vars['selector'];
if ($selector) {
$params['value'] = $selector;
}
echo elgg_view('input/dropdown', $params);
?>
<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
$(document).ready(function() {
$('#elgg-river-selector').change(function() {
var url = window.location.href;
if (window.location.search.length) {
url = url.substring(0, url.indexOf('?'));
}
url += '?' + $(this).val();
elgg.forward(url);
});
});
</script>
|