aboutsummaryrefslogtreecommitdiff
path: root/views/default/page_elements/owner_block.php
blob: c2cb75a2664e4499cbe170ad511285e133ed0b7c (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php

	/**
	 * Elgg owner block
	 * Displays page ownership information
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Curverider Ltd
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.org/
	 * 
	 */

		$contents = "";

	// Is there a page owner?
		if ($owner = page_owner_entity()) {
			$icon = elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny'));
			if ($owner instanceof ElggUser || $owner instanceof ElggGroup) {
				$info = $owner->name;
			}
			$display = "<div id=\"owner_block_icon\">" . $icon . "</div>";
			$display .= "<div id=\"owner_block_content\">" . $info . "</div><br class=\"clearfloat\" />";
			
			if ($owner->briefdescription) {
			    $desc = $owner->briefdescription;
			    $display .= "<div id=\"owner_block_desc\">" . $desc . "</div>";
		    }
		    
		    $contents .= $display;
		}
		
	// Are there feeds to display?
		global $autofeed;
		
		if (isset($autofeed) && $autofeed == true) {
			$url = $url2 = full_url();
			if (substr_count($url,'?')) {
				$url .= "&view=rss";
			} else {
				$url .= "?view=rss";
			}
			if (substr_count($url2,'?')) {
				$url2 .= "&view=odd";
			} else {
				$url2 .= "?view=opendd";
			}
			$label = elgg_echo('feed:rss');
			$label2 = elgg_echo('feed:odd');
			$contents .= <<<END

	<div id="owner_block_rss_feed"><a href="{$url}">{$label}</a></div>
	<div id="owner_block_odd_feed"><a href="{$url2}">{$label2}</a></div>
			
END;
		}
		
		//the follow are for logged in users only
		if(isloggedin()){
		
    		//is the bookmark plugin installed?
    		if(is_plugin_enabled('bookmarks')){
    
    		  	$label3 = elgg_echo('bookmarks:this');
    			$contents .= "<div id=\"owner_block_bookmark_this\"><a href=\"javascript:location.href='". $CONFIG->wwwroot . "mod/bookmarks/add.php?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">{$label3}</a></div>";
    
    		}
    
    		//report this button
    		if (is_plugin_enabled('reportedcontent'))
    		{
	    		$label4 = elgg_echo('Report this');
	    		$contents .= "<div id=\"owner_block_report_this\"><a href=\"javascript:location.href='". $CONFIG->wwwroot . "mod/reportedcontent/add.php?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">{$label4}</a></div>";
    		}

	    }

		
		$contents .= elgg_view('owner_block/extend');
		
	// Have we been asked to inject any content? If so, display it
		if (isset($vars['content']))
			$contets .= $vars['content'];
		
	// Initialise the submenu
		$submenu = get_submenu(); // elgg_view('canvas_header/submenu');
		if (!empty($submenu)) $submenu = "<ul>" . $submenu . "</ul>";
		if (!empty($submenu))
			$contents .= "<div id=\"owner_block_submenu\">" . $submenu . "</div>"; // plugins can extend this to add menu options
			
		if (!empty($contents)) {
			echo "<div id=\"owner_block\">";
			echo $contents;
			echo "</div>";
		}

?>