Elgg  Version 1.9
river.php
Go to the documentation of this file.
1 <?php
6 $options = array();
7 
8 $page_type = preg_replace('[\W]', '', get_input('page_type', 'all'));
9 $type = preg_replace('[\W]', '', get_input('type', 'all'));
10 $subtype = preg_replace('[\W]', '', get_input('subtype', ''));
11 if ($subtype) {
12  $selector = "type=$type&subtype=$subtype";
13 } else {
14  $selector = "type=$type";
15 }
16 
17 if ($type != 'all') {
18  $options['type'] = $type;
19  if ($subtype) {
20  $options['subtype'] = $subtype;
21  }
22 }
23 
24 switch ($page_type) {
25  case 'mine':
26  $title = elgg_echo('river:mine');
27  $page_filter = 'mine';
28  $options['subject_guid'] = elgg_get_logged_in_user_guid();
29  break;
30  case 'owner':
31  $subject_username = get_input('subject_username', '', false);
32  $subject = get_user_by_username($subject_username);
33  if (!$subject) {
34  register_error(elgg_echo('river:subject:invalid_subject'));
35  forward('');
36  }
37  $title = elgg_echo('river:owner', array(htmlspecialchars($subject->name, ENT_QUOTES, 'UTF-8', false)));
38  $page_filter = 'subject';
39  $options['subject_guid'] = $subject->guid;
40  break;
41  case 'friends':
42  $title = elgg_echo('river:friends');
43  $page_filter = 'friends';
44  $options['relationship_guid'] = elgg_get_logged_in_user_guid();
45  $options['relationship'] = 'friend';
46  break;
47  default:
48  $title = elgg_echo('river:all');
49  $page_filter = 'all';
50  break;
51 }
52 
54 if (!$activity) {
55  $activity = elgg_echo('river:none');
56 }
57 
58 $content = elgg_view('core/river/filter', array('selector' => $selector));
59 
60 $sidebar = elgg_view('core/river/sidebar');
61 
62 $params = array(
63  'title' => $title,
64  'content' => $content . $activity,
65  'sidebar' => $sidebar,
66  'filter_context' => $page_filter,
67  'class' => 'elgg-river-layout',
68 );
69 
71 
elgg_list_river(array $options=array())
List river items.
Definition: river.php:490
if(!$activity) $content
Definition: river.php:58
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$subject
Definition: exceptions.php:25
$page_type
Definition: river.php:8
if($type!= 'all') switch($page_type) $activity
Definition: river.php:53
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
$sidebar
Definition: river.php:60
$title
Definition: save.php:24
get_user_by_username($username)
Get user by username.
Definition: users.php:246
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg echo
Translates a string.
Definition: languages.js:43
$params
Definition: river.php:62
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:617
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
elgg_view_page($title, $body, $page_shell= 'default', $vars=array())
Assembles and outputs a full page.
Definition: views.php:437
$selector
Definition: filter.php:32
$subtype
Definition: river.php:10
$body
Definition: river.php:70
$options
Main activity stream list page.
Definition: river.php:6
$type
Definition: river.php:9
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42