Ejemplo n.º 1
0
 public function naoVerificadas($params)
 {
     $query = Denuncia::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;
     $periodobkp = $this->periodo;
     if ($this->periodo != null) {
         if (strcmp($this->periodo, 'Manhã') == 0) {
             $this->periodo = 1;
         } elseif (strcmp($this->periodo, 'Tarde') == 0) {
             $this->periodo = 2;
         } elseif (strcmp($this->periodo, 'Noite') == 0) {
             $this->periodo = 3;
         } elseif (strcmp($this->periodo, 'Madrugada') == 0) {
             $this->periodo = 4;
         }
     }
     if ($this->data != null) {
         list($dia, $mes, $ano) = split('[/]', $this->data);
         $this->data = $ano . '-' . $mes . '-' . $dia;
     }
     $query->andFilterWhere(['idDenuncia' => $this->idDenuncia, 'data' => $this->data, 'status' => 1, 'periodo' => $this->periodo]);
     $query->andFilterWhere(['like', 'descricao', $this->descricao])->andFilterWhere(['like', 'hora', $this->hora]);
     $this->data = $databkp;
     $this->periodo = $periodobkp;
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Creates a new Ocorrencia model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreatefromdenuncia($idDenuncia)
 {
     $model = new Ocorrencia();
     $denuncia = Denuncia::findOne($idDenuncia);
     $model->detalheLocal = $denuncia->detalheLocal;
     $model->data = $denuncia->data;
     $model->hora = $denuncia->hora;
     $model->descricao = $denuncia->descricao;
     $model->idLocal = $denuncia->idLocal;
     $model->idSubLocal = $denuncia->idSubLocalbkp;
     $sublocal = Sublocal::findOne($denuncia->idSubLocalbkp);
     $model->idLocal = $sublocal->idLocalbkp;
     $model->periodo = $denuncia->periodo;
     $model->comentarioFoto = $denuncia->comentarioFoto;
     if (strcmp($model->periodo, 'Manhã') == 0) {
         $model->periodo = 1;
     } elseif (strcmp($model->periodo, 'Tarde') == 0) {
         $model->periodo = 2;
     } elseif (strcmp($model->periodo, 'Noite') == 0) {
         $model->periodo = 3;
     } elseif (strcmp($model->periodo, 'Madrugada') == 0) {
         $model->periodo = 4;
     }
     if ($model->load(Yii::$app->request->post())) {
         list($dia, $mes, $ano) = split('[/]', $model->data);
         $model->data = $ano . '-' . $mes . '-' . $dia;
         if ($model->dataConclusao != null) {
             list($dia, $mes, $ano) = split('[/]', $model->dataConclusao);
             $model->dataConclusao = $ano . '-' . $mes . '-' . $dia;
         }
         $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles');
         $path = Yii::$app->basePath . '/web/uploadFoto/';
         $model->cpfUsuario = Yii::$app->user->identity->cpf;
         if ($model->save()) {
             //         if (count ($model->imageFiles) >= 1) {
             foreach ($model->imageFiles as $file) {
                 $foto = new Foto();
                 $foto->idOcorrencia = $model->idOcorrencia;
                 $foto->comentario = $model->comentarioFoto;
                 $foto->endereco = $path . $file->baseName . '.' . $file->extension;
                 $foto->nome = $file->baseName . '.' . $file->extension;
                 $file->saveAs($foto->endereco);
                 $foto->save();
                 $foto = null;
             }
             $foto = FotoController::getFotoDenuncia($denuncia->idDenuncia);
             foreach ($foto as $file) {
                 $file->idOcorrencia = $model->idOcorrencia;
                 $file->save();
             }
             //   }
             return $this->redirect(['view', 'id' => $model->idOcorrencia]);
         } else {
             return $this->render('createdenuncia', ['model' => $model]);
         }
     } else {
         return $this->render('createdenuncia', ['model' => $model]);
     }
 }
Ejemplo n.º 3
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>";
}
Ejemplo n.º 4
0
 /**
  * Finds the Denuncia model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Denuncia the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Denuncia::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdDenuncia0()
 {
     return $this->hasOne(Denuncia::className(), ['idDenuncia' => 'idDenuncia']);
 }