<?php $myCalendar = new tc_calendar("date1", true); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(01, 03, 1960); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(1960, 2015); $myCalendar->dateAllow('1960-01-01', '2015-03-01'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month'); $myCalendar->setOnChange("myChanged('test')"); $myCalendar->writeScript(); ?> <html> <head> <script language="javascript"> < !-- function myChanged(v){ alert("Hello, value has been changed : "+document.getElementById("date1").value+"["+v+"]"); } //--> </script> </head> </html>
function generateCalendarScript($name, $default_date) { $myCalendar = new tc_calendar($name, true, false); $myCalendar->setIcon("images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($default_date)), date('m', strtotime($default_date)), date('Y', strtotime($default_date))); $myCalendar->setPath("/stats/"); $myCalendar->setYearInterval(1970, 2020); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setDatePair('fm_date_start', 'fm_date_end'); $myCalendar->writeScript(); }
if ($y == $y1 && (int) $m < (int) $m1) { $m = $m1; } } if ($ta2_set) { $m2 = $cdate->getDate('m', $time_allow2); $y2 = $cdate->getDate('Y', $time_allow2); if ($y == $y2 && (int) $m > (int) $m2) { $m = $m2; } } } $objname = getParameter("objname"); $dp = getParameter("dp", "boolean"); $cobj = new tc_calendar(""); $cobj->setDate($sld, $slm, $sly); $cobj->startDate($startDate); $cobj->dsb_days = explode(",", $dsb_txt); $cobj->time_allow1 = $time_allow1; $cobj->time_allow2 = $time_allow2; $cobj->setYearInterval($year_start, $year_end); $cobj->setTimezone($timezone); //set for further usage, nothing for now $theme_path = $theme != "" ? $cobj->getThemePath($theme) : ""; if (!is_file($theme_path)) { $theme_path = ""; } //check and show default calendar month and year on valid range of date_allow if (!isset($_REQUEST["m"])) { if ($time_allow1 != "") { //get date of time allow1
$myCalendar->setYearInterval(1970, 2020); //$myCalendar->dateAllow('2009-02-20', "", false); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setDatePair('date3', 'date4', $date2); //$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->writeScript(); ?> </div> </div> <div style="float: left;"> <div style="float: left; padding-left: 3px; padding-right: 3px; line-height: 18px;">to</div> <div style="float: left;"> <?php $myCalendar = new tc_calendar("date4", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($date2)), date('m', strtotime($date2)), date('Y', strtotime($date2))); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(1970, 2020); //$myCalendar->dateAllow("", '2009-11-03', false); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setDatePair('date3', 'date4', $date1); //$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->writeScript(); ?> </div> </div> <p> <input type="button" name="button2" id="button2" value="Check the value" onClick="javascript:alert('Date select from '+this.form.date3.value+' to '+this.form.date4.value);"> </p> <p><b>Code:</b></p> <pre><?php <br> $date3_default = "<?php
function CalendarAutoSubmit($strLabel, $strField, $strForm, $strDate = "") { echo "<tr>"; echo "\t<td valign=top>"; echo $strLabel; echo "\t</td>"; echo "\t<td>"; $myCalendar = new tc_calendar($strField); $myCalendar->setIcon("images/iconCalendar.gif"); if (empty($strDate)) { $myCalendar->setDate(date('d'), date('m'), date('Y')); } else { $arr = explode("-", $strDate); $myCalendar->setDate($arr[2], $arr[1], $arr[0]); } $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(1970, 2020); $myCalendar->dateAllow('2008-05-13', '2015-03-01', false); $myCalendar->startMonday(true); $myCalendar->disabledDay("Fri"); $myCalendar->autoSubmit(true, $strForm); $myCalendar->writeScript(); echo "\t</td>"; echo "</tr>"; }
<tr> <td><b><?php echo A_CONFCONTENT_178; ?> </b> </td> <td class=success> <?php $myCalendar = new tc_calendar("date1", true, false); $myCalendar->zindex = 150; //default 1 $myCalendar->setIcon("./plugins/calendar/images/iconCalendar.gif"); $myCalendar->setPath("./plugins/calendar/"); if ($INSTALL_DATE && $INSTALL_DATE != "") { $installdate = strtotime($INSTALL_DATE); $myCalendar->setDate(date('d', $installdate), date('m', $installdate), date('Y', $installdate)); } else { $CorrectedTime = mktime(date("G") + C_TMZ_OFFSET * 60 * 60, date("i"), date("s"), date("m"), date("d"), date("Y")); $myCalendar->setDate(date('d', $CorrectedTime), date('m', $CorrectedTime), date('Y', $CorrectedTime)); } $myCalendar->setYearInterval(2000, date('Y')); $myCalendar->dateAllow('2000-01-01', date('Y-m-d')); $myCalendar->setAlignment('left', 'bottom'); //optional $myCalendar->writeScript(); ?> </td> </tr> </table> <table align="center" width="780" class=table> <tr bgcolor="#FFFFFF"><td colspan=2 align=center><a name="skins"></a><b><?php
echo $_SERVER['PHP_SELF']; ?> "> <p class="largetxt"><b>Select Date: </b></p> <?php $thisYear = date("Y"); $thisDate = date("Y-m-d"); $thisRange = date("Y-m-d", strtotime("+7 days")); if (strtotime($theDate) > strtotime($thisRange) || strtotime($theDate) < strtotime($thisDate)) { $theDate = $thisDate; } $myCalendar = new tc_calendar("date1"); $myCalendar->setIcon("images/iconCalendar.gif"); if (!empty($theDate)) { $newDate = strtotime($theDate); $myCalendar->setDate(date('d', $newDate), date('m', $newDate), date('Y', $newDate)); $nowDate = date("D, F d, Y", $newDate); } else { $myCalendar->setDate(date('d'), date('m'), date('Y')); $theDate = date("Y-m-d"); $nowDate = date("D, F d, Y"); } $myCalendar->setPath("./"); $myCalendar->setYearInterval($thisYear, $thisYear); $myCalendar->dateAllow($thisDate, $thisRange, false); $myCalendar->startMonday(true); //$myCalendar->setDateFormat('d, m, Y'); //$myCalendar->autoSubmit(true, "", "index.php"); $myCalendar->autoSubmit(true, "form1"); $myCalendar->writeScript(); echo "<input type='hidden' name='class' id='class' value='{$class}'>";
<div class="form-inline"> <p>Description of Accident</p> <div class="form-group"> <label for="body_part_injured">Body Part(s) Injured</label> <input type="text" class="form-control" id="body_part_injured" placeholder="upper arm" /> </div> <div class="form-group"> <label for="date_of_accident">Date of Accident</label> <!--<input type="datetime" class="form-control" id="date_of_accident" placeholder="01/31/2015" />--> <?php //get class into the page require_once 'classes/tc_calendar.php'; //instantiate class and set properties $myCalendar = new tc_calendar("date1", true); //$myCalendar->setIcon("images/iconCalendar.gif"); $myCalendar->setDate(17, 7, 2015); //output the calendar $myCalendar->writeScript(); ?> </div> <div class="form-group"> <label for="time_of_accident">Time of Accident</label> <?php include 'time-include.php'; ?> </div> </div> <div class="form_space"> <div class="form-group"> <label for="exact_location">Exact Location</label>
</tr> <tr> <td><b><?php echo A_CONFCONTENT_178; ?> </b> </td> <td class=success> <?php $myCalendar = new tc_calendar("date1", true, false); $myCalendar->zindex = 150; //default 1 $myCalendar->setIcon("./plugins/calendar/images/iconCalendar.gif"); $myCalendar->setPath("./plugins/calendar/"); if ($INSTALL_DATE && $INSTALL_DATE != "") { $myCalendar->setDate(substr($INSTALL_DATE, -2), substr($INSTALL_DATE, 5, 2), substr($INSTALL_DATE, 0, 4)); } else { $CorrectedTime = mktime(date("G") + C_TMZ_OFFSET * 60 * 60, date("i"), date("s"), date("m"), date("d"), date("Y")); $myCalendar->setDate(date('d', $CorrectedTime), date('m', $CorrectedTime), date('Y', $CorrectedTime)); } $myCalendar->setYearInterval(2000, date('Y')); $myCalendar->dateAllow('1900-01-01', date('Y-m-d')); $myCalendar->setAlignment('left', 'bottom'); //optional $DbLink->query("SELECT username,birthday,show_age FROM " . C_REG_TBL . " WHERE birthday != '' AND birthday != '0000-00-00' AND show_bday = '1' ORDER BY birthday ASC"); if ($DbLink->num_rows() != 0) { $mday = array(); include_once 'plugins/birthday/age.class.php'; $my_dob = new DateOfBirth(); while (list($birthname, $birthday, $show_age) = $DbLink->next_record()) { if ($show_age) {
?> <TR> <TD ALIGN="RIGHT" VALIGN="TOP" NOWRAP="NOWRAP"><?php echo L_PRO_7; ?> :</TD> <TD VALIGN="TOP" CLASS=success> <?php $myCalendar = new tc_calendar("date1", true, true); $myCalendar->setAutoHide(false); $myCalendar->zindex = 150; //default 1 $myCalendar->setIcon("plugins/calendar/images/iconCalendar.gif"); $myCalendar->setPath("plugins/calendar/"); if (isset($BIRTHDAY)) { $myCalendar->setDate(substr($BIRTHDAY, -2), substr($BIRTHDAY, 5, 2), substr($BIRTHDAY, 0, 4)); } $myCalendar->setYearInterval(1900, date('Y')); $myCalendar->dateAllow('1900-01-01', date('Y-m-d')); $DbLink->query("SELECT username,birthday,show_age FROM " . C_REG_TBL . " WHERE birthday != '' AND birthday != '0000-00-00' AND show_bday = '1' ORDER BY birthday ASC"); if ($DbLink->num_rows() != 0) { $mday = array(); include_once 'plugins/birthday/age.class.php'; $my_dob = new DateOfBirth(); while (list($birthname, $birthday, $show_age) = $DbLink->next_record()) { if ($show_age) { $my_dob->birth_num_year = substr($birthday, 0, 4); $my_dob->birth_num_month = str_replace("0", "", substr($birthday, 5, 1)) . substr($birthday, 6, 1); $my_dob->birth_num_day = str_replace("0", "", substr($birthday, -2, 1)) . substr($birthday, -1); $my_dob->calculate_age(); $age = $my_dob->age;
function _calendar($date) { $myCalendar = new tc_calendar("date1", true); $myCalendar->setIcon("../site/calendar/images/iconCalendar.gif"); //$myCalendar->setDate(date('d'), date('m'), date('Y')); if (isset($date)) { $myCalendar->setDate(date('d', strtotime($date)), date('m', strtotime($date)), date('Y', strtotime($date))); } $myCalendar->setPath("../site/calendar/"); $myCalendar->setYearInterval(2005, 2045); //$myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('Y-m-d'); //$myCalendar->setHeight(350); //$myCalendar->autoSubmit(true, "phmembership"); $myCalendar->setAlignment('left', 'bottom'); //$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); //$myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month'); // $myCalendar->setSpecificDate(array("2011-06-01"), 0, ''); $myCalendar->writeScript(); }
<tr> <td class="title">Email</td> <td class="info"><input type="text" name="txtemail" size="30" value="<?php echo $email; ?> "/></td> </tr> <tr> <td class="title">Ngày Sinh</td> <td class="info"> <form id="form2" name="form2" method="post" action=""> <?php $myCalendar = new tc_calendar("date1", true); $myCalendar->setIcon("images/iconCalendar.gif"); $myCalendar->setDate($ngaysinh, $thangsinh, $namsinh); $myCalendar->setPath("./"); $myCalendar->setYearInterval(1920, date('Y', time())); $myCalendar->dateAllow('1960-01-01', '2015-03-01'); //$myCalendar->setHeight(350); //$myCalendar->autoSubmit(true, "form1"); $myCalendar->disabledDay("Sat"); $myCalendar->disabledDay("sun"); $myCalendar->writeScript(); ?> </form> </td> </tr> <tr> <td class="title">Giới Tính </td>
private function RenderPanel($Prefix, $DefaultTime) { require_once 'calendar/calendar/classes/tc_calendar.php'; $html = ""; $html .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr><td nowrap>"; $html .= "<SPAN CLASS='fieldtext'>" . $Prefix . " Date:</SPAN>"; $html .= "</td><td>"; //@todo: give an appropriate html name to this. $myCalendar = new \tc_calendar($Prefix . "datepicker", true, false); //date5->HTML name. $myCalendar->setIcon("calendar/calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d', $DefaultTime), date('m', $DefaultTime), date('Y', $DefaultTime)); //$myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/calendar/"); $myCalendar->setYearInterval(2000, 2050); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->zindex = 10; // This should, hypothetically, redirect the output from echo to a string. // It's either this, or rewrite the control. ob_start(); $myCalendar->writeScript(); $calendarhtml = ob_get_contents(); ob_end_clean(); $html .= "<SPAN CLASS='fieldtext'>"; $html .= $calendarhtml; $html .= "</SPAN>"; $html .= "</td><td>"; //$html .= $myCalendar->writeScript(); $html .= "<SELECT NAME=\"" . $Prefix . "hour\">"; // $_POST["starthour"], $_POST["endhour"] for ($hour = 1; $hour <= 12; $hour++) { $html .= "<OPTION value=\"" . str_pad($hour, 2, "0", STR_PAD_LEFT) . "\""; if ($hour == date("g", $DefaultTime)) { $html .= " selected=\"selected\""; } $html .= ">" . $hour . "</OPTION>"; } $html .= "</SELECT>"; $html .= "<SELECT NAME=\"" . $Prefix . "minute\">"; // $_POST["startminute"], $_POST["endminute"] for ($minute = 0; $minute < 60; $minute++) { $html .= "<OPTION VALUE=\"" . str_pad($minute, 2, "0", STR_PAD_LEFT) . "\""; if ($minute == date("i", $DefaultTime)) { $html .= " selected=\"selected\""; } $html .= ">" . str_pad($minute, 2, "0", STR_PAD_LEFT) . "</OPTION>"; } $html .= "</SELECT>"; $html .= "<SELECT NAME=\"" . $Prefix . "period\">"; // $_POST["startperiod"], $_POST["startperiod"] $html .= "<OPTION VALUE=\"AM\""; if ("AM" == date("A", $DefaultTime)) { $html .= " selected=\"selected\""; } $html .= ">AM</OPTION>"; $html .= "<OPTION VALUE=\"PM\""; if ("PM" == date("A", $DefaultTime)) { $html .= " selected=\"selected\""; } $html .= ">PM</OPTION>"; $html .= "</SELECT>"; $html .= "</tr></table>"; $html .= "<BR>"; return $html; }
</form> </td> <td> <?php $date3_default_not_formatted = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")); $date3_default = date("Y-m-d", $date3_default_not_formatted); $date4_default = date("Y-m-d"); $myCalendar = new tc_calendar("date3", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($date3_default)), date('m', strtotime($date3_default)), date('Y', strtotime($date3_default))); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2020); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setDatePair('date3', 'date4', $date4_default); $myCalendar->writeScript(); $myCalendar = new tc_calendar("date4", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($date4_default)), date('m', strtotime($date4_default)), date('Y', strtotime($date4_default))); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2020); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setDatePair('date3', 'date4', $date3_default); $myCalendar->writeScript(); ?> </td> <td><div class="arrow-right"></div></td> </tr> </table> </body> </html>
?> <TR> <TD ALIGN="RIGHT" VALIGN="TOP" NOWRAP="NOWRAP"><?php echo L_PRO_7; ?> :</TD> <TD VALIGN="TOP" CLASS=success> <?php $myCalendar = new tc_calendar("date1", true, true); $myCalendar->zindex = 150; //default 1 $myCalendar->setIcon("plugins/calendar/images/iconCalendar.gif"); $myCalendar->setPath("plugins/calendar/"); if (isset($BIRTHDAY)) { $birth_day = strtotime($BIRTHDAY); $myCalendar->setDate(date('d', $birth_day), date('m', $birth_day), date('Y', $birth_day)); } $myCalendar->setYearInterval(1935, date('Y')); $myCalendar->dateAllow('1935-01-01', date('Y-m-d')); $myCalendar->writeScript(); ?> <?php if (!$done && C_REQUIRE_BDAY) { echo "<SPAN CLASS=\"error\">*</SPAN>"; } ?> <INPUT TYPE="hidden" NAME="BIRTHDAY" VALUE="<?php echo $BIRTHDAY; ?> "> </TD>
<td>Epiweek</td> <td> <?php echo "<select>"; for ($x = 1; $x < 54; $x++) { echo "<option>" . $x . "</option>"; } echo "</select>"; ?> </td> <td>Week Ending</td> <td> <?php $myCalendar = new tc_calendar("endmonth", true); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval($yearsago, $currentyear); //$myCalendar->dateAllow('1960-01-01', '2015-03-01'); $myCalendar->writeScript(); ?> </td> </tr> <tr> <td><span class="mandatory">* </span>Health Facility </td> <td colspan="6"><strong> <select style="width:262px" id='cat' name="cat">
</tr> </table> <ul> <li>No default date</li> <li>Set year navigate from 2000 to 2015 </li> <li>Allow date selectable from 13 May 2008 to 01 March 2010</li> <li>Allow to navigate other dates from above </li> </ul> <p><b>DatePicker with no input box</b></p> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td>Date 3 :</td> <td><?php $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("./images/iconCalendar.gif"); $myCalendar->setDate(5, 10, 2009); $myCalendar->setPath("./"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2010-03-01'); $myCalendar->setDateFormat('j F Y'); //$myCalendar->setHeight(350); //$myCalendar->autoSubmit(true, "form1"); $myCalendar->writeScript(); ?> </td> <td><input type="button" name="button" id="button" value="Check the value" onClick="javascript:alert(this.form.date5.value);"></td> </tr> </table> <ul> <li>Default date to 5 October 2009 </li> <li>Set year navigate from 2000 to 2015 </li>