Example #1
0
            </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');
Example #2
0
 public function actionCronLatest()
 {
     $soundConditionTime = 900;
     $data['html'] = '';
     $data['count'] = 0;
     $post = Yii::$app->request->post();
     if (!empty($post)) {
         $timeLoop = $post['time_loop'];
         $from = $post['current_time'] - $timeLoop;
         $to = $post['current_time'];
         // 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[] = ['>=', 'warning_time', $from];
         $condition[] = ['<=', 'warning_time', $to];
         $warnings = Warning::getWarning('warning_time DESC', 0, $condition);
         if (!empty($warnings)) {
             $data['count'] = count($warnings);
             $data['html'] = Show::warnings($warnings);
         }
     }
     print json_encode($data);
 }