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