'template' => "{label}\n<div class=\"col-lg-8\">{input}</div>\n<div class=\"col-lg-2\">{error}</div>",
	            'labelOptions' => ['class' => 'col-lg-2 control-label'],
	        ],
		]); ?>

	    <?= $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(); ?>
Example #2
0
 [
     'attribute' => 'answer_json',
     'format' => 'raw',
     'value' => function ($model) {
         if ($model->task_type == $model::TYPE_CHOICE) {
             return implode(',', json_decode($model->answer_json));
         }
         return mb_substr(Markdown::convert($model->answer_json), 0, 400, 'utf-8');
     }
 ],
 [
     'attribute' => 'score',
     'format' => 'raw',
     'filter' => Html::activeDropDownList($searchModel, 'score', Task::scoreList(Task::INCLUDE_ALL), ['class' => 'form-control']),
     'value' => function ($model) {
         $list = Task::scoreList();
         return $list[$model->score];
     },
     'headerOptions' => ['width' => '95px'],
 ],
 [
     'attribute' => 'task_type',
     'format' => 'raw',
     'filter' => Html::activeDropDownList($searchModel, 'task_type', Task::typeList(Task::INCLUDE_ALL), ['class' => 'form-control']),
     'value' => function ($model) {
         $list = Task::typeList();
         return $list[$model->task_type];
     },
     'headerOptions' => ['width' => '95px'],
 ],
 [