function displayFormAll() { global $wgUser, $wgOut, $wgRequest, $wgGiveGiftPerRow, $wgUploadPath; $user = Title::makeTitle(NS_USER, $this->user_name_to); $page = $wgRequest->getInt('page'); if (!$page || !is_numeric($page)) { $page = 1; } $per_page = 24; $per_row = $wgGiveGiftPerRow; if (!$per_row) { $per_row = 3; } $total = Gifts::getGiftCount(); $gifts = Gifts::getGiftList($per_page, $page, 'gift_name'); $output = ''; if ($gifts) { $wgOut->setPageTitle(wfMsg('g-give-all-title', $this->user_name_to)); $output .= '<div class="back-links"> <a href="' . $user->escapeFullURL() . '">' . wfMsg('g-back-link', $this->user_name_to) . '</a> </div> <div class="g-message">' . wfMsg('g-give-all', $this->user_name_to) . '</div> <form action="" method="post" enctype="multipart/form-data" name="gift">'; $x = 1; foreach ($gifts as $gift) { $gift_image = "<img id=\"gift_image_{$gift['id']}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage($gift['id'], 'l') . '" border="0" alt="" />'; $output .= "<div onclick=\"selectGift({$gift['id']})\" onmouseover=\"highlightGift({$gift['id']})\" onmouseout=\"unHighlightGift({$gift['id']})\" id=\"give_gift_{$gift['id']}\" class=\"g-give-all\">\r\n\t\t\t\t\t{$gift_image}\r\n\t\t\t\t\t<div class=\"g-title g-blue\">{$gift['gift_name']}</div>"; if ($gift['gift_description']) { $output .= "<div class=\"g-describe\">{$gift['gift_description']}</div>"; } $output .= '<div class="cleared"></div> </div>'; if ($x == count($gifts) || $x != 1 && $x % $per_row == 0) { $output .= '<div class="cleared"></div>'; } $x++; } /** * Build next/prev nav */ $giveGiftLink = SpecialPage::getTitleFor('GiveGift'); $numofpages = $total / $per_page; $user_safe = urlencode($user->getText()); if ($numofpages > 1) { $output .= '<div class="page-nav">'; if ($page > 1) { $output .= '<a href="' . $giveGiftLink->escapeFullURL('user='******'&page=' . ($page - 1)) . '">' . wfMsg('g-previous') . '</a> '; } if ($total % $per_page != 0) { $numofpages++; } if ($numofpages >= 9) { $numofpages = 9 + $page; } for ($i = 1; $i <= $numofpages; $i++) { if ($i == $page) { $output .= $i . ' '; } else { $output .= '<a href="' . $giveGiftLink->escapeFullURL('user='******'&page=' . $i) . "\">{$i}</a> "; } } if ($total - $per_page * $page > 0) { $output .= ' <a href="' . $giveGiftLink->escapeFullURL('user='******'&page=' . ($page + 1)) . '">' . wfMsg('g-next') . '</a>'; } $output .= '</div>'; } /** * Build next/prev nav */ $output .= '<div class="g-give-all-message-title">' . wfMsg('g-give-all-message-title') . '</div> <textarea name="message" id="message" rows="4" cols="50"></textarea> <div class="g-buttons"> <input type="hidden" name="gift_id" value="0" /> <input type="hidden" name="user_name" value="' . addslashes($this->user_name_to) . '" /> <input type="button" class="site-button" value="' . wfMsg('g-send-gift') . '" size="20" onclick="sendGift()" /> <input type="button" class="site-button" value="' . wfMsg('g-cancel') . '" size="20" onclick="history.go(-1)" /> </div> </form>'; } else { $wgOut->setPageTitle(wfMsg('g-error-title')); $wgOut->addHTML(wfMsg('g-error-message-invalid-link')); } return $output; }
function displayFormAll() { global $wgGiveGiftPerRow, $wgUploadPath; $out = $this->getOutput(); $user = Title::makeTitle(NS_USER, $this->user_name_to); $page = $this->getRequest()->getInt('page'); if (!$page || !is_numeric($page)) { $page = 1; } $per_page = 24; $per_row = $wgGiveGiftPerRow; if (!$per_row) { $per_row = 3; } $total = Gifts::getGiftCount(); $gifts = Gifts::getGiftList($per_page, $page, 'gift_name'); $output = ''; if ($gifts) { $out->setPageTitle($this->msg('g-give-all-title', $this->user_name_to)->parse()); $output .= '<div class="back-links"> <a href="' . htmlspecialchars($user->getFullURL()) . '">' . $this->msg('g-back-link', $this->user_name_to)->parse() . '</a> </div> <div class="g-message">' . $this->msg('g-give-all', $this->user_name_to)->parse() . '</div> <form action="" method="post" enctype="multipart/form-data" name="gift">'; $x = 1; foreach ($gifts as $gift) { $gift_image = "<img id=\"gift_image_{$gift['id']}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage($gift['id'], 'l') . '" border="0" alt="" />'; $output .= "<div id=\"give_gift_{$gift['id']}\" class=\"g-give-all\">\n\t\t\t\t\t{$gift_image}\n\t\t\t\t\t<div class=\"g-title g-blue\">{$gift['gift_name']}</div>"; if ($gift['gift_description']) { $output .= "<div class=\"g-describe\">{$gift['gift_description']}</div>"; } $output .= '<div class="cleared"></div> </div>'; if ($x == count($gifts) || $x != 1 && $x % $per_row == 0) { $output .= '<div class="cleared"></div>'; } $x++; } /** * Build next/prev nav */ $giveGiftLink = $this->getPageTitle(); $numofpages = $total / $per_page; $user_name = $user->getText(); if ($numofpages > 1) { $output .= '<div class="page-nav">'; if ($page > 1) { $output .= Linker::link($giveGiftLink, $this->msg('g-previous')->plain(), array(), array('user' => $user_name, 'page' => $page - 1)) . $this->msg('word-separator')->plain(); } if ($total % $per_page != 0) { $numofpages++; } if ($numofpages >= 9) { $numofpages = 9 + $page; } for ($i = 1; $i <= $numofpages; $i++) { if ($i == $page) { $output .= $i . ' '; } else { $output .= Linker::link($giveGiftLink, $i, array(), array('user' => $user_name, 'page' => $i)) . $this->msg('word-separator')->plain(); } } if ($total - $per_page * $page > 0) { $output .= $this->msg('word-separator')->plain() . Linker::link($giveGiftLink, $this->msg('g-next')->plain(), array(), array('user' => $user_name, 'page' => $page + 1)); } $output .= '</div>'; } /** * Build the send/cancel buttons and whatnot */ $output .= '<div class="g-give-all-message-title">' . $this->msg('g-give-all-message-title')->plain() . '</div> <textarea name="message" id="message" rows="4" cols="50"></textarea> <div class="g-buttons"> <input type="hidden" name="gift_id" value="0" /> <input type="hidden" name="user_name" value="' . addslashes($this->user_name_to) . '" /> <input type="button" id="send-gift-button" class="site-button" value="' . $this->msg('g-send-gift')->plain() . '" size="20" /> <input type="button" class="site-button" value="' . $this->msg('g-cancel')->plain() . '" size="20" onclick="history.go(-1)" /> </div> </form>'; } else { $out->setPageTitle($this->msg('g-error-title')->plain()); $out->addHTML($this->msg('g-error-message-invalid-link')->plain()); } return $output; }