<?php /** * @link http://phe.me * @copyright Copyright (c) 2014 yesaulov * @license MIT http://opensource.org/licenses/MIT */ use yii\helpers\Html; use yesaulov\settings\Module; /** * @var yii\web\View $this * @var yesaulov\settings\models\Setting $model */ $this->title = Module::t('settings', 'Update {modelClass}: ', ['modelClass' => 'Setting']) . ' ' . $model[0]->section; $this->params['breadcrumbs'][] = ['label' => Module::t('settings', 'Settings'), 'url' => ['index']]; //$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; //$this->params['breadcrumbs'][] = Module::t('settings', 'Update'); ?> <div class="setting-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
$this->title = Module::t('settings', 'Settings'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="setting-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php //echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Module::t('settings', 'Create {modelClass}', ['modelClass' => 'Setting']), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['section', ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) { return [$action, 'id' => $model->id, 'section' => $model->section]; }, 'template' => '{update} {delete}']]]); ?> <?php Pjax::end(); ?> </div>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('settings', 'ID'), 'type' => Module::t('settings', 'Type'), 'section' => Module::t('settings', 'Section'), 'key' => Module::t('settings', 'Key'), 'value' => Module::t('settings', 'Value'), 'active' => Module::t('settings', 'Active'), 'created' => Module::t('settings', 'Created'), 'modified' => Module::t('settings', 'Modified')]; }
use yesaulov\settings\Module; /** * @var yii\web\View $this * @var yesaulov\settings\models\Setting $model */ $this->title = $model->section . '.' . $model->key; $this->params['breadcrumbs'][] = ['label' => Module::t('settings', 'Settings'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="setting-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('settings', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('settings', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('settings', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'type', 'section', 'active:boolean', 'key', 'value:ntext', 'created:relativeTime', 'modified:relativeTime']]); ?> </div>
<a href="#" class="add_another_value"><i class="fa fa-plus"></i> Add Another</a> </div> </div> <?php } ?> </div> <?php //echo $form->field($model[0], 'active')->checkbox(['value' => 1]) ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('settings', 'Save'), ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $( document ).ready(function() { $(".add_another_value").on('click', function(){ var str = '<div class="row"><div class="col-xs-5"><div class="form-group field-setting-key has-success">'; str += '<label class="control-label" for="setting-key">Key</label><input class="form-control" name="Setting[key][]" maxlength="100" type="text">';
<?php echo $form->field($model, 'section'); ?> <?php echo $form->field($model, 'key'); ?> <?php echo $form->field($model, 'value'); ?> <?php echo $form->field($model, 'active')->checkbox(); ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('settings', 'Search'), ['class' => 'btn btn-primary']); ?> <?php echo Html::resetButton(Module::t('settings', 'Reset'), ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?> </div>