Ejemplo n.º 1
0
 function printNewsPageListWithNav($next = 'next »', $prev = '« prev', $nextprev = true, $class = 'pagelist')
 {
     global $_zp_zenpage_total_pages;
     $total = ceil(getTotalArticles() / getOption("zenpage_articles_per_page"));
     $current = getCurrentNewsPage();
     echo "<ul class=\"{$class}\">";
     if ($nextprev) {
         echo "<li class=\"prev\">";
         $this->printPrevNewsPageLink($prev);
         echo "</li>";
     }
     $j = max(1, min($current - 3, $total - 6));
     if ($j != 1) {
         echo "\n <li>";
         echo "<a href=\"" . getNewsBaseURL() . getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath() . max($j - 4, 1) . "\">...</a>";
         echo '</li>';
     }
     for ($i = $j; $i <= min($total, $j + 6); $i++) {
         if ($i == $current) {
             echo "<li class='current'><a>" . $i . "</a></li>\n";
         } else {
             echo "<li><a href='" . getNewsBaseURL() . getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath() . $i . "' title='" . gettext("Page") . " " . $i . "'>" . $i . "</a></li>\n";
         }
     }
     if ($i <= $total) {
         echo "\n <li>";
         echo "<a href=\"" . getNewsBaseURL() . getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath() . min($j + 10, $total) . "\">...</a>";
         echo '</li>';
     }
     if ($nextprev) {
         if ($current < $total) {
             echo "<li class='next'>";
             printNextNewsPageLink($next);
             echo "</li>";
         } else {
             echo "<li class='next'><a>{$next}</a></li>";
         }
     }
     echo "</ul>";
 }
/**
 * Prints the full news page navigation with prev/next links and the page number list
 *
 * @param string $next The next page link text
 * @param string $prev The prev page link text
 * @param bool $nextprev If the prev/next links should be printed
 * @param string $class The CSS class for the disabled link
 * @param bool $firstlast Add links to the first and last pages of you gallery
 * @param int $navlen Number of navigation links to show (0 for all pages). Works best if the number is odd.
 *
 * @return string
 */
function printNewsPageListWithNav($next, $prev, $nextprev = true, $class = 'pagelist', $firstlast = true, $navlen = 9)
{
    global $_zp_zenpage, $_zp_page;
    $total = ceil($_zp_zenpage->getTotalArticles() / ZP_ARTICLES_PER_PAGE);
    if ($total > 1) {
        if ($navlen == 0) {
            $navlen = $total;
        }
        $extralinks = 2;
        if ($firstlast) {
            $extralinks = $extralinks + 2;
        }
        $len = floor(($navlen - $extralinks) / 2);
        $j = max(round($extralinks / 2), min($_zp_page - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1));
        $ilim = min($total, max($navlen - round($extralinks / 2), $_zp_page + floor($len)));
        $k1 = round(($j - 2) / 2) + 1;
        $k2 = $total - round(($total - $ilim) / 2);
        echo "<ul class=\"{$class}\">\n";
        if ($nextprev) {
            echo "<li class=\"prev\">";
            printPrevNewsPageLink($prev);
            echo "</li>\n";
        }
        if ($firstlast) {
            echo '<li class = "' . ($_zp_page == 1 ? 'current' : 'first') . '">';
            if ($_zp_page == 1) {
                echo "1";
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav(1)) . '" title = "' . gettext("Page") . ' 1">1</a>';
            }
            echo "</li>\n";
            if ($j > 2) {
                echo "<li>";
                $linktext = $j - 1 > 2 ? '...' : $k1;
                echo '<a href = "' . html_encode(getNewsPathNav($k1)) . '" title = "' . sprintf(ngettext('Page %u', 'Page %u', $k1), $k1) . '">' . $linktext . '</a>';
                echo "</li>\n";
            }
        }
        for ($i = $j; $i <= $ilim; $i++) {
            echo "<li" . ($i == $_zp_page ? " class=\"current\"" : "") . ">";
            if ($i == $_zp_page) {
                echo $i;
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav($i)) . '" title = "' . sprintf(ngettext('Page %1$u', 'Page %1$u', $i), $i) . '">' . $i . '</a>';
            }
            echo "</li>\n";
        }
        if ($i < $total) {
            echo "<li>";
            $linktext = $total - $i > 1 ? '...' : $k2;
            echo '<a href = "' . html_encode(getNewsPathNav($k2)) . '" title = "' . sprintf(ngettext('Page %u', 'Page %u', $k2), $k2) . '">' . $linktext . '</a>';
            echo "</li>\n";
        }
        if ($firstlast && $i <= $total) {
            echo "\n  <li class=\"last\">";
            if ($_zp_page == $total) {
                echo $total;
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav($total)) . '" title = "' . sprintf(ngettext('Page {%u}', 'Page {%u}', $total), $total) . '">' . $total . '</a>';
            }
            echo "</li>\n";
        }
        if ($nextprev) {
            echo '<li class = "next">';
            printNextNewsPageLink($next);
            echo "</li>\n";
        }
        echo "</ul>\n";
    }
}
Ejemplo n.º 3
0
					</div>
					<?php 
}
?>
				</div>
				
				<?php 
