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(); }
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"> </select> <script> var combo = dhtmlXComboFromSelect("cat"); combo.enableFilteringMode(true,"get_district_facilitys.php",true);
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(); }
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>"; }
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; }