Commit b91da79f authored by Penny Leach's avatar Penny Leach Committed by Penny Leach
Browse files

teeny changes to wall

parent 17cd1ac0
......@@ -34,5 +34,6 @@ $string['viewwall'] = 'View wall';
$string['backtoprofile'] = 'Back to profile';
$string['wall'] = 'Wall';
$string['wholewall'] = 'View whole wall';
$string['reply'] = 'reply';
$string['delete'] = 'delete post';
?>
......@@ -49,8 +49,13 @@ class PluginBlocktypeWall extends SystemBlocktype {
}
public static function render_instance(BlockInstance $instance, $editing=false) {
global $USER;
$owner = $instance->get_view()->get('owner');
$userid = (!empty($USER) ? $USER->get('id') : 0);
$smarty = smarty_core();
$smarty->assign('instanceid', $instance->get('id'));
$smarty->assign('ownwall', (!empty($USER) && $USER->get('id') == $owner));
if ($posts = self::fetch_posts($instance)) {
$smarty->assign('wallposts', $posts);
}
......@@ -136,7 +141,7 @@ class PluginBlocktypeWall extends SystemBlocktype {
$sql = '
SELECT bwp.*,' . db_format_tsfield('postdate') . ',
u.firstname,u.lastname,u.preferredname
u.username,firstname,u.lastname,u.preferredname
FROM {blocktype_wall_post} bwp
JOIN {usr} u ON bwp.from = u.id
WHERE bwp.instance = ? AND u.deleted = 0
......
......@@ -5,10 +5,21 @@
{if $wallposts}
{foreach from=$wallposts item=wallpost}
<div id="wallpost">
{* TODO THIS BADLY NEEDS FORMATTING *}
<div id="icon"><img src="{$WWWROOT}thumb.php?type=profileicon&maxwidth=50&maxheight=50&id={$wallpost->from}" /></div>
<div id="userinfo">{$wallpost->displayname|escape}</div>
<div id="text">{$wallpost->text|escape}</div>
<div id="postedon">{$wallpost->postdate|format_date}</div>
<div id="controls">controls</div>
<div id="controls">
{if $ownwall}
[ <a href="{$WWWROOT}blocktype/wall/wall.php?instance={$instanceid}&replyto={$wallpost->id}">{str tag='reply' section='blocktype.wall'}</a> ]
{/if}
{if $ownwall || $wallpost->from == $userid}
[ <a href="{$WWWROOT}blocktype/wall/deletepost.php?instance={$instanceid}&return={if $wholewall}wall{else}profile{/if}">
{str tag='delete' section='blocktype.wall'}
</a> ]
{/if}
</div>
</div>
{/foreach}
{if !$wholewall}
......
......@@ -33,14 +33,22 @@ safe_require('blocktype', 'wall');
define('TITLE', get_string('viewwall', 'blocktype.wall'));
$instanceid = param_integer('id');
$reply = param_boolean('reply', false); // TODO send this to the form
$postid = 0;
if ($reply) {
$postid = param_integer('postid'); // TODO just fetch this thread
}
$postid = param_integer('postid', 0);
$block = new BlockInstance($instanceid);
$view = $block->get_view();
$owner = $view->get_owner_object();
$owner->displayname = display_name($owner);
$smarty = smarty();
$smarty->assign('instanceid', $instanceid);
$smarty->assign('owner', $owner);
$smarty->assign('wholewall', true);
$smarty->assign('ownwall', (!empty($USER) && $USER->get('id') == $owner->id));
if ($posts = PluginBlocktypeWall::fetch_posts($block)) {
$smarty->assign('wallposts', $posts);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment