Yii2 Bootstrap 3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

11 years ago
<?php
use yii\helpers\Html;
11 years ago
use yii\widgets\ActiveForm;
11 years ago
use yii\gii\components\ActiveField;
11 years ago
use yii\gii\CodeFile;
11 years ago
/**
11 years ago
* @var yii\web\View $this
11 years ago
* @var yii\gii\Generator $generator
* @var string $id
11 years ago
* @var yii\widgets\ActiveForm $form
11 years ago
* @var string $results
* @var boolean $hasError
11 years ago
* @var CodeFile[] $files
11 years ago
* @var array $answers
11 years ago
*/
$this->title = $generator->getName();
$templates = [];
11 years ago
foreach ($generator->templates as $name => $path) {
$templates[$name] = "$name ($path)";
}
11 years ago
?>
<div class="default-view">
<h1><?= Html::encode($this->title) ?></h1>
11 years ago
<p><?= $generator->getDescription() ?></p>
11 years ago
<?php $form = ActiveForm::begin([
'id' => "$id-generator",
11 years ago
'successCssClass' => '',
'fieldConfig' => ['class' => ActiveField::className()],
]); ?>
11 years ago
<div class="row">
<div class="col-lg-8">
<?= $this->renderFile($generator->formView(), [
11 years ago
'generator' => $generator,
'form' => $form,
]) ?>
<?= $form->field($generator, 'template')->sticky()
11 years ago
->label('Code Template')
11 years ago
->dropDownList($templates)->hint('
Please select which set of the templates should be used to generated the code.
') ?>
11 years ago
<div class="form-group">
<?= Html::submitButton('Preview', ['name' => 'preview', 'class' => 'btn btn-primary']) ?>
11 years ago
<?php if (isset($files)): ?>
<?= Html::submitButton('Generate', ['name' => 'generate', 'class' => 'btn btn-success']) ?>
11 years ago
<?php endif; ?>
</div>
11 years ago
</div>
</div>
11 years ago
11 years ago
<?php
if (isset($results)) {
echo $this->render('view/results', [
11 years ago
'generator' => $generator,
'results' => $results,
'hasError' => $hasError,
]);
11 years ago
} elseif (isset($files)) {
echo $this->render('view/files', [
11 years ago
'generator' => $generator,
'files' => $files,
'answers' => $answers,
]);
11 years ago
}
?>
11 years ago
<?php ActiveForm::end(); ?>
11 years ago
</div>