Ejemplo n.º 1
0
			<?php 
echo Html::encode($this->title);
?>
		</h3>
	</div>

	<div class="box-body default-view">

		<p>
			<?php 
echo $generator->getDescription();
?>
		</p>

		<?php 
$form = ActiveForm::begin(['id' => "{$id}-generator", 'successCssClass' => '', 'fieldConfig' => ['class' => ActiveField::className()]]);
?>

		<?php 
echo $this->renderFile($generator->formView(), ['generator' => $generator, 'form' => $form]);
?>
		<?php 
echo $form->field($generator, 'template')->sticky()->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', ['name' => 'preview', 'class' => 'btn btn-primary']);
?>
Ejemplo n.º 2
0
<?php

use blumster\migration\DesignerAsset;
use blumster\migration\models\Column;
use blumster\migration\models\ForeignKey;
use blumster\migration\models\Index;
use blumster\migration\models\Table;
use yii\bootstrap\ActiveForm;
use yii\gii\components\ActiveField;
use yii\helpers\Json;
/* @var yii\web\View $this */
/* @var yii\widgets\ActiveForm $form */
/* @var blumster\migration\generators\designer\Generator $generator */
DesignerAsset::register($this);
$tempForm = new ActiveForm(['successCssClass' => '', 'fieldConfig' => ['class' => ActiveField::className()]]);
$tableTemplate = $this->render('views/template/_table_template', ['form' => $tempForm, 'table' => new Table(), 'i' => '{{i}}']);
$columnTemplate = $this->render('views/template/_column_template', ['form' => $tempForm, 'column' => new Column(), 'i' => '{{i}}', 'c' => '{{c}}']);
$indexTemplate = $this->render('views/template/_index_template', ['form' => $tempForm, 'index' => new Index(), 'i' => '{{i}}']);
$foreignKeyTemplate = $this->render('views/template/_foreign_key_template', ['form' => $tempForm, 'foreignKey' => new ForeignKey(), 'i' => '{{i}}']);
$this->registerJs("\$('#template-container').data('table-template', " . Json::encode($tableTemplate) . ');');
$this->registerJs("\$('#template-container').data('column-template', " . Json::encode($columnTemplate) . ');');
$this->registerJs("\$('#template-container').data('index-template', " . Json::encode($indexTemplate) . ');');
$this->registerJs("\$('#template-container').data('foreign-key-template', " . Json::encode($foreignKeyTemplate) . ');');
?>

<div id="template-container" style="display: none;"></div>
<a href="#" class="btn-table-collapse" data-toggle="collapse" data-target="#table-table"><h4>Tables<span class="caret"></span><span class="badge <?php 
echo count($generator->tables) == 0 ? 'hidden' : '';
?>
" id="table-badge"><?php 
echo count($generator->tables);