當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::typeList方法代碼示例

本文整理匯總了PHP中app\models\Task::typeList方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::typeList方法的具體用法?PHP Task::typeList怎麽用?PHP Task::typeList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Task的用法示例。


在下文中一共展示了Task::typeList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

	<div class="task-form">

	    <?php $form = ActiveForm::begin([
	        'options' => [
	            'class' => 'form-horizontal',
	            'enctype' => 'multipart/form-data',
	        ],
	        'fieldConfig' => [
	            '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')->dropdownList(ArrayHelper::map(Course::fileMap(['id', 'name']), 'id', 'name')) ?>

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

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

		<span id="choice-a" style="display: none">
			<?= $form->field($model, 'option_A')->textInput(['maxlength' => true]) ?>
		</span>
		
		<span id="choice-b" style="display: none">
			<?= $form->field($model, 'option_B')->textInput(['maxlength' => true]) ?>
		</span>
		
		<span id="choice-c" style="display: none">
			<?= $form->field($model, 'option_C')->textInput(['maxlength' => true]) ?>
		</span>
開發者ID:songwanfu,項目名稱:SummerNut,代碼行數:30,代碼來源:create.php

示例2:

	<div class="task-form">

	    <?php $form = ActiveForm::begin([
	        'options' => [
	            'class' => 'form-horizontal',
	            'enctype' => 'multipart/form-data',
	        ],
	        'fieldConfig' => [
	            '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">
開發者ID:songwanfu,項目名稱:SummerNut,代碼行數:31,代碼來源:update-short-calculation.php

示例3: implode

/* @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));
}

?>
<div class="task-view">
開發者ID:songwanfu,項目名稱:SummerNut,代碼行數:30,代碼來源:view.php


注:本文中的app\models\Task::typeList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。