示例#1
0
 function getChangedBy($action_str, $div_id = 'qc_changedby', $u = null)
 {
     if ($u == null) {
         //normal use
         $userText = $this->mResult->qc_user_text;
         $u = User::newFromName($userText);
     }
     $html = "<div id='{$div_id}' class='qc_by'>{$action_str}";
     if ($u) {
         $display = $u->getRealName() == "" ? $u->getName() : $u->getRealName();
         $img = "<a target='new' href='{$u->getUserPage()->getFullURL()}' class='tooltip'><img src='" . Avatar::getAvatarURL($u->getName()) . "' /></a>";
         $html .= "{$img} <a target='new' href='{$u->getUserPage()->getFullURL()}'>{$display}</a>";
         $html .= "<span class='tooltip_span'>Hi, I'm {$display}</span>";
         //add a Quick Note button for patrols
         if (preg_match('@patrol@', $action_str)) {
             $t = Title::newFromID($this->mResult->qc_page);
             //make and format the Quick Note button
             $qn = QuickNoteEdit::getQuickNoteDiffButton($t, $u, $this->mResult->qc_rev_id, $this->mResult->qc_old_rev_id);
             $class = "";
             $html .= preg_replace("@href@", $class . " href", $qn);
         }
     } else {
         $html .= "<a target='new' href='{$userText}'>{$userText}</a>";
     }
     $html .= '</div>';
     return $html;
 }