aboutsummaryrefslogtreecommitdiff
path: root/mod/riverdashboard/index.php
blob: 2312da9458ebe2aa801a3ecac9422b04bc084368 (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
71
72
73
74
75
76
77
78
<?php

	/**
	 * Elgg river dashboard plugin index page
	 *
	 * @package ElggRiverDash
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Curverider Ltd <info@elgg.com>
	 * @copyright Curverider Ltd 2008-2010
	 * @link http://elgg.org/
	 */

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

		gatekeeper();

		$content = get_input('content','');
		$content = explode(',',$content);
		$type = $content[0];
		if (isset($content[1])) {
			$subtype = $content[1];
		} else {
			$subtype = '';
		}
		$orient = get_input('display');
		$callback = get_input('callback');

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

		$body = '';
		if (empty($callback)) {

			//set a view for the wire to extend
			$area1 = elgg_view("riverdashboard/sitemessage");

			//set a view to display newest members
			$area1 .= elgg_view("riverdashboard/newestmembers");

			//set a view to display a welcome message
			$body .= elgg_view("riverdashboard/welcome");

		}

		switch($orient) {
			case 'mine':
							$subject_guid = $_SESSION['user']->guid;
							$relationship_type = '';
							break;
			case 'friends':	$subject_guid = $_SESSION['user']->guid;
							$relationship_type = 'friend';
							break;
			default:		$subject_guid = 0;
							$relationship_type = '';
							break;
		}

		$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '') . "</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 (empty($callback)) {
			$body .= elgg_view('riverdashboard/container', array('body' => $nav . $river . elgg_view('riverdashboard/js')));
			page_draw(elgg_echo('dashboard'),elgg_view_layout('sidebar_boxes',$area1,$body));
		} else {
			header("Content-type: text/html; charset=UTF-8");
			echo $nav . $river . elgg_view('riverdashboard/js');
		}

?>