Changeset 689 for trunk/plugins

Show
Ignore:
Timestamp:
10/31/07 23:50:46 (14 months ago)
Author:
michiel
Message:

stop showing 'go to previous month' links in the singlemonth
alternative montharchive sidebar when we are showing the month
of the oldest post in the database.

Closes #171

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/altarchive_onemonth.php

    r635 r689  
    5858        /* genaltarchive_onemonth {{{ */ 
    5959        public function genaltarchive_onemonth($defaultmenu) { 
     60                /* find out what the oldest post date is */ 
     61                $q = "SELECT date FROM articles WHERE active = 1 AND public = 1 ORDER BY date LIMIT 1"; 
     62                $res = $this->_mvblog->db->query($q); 
     63                $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC); 
     64                $oldest = $row["date"]; 
     65 
    6066                $output   = ""; 
    6167                $url_next = ""; 
     
    124130                } 
    125131                $output .= "</tr><tr>\n"; 
    126                 $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\"><a href=\"$url_prev\"><< ".strftime("%b", mktime(0, 0, 0, $_month-1, 1, $_year))."</a></td>\n"; 
     132                if ($oldest < mktime(0, 0, 0, $_month, 1, $_year)) 
     133                        $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\"><a href=\"$url_prev\"><< ".strftime("%b", mktime(0, 0, 0, $_month-1, 1, $_year))."</a></td>\n"; 
     134                else 
     135                        $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\">&nbsp;</td>\n"; 
    127136                $output .= "<td class=\"altarchive_onemonth_month_noitems\">&nbsp;</td>\n"; 
    128137                if (date("m") == $_month)