Ticket #107: mythweb.program_listing.diff

File mythweb.program_listing.diff, 1.5 KB (added by Robert Tsai <rtsai1111>, 19 years ago)
  • mythweb/themes/Default/program_listing.php

     
    4040                ?></select></td>
    4141            <td align="right"><?echo t('Date') ?>:&nbsp;</td>
    4242            <td><select name="date" onchange="get_element('program_listing').submit()"><?php
     43            // Find out how many days into the past we should bother checking
     44                $result = mysql_query('SELECT TO_DAYS(min(starttime)) - TO_DAYS(NOW()) FROM program')
     45                    or trigger_error('SQL Error: '.mysql_error(), FATAL);
     46                list($min_days) = mysql_fetch_row($result);
     47                mysql_free_result($result);
    4348            // Find out how many days into the future we should bother checking
    4449                $result = mysql_query('SELECT TO_DAYS(max(starttime)) - TO_DAYS(NOW()) FROM program')
    4550                    or trigger_error('SQL Error: '.mysql_error(), FATAL);
    4651                list($max_days) = mysql_fetch_row($result);
    4752                mysql_free_result($result);
    4853            // Print out the list
    49                 for ($i=-1;$i<=$max_days;$i++) {
     54                for ($i=$min_days;$i<=$max_days;$i++) {
    5055                    $time = mktime(0,0,0, date('m'), date('d') + $i, date('Y'));
    5156                    $date = date("Ymd", $time);
    5257                    echo "<option value=\"$date\"";