Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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:512
$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:679
$subtype
Definition: river.php:12
$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
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
$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_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
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:1310
$body
Definition: river.php:73
$type
Definition: river.php:11
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
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:437