Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_area_js_calendar_navigator_management.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
19 
31 {
32 
33 
39  {
40  $this->Asset_Management($pm);
41 
42  $this->vars = Array(
43  'target_assetid' => Array(
44  'added' => '0.1',
45  'type' => 'assetid',
46  'default' => '',
47  'description' => 'DEPRECATED - DONE WITH LINKS INSTEAD FROM V0.2',
48  ),
49  'element_id' => Array(
50  'added' => '0.1',
51  'type' => 'text',
52  'default' => 'js_calendar_navigator',
53  'description' => 'Element ID on HTML page',
54  ),
55  'style_assetid' => Array(
56  'added' => '0.1',
57  'type' => 'assetid',
58  'default' => '',
59  'description' => 'Optional CSS',
60  ),
61  );
62 
63  }//end constructor
64 
65 
74  function _upgrade($current_version)
75  {
76  if (!parent::_upgrade($current_version)) return FALSE;
77  $am =& $GLOBALS['SQ_SYSTEM']->am;
78  if (version_compare($current_version, '0.2', '<')) {
79  pre_echo('UPGRADING CALENDAR NAVIGATOR DESIGN AREA TO V0.2');
80  $instances = $am->getTypeAssetids($this->getAssetType(), FALSE, TRUE);
81  $to_reparse = Array();
82  foreach ($instances as $id => $type) {
83  $instance = $am->getAsset($id, 'design_area_js_calendar_navigator');
84  $pageid = @$instance->attr('target_assetid');
85  if (!empty($pageid)) {
86  $page = $am->getAsset($pageid);
87  if (!is_null($page)) {
88  foreach (Array('day', 'week', 'month', 'year') as $view) {
89  $instance->createLink($page, SQ_LINK_NOTICE, $view.'_page');
90  }
91  }
92  }
93  $designs = $instance->getDesigns();
94  foreach (array_keys($designs) as $i) {
95  if ($designs[$i]->type() == 'design') {
96  // only want real designs, customisations will look after themselves
97  $to_reparse[] = $designs[$i]->id;
98  }
99  }
100  }
101  pre_echo('REPARSING DESIGNS');
102  $edit_fns = NULL;
103  foreach (array_unique($to_reparse) as $designid) {
104  $design = $am->getAsset($designid, 'design');
105  if (is_null($edit_fns)) {
106  $edit_fns = $design->getEditFns();
107  }
108  $edit_fns->parseAndProcessFile($design);
109  $design->_updateCustomisations();
110  }
111  pre_echo('CALENDAR NAVIGATOR DESIGN AREA COMPLETE');
112  }//end if version less than 0.2
113  return TRUE;
114 
115  }//end _upgrade()
116 
117 
118 }//end class
119 ?>