36 var $settings = Array(
42 'onWeekClick' => null,
43 'onYearClick' => null,
46 'day_name_length' => 2,
69 $this->settings[$name] = $value;
87 $css = array_get_index($this->settings,
'cssURL',sq_web_path(
'fudge').
'/js_calendar/js_calendar.css');
89 <!-- Start
init of JS Calendar -->
90 <script src=
"<?php echo sq_web_path('fudge'); ?>/js_calendar/js_calendar.js" type=
"text/javascript"></script>
91 <script type=
"text/javascript">
92 addStyle(
'@import url("<?php echo $css; ?>");');
94 <!-- End
init of JS Calendar -->
96 $GLOBALS[
'SQ_JS_CALENDAR_INIT'] =
true;
110 return (isset($GLOBALS[
'SQ_JS_CALENDAR_INIT']) && $GLOBALS[
'SQ_JS_CALENDAR_INIT'] ===
true);
129 function paint($prefix, $container_name=
'', $popup=
false, $container_exists=
false)
133 $this->settings[
'popup'] = $popup;
134 if (!isset($this->settings[
'imageURL']) || is_null($this->settings[
'imageURL'])) {
135 $this->settings[
'imageURL'] = sq_web_path(
'fudge').
'/js_calendar/calendar.gif';
138 if (empty($container_name)) {
139 $container_name = $prefix.
'_js_calendar_span';
144 if (array_get_index($GLOBALS,
'SQ_JS_CALENDAR_POPUP',
false) ===
false) {
145 $GLOBALS[
'SQ_JS_CALENDAR_POPUP'] = $container_name;
146 ?><span
id=
"<?php echo $container_name; ?>"></span><?php
148 $container_name = $GLOBALS[
'SQ_JS_CALENDAR_POPUP'];
151 if (array_get_index($GLOBALS, $container_name,
false) ===
false) {
152 $GLOBALS[$container_name] = 1;
154 $GLOBALS[$container_name]++;
156 $name_add_on = ($GLOBALS[$container_name] == 1)?
'':
'_'.$GLOBALS[$container_name];
157 ?><span
id=
"<?php echo $container_name.$name_add_on; ?>"></span><?php
159 if (!isset($this->settings[
'currentDate'])) {
160 $this->settings[
'currentDate'] = date(
'Y-m-d');
163 list($year, $month, $day) = explode(
'-', $this->settings[
'currentDate']);
165 <script type=
"text/javascript">
167 <?php echo $prefix; ?>_cal =
new Calendar(
"<?php echo $prefix; ?>_cal",
"<?php echo $container_name.$name_add_on; ?>",
"<?php echo $this->settings['width'];?>",
"<?php echo $this->settings['height'];?>",
"<?php echo $year;?>",
"<?php echo $month;?>",
"<?php echo $day;?>");
168 <?php echo $prefix; ?>_cal.prefix =
"<?php echo $prefix; ?>";
170 foreach ($this->settings as $name => $value) {
171 if (is_null($value) || $name ==
'cssURL'){
175 if (is_bool($value)) {
176 $value = ($value) ?
'true' :
'false';
177 }
else if (!in_array($name, Array(
'onDayClick',
'onMonthClick',
'onYearClick',
'onWeekClick'))) {
178 $value =
'"'.$value.
'"';
181 echo $prefix.
'_cal.'.$name.
' = '.$value.
";\n";
184 <?php echo $prefix; ?>_cal.draw();