Example #1
0
 static function printAllDates($class = 'archive', $yearid = 'year', $monthid = 'month', $order = 'asc')
 {
     global $_zp_current_search;
     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;
     $years = array();
     while (list($key, $val) = each($datecount)) {
         $nr++;
         if ($key == '0000-00-01') {
             $year = "no date";
             $month = "";
         } else {
             $d = strftime('%Y-%m', strtotime($key));
             $index = substr($d, 5);
             $dt = strftime('%Y-%B', strtotime($key));
             $year = substr($dt, 0, 4);
             $month = substr($dt, 5);
         }
         if ($lastyear != $year) {
             $lastyear = $year;
             echo "<li id='year-{$year}' {$yearid} year='{$year}'><p>{$year}</p></li>";
             $years[$year] = array();
         }
         $years[$year][$month] = array($index, $val);
     }
     echo "</ul>";
     return $years;
 }
/**
 * 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";
}