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.

62 lines
1.6 KiB

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