18 require_once SQ_CORE_PACKAGE_PATH.
'/folder/folder_edit_fns.inc';
19 require_once SQ_ATTRIBUTES_PATH.
'/wysiwyg/wysiwyg.inc';
46 $this->static_screens[
'details'][
'force_unlock'] = FALSE;
63 $write_access = $asset->writeAccess(
'attributes');
65 $o->openField(translate(
'online_quiz_question_group_score_categories'));
67 $score_categories = $asset->getScoreCategories();
69 if (empty($score_categories)) {
70 echo translate(
'online_quiz_question_group_empty_score_categories');
74 <table
class=
"sq-backend-table">
76 <th><?php echo translate(
'online_quiz_question_group_score_category'); ?></th>
77 <th><?php echo translate(
'online_quiz_question_group_minimum_score'); ?></th>
78 <th><?php echo translate(
'online_quiz_question_group_maximum_score'); ?></th>
82 <th><?php echo translate(
'online_quiz_question_group_delete_category'); ?></th>
88 foreach ($score_categories as $key => $score_category) {
93 text_box($prefix.
'_score_category['.$key.
'][name]', $score_category[
'name'], 60);
95 echo $score_category[
'name'];
101 int_text_box($prefix.
'_score_category['.$key.
'][min_score]', $score_category[
'min_score'], TRUE, 5);
103 echo $score_category[
'min_score'];
109 int_text_box($prefix.
'_score_category['.$key.
'][max_score]', $score_category[
'max_score'], TRUE, 5);
111 echo $score_category[
'max_score'];
117 ?><td><?php check_box($prefix.
'_score_category['.$key.
'][delete]'); ?></td><?php
133 $o->openField(translate(
'online_quiz_question_group_new_score_category'));
134 text_box($prefix.
'_new_score_category',
'', 60);
138 return $write_access;
155 $write_access = $asset->writeAccess(
'attributes');
160 $score_categories = Array();
161 $to_edit = array_get_index($_REQUEST, $prefix.
'_score_category', Array());
163 $option_key_counter = 0;
165 foreach ($to_edit as $option_key => $option) {
167 if (!array_get_index($option,
'delete')) {
168 $name = trim(array_get_index($option,
'name'));
169 $min_score = array_get_index($option,
'min_score', NULL);
170 $max_score = array_get_index($option,
'max_score', NULL);
171 $content = $_REQUEST[$prefix.
'_supplement_'.$option_key];
174 $score_categories[$option_key_counter][
'name'] = $name;
175 $score_categories[$option_key_counter][
'min_score'] =
'';
176 $score_categories[$option_key_counter][
'max_score'] =
'';
177 $score_categories[$option_key_counter][
'content'] = $content;
179 if ($min_score !=
'') {
180 $score_categories[$option_key_counter][
'min_score'] = (int)$min_score;
182 if ($max_score !=
'') {
183 $score_categories[$option_key_counter][
'max_score'] = (int)$max_score;
186 $option_key_counter++;
192 $new_score_category = trim(array_get_index($_REQUEST, $prefix.
'_new_score_category'));
193 if (!empty($new_score_category)) {
194 $score_categories[$option_key_counter] = Array(
195 'name' => $new_score_category,
201 $option_key_counter++;
204 $asset->setAttrValue(
'score_categories', $score_categories);
208 return $write_access;
225 $write_access = $asset->writeAccess(
'attributes');
227 $o->openField(translate(
'online_quiz_question_group_score_categories'));
229 $score_categories = $asset->getScoreCategories();
231 if (empty($score_categories)) {
232 echo translate(
'online_quiz_question_group_empty_score_categories');
236 <table
class=
"sq-backend-table">
238 <th><?php echo translate(
'online_quiz_question_group_score_category'); ?></th>
239 <th><?php echo translate(
'online_quiz_question_group_supplementary_content'); ?></th>
243 foreach ($score_categories as $option_key => $option) {
247 echo $option[
'name'];
251 <table border=
"0" width=
"100%">
255 $wysiwyg_prefix = $prefix.
'_supplement_'.$option_key;
257 if (isset($option[
'content'])) {
258 $wysiwyg->value = $option[
'content'];
260 $wysiwyg->paint($wysiwyg_prefix, !$write_access);
278 return $write_access;