Revision 571
Added by thorn almost 18 years ago
| README | ||
|---|---|---|
| 31 | 31 |  | 
| 32 | 32 | http://dynarch.com/mishoo/calendar.epl | 
| 33 | 33 |  | 
| 34 |  | |
| 35 | How to use | |
| 36 | ----------- | |
| 37 |  | |
| 38 | 1. enter this code somewhere _above_ the form | |
| 39 | you can overwrite some vars as descripted below | |
| 40 | --cut-PHP---------------------------------------------------- | |
| 41 | // include jscalendar-setup | |
| 42 | $jscal_use_time = false; // whether to use a clock, too | |
| 43 | require_once(WB_PATH."/include/jscalendar/wb-setup.php"); | |
| 44 | // override some vars: (normally, there is no need to change this) | |
| 45 | //$jscal_lang = "en"; //- calendar-language (default: wb-backend-language) | |
| 46 | //$jscal_today = ""; // - date the calendar offers if the text-field is empty (default: today) | |
| 47 | //$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else)) | |
| 48 | //$jscal_format = "Y-m-d"; // - initial-format used for the text-field (default: from wb-backend-date-format) | |
| 49 | //$jscal_ifformat = "%Y-%m-%d"; // - format for jscalendar (default: from wb-backend-date-format) | |
| 50 | ---------------------------------------------------------- | |
| 51 |  | |
| 52 |  | |
| 53 | 2. enter this code within your form | |
| 54 | $date holds the entered date as timestamp | |
| 55 | the field is called "my_date_field" | |
| 56 | the calender-trigger is called "my_date_trigger" | |
| 57 | --cut-HTML--------------------------------------------------- | |
| 58 | <input type="text" id="my_date_field" name="my_date_field" value="<?php if($date==0) print ""; else print date($jscal_format, $date)?>" style="width: 120px;" /> | |
| 59 | <img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="my_date_trigger" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /> | |
| 60 | ---------------------------------------------------------- | |
| 61 |  | |
| 62 |  | |
| 63 | 3. enter this code _below_ the form | |
| 64 | to store the result as timestamp, you have to use range : [1970, 2037], | |
| 65 | --cut-HTML--------------------------------------------------- | |
| 66 | <script type="text/javascript"> | |
| 67 | Calendar.setup( | |
| 68 | 			{
 | |
| 69 | inputField : "my_date_field", | |
| 70 | ifFormat : "<?php echo $jscal_ifformat ?>", | |
| 71 | button : "my_date_trigger", | |
| 72 | firstDay : <?php echo $jscal_firstday ?>, | |
| 73 | 				<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
 | |
| 74 | showsTime : "true", | |
| 75 | timeFormat : "24", | |
| 76 | <?php } ?> | |
| 77 | date : "<?php echo $jscal_today ?>", | |
| 78 | range : [1970, 2037], | |
| 79 | step : 1 | |
| 80 | } | |
| 81 | ); | |
| 82 | </script> | |
| 83 | ---------------------------------------------------------- | |
| 84 |  | |
Also available in: Unified diff
adapted news-module to use the new jscalendar, removed old one