Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
content.php
Go to the documentation of this file.
1 <?php
18 
19 $vars['title'] = elgg_extract('title', $vars, '');
20 if (!$vars['title'] && $vars['title'] !== false) {
21  $vars['title'] = elgg_echo($context);
22 }
23 
24 // 1.8 supported 'filter_override'
25 if (isset($vars['filter_override'])) {
26  $vars['filter'] = $vars['filter_override'];
27 }
28 
29 // register the default content filters
30 if (!isset($vars['filter']) && elgg_is_logged_in() && $context) {
32  $filter_context = elgg_extract('filter_context', $vars, 'all');
33 
34  // generate a list of default tabs
35  $tabs = array(
36  'all' => array(
37  'text' => elgg_echo('all'),
38  'href' => (isset($vars['all_link'])) ? $vars['all_link'] : "$context/all",
39  'selected' => ($filter_context == 'all'),
40  'priority' => 200,
41  ),
42  'mine' => array(
43  'text' => elgg_echo('mine'),
44  'href' => (isset($vars['mine_link'])) ? $vars['mine_link'] : "$context/owner/$username",
45  'selected' => ($filter_context == 'mine'),
46  'priority' => 300,
47  ),
48  'friend' => array(
49  'text' => elgg_echo('friends'),
50  'href' => (isset($vars['friend_link'])) ? $vars['friend_link'] : "$context/friends/$username",
51  'selected' => ($filter_context == 'friends'),
52  'priority' => 400,
53  ),
54  );
55 
56  foreach ($tabs as $name => $tab) {
57  $tab['name'] = $name;
58  elgg_register_menu_item('filter', $tab);
59  }
60 }
61 
62 $filter = elgg_view('page/layouts/elements/filter', $vars);
63 $vars['content'] = $filter . $vars['content'];
64 
65 echo elgg_view_layout('one_sidebar', $vars);
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
Definition: sessions.php:51
$username
Definition: delete.php:22
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
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
if(!$vars['title']&&$vars['title']!==false) if(isset($vars['filter_override'])) if(!isset($vars['filter'])&&elgg_is_logged_in()&&$context) $filter
Definition: content.php:62
elgg_get_context()
Get the current context.
Definition: pageowner.php:204
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
$context
Main content area layout.
Definition: content.php:17
$vars['title']
Definition: content.php:19
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32