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