],
		]); ?>

	    <?= $form->field($model, 'course_id')->textInput() ?>

	    <?= $form->field($model, 'task_type')->dropdownList(Task::typeList(), ['disabled' => 'true']) ?>

	    <?= $form->field($model, 'title')->widget(MarkdownEditor::classname(), ['height' => 260, 'encodeLabels' => true, 'smarty' => true, 'previewAction' => Url::to(['task/preview']),]); ?>

	    <?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
		
		<?= $form->field($model, 'answer_json')->widget(MarkdownEditor::classname(), ['height' => 260, 'encodeLabels' => true, 'smarty' => true, 'previewAction' => Url::to(['task/preview']),]); ?>

	    <?= $form->field($model, 'score')->dropdownList(Task::scoreList()) ?>

	    <?= $form->field($model, 'is_timing')->dropdownList(Task::timingList()) ?>

		<span id="complete_time">
	    	<?= $form->field($model, 'complete_time')->dropdownList(Task::timeList()) ?>
		</span>
	    <div class="form-group">
	    	<label class="col-lg-2 control-label"></label>
	    	<div class="col-lg-4">
	        	<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
	    	</div>
	    </div>

	    <?php ActiveForm::end(); ?>

	</div>
Example #2
0
use kartik\markdown\Markdown;

/* @var $this yii\web\View */
/* @var $model app\models\Task */

// $content = '### Heading 3 ###';
// echo Markdown::process($content); 
// die;

$this->title = $model->title;
$title = mb_substr(strip_tags($this->title), 0, 60);
$title .= '......';
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Tasks'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $title;

$timingList = Task::timingList();
$typeList = Task::typeList();

//将选项json解析为字符串
$htmlStr = '';
if ($model->task_type == $model::TYPE_CHOICE) {
    $htmlStr = Common::parseJsonToStr($model->option_json);
}

//将答案json解析为字符串
$answerStr = '';
if ($model->task_type == Task::TYPE_CHOICE) {
    $answerStr = implode(',', json_decode($model->answer_json));
}

?>