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

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

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

gatekeeper();
		
$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 = $_SESSION['user']->guid;
				$relationship_type = ''; 
				$title_wording = elgg_echo('river:mine');
				break;
	case 'friends':	$subject_guid = $_SESSION['user']->guid;
				$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);

//select the correct river
if (get_plugin_setting('activitytype', 'riverdashboard') == 'classic')
	$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '', 20, 0, 0, true, true)  . "</div>";
else
	$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '', 20, 0, 0, true, false)  . "</div>";

// 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 = '';
}
set_context('riverdashboard');
if (empty($callback)) {
	$body .= elgg_view('riverdashboard/container', array('body' => $nav . $river . elgg_view('riverdashboard/js')));
	page_draw($title_wording,elgg_view_layout('one_column_with_sidebar',$title . $body, $sidebar));
} else {
	header("Content-type: text/html; charset=UTF-8");
	echo $nav . $river . elgg_view('riverdashboard/js');
}