Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_upcoming_events_list_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  'num_events' => Array(
44  'type' => 'int',
45  'default' => 3,
46  'parameters' => Array(
47  'allow_negative' => FALSE,
48  'range_lower' => 1,
49  'range_upper' => 255,
50  ),
51  ),
52  'horizon' => Array(
53  'type' => 'int',
54  'default' => 180,
55  'parameters' => Array(
56  'allow_negative' => FALSE,
57  'range_lower' => 1,
58  'range_upper' => 800,
59  ),
60  ),
61  'root_nodes' => Array(
62  'type' => 'serialise',
63  'default' => Array(),
64  ),
65  'parameter_map' => Array(
66  'added' => '0.2',
67  'type' => 'parameter_map',
68  'default' => Array(),
69  'parameters' => Array(
70  'parameters' => Array(
71  'replacement_root_node' => 'Replacement Event Source',
72  ),
73  ),
74  ),
75  'types' => Array(
76  'added' => '0.3',
77  'type' => 'serialise',
78  'default' => Array(
79  'calendar_event_single' => 0,
80  'calendar_event_recurring' => 0,
81  'calendar_event_multi_date' => 0,
82  ),
83  ),
84  );
85 
86 
87  }//end constructor
88 
89 
96  function getEventList()
97  {
98  return Array(
99  Array(
100  'event_name' => 'requestKeywords',
101  'broadcast_type_code' => 'content_type',
102  'broadcast_strict_type_code' => FALSE,
103  'options' => Array(
104  'side_of_link' => 'major',
105  'indirect' => TRUE,
106  'is_exclusive' => NULL,
107  'is_dependant' => 1,
108  'value' => '',
109  'link_type' => SQ_LINK_TYPE_2 | SQ_LINK_TYPE_1,
110  ),
111  ),
112  );
113 
114  }//end getEventList()
115 
116 
125  function _upgrade($current_version)
126  {
127  if (!parent::_upgrade($current_version)) return FALSE;
128 
129  $asset_name = strtoupper($this->_pm->getTypeInfo($this->getAssetType(), 'name'));
130  $am =& $GLOBALS['SQ_SYSTEM']->am;
131 
132  if (version_compare($current_version, '0.3', '<')) {
133  // version 0.2 -> 0.3
134  pre_echo('STARTING '.$asset_name.' UPGRADE - FROM VERSION '.$current_version);
135 
136  // Name the links to the "Page Contents" and "Type Formats" folders
137  $pages = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids($this->getAssetType(), FALSE, TRUE);
138  foreach ($pages as $assetid => $type_code) {
139  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid, $type_code);
140  if (is_null($asset)) continue;
141 
142  $contents_folder_link = $GLOBALS['SQ_SYSTEM']->am->getLink($assetid, SQ_LINK_TYPE_2, 'bodycopy', TRUE, '', 'major', TRUE);
143  if ($contents_folder_link['value'] != 'page_contents') {
144  $GLOBALS['SQ_SYSTEM']->am->updateLink($contents_folder_link['linkid'], SQ_LINK_TYPE_2, 'page_contents');
145  }
146 
147  $tf_folder_link = $GLOBALS['SQ_SYSTEM']->am->getLink($assetid, SQ_LINK_TYPE_2, 'folder', TRUE, '', 'major', TRUE);
148  if ($tf_folder_link['value'] != 'type_formats') {
149  $GLOBALS['SQ_SYSTEM']->am->updateLink($tf_folder_link['linkid'], SQ_LINK_TYPE_2, 'type_formats');
150  }
151 
152  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset);
153  }
154 
155  pre_echo($asset_name.' UPGRADE COMPLETE - FROM VERSION 0.2');
156  }
157 
158  return TRUE;
159 
160  }//end _upgrade()
161 
162 
163 }//end class
164 
165 ?>