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(); }
</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>
<?php // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com $myCalendar = new tc_calendar("date1", true); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->zindex = 150; //default 1 $myCalendar->setYearInterval(1995, date('Y')); $myCalendar->dateAllow('1960-03-01', date('Y-m-d')); //$myCalendar->autoSubmit(true, "calendar"); //$myCalendar->setDateFormat('l, dS \of F Y'); $myCalendar->disabledDay("sat"); $myCalendar->disabledDay("sun"); $myCalendar->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month'); $myCalendar->setSpecificDate(array("2011-04-01"), 0, 'year'); $myCalendar->setAlignment('right', 'bottom'); //optional $myCalendar->writeScript(); ?> </td> <tr/> </table> </form> Rest of your page body content <br /> [...] <br /><br /> <a href="sample.txt" target="blank">View page source</a> </body> </html>
echo $days_row; foreach ($global_times as $time) { echo '<tr><th class="reservation_time_th">' . $time . '</th>'; $i = 0; while ($i < 7) { $i++; echo '<td><div class="reservation_time_div"><div class="reservation_time_cell_div" id="div:' . $week . ':' . $i . ':' . $time . '" onclick="void(0)">' . read_reservation($week, $i, $time, $conn) . '</div></div></td>'; } echo '</tr>'; } echo '</table>'; } else { echo '<div class="box_div" id="cp_div"><div class="box_top_div"><a href="#"><input type="button" class="small_button blue_button" value="' . $_SESSION['user_name'] . '"></a></div>'; $myCalendar = new tc_calendar("date1", true, false); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(date('Y'), date('Y') + 10); $myCalendar->dateAllow(date('Y-m-d'), '2020-12-31'); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setAlignment("right", "bottom"); $myCalendar->setOnChange("myChanged()"); $myCalendar->writeScript(); ?> <script language="javascript"> var global_week_number ="<?php echo global_week_number; ?> "; </script> <?php echo '</div><div class="box_div" id="reservation_div"><div class="box_top_div" id="reservation_top_div"><div id="reservation_top_left_div"><a href="." id="previous_week_a">< Prethodni dan</a></div><div id="reservation_top_center_div">Rezervacije za datum <span id="week_number_span">' . global_week_number . '</span></div><div id="reservation_top_right_div"><a href="." id="next_week_a">Slijedni dan ></a></div></div><div class="box_body_div"><div id="reservation_table_div"></div></div></div><div id="reservation_details_div">'; }
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(); }
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; }