<div class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-list"></span> ' . Yii::t('app', 'Full list'), ['index'], ['class' => 'btn btn-default']); ?> </div> </div> <?php $this->beginBlock('app\\models\\Calibration'); ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'datetime', 'height', ['attribute' => 'measure', 'value' => app\models\Calibration::getMeasureValueLabel($model->measure)], ['format' => 'html', 'attribute' => 'sensorid', 'value' => $model->getSensor()->one() ? Html::a($model->getSensor()->one()->name, ['sensor/view', 'id' => $model->getSensor()->one()->id]) : '<span class="label label-warning">?</span>'], 'yourname', 'youremail:email']]); ?> <hr/> <?php echo Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data-confirm' => '' . Yii::t('app', 'Are you sure to delete this item?') . '', 'data-method' => 'post']); ?> <?php $this->endBlock(); ?> <?php
$this->beginBlock('main'); ?> <p> <?php echo $form->field($model, 'id')->textInput(); ?> <?php echo $form->field($model, 'datetime')->textInput(); ?> <?php echo $form->field($model, 'height')->textInput(); ?> <?php echo $form->field($model, 'measure')->dropDownList(app\models\Calibration::optsmeasure()); ?> <?php echo $form->field($model, 'sensorid')->dropDownList(\yii\helpers\ArrayHelper::map(app\models\Sensor::find()->all(), 'id', 'name'), ['prompt' => Yii::t('app', 'Select')]); ?> <?php echo $form->field($model, 'yourname')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'youremail')->textInput(['maxlength' => true]); ?> </p> <?php $this->endBlock(); ?>
<?php echo \yii\bootstrap\ButtonDropdown::widget(['id' => 'giiant-relations', 'encodeLabel' => false, 'label' => '<span class="glyphicon glyphicon-paperclip"></span> ' . Yii::t('app', 'Relations'), 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['url' => ['sensor/index'], 'label' => '<i class="glyphicon glyphicon-arrow-right"> ' . Yii::t('app', 'Sensor') . '</i>']]], 'options' => ['class' => 'btn-default']]); ?> </div> </div> <div class="table-responsive"> <?php echo GridView::widget(['layout' => '{summary}{pager}{items}{pager}', 'dataProvider' => $dataProvider, 'pager' => ['class' => yii\widgets\LinkPager::className(), 'firstPageLabel' => Yii::t('app', 'First'), 'lastPageLabel' => Yii::t('app', 'Last')], 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered table-hover'], 'headerRowOptions' => ['class' => 'x'], 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) { // using the column name as key, not mapping to 'id' like the standard generator $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key]; $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action; return Url::toRoute($params); }, 'contentOptions' => ['nowrap' => 'nowrap']], 'datetime', 'height', ['attribute' => 'measure', 'value' => function ($model) { return app\models\Calibration::getMeasureValueLabel($model->measure); }], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'sensorid', 'value' => function ($model) { if ($rel = $model->getSensor()->one()) { return Html::a($rel->name, ['sensor/view', 'id' => $rel->id], ['data-pjax' => 0]); } else { return ''; } }, 'format' => 'raw']]]); ?> </div> </div> <?php \yii\widgets\Pjax::end();