示例#1
0
 static function getArchiveMonthLink($year, $month, $monthIndex, $count, $tag = 'a')
 {
     global $_zp_current_search;
     if (is_object($_zp_current_search)) {
         $albumlist = $_zp_current_search->album_list;
     } else {
         $albumlist = NULL;
     }
     return "<{$tag} href='" . htmlspecialchars(getSearchURl('', "{$year}-{$monthIndex}", 0, 0, $albumlist)) . "&f=xml' rel='nofollow'>{$month} ({$count})</{$tag}>";
 }
/**
 * Prints a compendum of dates and links to a search page that will show results of the date
 *
 * @param string $class optional class
 * @param string $yearid optional class for "year"
 * @param string $monthid optional class for "month"
 * @param string $order set to 'desc' for the list to be in descending order
 */
function printAllDates($class = 'archive', $yearid = 'year', $monthid = 'month', $order = 'asc')
{
    global $_zp_current_search, $_zp_gallery_page;
    if (empty($class)) {
        $classactive = 'archive_active';
    } else {
        $classactive = $class . '_active';
        $class = "class=\"{$class}\"";
    }
    if ($_zp_gallery_page == 'search.php') {
        $activedate = getSearchDate('%Y-%m');
    } else {
        $activedate = '';
    }
    if (!empty($yearid)) {
        $yearid = "class=\"{$yearid}\"";
    }
    if (!empty($monthid)) {
        $monthid = "class=\"{$monthid}\"";
    }
    $datecount = getAllDates($order);
    $lastyear = "";
    echo "\n<ul {$class}>\n";
    $nr = 0;
    while (list($key, $val) = each($datecount)) {
        $nr++;
        if ($key == '0000-00-01') {
            $year = "no date";
            $month = "";
        } else {
            $dt = strftime('%Y-%B', strtotime($key));
            $year = substr($dt, 0, 4);
            $month = substr($dt, 5);
        }
        if ($lastyear != $year) {
            $lastyear = $year;
            if ($nr != 1) {
                echo "</ul>\n</li>\n";
            }
            echo "<li {$yearid}>{$year}\n<ul {$monthid}>\n";
        }
        if (is_object($_zp_current_search)) {
            $albumlist = $_zp_current_search->getAlbumList();
        } else {
            $albumlist = NULL;
        }
        $datekey = substr($key, 0, 7);
        if ($activedate = $datekey) {
            $cl = ' class="' . $classactive . '"';
        } else {
            $cl = '';
        }
        echo "<li" . $cl . "><a href=\"" . html_encode(getSearchURl('', $datekey, '', 0, array('allbums' => $albumlist))) . "\">{$month} ({$val})</a></li>\n";
    }
    echo "</ul>\n</li>\n</ul>\n";
}
/**
 * Prints a compendum of dates and links to a search page that will show results of the date
 *
 * @param string $class optional class
 * @param string $yearid optional class for "year"
 * @param string $monthid optional class for "month"
 * @param string $order set to 'desc' for the list to be in descending order
 */
function printAllDates($class = 'archive', $yearid = 'year', $monthid = 'month', $order = 'asc')
{
    if (!empty($class)) {
        $class = "class=\"{$class}\"";
    }
    if (!empty($yearid)) {
        $yearid = "class=\"{$yearid}\"";
    }
    if (!empty($monthid)) {
        $monthid = "class=\"{$monthid}\"";
    }
    $datecount = getAllDates($order);
    $lastyear = "";
    echo "\n<ul {$class}>\n";
    $nr = 0;
    while (list($key, $val) = each($datecount)) {
        $nr++;
        if ($key == '0000-00-01') {
            $year = "no date";
            $month = "";
        } else {
            $dt = strftime('%Y-%B', strtotime($key));
            $year = substr($dt, 0, 4);
            $month = substr($dt, 5);
        }
        if ($lastyear != $year) {
            $lastyear = $year;
            if ($nr != 1) {
                echo "</ul>\n</li>\n";
            }
            echo "<li {$yearid}>{$year}\n<ul {$monthid}>\n";
        }
        echo "<li><a href=\"" . htmlspecialchars(getSearchURl('', substr($key, 0, 7), 0, 0)) . "\" rel=\"nofollow\">{$month} ({$val})</a></li>\n";
    }
    echo "</ul>\n</li>\n</ul>\n";
}