if ($zpbase_newsstyle == 'masonry-style') {
    ?>
				<?php 
    if (getNextNewsPageURL()) {
        ?>
	
				<div id="page-nav-mas">
					<?php 
        printNextNewsPageLink(gettext('Load More...'));
        ?>
				</div>
				<?php 
    }
    ?>
				<div id="page-nav" class="clearfix">
					<div class="jump"><?php 
    printBaseAlbumMenuJump('count', gettext('Gallery Index'));
    ?>
</div>
				</div>
				<?php 
} else {
    ?>
				<div class="page-nav">
/**
 * Prints the full news page navigation with prev/next links and the page number list
 *
 * @param string $next The next page link text
 * @param string $prev The prev page link text
 * @param bool $nextprev If the prev/next links should be printed
 * @param string $class The CSS class for the disabled link
 * @param bool $firstlast Add links to the first and last pages of you gallery
 * @param int $navlen Number of navigation links to show (0 for all pages). Works best if the number is odd.
 *
 * @return string
 */
function printNewsPageListWithNav($next, $prev, $nextprev = true, $class = 'pagelist', $firstlast = true, $navlen = 9)
{
    global $_zp_zenpage;
    $total = ceil($_zp_zenpage->getTotalArticles() / ZP_ARTICLES_PER_PAGE);
    $current = $_zp_zenpage->getCurrentNewsPage();
    if ($total > 1) {
        if ($navlen == 0) {
            $navlen = $total;
        }
        $extralinks = 2;
        if ($firstlast) {
            $extralinks = $extralinks + 2;
        }
        $len = floor(($navlen - $extralinks) / 2);
        $j = max(round($extralinks / 2), min($current - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1));
        $ilim = min($total, max($navlen - round($extralinks / 2), $current + floor($len)));
        $k1 = round(($j - 2) / 2) + 1;
        $k2 = $total - round(($total - $ilim) / 2);
        echo "<ul class=\"{$class}\">\n";
        if ($nextprev) {
            echo "<li class=\"prev\">";
            printPrevNewsPageLink($prev);
            echo "</li>\n";
        }
        if ($firstlast) {
            echo '<li class="' . ($current == 1 ? 'current' : 'first') . '">';
            if ($current == 1) {
                echo "1";
            } else {
                if ($_zp_zenpage->news_on_index) {
                    echo "<a href='" . html_encode(getNewsIndexURL()) . "' title='" . gettext("Page") . " 1'>1</a>";
                } else {
                    echo "<a href='" . getNewsBaseURL() . html_encode(getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath()) . "1' title='" . gettext("Page") . " 1'>1</a>";
                }
            }
            echo "</li>\n";
            if ($j > 2) {
                echo "<li>";
                $linktext = $j - 1 > 2 ? '...' : $k1;
                echo "<a href=\"" . getNewsBaseURL() . html_encode(getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath()) . $k1 . "\" title=\"" . sprintf(ngettext('Page %u', 'Page %u', $k1), $k1) . "\">" . $linktext . "</a>";
                echo "</li>\n";
            }
        }
        for ($i = $j; $i <= $ilim; $i++) {
            echo "<li" . ($i == $current ? " class=\"current\"" : "") . ">";
            if ($i == $current) {
                echo $i;
            } else {
                echo "<a href='" . getNewsBaseURL() . html_encode(getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath()) . $i . "' title='" . sprintf(ngettext('Page %1$u', 'Page %1$u', $i), $i) . "'>" . $i . "</a>";
            }
            echo "</li>\n";
        }
        if ($i < $total) {
            echo "<li>";
            $linktext = $total - $i > 1 ? '...' : $k2;
            echo "<a href='" . getNewsBaseURL() . html_encode(getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath()) . $k2 . "' title='" . sprintf(ngettext('Page %u', 'Page %u', $k2), $k2) . "'>" . $linktext . "</a>";
            echo "</li>\n";
        }
        if ($firstlast && $i <= $total) {
            echo "\n  <li class=\"last\">";
            if ($current == $total) {
                echo $total;
            } else {
                echo "<a href=\"" . getNewsBaseURL() . html_encode(getNewsCategoryPathNav() . getNewsArchivePathNav() . getNewsPagePath()) . $total . "\" title=\"" . sprintf(ngettext('Page {%u}', 'Page {%u}', $total), $total) . "\">" . $total . "</a>";
            }
            echo "</li>\n";
        }
        if ($nextprev) {
            echo "<li class=\"next\">";
            printNextNewsPageLink($next);
            echo "</li>\n";
        }
        echo "</ul>\n";
    }
}