18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
43 'response_form' => Array(
45 'type' =>
'serialise',
47 'description' =>
'The options that control the response form',
49 'max_option_selections' => Array(
53 'parameters' => Array(
54 'allow_negative' => FALSE,
55 'allow_empty' => FALSE,
57 'description' =>
'The maximum number of options a user can select when answering this question without forfeiting points',
59 'forfeit_penalty' => Array(
63 'description' =>
'The number of points a user will lose if they forfeit for whatever reason (eg. selected too many options, didn\'t answer the question)',
65 'option_style' => Array(
67 'type' =>
'selection',
69 'parameters' => Array(
71 'radio' =>
'Radio Buttons / Checkboxes',
72 'list' =>
'Dropdown List',
74 'allow_empty' => FALSE,
76 'description' =>
'The options that control the response form',
78 'use_html_options' => Array(
80 'type' =>
'selection',
82 'parameters' => Array(
89 'allow_empty' => FALSE,
107 if (version_compare($current_version,
'0.2',
'<')) {
108 $children = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE);
109 pre_echo(
'STARTING ONLINE QUIZ QUESTION MULTI-CHOICE UPGRADE - VERSION 0.1 => 0.2');
111 foreach ($children as $assetid) {
112 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
115 $question_options = $asset->attr(
'response_form');
117 foreach ($question_options as $option_key => $option) {
118 $question_options[$option_key][
'response_supplement'] =
'';
121 if (!$asset->setAttrValue(
'response_form', $question_options)) {
122 trigger_localised_error(
'CMS0039', E_USER_WARNING,
'0.2');
125 if (!$asset->saveAttributes()) {
126 trigger_localised_error(
'CMS0026', E_USER_WARNING,
'0.2');
130 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
133 pre_echo(
'ONLINE QUIZ QUESTION MULTI-CHOICE UPGRADE COMPLETE - VERSION 0.1 => 0.2');
136 return parent::_upgrade($current_version);