Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

72 lines
2.3KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\gii\components\ActiveField;
  5. use yii\gii\CodeFile;
  6. /* @var $this yii\web\View */
  7. /* @var $generator yii\gii\Generator */
  8. /* @var $id string panel ID */
  9. /* @var $form yii\widgets\ActiveForm */
  10. /* @var $results string */
  11. /* @var $hasError boolean */
  12. /* @var $files CodeFile[] */
  13. /* @var $answers array */
  14. $this->title = $generator->getName();
  15. $templates = [];
  16. foreach ($generator->templates as $name => $path) {
  17. $templates[$name] = "$name ($path)";
  18. }
  19. ?>
  20. <div class="default-view">
  21. <h1><?= Html::encode($this->title) ?></h1>
  22. <p><?= $generator->getDescription() ?></p>
  23. <?php $form = ActiveForm::begin([
  24. 'id' => "$id-generator",
  25. 'successCssClass' => '',
  26. 'fieldConfig' => ['class' => ActiveField::className()],
  27. ]); ?>
  28. <div class="row">
  29. <div class="col-lg-8 col-md-10">
  30. <?= $this->renderFile($generator->formView(), [
  31. 'generator' => $generator,
  32. 'form' => $form,
  33. ]) ?>
  34. <?= $form->field($generator, 'template')->sticky()
  35. ->label('Code Template')
  36. ->dropDownList($templates)->hint('
  37. Please select which set of the templates should be used to generated the code.
  38. ') ?>
  39. <div class="form-group">
  40. <?= Html::submitButton('Preview', ['name' => 'preview', 'class' => 'btn btn-primary']) ?>
  41. <?php if (isset($files)): ?>
  42. <?= Html::submitButton('Generate', ['name' => 'generate', 'class' => 'btn btn-success']) ?>
  43. <?php endif; ?>
  44. </div>
  45. </div>
  46. </div>
  47. <?php
  48. if (isset($results)) {
  49. echo $this->render('view/results', [
  50. 'generator' => $generator,
  51. 'results' => $results,
  52. 'hasError' => $hasError,
  53. ]);
  54. } elseif (isset($files)) {
  55. echo $this->render('view/files', [
  56. 'id' => $id,
  57. 'generator' => $generator,
  58. 'files' => $files,
  59. 'answers' => $answers,
  60. ]);
  61. }
  62. ?>
  63. <?php ActiveForm::end(); ?>
  64. </div>