<td><?php echo $Sday . ' ' . change_mount($Smonth) . ' ' . changeYear($Syear); ?> </td> </tr> <tr> <td>วันสิ้นสุดการติดตั้ง</td> <td><?php echo $Eday . ' ' . change_mount($Emonth) . ' ' . changeYear($Eyear); ?> </td> </tr> <tr> <td>วันรื้อถอน</td> <td><?php echo $Oday . ' ' . change_mount($Omonth) . ' ' . changeYear($Oyear); ?> </td> </tr> <tr> <td>ตัวอย่างป้าย</td> <td><img src="<?php echo $row[7]; ?> " width="300" height="250"></td> </tr> <tr> <td>รายละเอียดงานหรือกิจกรรม</td> <td><?php echo $row[8]; ?>
if ($rows[10] < date('Y-m-d', strtotime('-3 days'))) { echo '<label style="color:red;">*ป้ายเลยกำหนดเวลาการยืนเอกสาร</label>'; $sql_update_event = "update event set status='time out' where eId = " . $rows[0]; $result_update = $conn->query($sql_update_event); $time_out = TRUE; } echo '</td>'; echo '<td>'; echo '<ol>'; echo '<ul>' . sel_notice($rows[2], $conn) . '</ul>'; echo '</ol>'; echo '<label style="color:green;">วันที่เริ่มจอง ' . $Nday . ' ' . change_mount($Nmonth) . ' ' . changeYear($Nyear) . '</label>'; echo '</td>'; echo '<td>' . $Sday . ' ' . change_mount($Smonth) . ' ' . changeYear($Syear) . '</td>'; echo '<td>' . $Eday . ' ' . change_mount($Emonth) . ' ' . changeYear($Eyear) . '</td>'; echo '<td>' . $Oday . ' ' . change_mount($Omonth) . ' ' . changeYear($Oyear) . '</td>'; echo '<td>' . $rows[9] . '</td>'; echo '<td>'; echo '<a href="edit_form_user.php?eId=' . $rows[0] . '&userId=' . $rows[1] . '"><button class="btn btn-outline btn-primary" type="button" style="margin:5px;">แก้ไข</button></a><br>'; if (!$time_out == TRUE) { echo '<a href="print_form.php?eId=' . $rows[0] . '">'; echo '<button class="btn btn-outline btn-success" type="button" style="margin:5px;" >แบบฟอร์มการจอง</button>'; echo '</a><br>'; } else { echo '<button class="btn btn-default disabled" type="button" style="margin:5px;">แบบฟอร์มการจอง</button>'; } echo '<button class="btn btn-outline btn-danger" type="button" style="margin:5px;" onclick="del_event(' . $rows[0] . ')">ลบ</button>'; echo '</td>'; echo '</tr>'; } ?>
function check_equals_notice($nId, $conn, $sDate, $oDate) { $sql_sel_nId = "SELECT eId, nIds FROM event WHERE eStart <= '" . $oDate . "' AND eOut >='" . $sDate . "'"; list($Syear, $Smonth, $Sday) = split("-", $sDate); list($Oyear, $Omonth, $Oday) = split("-", $oDate); $arr_nId = explode(",", $nId); $result = $conn->query($sql_sel_nId); $arr_eId = array(); $temp_arr = array(); $k = 0; $l = 0; $cou = 1; if ($result->num_rows) { while ($rs = $result->fetch_array()) { $ev_nId = explode("_", $rs[1]); for ($j = 0; $j < count($arr_nId); $j++) { if (in_array($arr_nId[$j], $ev_nId)) { // ป้ายไม่สามารถใช้ได้ if (!in_array($arr_nId[$j], $temp_arr)) { $sql_sel_notice = "select nName from local_notice where nId =" . $arr_nId[$j]; $result_notice = $conn->query($sql_sel_notice); $row = $result_notice->fetch_array(); $temp_arr[$l] = $arr_nId[$j]; $l++; echo $cou . '.<label>' . $row[0] . '</label> <label style="color:red;"> ไม่สามารถใช้ได้ในวันที่ </label> '; echo '<label>' . $Sday . ' ' . change_mount($Smonth) . ' ' . changeYear($Syear) . ' ถึง ' . $Oday . ' ' . change_mount($Omonth) . ' ' . changeYear($Oyear); echo '</label><br>'; $cou++; } } else { //ป้ายสามารถใข้ได้ if (!in_array($arr_nId[$j], $arr_eId)) { $arr_eId[$k] = $arr_nId[$j]; $k++; } } } } } else { return array_values($arr_eId); } // if($k > 0){ // $arr_eId = array_diff($arr_eId, $temp_arr); // return array_values($arr_eId); // } $arr_eId = array_diff($arr_eId, $temp_arr); array_values($arr_eId); if (count($arr_eId) == 0 && count($arr_nId) == count($temp_arr)) { // echo "overlap"; return $arr_eId = array("overlap"); } else { if (count($arr_nId) == count($arr_eId)) { // echo 'unoverlap'; return $arr_eId = array("unoverlap"); } else { return array_values($arr_eId); } } }