18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
48 'is_contextable'=> TRUE,
50 'sort_order' => Array(
52 'type' =>
'serialise',
57 'type' =>
'serialise',
60 'question_col_width' => Array(
62 'type' =>
'html_width',
65 'answer_col_width' => Array(
67 'type' =>
'html_width',
70 'section_width' => Array(
72 'type' =>
'html_width',
75 'next_questionid' => Array(
82 'type' =>
'serialise',
100 'event_name' =>
'requestKeywords',
101 'broadcast_type_code' =>
'content_type',
102 'broadcast_strict_type_code' => FALSE,
104 'side_of_link' =>
'major',
106 'is_exclusive' => NULL,
109 'link_type' => SQ_LINK_TYPE_2 | SQ_LINK_TYPE_1,
127 if (!parent::_upgrade($current_version))
return FALSE;
129 $asset_name = strtoupper($this->_pm->getTypeInfo($this->getAssetType(),
'name'));
131 if (version_compare($current_version,
'0.6',
'<')) {
137 pre_echo(
'STARTING '.$asset_name.
' UPGRADE - TO VERSION 0.6');
140 $form_sections = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetIds($this->
getAssetType(), FALSE);
142 pre_echo(
'Upgrading '.count($form_sections).
' assets...');
143 foreach ($form_sections as $assetid) {
144 $form_section = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
147 if (is_null($form_section)) {
148 pre_echo(
'Could get asset #'.$assetid);
153 $form_section_edit_fns = $form_section->getEditFns();
154 if (!$form_section_edit_fns->generateContentFile($form_section)) {
155 pre_echo(
'Could not generate content file for asset #'.$assetid);
158 unset($form_section_edit_fns);
159 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($form_section);
161 pre_echo($asset_name.
' UPGRADE COMPLETE - FROM VERSION '.$current_version.
' TO 0.6');
166 if (version_compare($current_version,
'0.7',
'<')) {
167 $form_section_ids = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE);
168 foreach ($form_section_ids as $id) {
169 $form_section_ = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($id);
171 $sort_order = $form_section_->attr(
'sort_order');
172 $questions = $form_section_->attr(
'questions');
173 $new_questions = Array();
174 foreach ($sort_order as $shadowid) {
175 $id_parts = explode(
':q', $shadowid);
176 $new_questions[$id_parts[1]] = $questions[$id_parts[1]];
178 $form_section_->setAttrValue(
'questions', $new_questions);
179 $form_section_->saveAttributes();
181 pre_echo(count($form_section_ids).
' FORM_SECTIONS UPDATED');