diff --git a/lib/zin/func.php b/lib/zin/func.php index 6a9498530e..3e34acaf22 100644 --- a/lib/zin/func.php +++ b/lib/zin/func.php @@ -215,6 +215,7 @@ function thinkCover(): thinkCover {return createWg('thinkCover', func_get_args() function affected(): affected {return createWg('affected', func_get_args());} function thinkPffa(): thinkPffa {return createWg('thinkPffa', func_get_args());} function thinkPestel(): thinkPestel {return createWg('thinkPestel', func_get_args());} +function think4p(): think4p {return createWg('think4p', func_get_args());} if(is_dir(__DIR__ . DS . 'wg' . DS . 'boardeditor')) { diff --git a/lib/zin/wg/think4p/v1.php b/lib/zin/wg/think4p/v1.php new file mode 100644 index 0000000000..ae7e58929c --- /dev/null +++ b/lib/zin/wg/think4p/v1.php @@ -0,0 +1,88 @@ +buildQuestionItem($step)); + return $questionList; + } + + protected function buildItem(int $order, object $block): node|array + { + global $app, $lang, $config; + $app->loadLang('thinkwizard'); + + $mode = $this->prop('mode'); + $defaultTitle = $mode == 'preview' ? $lang->thinkwizard->unAssociated : ''; + $blockTitle = $block->text ?: $defaultTitle; + $blockStyle = $mode == 'preview' ? array('min-height' => '200px', 'width' => '50%') : array('min-height' => '200px', 'width' => '1078px'); + $blockColor = $config->thinkbackground->blockColor[$order]; + $descSize = $mode === 'preview' ? 'text-sm' : 'text-2xl'; + + return div + ( + setClass('relative col justify-between py-2 bg-canvas border border-canvas border-2 model-block', "bg-$blockColor-100", "block-$order"), + setStyle($blockStyle), + div + ( + setClass('h-full'), + div(setClass('item-step-title text-center text-clip', "text-$blockColor"), set::title($blockTitle), $blockTitle), + !isset($block->steps) ? null : div(setClass('py-3 flex flex-wrap gap-2.5 relative z-10'), $this->buildQuestion($block->steps)) + ), + div(setClass('item-desc text-center leading-tight text-canvas', $descSize), $lang->thinkwizard->fourpDesc[$order]) + ); + } + + protected function buildRow(int $key): node + { + global $app, $lang; + $app->loadLang('thinkwizard'); + + $blocks = $this->prop('blocks'); + return div + ( + setClass('px-2.5 col items-center'), + div(setClass('w-full flex items-center justify-between mt-1.5 mb-1 text-gray-400'), span($lang->thinkwizard->block . $lang->thinkwizard->blockList[$key]), span($lang->thinkwizard->block . $lang->thinkwizard->blockList[$key + 1])), + div + ( + setClass('w-full flex items-center'), + $this->buildItem($key, $blocks[$key]), + $this->buildItem($key + 1, $blocks[$key + 1]) + ) + ); + } + + protected function buildBody(): array + { + $blocks = $this->prop('blocks'); + $modelItems = array(); + foreach($blocks as $key => $block) + { + if($key % 2 == 0) $modelItems[] = $this->buildRow($key); + } + return $modelItems; + } + + protected function build(): node + { + $mode = $this->prop('mode'); + $style = $mode == 'preview' ? setStyle(array('min-height' => '254px')) : setStyle(array('min-height' => '254px', 'width' => '2156px')); + + return div + ( + setClass('model-4p my-1 flex col flex-wrap justify-between'), + $style, + $this->buildBody() + ); + } +} diff --git a/lib/zin/wg/thinkresult/v1.php b/lib/zin/wg/thinkresult/v1.php index 34ff7db7e8..dca310c078 100644 --- a/lib/zin/wg/thinkresult/v1.php +++ b/lib/zin/wg/thinkresult/v1.php @@ -27,7 +27,7 @@ class thinkResult extends wg list($wizard, $mode, $blocks) = $this->prop(array('wizard', 'mode', 'blocks')); $model = $wizard->model; - $wgMap = array('swot' => 'thinkSwot', 'pffa' => 'thinkPffa', 'pestel' => 'thinkPestel'); + $wgMap = array('swot' => 'thinkSwot', 'pffa' => 'thinkPffa', 'pestel' => 'thinkPestel', '4p' => 'think4p'); if(!isset($wgMap[$model])) return array(); return createWg($wgMap[$model], array(set::mode($mode), set::blocks($blocks)));