Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_area_js_calendar_navigator.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/designs/design_area/design_area.inc';
18 
31 {
32 
33 
47  function _getAllowedLinks()
48  {
49  $res = parent::_getAllowedLinks();
50  $res[SQ_LINK_NOTICE]['page_calendar'] = Array('card' => 'M', 'exclusive' => FALSE);
51  return $res;
52 
53  }//end _getAllowedLinks()
54 
55 
63  function printPaintingCode()
64  {
65  $page_links = $GLOBALS['SQ_SYSTEM']->am->getLinks($this->id, SQ_LINK_NOTICE, 'page_calendar', FALSE);
66  $page_ids = Array();
67  foreach ($page_links as $link) {
68  $page_ids[substr($link['value'], 0, -5)] = $link['minorid'];
69  }
70 
71  $open_php = '<'.'?'.'php';
72  $close_php = '?'.'>';
73  ?>
74 
75  <?php echo $open_php; ?>
76  $<?php echo $this->attr('id_name'); ?>_target_pages = <?php var_export($page_ids); ?>;
77  $<?php echo $this->attr('id_name'); ?>_target_urls = $GLOBALS['SQ_SYSTEM']->am->getAssetURL(array_values($<?php echo $this->attr('id_name'); ?>_target_pages));
78  <?php echo $close_php; ?>
79 
80  <script type="text/javascript">
81  //<![CDATA[
82  <?php
83  foreach (Array('day', 'week', 'month', 'year') as $unit) {
84  ?>
85 
86  function on<?php echo ucfirst($unit); ?>Click(day, mon, year)
87  {
88  <?php echo $open_php; ?>
89  if (!empty($<?php echo $this->attr('id_name'); ?>_target_pages['<?php echo $unit; ?>'])) {
90  $cal_page_id = $<?php echo $this->attr('id_name'); ?>_target_pages['<?php echo $unit; ?>'];
91  if (!empty($<?php echo $this->attr('id_name'); ?>_target_urls[$cal_page_id])) {
92  <?php echo $close_php; ?>
93  frameRedirect("<?php echo $open_php; ?> echo $<?php echo $this->attr('id_name'); ?>_target_urls[$cal_page_id]; <?php echo $close_php; ?>?SQ_CALENDAR_VIEW=<?php echo $unit; ?>&SQ_CALENDAR_DATE=" + DateConvert2MySQL(day, mon, year));
94  <?php echo $open_php; ?>
95  }
96  }
97  <?php echo $close_php; ?>
98  }
99 
100  <?php
101  }
102  ?>
103  //]]>
104  </script>
105 
106  <?php echo $open_php; ?>
107  if (!empty($<?php echo $this->attr('id_name'); ?>_target_urls)) {
108  require_once SQ_LIB_PATH."/js_calendar/js_calendar.inc";
109  $calendar = new JS_Calendar();
110  $calendar->changeSetting("onDayClick", "onDayClick");
111  $calendar->changeSetting("onWeekClick", "onWeekClick");
112  $calendar->changeSetting("onMonthClick","onMonthClick");
113  $calendar->changeSetting("onYearClick", "onYearClick");
114  $calendar->changeSetting("height", "100%");
115  $calendar->changeSetting("width", "100%");
116  if (isset($_GET["SQ_CALENDAR_DATE"])) {
117  $calendar->changeSetting("currentDate", $_GET["SQ_CALENDAR_DATE"]);
118  }
119 
120  $custom_style_assetid = '<?php echo $this->attr('style_assetid'); ?>';
121  if (!empty($custom_style_assetid)) {
122  $style_file = $GLOBALS['SQ_SYSTEM']->am->getAsset($custom_style_assetid);
123  $calendar->changeSetting("cssURL", $style_file->getURL());
124  }
125 
126  $calendar->paint("js_calendar", '<?php echo str_replace("'", "\\'", $this->attr('element_id')); ?>');
127  }
128  <?php echo $close_php; ?>
129 
130  <?php
131  return TRUE;
132 
133  }//end printPaintingCode()
134 
135 
136 }//end class
137 
138 ?>