<?php use yii\helpers\Html; use yii\grid\GridView; use common\components\helpers\Show; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Danh sách cảm biến'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="sensor-index"> <h4><?php echo Html::encode($this->title); ?> </h4> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'options' => ['width' => '6%']], 'name', ['attribute' => 'binary_pos', 'options' => ['width' => '10%']], ['attribute' => 'active', 'format' => 'html', 'value' => function ($model) { $color = $model->isActive() ? 'active' : 'inactive'; return Show::decorateString($model->getActive(), $color); }, 'options' => ['width' => '15%']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'options' => ['width' => '10%']]]]); ?> </div>
<h4><?php echo Html::encode($this->title); ?> </h4> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'options' => ['width' => '6%']], 'code', 'name', ['attribute' => 'center_id', 'format' => 'text', 'value' => function ($model) { $center = Center::findOne($model->center_id); if ($center) { return $center->name; } return null; }], ['attribute' => 'area_id', 'format' => 'text', 'value' => function ($model) { $area = Area::findOne($model->area_id); if ($area) { return $area->name; } return null; }], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) { if ($model->status == Station::STATUS_CONNECTED) { $html = Show::decorateString($model->getStatus($model->status), 'good'); } if ($model->status == Station::STATUS_LOST) { $html = Show::decorateString($model->getStatus($model->status), 'bad'); } return $html; }], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['width' => '10%']]]]); ?> </div>
$pics = $model->findPicture($model->id); $html = '<div class="gallery">'; if (!empty($pics)) { $no = 1; foreach ($pics as $pic) { $hide = 1; if ($no == 1) { $hide = 0; } $hideIt = $hide ? 'style="display: none;"' : ''; $path = Yii::$app->urlManager->baseUrl . '/uploads/' . $pic['picture']; $html .= '<button ' . $hideIt . ' class="btn btn-warning btn-xs" href="' . $path . '">Xem ảnh</button>'; $no++; } } else { $html .= Show::decorateString('Lỗi camera', 'bad'); } $html .= '</div>'; return $html; }, 'options' => ['width' => '10%']], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['width' => '5%', 'align' => 'center'], 'template' => '{delete}']]]); ?> </div> </div> <script type="text/javascript"> function confirmDeleteAll(obj) { var href = $(obj).attr('href'); if (confirm("Bạn chắc chắn muốn xóa tất cả <?php echo $dataProvider->getTotalCount(); ?>
<a href="http://<?php echo $model->ip; ?> :<?php echo $model->port; ?> " target="_blank" type="button" class="btn btn-primary btn-xs">Link đến thiết bị</a> </th> </tr> <?php $sc = Yii::$app->session->getFlash('update_success'); if (isset($sc)) { ?> <tr> <td colspan="5"><?php echo Show::decorateString(Yii::$app->session->getFlash('update_success'), 'good'); ?> </td> </tr> <?php } ?> <tr> <th width="5%">#</th> <th width="45%">Tên thiết bị</th> <th width="25%">Tình trạng</th> <th width="">Thiết lập</th> </tr> <?php if (isset($equipments) && !empty($equipments)) {
<?php use common\models\StationStatus; use common\components\helpers\Convert; use common\components\helpers\Show; use yii\helpers\Html; use yii\grid\GridView; $this->title = 'Thống kê trạng thái trạm ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'DS Trạm', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="station-status"> <h4><?php echo Html::encode($this->title); ?> </h4> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'request_string', ['attribute' => 'time_update', 'value' => function ($model) { return date('d/m/Y H:i', $model->time_update); }], ['attribute' => 'received', 'format' => 'html', 'value' => function ($model) { $emotion = $model->received == StationStatus::STATUS_RECEIVED ? 'good' : 'great'; return Show::decorateString($model->getStatus($model->received), $emotion); }], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) { $emotion = $model->status == StationStatus::STATUS_OK ? 'good' : 'bad'; return Show::decorateString($model->getStatusConnect($model->status), $emotion); }]]]); ?> </div>