From 211da5263ccec00dce5e4304fb5ebfaf3c8f8393 Mon Sep 17 00:00:00 2001 From: Zhangyu Date: Wed, 28 Aug 2024 00:42:02 +0000 Subject: [PATCH] * [task#126402] modify multiple-choice questions reference other questions options of thinkradio. --- lib/zin/wg/thinkradio/v1.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/zin/wg/thinkradio/v1.php b/lib/zin/wg/thinkradio/v1.php index 8bddbcfc41..0042751460 100644 --- a/lib/zin/wg/thinkradio/v1.php +++ b/lib/zin/wg/thinkradio/v1.php @@ -41,6 +41,26 @@ class thinkRadio extends thinkQuestion $fields = $step->options->fields ?? array(); $items = array(); + if(empty($fields) && $isRun) + { + if($step->options->setOption == 1) + { + foreach($quoteQuestions as $item) + { + if($isRun && $item->origin == $step->options->quoteTitle) + { + $item->answer = json_decode($item->answer); + $item->options = json_decode($item->options); + $quoteFields = $item->options->fields; + if($step->options->citation == 0) $fields = $quoteFields; + if($step->options->citation == 1) $fields = array_intersect($item->options->fields, $item->answer->result); + if($step->options->citation == 2) $fields = array_diff($item->options->fields, $item->answer->result); + if(in_array('other',$item->answer->result)) $fields[] = $item->answer->other; + } + } + } + $fields = array_values($fields); + } if(!empty($fields)) foreach($fields as $field) $items[] = array('text' => $field, 'value' => $field); if(empty($fields) && !$isRun) $items[] = array('text' => $lang->thinkstep->optionReference, 'disabledPrefix' => true); if(!empty($step->options->enableOther)) $items[] = array('text' => $lang->other, 'value' => 'other', 'isOther' => '1', 'other' => isset($answer->other) ? $answer->other : '');