value="<?php echo $center->id; ?> "><?php echo $center->name; ?> </option> <?php } } ?> </select> </div> <div class="filter-item"> <?php echo Show::multiSelect('station', isset($_GET['station']) ? $_GET['station'] : [], $stationList, 'id', 'name', '', ['class' => 'stations', 'style' => 'height: 300px;']); ?> </div> <div class="filter-item"> <button type="submit" class="btn btn-primary btn-xs">Tìm kiếm</button> </div> </form> <style type="text/css"> .filter-item { margin-bottom: 15px; } .filter-item input, .filter-item select { padding: 2px 5px; width: 90%; } </style>
<?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>
<?php echo $form->field($model, 'port')->textInput(['maxlength' => 20]); ?> <?php echo $form->field($model, 'phone')->textInput(['maxlength' => 100]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => 50]); ?> <?php echo $form->field($model, 'picture_warning_numb')->textInput(); ?> <?php echo $form->field($model, 'addition')->textarea(['rows' => 6]); ?> <?php echo Show::submitButton($model); ?> <?php ActiveForm::end(); ?> </div>
</div> </div> <table id="warning-table" class="detail-view table table-hover table-bordered" style="margin-bottom: 0px;"> <tr class="warning-heading"> <th width="15%">Trạm</th> <th width="10%">Khu vực</th> <th width="10%">Trung tâm</th> <th>Nội dung</th> <th width="10%">Thời gian</th> <th width="14%"></th> </tr> <?php if (isset($warnings) && !empty($warnings)) { print Show::warnings($warnings, false); } ?> </table> </div> </div> <script type="text/javascript"> jQuery(function ($) { $(document).on('click', '.do-read', function() { var warning = $(this).parent().parent().parent().parent(); var id = warning.attr('id'); var stationHref = warning.attr('station-href');
<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>
<div class="sensor-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'binary_pos')->textInput(); ?> <?php echo Show::activeDropDownList($model, 'active', $attributeLabels, $model->optionsActive()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Thêm mới' : 'Cập nhật', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
</tr> <tr> <td><span>Port Server</span></td> <td> <input class="form-control" type="text" name="server_port" value="<?php echo $model->server_port; ?> "> </td> </tr> <tr> <td><span>Mật khẩu root</span></td> <td> <input class="form-control" type="password" name="password_root" value="******"> <?php echo isset($errors['password']) ? Show::errorBlock($errors['password']) : ''; ?> </td> </tr> <tr> <td colspan="2"> <button type="submit" class="btn btn-primary">Cập nhật</button> </td> </tr> </table> </form> </div> </div>
public function actionCronUnread() { $html = ''; $count = 0; $post = Yii::$app->request->post(); // permission $role = new Role(); $condition = []; if (!$role->isAdministrator) { $position = $role->getPosition(); $stationIds = Station::getByRole($position, Yii::$app->user->id); $condition[] = ['in', 'station_id', $stationIds]; } $condition[] = ['=', 'read', Warning::STATUS_UNREAD]; $warnings = Warning::getWarning('warning_time DESC', 0, $condition); if (!empty($warnings)) { $count = count($warnings); $html = Show::warningsTable($warnings); } $data['html'] = $html; $data['count'] = $count; print json_encode($data); }
echo $form->field($model, 'fullname')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'mobile')->textInput(['maxlength' => 20]); ?> <?php echo Show::activeDropDownList($model, 'type', $labels, $types, [], $errors); ?> <div class="form-group"> <?php echo Html::submitButton($action == 'create' ? 'Thêm mới' : 'Cập nhật', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<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)) {
$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(); ?>
<?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>