Пример #1
0
    /**
     * Display the text list of all existing gifts and a delete link to users
     * who are allowed to delete gifts.
     *
     * @return String: HTML
     */
    function displayGiftList()
    {
        $output = '';
        // Prevent E_NOTICE
        $page = 0;
        /**
         * @todo FIXME: this is a dumb hack. The value of this variable used to
         * be 10, but then it would display only the *first ten* gifts, as this
         * special page seems to lack pagination.
         * @see https://www.mediawiki.org/w/index.php?oldid=988111#Gift_administrator_displays_10_gifts_only
         */
        $per_page = 1000;
        $gifts = Gifts::getManagedGiftList($per_page, $page);
        if ($gifts) {
            foreach ($gifts as $gift) {
                $deleteLink = '';
                if ($this->canUserDelete()) {
                    $deleteLink = '<a href="' . htmlspecialchars(SpecialPage::getTitleFor('RemoveMasterGift')->getFullURL("gift_id={$gift['id']}")) . '" style="font-size:10px; color:red;">' . $this->msg('delete')->plain() . '</a>';
                }
                $output .= '<div class="Item">
				<a href="' . htmlspecialchars($this->getPageTitle()->getFullURL("id={$gift['id']}")) . '">' . $gift['gift_name'] . '</a> ' . $deleteLink . "</div>\n";
            }
        }
        return '<div id="views">' . $output . '</div>';
    }
	/**
	 * Display the text list of all existing gifts and a delete link to users
	 * who are allowed to delete gifts.
	 *
	 * @return String: HTML
	 */
	function displayGiftList() {
		$output = ''; // Prevent E_NOTICE
		$page = 0;
		$per_page = 10;
		$gifts = Gifts::getManagedGiftList( $per_page, $page );
		if ( $gifts ) {
			foreach ( $gifts as $gift ) {
				$deleteLink = '';
				if ( $this->canUserDelete() ) {
					$deleteLink = '<a href="' .
						SpecialPage::getTitleFor( 'RemoveMasterGift' )->escapeFullURL( "gift_id={$gift['id']}" ) .
						'" style="font-size:10px; color:red;">' .
						wfMsg( 'delete' ) . '</a>';
				}

				$output .= '<div class="Item">
				<a href="' . $this->getTitle()->escapeFullURL( "id={$gift['id']}" ) . '">' .
					$gift['gift_name'] . '</a> ' .
					$deleteLink . "</div>\n";
			}
		}
		return '<div id="views">' . $output . '</div>';
	}
    function displayGiftList()
    {
        global $wgScriptPath;
        $output = '';
        // Prevent E_NOTICE
        $page = 0;
        $per_page = 10;
        $gifts = Gifts::getManagedGiftList($per_page, $page);
        if ($gifts) {
            foreach ($gifts as $gift) {
                $output .= '<div class="Item">
				<a href="' . $wgScriptPath . '/index.php?title=Special:GiftManager&amp;id=' . $gift['id'] . '">' . $gift['gift_name'] . '</a> ' . ($this->canUserDelete() ? '<a href="' . SpecialPage::getTitleFor('RemoveMasterGift')->escapeFulLURL("gift_id={$gift["id"]}") . '" style="font-size:10px; color:red;">' . wfMsg('delete') . '</a>' : '') . "</div>\n";
            }
        }
        return '<div id="views">' . $output . '</div>';
    }