Ticket #354: commentwall-walltowall.diff
| File commentwall-walltowall.diff, 4.6 kB (added by justinr, 3 months ago) |
|---|
-
mod/commentwall/lib.php
old new 82 82 83 83 return get_records_sql($query); 84 84 } 85 86 87 /** 88 * Retrieve the wall-to-wall for a given pair of userids. 89 * 90 * @return mixed Array of comment objects, else returns false. 91 * @param unknown_type $userid The user / wall we are retrieving 92 * @param unknown_type $limit Limit on the search 93 * @param unknown_type $offset Offset 94 */ 95 function commentwall_getwalltowall($userid, $otherid, $limit = 10, $offset = 0) 96 { 97 global $CFG; 98 99 $query = "SELECT * FROM " . $CFG->prefix . "commentwall " . 100 "WHERE (wallowner=" . $userid . " AND comment_owner=" . $otherid . ") OR ". 101 "(wallowner=" . $otherid . " AND comment_owner=" . $userid . ") ". 102 "ORDER BY posted desc LIMIT " . $offset . "," . $limit; 103 104 //echo $query; 105 106 return get_records_sql($query); 107 } 108 85 109 86 110 /** 87 111 * Add a comment to a wall. … … 223 247 $text = $comment_obj->content; 224 248 225 249 $replytowall = __gettext("Post reply"); 226 $replytootherwall = sprintf(__gettext("Reply on %s's wall"), $comment_owner_username); 250 $replytootherwall = sprintf(__gettext("%s's wall"), $comment_owner_username); 251 $walltowall = __gettext("Wall-to-wall"); 227 252 $delete = __gettext("Delete"); 228 253 229 $doaction = "{$CFG->wwwroot}mod/commentwall/do_action.php?owner=" . page_owner(). "&return_url=" .urlencode($_SERVER['REQUEST_URI']);254 $doaction = "{$CFG->wwwroot}mod/commentwall/do_action.php?owner=" . $comment_obj->wallowner. "&return_url=" .urlencode($_SERVER['REQUEST_URI']); 230 255 231 256 $replybar = ""; 232 257 if (isloggedin()) 233 258 { 234 259 //$replybar .= "<a href=\"#commentwall_form_-1\">$replytowall</a>"; 235 if (($comment_obj->wallowner != $comment_obj->comment_owner) && ($comment_obj->comment_owner != 0))260 if (($comment_obj->wallowner != $comment_obj->comment_owner) && ($comment_obj->comment_owner != 0)) { 236 261 $replybar .= "<a href=\"{$CFG->wwwroot}mod/commentwall/index.php?owner={$comment_obj->comment_owner}&wallowner={$comment_obj->comment_owner}&comment_owner={$_SESSION['userid']}&reply={$comment_obj->ident}&return_url=" .urlencode($_SERVER['REQUEST_URI'])."\">$replytootherwall</a> | "; 237 238 if ((commentwall_permissions_check($comment_obj->comment_owner)) 239 || (commentwall_permissions_check($comment_obj->wallowner))) 240 $replybar.= "<a href=\"$doaction&action=commentwall::delete&ident={$comment_obj->ident}\">$delete</a>"; 262 $replybar .= "<a href=\"{$CFG->wwwroot}mod/commentwall/walltowall.php?owner={$comment_obj->wallowner}&other={$comment_obj->comment_owner}&return_url=" .urlencode($_SERVER['REQUEST_URI'])."\">$walltowall</a> | "; 263 } 264 if ((commentwall_permissions_check($comment_obj->comment_owner)) 265 || (commentwall_permissions_check($comment_obj->wallowner))) 266 $replybar.= "<a href=\"$doaction&action=commentwall::delete&ident={$comment_obj->ident}\">$delete</a>"; 241 267 } 242 268 243 269 … … 314 340 ) 315 341 { 316 342 // $owner = page_owner(); 317 $html = "<div id=\"commentwall_title\"><h2>" . sprintf(__gettext(" %s's comment wall"), user_info("name", page_owner())) . "</h2></div>";343 $html = "<div id=\"commentwall_title\"><h2>" . sprintf(__gettext("Write on %s's comment wall"), user_info("name", $owner)) . "</h2></div>"; 318 344 319 345 if (($showalltxt) && ($wall)) 320 346 { … … 322 348 } 323 349 324 350 325 $html .= commentwall_post_form( page_owner());351 $html .= commentwall_post_form($owner); 326 352 327 353 if (!$wall) { 328 354 $html .= "<p>" . __gettext("No comments on this wall, why not be the first?") . "</p>"; -
mod/commentwall/walltowall.php
old new 1 <?php 2 /** wall-to-wall viewing page */ 3 4 // Load the Elgg framework 5 6 require_once("../../includes.php"); 7 global $CFG, $messages; 8 9 /* 10 * Variable initialisation 11 */ 12 13 $owner = optional_param('owner', page_owner()); 14 15 $other = required_param('other'); 16 17 $offset = optional_param('offset', 0); 18 $limit = optional_param('limit', 10); 19 20 $title = sprintf(__gettext("%s and %s's Wall-to-wall"), user_info("name", $owner), user_info("name", $other)); 21 22 $wall = commentwall_getwalltowall($owner, $other, $limit, $offset); 23 24 $html = commentwall_displaywall_html($wall, true, $other); 25 $html.= commentwall_display_footer($owner, $limit, $offset); 26 27 templates_page_output($title, $html); 28 29 ?>
