aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default/object/blog.php
blob: 01fbe4b4cdb17ba32df377c151c652c51ae4e103 (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
100
101
102
103
104
105
106
<?php

	/**
	 * Elgg blog individual post view
	 * 
	 * @package ElggBlog
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Ben Werdmuller <ben@curverider.co.uk>
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.com/
	 * 
	 * @uses $vars['entity'] Optionally, the blog post to view
	 */

		if (isset($vars['entity'])) {
			
?>

	<div class="blog-post">
		<h3><a href="<?php echo $vars['url']; ?>mod/blog/read.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo $vars['entity']->title; ?></a></h3>
		<p class="strapline">
			<span style="float:right">
			<?php

				echo sprintf(elgg_echo("blog:strapline"),
								date("F j",$vars['entity']->time_created)
				);
			
			?>
			</span>
			<a href="<?php echo $vars['url']; ?>mod/blog/?username=<?php echo $vars['entity_owner']->username; ?>"><?php echo $vars['entity_owner']->name; ?></a>
		</p>
		<p>
			<?php

				echo nl2br($vars['entity']->description);
			
			?>
		</p>
		<p>
			<?php

				echo elgg_view('output/tags', array('tags' => $vars['entity']->tags));
			
			?>
		</p>
		<?php

			if ($vars['entity']->canEdit()) {
			?>
				<a href="<?php echo $vars['url']; ?>mod/blog/edit.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a>
				<a href="<?php echo $vars['url']; ?>action.php?action=blog/delete&blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("delete"); ?></a>
				<?php

					// Allow the menu to be extended
					echo elgg_view("editmenu",array('entity' => $vars['entity']));
				
				?>
			<?php
			}
		
		?>
	</div>

<?php

		// If we've been asked to display the full view
			if (isset($vars['full']) && $vars['full'] == true) {
				
?>

		<div class="blog-comments">
		
<?php

		// Display comments if any
			echo elgg_view('object/blog-comments',array('comments' => $vars['comments']));

?>
			<form action="<?php echo $vars['url']; ?>action/blog/comments/add" method="post">
				<h3>
					<?php echo elgg_echo("blog:comment:add"); ?>
				</h3>
				<p>
					<label><?php echo elgg_echo("blog:comment:text"); ?>
						<?php

							echo elgg_view("input/longtext",array('internalname' => 'comment'));
						
						?>
					</label>
				</p>
				<p>
					<input type="hidden" name="blogpost_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /> 
					<input type="submit" value="<?php echo elgg_echo("save"); ?>" />
				</p>
			</form>
		
		</div>

<?php
				
			}
		}

?>