?
Path : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/includes/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/includes/calendar.php |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=utf-8"> <TITLE>.:: Calendar ::.</TITLE> <STYLE type="text/css"> TABLE { border-collapse: collapse; border-spacing: 5px; font-family: 'Verdana'; font-size: 1px; font-size-adjust: none; border-width: 0px; width: 100%; } b{ font-family: 'Verdana'; font-size: 9pt; height: 20px; width:15px; text-align: center; font-weight: bold; } TD{ font-family: 'Verdana'; font-size: 9pt; height: 20px; text-align: center; } </STYLE> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var dDate = new Date(); var dCurMonth = dDate.getMonth(); var dCurDayOfMonth = dDate.getDate(); var dCurYear = dDate.getFullYear(); var objPrevElement = new Object(); function fToggleColor(myElement) { var toggleColor = "#ff0000"; if (myElement.id == "calDateText") { if (myElement.color == toggleColor) { myElement.color = ""; } else { myElement.color = toggleColor; } } else if (myElement.id == "calCell") { for (var i in myElement.children) { if (myElement.children[i].id == "calDateText") { if (myElement.children[i].color == toggleColor) { myElement.children[i].color = ""; } else { myElement.children[i].color = toggleColor; } } } } } function fSetSelectedDay(myElement,Flag){ if (myElement.id == "calCell") { if (!isNaN(parseInt(myElement.children["calDateText"].innerText))) { myElement.bgColor = "#D6DBDC"; objPrevElement.bgColor = ""; document.all.calSelectedDate.value = parseInt(myElement.children["calDateText"].innerText); var var_date = document.all.calSelectedDate.value; var var_month = document.frmCalendarSample.tbSelMonth.value; var var_year = document.frmCalendarSample.tbSelYear.value; var month_txt = document.frmCalendarSample.tbSelMonth.options[document.frmCalendarSample.tbSelMonth.selectedIndex].text; var year_txt = document.frmCalendarSample.tbSelYear.options[document.frmCalendarSample.tbSelYear.selectedIndex].text; var Set_var = var_year+"-"+var_month + "-"+var_date; var Set_text = var_date+" "+month_txt+" "+year_txt; switch (Flag) { case 1 :window.opener.parent.DATA.date_start_show.value=Set_text; window.opener.parent.DATA.date_start.value=Set_var; window.close(); break;//date_start case 2 :window.opener.parent.DATA.date_end_show.value=Set_text; window.opener.parent.DATA.date_end.value=Set_var; window.close(); break;//date_end_show } objPrevElement = myElement; } } } function fGetDaysInMonth(iMonth, iYear) { var dPrevDate = new Date(iYear, iMonth, 0); return dPrevDate.getDate(); } function fBuildCal(iYear, iMonth, iDayStyle) { var aMonth = new Array(); aMonth[0] = new Array(7); aMonth[1] = new Array(7); aMonth[2] = new Array(7); aMonth[3] = new Array(7); aMonth[4] = new Array(7); aMonth[5] = new Array(7); aMonth[6] = new Array(7); var dCalDate = new Date(iYear, iMonth-1, 1); var iDayOfFirst = dCalDate.getDay(); var iDaysInMonth = fGetDaysInMonth(iMonth, iYear); var iVarDate = 1; var i, d, w; if (iDayStyle == 2) { aMonth[0][0] = "Sunday"; aMonth[0][1] = "Monday"; aMonth[0][2] = "Tuesday"; aMonth[0][3] = "Wednesday"; aMonth[0][4] = "Thursday"; aMonth[0][5] = "Friday"; aMonth[0][6] = "Saturday"; } else if (iDayStyle == 1) { aMonth[0][0] = "อา"; aMonth[0][1] = "จ"; aMonth[0][2] = "อ"; aMonth[0][3] = "พ"; aMonth[0][4] = "พฤ"; aMonth[0][5] = "ศ"; aMonth[0][6] = "ส"; } else { aMonth[0][0] = "Su"; aMonth[0][1] = "Mo"; aMonth[0][2] = "Tu"; aMonth[0][3] = "We"; aMonth[0][4] = "Th"; aMonth[0][5] = "Fr"; aMonth[0][6] = "Sa"; } for (d = iDayOfFirst; d < 7; d++) { aMonth[1][d] = iVarDate; iVarDate++; } for (w = 2; w < 7; w++) { for (d = 0; d < 7; d++) { if (iVarDate <= iDaysInMonth) { aMonth[w][d] = iVarDate; iVarDate++; } } } return aMonth; } function fDrawCal(iYear, iMonth, iCellWidth, iCellHeight, sDateTextSize, sDateTextWeight, iDayStyle,Flag) { var myMonth; myMonth = fBuildCal(iYear, iMonth, iDayStyle); document.write("<BR><table border='1' cellspacing=\"0\" cellpadding=\"0\" align=\"center\">") document.write("<tr bgcolor='#6699CC'>"); document.write("<td class='b'>" + myMonth[0][0] + "</td>"); document.write("<td class='b'>" + myMonth[0][1] + "</td>"); document.write("<td class='b'>" + myMonth[0][2] + "</td>"); document.write("<td class='b'>" + myMonth[0][3] + "</td>"); document.write("<td class='b'>" + myMonth[0][4] + "</td>"); document.write("<td class='b'>" + myMonth[0][5] + "</td>"); document.write("<td class='b'>" + myMonth[0][6] + "</td>"); document.write("</tr>"); for (w = 1; w < 7; w++) { document.write("<tr bgcolor='#E8EFF4'>") for (d = 0; d < 7; d++) { document.write("<td valign='top' width='" + iCellWidth + "' height='" + iCellHeight + "' id=calCell style='CURSOR:pointer' onMouseOver='fToggleColor(this)' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this,"+Flag+")>"); if (!isNaN(myMonth[w][d])) { document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:pointer;FONT-FAMILY:'MS Sans Serif';FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this,"+Flag+")>" + myMonth[w][d] + "</font>"); } else { document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:pointer;FONT-FAMILY:Arial;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this,"+Flag+")> </font>"); } document.write("</td>") } document.write("</tr>"); } document.write("</table>") } function fUpdateCal(iYear, iMonth) { myMonth = fBuildCal(iYear, iMonth); objPrevElement.bgColor = ""; document.all.calSelectedDate.value = ""; for (w = 1; w < 7; w++) { for (d = 0; d < 7; d++) { if (!isNaN(myMonth[w][d])) { calDateText[((7*w)+d)-7].innerText = myMonth[w][d]; } else { calDateText[((7*w)+d)-7].innerText = " "; } } } } // End --> </script> </head> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY LeftMargin=0 TopMargin=0 bgcolor='#E8EFF4'> <script language="JavaScript" for=window event=onload> <!-- Begin var dCurDate = new Date(); frmCalendarSample.tbSelMonth.options[dCurDate.getMonth()].selected = true; for (i = 0; i < frmCalendarSample.tbSelYear.length; i++) if (frmCalendarSample.tbSelYear.options[i].value == dCurDate.getFullYear()) frmCalendarSample.tbSelYear.options[i].selected = true; // End --> </script> <form name="frmCalendarSample" method="post" action=""> <input type="hidden" name="calSelectedDate" value=""> <table border="0" bgcolor="#E8EFF4" align="center"> <tr> <td> <select name="tbSelMonth" onchange='fUpdateCal(frmCalendarSample.tbSelYear.value, frmCalendarSample.tbSelMonth.value)'> <option value="1">มกราคม</option> <option value="2">กุมภาพันธ์</option> <option value="3">มีนาคม</option> <option value="4">เมษายน</option> <option value="5">พฤษภาคม</option> <option value="6">มิถุนายน</option> <option value="7">กรกฎาคม</option> <option value="8">สิงหาคม</option> <option value="9">กันยายน</option> <option value="10">ตุลาคม</option> <option value="11">พฤศจิกายน</option> <option value="12">ธันวาคม</option> <!-- <option value="1">January</option> <option value="2">Fabruary</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> --> </select> <?php $curr_yen=date("Y"); $SelYear="<select name=\"tbSelYear\" onchange='fUpdateCal(frmCalendarSample.tbSelYear.value, frmCalendarSample.tbSelMonth.value)'>"; for ($ien=$curr_yen-50;$ien<$curr_yen;$ien++){ $ith=$ien; $SelYear=$SelYear."<option value=".$ien.">".($ith+543)."</option>\n"; } for ($ien=$curr_yen;$ien<$curr_yen+5;$ien++){ $ith=$ien; $SelYear=$SelYear."<option value=".$ien.">".($ith+543)."</option>\n"; } $SelYear=$SelYear."</select>"; echo $SelYear; ?> </td> </tr> <tr> <td> <?php echo "<script language='JavaScript'> var dCurDate = new Date(); // Draw Table Calendar //ค่าที่ส่ง 1. Object Date// 2. Get ปี// 3. Get เดือน fDrawCal(dCurDate.getFullYear(), dCurDate.getMonth()+1, 5, 5,\"9pt\", \"bold\", 1,$flg); </script>"; ?> </td> </tr> </table> </form>