Changeset 1594

Show
Ignore:
Timestamp:
05/20/08 07:40:12 (3 months ago)
Author:
misja
Message:

Misja Hoebe <misja@curverider.co.uk> Applied attachment:ticket:354:commentwall-walltowall.diff. Fixes #354, wall-to-wall display for commentwall - thanks justinr

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/commentwall/lib.php

    r1591 r1594  
    8383                return get_records_sql($query); 
    8484        } 
     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 
    85109         
    86110        /** 
     
    224248                 
    225249                $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"); 
    227252                $delete = __gettext("Delete"); 
    228253                 
    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']); 
    230255 
    231256                $replybar = ""; 
     
    233258                { 
    234259                        //$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)) { 
    236261                                $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>"; 
    241267                } 
    242268 
     
    315341                { 
    316342            // $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>"; 
    318344 
    319345            if (($showalltxt) && ($wall)) 
     
    323349 
    324350 
    325             $html .= commentwall_post_form(page_owner()); 
     351            $html .= commentwall_post_form($owner); 
    326352                 
    327353                if (!$wall) {