Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

On the my reviews page, show a list of pages I own

  • Loading branch information...
commit 0dd7364d3e62e2f63697df9f2fe98c14a29b297c 1 parent da65db0
Andrew Whitworth authored
Showing with 30 additions and 6 deletions.
  1. +30 −6 MyReviews_body.php
36 MyReviews_body.php
View
@@ -207,15 +207,15 @@ function showViewerAdditions()
}
# Reviews this user has given
- function reviewsIGave($userid) {
- $selectquery =<<<EOSQL
+ function reviewsIGave() {
+ $selectquery = <<<EOSQL
SELECT
review_score.display_as, page.page_namespace, page.page_title, review.*
FROM
review_score INNER JOIN (
review INNER JOIN page ON review.page_id = page.page_id
) ON review.review_score_id = review_score.id
- WHERE user_id = '{$userid}';
+ WHERE user_id = '{$this->userID}';
EOSQL;
$dbr = wfGetDB(DB_SLAVE);
$given = $dbr->query($selectquery);
@@ -249,7 +249,7 @@ function reviewsIGave($userid) {
}
# Reviews given to this user
- function reviewsIReceive($userid) {
+ function reviewsIReceive() {
# Explanation of this SQL: We want to get page/review information (along
# with the displayable name of the review) for all pages that this user
# owns
@@ -293,13 +293,35 @@ function reviewsIReceive($userid) {
return $takenReviews;
}
+ function ownedPages() {
+ $selectquery = <<<EOT
+SELECT
+ page.page_namespace, page.page_title
+ FROM page, page_owner
+ WHERE page_owner.user_id = '{$this->userID}'
+ AND page_owner.page_id = page.page_id
+EOT;
+ $dbr = wfGetDB(DB_SLAVE);
+ $pages = $dbr->query($selectquery);
+ $pagehtml = "";
+ while ($row = $dbr->fetchObject($pages)) {
+ $pagename = $this->getNamespaceNameFromId($row->page_namespace) . $row->page_title;
+ $page = Title::newFromText($pagename);
+ $pagehref = $page->getFullURL();
+ $talkhref = $page->getTalkPage()->getFullURL();
+ $pagehtml .= "<p><a href='$pagehref'>$pagename</a> (<a href='$talkhref'>Talk</a>)</p>";
+ }
+ return $pagehtml;
+ }
+
# Show the basic main page
function showMainPage() {
global $wgRequest, $wgOut;
$this->showViewerAdditions();
- $givenReviews = $this->reviewsIGave($this->userID);
- $takenReviews = $this->reviewsIReceive($this->userID);
+ $givenReviews = $this->reviewsIGave();
+ $takenReviews = $this->reviewsIReceive();
+ $ownedpages = $this->ownedPages();
# TODO: Show a list of all pages I own
$html = <<<EOT
@@ -313,6 +335,8 @@ function showMainPage() {
<td id="PeerReview-MyReviews-given-side" valign="top">
<h3>Reviews given by {$this->username}</h3>
{$givenReviews}
+ <h3>Pages owned by {$this->username}</h3>
+ {$ownedpages}
</td>
</tr>
</table>
Please sign in to comment.
Something went wrong with that request. Please try again.