예제 #1
0
<?php

use app\assets\AppAsset;
use app\models\Ocorrencia;
use app\models\Denuncia;
AppAsset::register($this);
/* @var $this yii\web\View */
$this->title = 'SOS-UFAM';
if (Yii::$app->user->isGuest == false && Yii::$app->user->identity->idTipoUsuario == 'Chefe de Segurança') {
    $totalDen = Denuncia::find()->where('status = 1')->count();
    $total = Ocorrencia::find()->where('status = 1')->count();
    echo "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset='utf-8'>\n    <meta http-equiv='X-UA-Compatible' content='IE=edge'>\n    <meta name='viewport' content='width=device-width, initial-scale=1'>\n    <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n    <meta name='description' content=''>\n    <meta name='author' content=''>\n   \n\n    <title>Home</title>\n\n    <!-- Bootstrap core CSS -->\n    <link href='bootstrap.css' rel='stylesheet'>\n\n\n          <style> \n          .navbar\n          {\n            background-color: #EEE9E9;\n            border-color: transparent;\n            }  \n       \n                 \n             #teste2{\n              max-width:100%; \n             height:auto;\n             width: 310px;            \n             left:59.2%;\n             top: 251px; \n             position: fixed;   \n\n            }\n              #teste3{\n             max-width:100%; \n             height:auto;\n             width: 309px;            \n             left:31%;\n             top: 250px; \n             position: fixed;\n\n            }    \n            \n             #titulo{\n              font-size:30px;line-height:1em;margin:4% 0; color: #2E8B57; margin-left: 150px;\n              font-family:'DejaVu Serif'             \n             }  \n\n             h1{\n               max-width:100%; \n              height:auto;\n              color: white;\n              font-size: 90px;\n              font-family: bold;\n              margin-left: 80px;\n              font-family:'Microsoft Yi Baite';\n             }\n             p{\n              max-width:100%; \n             height:auto;\n             }\n\n             #totalden{\n               max-width:10%; \n              height:auto;\n              left: 22%;\n              color: white;\n              position: relative;\n\n             }\n\n             #totalOcorrencia{\n              max-width:10%;\n              left: 55%;\n              top: 120px;\n              color: white;\n              position: relative;\n\n             }\n  \n        </style>\n  </head>\n\n<body>\n <h1 id='titulo'><p> Monitoramento de ocorrências e denúncias em tempo real</p></h1> \n\n\n<img id='teste2' src='aberto.png' /> <a href='index.php?r=ocorrencia%2Femaberto'><h1 id=totalOcorrencia>" . $total . "</h1></a>\n\n<img id='teste3' src='naoverificada.png' />      <a href='index.php?r=denuncia%2Fnaoverificadas'><h1 id=totalden>" . $totalDen . "</h1></a>  \n\n</body>\n</html>\n";
} elseif (Yii::$app->user->isGuest == false && Yii::$app->user->identity->idTipoUsuario == 'Segurança Terceirizada') {
    $totalDen = Denuncia::find()->where('status = 1')->count();
    echo "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset='utf-8'>\n    <meta http-equiv='X-UA-Compatible' content='IE=edge'>\n    <meta name='viewport' content='width=device-width, initial-scale=1'>\n    <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n    <meta name='description' content=''>\n    <meta name='author' content=''>\n   \n\n    <title>Home</title>\n\n    <!-- Bootstrap core CSS -->\n    <link href='bootstrap.css' rel='stylesheet'>\n\n\n          <style> \n          .navbar\n          {\n            background-color: #EEE9E9;\n            border-color: transparent;\n            }  \n       \n                 \n             #teste2{\n              max-width:100%; \n             height:auto;\n             width: 310px;            \n             left:59.2%;\n             top: 251px; \n             position: fixed;   \n\n            }\n              #teste3{\n             max-width:100%; \n             height:auto;\n             width: 309px;            \n             left:40%;\n             top: 250px; \n             position: fixed;\n\n            }    \n            \n             #titulo{\n              font-size:30px;line-height:1em;margin:4% 0; color: #2E8B57; margin-left: 150px;\n              font-family:'DejaVu Serif'             \n             }  \n\n             h1{\n               max-width:100%; \n              height:auto;\n              color: white;\n              font-size: 90px;\n              font-family: bold;\n              margin-left: 80px;\n              font-family:'Microsoft Yi Baite';\n             }\n             p{\n              max-width:100%; \n             height:auto;\n             }\n\n             #totalden{\n             top:120px;\n               max-width:10%; \n              height:auto;\n              left: 32%;\n              color: white;\n              position: relative;\n\n             }\n\n             #totalOcorrencia{\n              max-width:10%;\n              left: 55%;\n              top: 120px;\n              color: white;\n              position: relative;\n\n             }\n  \n        </style>\n  </head>\n\n<body>\n\n\n <h1 id='titulo'><p> Monitoramento de ocorrências e denúncias em tempo real</p></h1> \n\n<div>\n  <img id='teste3' src='naoverificada.png' />  <a href='index.php?r=denuncia%2Fnaoverificadas'> <h1 id=totalden>" . $totalDen . "</h1></a>  \n</div>              \n</body>\n</html>\n";
} else {
    echo "<html>\n<head>\n<title>Iniciar</title>\n<link rel='stylesheet' href='bootstrap.css'>\n<style> \n          .navbar\n          {\n            background-color: #EEE9E9;\n            border-color: transparent;\n            } \n\n            #police\n            { \n             max-width:100%; \n             height:auto;\n             width: 350px;            \n             left:44%;\n             top: 200px;    \n            }   \n            #fazerDenuncia{\n             max-width:100%; \n             height:auto; \n             width: 350px;\n             left:45%;\n             top: 470px; \n            }\n              \n            \n</style>\n</head>\n<body>\n  \n    <img id='police' src='5.png'/>\n    <a href='index.php?r=denuncia%2Fcreate'><img id='fazerDenuncia' src='6.png'/></a>\n  \n</body>\n</html>";
}
예제 #2
0
 public function relatorio($params)
 {
     $query = Ocorrencia::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $databkp = $this->data;
     if ($this->dataInicial != null) {
         list($dia, $mes, $ano) = split('[/]', $this->dataInicial);
         $this->dataInicial = $ano . '-' . $mes . '-' . $dia;
     }
     if ($this->dataFinal != null) {
         list($dia, $mes, $ano) = split('[/]', $this->dataFinal);
         $this->dataFinal = $ano . '-' . $mes . '-' . $dia;
     }
     //       if ($this->idLocal!=null)
     $sublocal = Sublocal::find()->where(['=', 'idLocal', $this->idLocal])->all();
     //$model->idSubLocal = $sublocal->Nome;
     $query->andFilterWhere(['status' => $this->status, 'idCategoria' => $this->idCategoria, 'idNatureza' => $this->idNatureza, 'periodo' => $this->periodo]);
     $query->andFilterWhere(['>=', 'data', $this->dataInicial]);
     $query->andFilterWhere(['<=', 'data', $this->dataFinal]);
     if ($this->idLocal != null) {
         $connection = \Yii::$app->db;
         $stringsql = "SELECT idSubLocal as idsublocal FROM sublocal WHERE idLocal = " . $this->idLocal;
         $sqlOcorrencia = $connection->createCommand($stringsql);
         $rstocorencia = $sqlOcorrencia->queryAll();
         $arraysublocal = array();
         $i = 0;
         foreach ($rstocorencia as $reg) {
             $arraysublocal[$i] = $reg['idsublocal'];
             $i = $i + 1;
         }
         $query->andFilterWhere(['IN', 'idSubLocal', $arraysublocal]);
     }
     return $dataProvider;
 }