Beispiel #1
0
/* @var $searchModel app\models\SlideSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Slides');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="slide-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Slide'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'source_url', 'value' => function ($data) {
    return "<img src='/" . $data->source_url . "' />";
}, 'format' => 'raw', 'contentOptions' => ['class' => 'grid-image'], 'filter' => false], 'alt', ['attribute' => 'common_status_id', 'value' => function ($data) {
    return $data->common_status_id == CommonStatus::ACTIVE ? '<span class="status-button status-active glyphicon glyphicon-refresh"></span>' : '<span class="status-button status-inactive glyphicon glyphicon-refresh"></span>';
}, 'format' => 'raw', 'filter' => CommonStatus::getAll()], ['class' => 'yii\\grid\\ActionColumn']], 'options' => ['data-url' => Yii::$app->urlManager->createUrl(['slide/change-status']), 'class' => 'grid']]);
?>

</div>
Beispiel #2
0
    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'date')->widget(DatePicker::classname(), ['options' => ['placeholder' => Yii::t('app', 'Enter birth date ...')], 'type' => DatePicker::TYPE_COMPONENT_APPEND, 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd'], 'removeButton' => false, 'language' => \app\models\Lang::getCurrent()['local']]);
?>

    <?php 
echo $form->field($model, 'breed_id')->dropDownList(\app\models\Breed::getAll());
?>

    <?php 
echo $form->field($model, 'common_status_id')->dropDownList(\app\models\CommonStatus::getAll());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>