* [task#127421] add quoted lable of thinkstepmenu.

This commit is contained in:
Zhangyu
2024-09-05 15:39:10 +08:00
committed by 刘刚
parent 6a760f15ad
commit 4181aa1bfa
+12
View File
@@ -48,12 +48,24 @@ class thinkStepMenu extends wg
foreach($items as $setting)
{
if(!is_object($setting)) continue;
$options = !empty($setting->options) ? json_decode($setting->options) : array();
$quotedTitle = !empty($options->quoteTitle) ? $options->quoteTitle : null;
$quotedText = '';
/* 给引用其他问题的多选题添加标签。Add tags to multiple-choice questions that reference other questions. */
if($quotedTitle)
{
foreach($items as $item)
{
if($quotedTitle == $item->id) $quotedText = sprintf($this->lang->thinkstep->treeLabel, $item->index);
}
}
$canView = common::hasPriv('thinkstep', 'view');
$unClickable = $toggleNonNodeShow && $setting->id != $activeKey && $setting->type != 'node' && json_decode($setting->answer) == null;
$item = array(
'key' => $setting->id,
'text' => (isset($setting->index) ? ($setting->index . '. ') : '') . $setting->title,
'subtitle' => !empty($quotedText) ? array('html' => "<span class='label size-sm rounded-full warning-pale'>$quotedText</span>") : null,
'hint' => $unClickable ? $this->lang->thinkrun->error->unanswered :$setting->title,
'url' => $unClickable || !$canView ? '' : $setting->url,
'data-id' => $setting->id,