Example #1
0
 function _calcDeliveryStartDay()
 {
     $year = (int) date('Y');
     $month = (int) date('m');
     $day = (int) date('d');
     $cur_calendar = calCalendar($year, $month, $day);
     $cur_holidayinfo = holidayText($year, $month);
     $next = nextMonth($year, $month);
     $year = (int) date('Y', $next);
     $month = (int) date('m', $next);
     $next_calendar = calCalendar($year, $month);
     $next_holidayinfo = holidayText($year, $month);
     // 配送可能日用のワーク(+2か月後)
     $next = nextMonth($year, $month);
     $year = (int) date('Y', $next);
     $month = (int) date('m', $next);
     $next2_calendar = calCalendar($year, $month);
     // 配送可能日計算
     $monthIndex = -1;
     $searchCalendar = array($cur_calendar, $next_calendar, $next2_calendar);
     $startCount = MODULE_CALENDAR_DELIVERY_START;
     for ($i = 0; $i < count($searchCalendar); $i++) {
         if ($searchCalendar[$i]['today'] != -1) {
             $monthIndex = $i;
             $dayIndex = $searchCalendar[$i]['today'];
             break;
         }
     }
     // 休日を除いて(営業日のみ)、発送可能日を計算する
     $shippingYear = 0;
     $shippingMonth = 0;
     $shippingDay = 0;
     while ($monthIndex != -1) {
         // 発送可能日見つけた
         if ($startCount == 0) {
             $shippinginfo = MODULE_CALENDAR_SHIIPING_DAY;
             $shippingYear = $searchCalendar[$monthIndex]['year'];
             $shippingMonth = $searchCalendar[$monthIndex]['month'];
             $shippingDay = $searchCalendar[$monthIndex]['calendarDay'][$dayIndex];
             return mktime(0, 0, 0, $shippingMonth, $shippingDay, $shippingYear);
             break;
         }
         // 日付がもう終わり?
         // その場合は翌月にする
         $dayIndex++;
         if ($dayIndex >= count($searchCalendar[$monthIndex]['calendarDay']) || $searchCalendar[$monthIndex]['calendarDay'][$dayIndex] == 0) {
             $monthIndex++;
             // カレンダー尽きた?
             if ($monthIndex >= count($searchCalendar)) {
                 break;
             }
             $dayIndex = 0;
             while ($dayIndex < count($searchCalendar[$monthIndex]['calendarDay']) && $searchCalendar[$monthIndex]['calendarDay'][$dayIndex] == 0) {
                 $dayIndex++;
             }
         }
         // 今の日付は営業日?
         if ($searchCalendar[$monthIndex]['calendarOpen'][$dayIndex] == 1) {
             $startCount--;
         }
     }
     return 0;
 }
                <div class="nextMonth">

                <?php 
    nextMonth('sport');
    ?>

                <?php 
    nextMonth('friday');
    ?>
        
                <?php 
    nextMonth('saturday');
    ?>
            
                <?php 
    nextMonth('special');
    ?>
                
                
                
                </div>
                
                <?php 
    randomQuote2();
    ?>
                
                <div class="clear"></div>
                
                <?php 
    monthBanner('2');
    ?>
Example #3
0
echo '<select name = year >';
for ($start_year = 1970; $start_year < 2039; $start_year++) {
    echo '<option value =' . $start_year . '>' . $start_year . '</option>';
}
echo '</select>' . '年';
echo '<select name = month>';
for ($start_month = 1; $start_month <= 12; $start_month++) {
    echo '<option value = ' . $start_month . '>' . $start_month . '</option>';
}
echo '</select>';
echo '月';
echo '<input type = "submit" name = "search" value = "查询">';
echo '</form>';
echo '</td>';
echo "<td><a href=?" . nextYear($year, $month) . ">" . '>>' . '</a></td>';
echo "<td><a href=?" . nextMonth($year, $month) . ">" . '>' . '</a></td>';
echo '</tr>';
echo '</table>';
function lastYear($year, $month)
{
    $year = $year - 1;
    return "year={$year}&month={$month}";
}
function lastMonth($year, $month)
{
    if ($month == 1) {
        $year = $year - 1;
        $month = 12;
    } else {
        $month--;
    }