aboutsummaryrefslogtreecommitdiff
path: root/mod/riverdashboard/index.php
blob: be516b15024ce5c3f2a75c5418911ad241b5b6b6 (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
<?php

/**
 * Elgg river dashboard plugin index page
 */

require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');

$type = get_input('type');
$subtype = get_input('subtype');
$orient = get_input('display');
if(!$orient) {
	$orient = 'all';
}
$callback = get_input('callback');

if ($type == 'all') {
	$type = '';
	$subtype = '';
}

$body = '';

switch($orient) {
	case 'mine':
		$subject_guid = get_loggedin_userid();
		$relationship_type = '';
		$title_wording = elgg_echo('river:mine');
		break;
	case 'friends':
		$subject_guid = get_loggedin_userid();
		$relationship_type = 'friend';
		$title_wording = elgg_echo('river:friends');
		break;
	default:
		$subject_guid = 0;
		$relationship_type = '';
		$title_wording = elgg_echo('river:all');
		break;
}

$title .= elgg_view_title($title_wording);
$extend = elgg_view("activity/extend");
$river = elgg_view_river_items_new($subject_guid, 0, $relationship_type, $type, $subtype, '', 20, 0, 0, TRUE);

// Replacing callback calls in the nav with something meaningless
$river = str_replace('callback=true', 'replaced=88,334', $river);

$nav = elgg_view('riverdashboard/nav',array('type' => $type,'subtype' => $subtype,'orient' => $orient));
if (isloggedin()) {
	$sidebar = elgg_view("riverdashboard/menu",array('type' => $type,'subtype' => $subtype,'orient' => $orient));
	$sidebar .= elgg_view("riverdashboard/sidebar", array("object_type" => 'riverdashboard'));
} else {
	$sidebar = '';
}

elgg_set_context('riverdashboard');

if (empty($callback)) {
	$body .= elgg_view('riverdashboard/container', array('body' => $nav . $extend . $river . elgg_view('riverdashboard/js')));
	$params = array(
		'content' => $title . $body,
		'sidebar' => $sidebar
	);
	$body = elgg_view_layout('one_column_with_sidebar', $params);
	echo elgg_view_page($title_wording, $body);
} else {
	header("Content-type: text/html; charset=UTF-8");
	echo $nav . $river . elgg_view('riverdashboard/js');
}