?? ??

Send Snippet To: Save this snippet to Code Collector Pro -- view all graywood's snippets
language: Other
license: Other

Code for Snippet:

                
<?
// $viewDate = “YYYY-MM”;
// 1. ??? ???
$last_day = date("t", strtotime($viewDate));
 
// 2. ???? ???
$start_week = date("w", strtotime(date("Y-m", strtotime($viewDate))."-01"));
 
// 3. ? ? ??? ???
$total_week = ceil(($last_day + $start_week) / 7);
 
// 4. ??? ?? ???
$last_week = date('w', strtotime(date("Y-m", strtotime($viewDate))."-".$last_day));
$unixTime = strtotime($viewDate);
 
// ???
$prevMonth = date("Y-m-d", strtotime("-1 month", strtotime($viewDate)));
// ???
$nextMonth = date("Y-m-d", strtotime("+1 month", strtotime($viewDate)));
$nowMonth = substr($viewDate, 0, 7);
 
$nowDateUnixTime = strtotime(date("Y-m-d"));
$nowDate = date("Y-m-d");
$nowDate = date('Y-m-d', strtotime($nowDate. ' + 2 days'));
 
// day0Active
?>
<p class="text-center">
<span class="m_r20 curP goMonth" data-godate="<?=$prevMonth;?>"><i class="fa fa-chevron-left" aria-hidden="true"></i></span>
<span class="boldF"><?=$viewDate;?></span>
<span class="m_l20 curP goMonth" data-godate="<?=$nextMonth;?>"><i class="fa fa-chevron-right" aria-hidden="true"></i></span>
 
</p>
<table class="table table-border table-condensed ft_09 grayBorder">
    <tr>
    <td height="25" align="center" bgcolor="#f1f1f1"><span class="redFont">?</span></td>
    <td align="center" bgcolor="#f1f1f1">?</td>
    <td align="center" bgcolor="#f1f1f1">?</td>
    <td align="center" bgcolor="#f1f1f1">?</td>
    <td align="center" bgcolor="#f1f1f1">?</td>
    <td align="center" bgcolor="#f1f1f1">?</td>
    <td align="center" bgcolor="#f1f1f1">?</td>
  </tr>
 
  <?
    // 5. ??? ??? ??? ???? 1? ??
    $day=1;
 
    // 6. ? ? ?? ??? ??? ???
    for($i=1; $i <= $total_week; $i++){?>
  <tr>
    <?
        // 7. ? ??? ???
        for ($j=0; $j<7; $j++){
        	$todayClass = "";
 
        	if($day == date("j", strtotime($viewDate))){
        		$todayClass = " today-confirm";
        	}
 
 
 
 
    ?>
    <td height="45" align="center" bgcolor="#FFFFFF"  class="grayBorder<?=$todayClass;?>" data-nowDay="<?=$day;?>" style="cursor:pointer;vertical-align: middle;">
      <?
        // 8. ??? ??? ?????? $j? ??? ?????? $j? ??? ???? ?? ???? ??????
        //    ? ??? ?? -  ! ?? ?? - ?? ??? ????.
 
			$activeDay = "";
        	if ($CT->day0Active == "Y" && $j == 0) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day1Active == "Y" && $j == 1) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day2Active == "Y" && $j == 2) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day3Active == "Y" && $j == 3) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day4Active == "Y" && $j == 4) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day5Active == "Y" && $j == 5) {
        		$activeDay = "selectActive";
        	}
 
        	if ($CT->day6Active == "Y" && $j == 6) {
        		$activeDay = "selectActive";
        	}
 
 
        if (!(($i == 1 && $j < $start_week) || ($i == $total_week && $j > $last_week))){
 
            if($j == 0){
                // 9. $j? 0?? ?????? ???
                echo "<font color='#FF6600'>";
            }else if($j == 6){
                // 10. $j? 0?? ?????? ???
                echo "<font color='#0000FF'>";
            }else{
                // 11. ??? ????? ???
                echo "<font color='#000000'>";
            }
 
            // 12. ?? ??? ?? ??
            if($day == date("j", strtotime($viewDate))){
                echo "<strong>";
            }
 
            // 13. ?? ??
 
            $nowPrintDate = $nowMonth."-".substr("0".$day, -2);
            if ($nowPrintDate < $nowDate) {
            	$activeDay = "";
            }
            echo "<div class='".$activeDay."' data-selectdate='".$nowPrintDate."' data-selectdayname='".$j."'>".$day."</div>";
 
            if($day == date("j", strtotime($viewDate))){
                echo "</strong>";
            }
 
            echo "</font>";
 
            // 14. ?? ??
            $day++;
        }
        ?>
    </td>
    <?}?>
  </tr>
  <?}?>
</table>
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 2
Date Added: 2017-09-05 12:50:18
Last Modified: 2017-11-08 01:39:19

Web Analytics