18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
47 'description' =>
'The name of the event',
49 'is_contextable' => TRUE,
51 'description' => Array(
55 'description' =>
'Description of the event',
57 'is_contextable' => TRUE,
59 'start_date' => Array(
62 'default' =>
'---------- --:--:--',
63 'parameters' => Array(
65 'show' => Array(
'd',
'm',
'y',
'h',
'i'),
67 'description' =>
'The starting date and/or time of the event',
74 'default' =>
'---------- --:--:--',
75 'parameters' => Array(
'allow_null' => TRUE),
76 'description' =>
'The ending date and/or time of the event',
100 function _upgrade($current_version)
102 if (!parent::_upgrade($current_version))
return FALSE;
104 if (version_compare($current_version,
'0.2',
'<')) {
110 pre_echo(
'STARTING UPGRADE OF CALENDAR EVENT FROM VERSION '.$current_version.
' TO VERSION 0.2');
111 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
112 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
114 $calendar_events = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE, TRUE);
115 pre_echo(
'Updating '.count($calendar_events).
' asset(s)...');
116 foreach ($calendar_events as $assetid => $type_code) {
117 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid, $type_code);
118 if (is_null($asset))
continue;
121 $asset->cacheCalendarData();
123 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
128 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
129 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
131 pre_echo(
'CALENDAR EVENT SUCCESSFULLY UPGRADED TO VERSION 0.2');