18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
43 'start_date' => Array(
46 'default' =>
'---------- --:--:--',
47 'parameters' => Array(
48 'allow_null' => FALSE,
50 'description' =>
'The starting date and/or time of the event',
56 'default' =>
'---------- --:--:--',
57 'parameters' => Array(
'allow_null' => FALSE),
58 'description' =>
'The ending date and/or time of the event',
61 'days_per_page' => Array(
64 'parameters' => Array(
'allow_negative' => FALSE),
68 'default' =>
'Next %n% Days >>',
69 'is_contextable' => TRUE,
73 'default' =>
'<< Previous %n% days',
74 'is_contextable' => TRUE,
78 $this->components = Array(
79 'short_name' => Array(
80 'description' =>
'Short Name',
81 'default_weighting' =>
'1',
98 'event_name' =>
'requestKeywords',
99 'broadcast_type_code' =>
'content_type',
100 'broadcast_strict_type_code' => FALSE,
102 'side_of_link' =>
'major',
104 'is_exclusive' => NULL,
107 'link_type' => SQ_LINK_TYPE_2 | SQ_LINK_TYPE_1,
125 if (!parent::_upgrade($current_version))
return FALSE;
127 $asset_name = strtoupper($this->_pm->getTypeInfo($this->getAssetType(),
'name'));
128 $am =& $GLOBALS[
'SQ_SYSTEM']->am;
131 if (version_compare($current_version,
'0.3',
'<') && !empty($GLOBALS[
'ROLLING_CAL_PAGE_UPGRADED_TO_03'])) {
133 pre_echo(
'STARTING '.$asset_name.
' UPGRADE - TO VERSION 0.3');
135 $am->includeAsset(
'bodycopy');
137 $pages = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), TRUE, 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 echo
'Upgrading Asset #'.$assetid.
"...\n";
144 if (!$asset->setAttrValue(
'duration_from', $asset->attr(
'days_from')) || !$asset->setAttrValue(
'duration_to', $asset->attr(
'days_to'))) {
145 echo
'Asset #', $asset->id,
' (', $asset->name,
') Unable to convert old days_from and/or days_to values',
"\n";
150 $date_format = $asset->attr(
'day_heading_format');
152 for ($ii = 0; $ii < strlen($date_format); $ii++) {
153 if (preg_match(
'/[[:alpha:]]/', $date_format[$ii]) && ($ii == 0 || $date_format[$ii - 1] !=
'\\')) {
154 $heading_date .=
'%time_unit_start_datetime_'.$date_format[$ii].
'%';
155 }
else if ($date_format[$ii] !=
'\\') {
156 $heading_date .= $date_format[$ii];
159 $heading = $asset->attr(
'day_heading_tag');
160 $unit_format =
'<'.$heading.
'>'.$heading_date.
'</'.$heading.
'>'.
"\n".
'%time_unit_event_list%';
167 'link_type' => SQ_LINK_TYPE_2,
170 'value' =>
'time_unit',
173 $time_unit_details = array_get_index($asset->bodycopies,
'time_unit', Array());
174 $bodycopy->setAttrValue(
'name', array_get_index($time_unit_details,
'name'));
175 if (!$bodycopy->create($link, Array(
'content' => $unit_format))) {
176 echo
'Asset #', $asset->id,
' (', $asset->name,
') Could not create Time Unit bodycopy',
"\n";
180 if (!$asset->saveAttributes()) {
181 echo
'Asset #', $asset->id,
' (', $asset->name,
') Unable to save attributes',
"\n";
184 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
187 pre_echo($asset_name.
' UPGRADE COMPLETE - TO VERSION 0.3');