/**
  * Finds the Naturezaocorrencia model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Naturezaocorrencia the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Naturezaocorrencia::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 public function afterFind()
 {
     list($ano, $mes, $dia) = split('[-]', $this->data);
     $this->data = $dia . '/' . $mes . '/' . $ano;
     if ($this->dataConclusao != null) {
         list($ano, $mes, $dia) = split('[-]', $this->dataConclusao);
         $this->dataConclusao = $dia . '/' . $mes . '/' . $ano;
     }
     if ($this->hora != null) {
         list($hora, $minuto, $segundos) = split('[:]', $this->hora);
         $this->hora = $hora . ':' . $minuto;
     }
     $foto = FotoController::getFotoOcorrencia($this->idOcorrencia);
     if ($foto != null) {
         $this->comentarioFoto = $foto[0]->comentario;
     }
     $this->idCategoriabkp = $this->idCategoria;
     //    echo "Categoria bkp".$this->idCategoriabkp;
     $this->idSubLocalbkp = $this->idSubLocal;
     $this->idNaturezabkp = $this->idNatureza;
     $sublocal = Sublocal::findOne($this->idSubLocal);
     $this->idLocal = $sublocal->idLocal;
     $this->cpfbkp = $this->cpfUsuario;
     $this->idSubLocal = Sublocal::findOne($this->idSubLocal)->Nome;
     $this->cpfUsuario = User::findOne($this->cpfUsuario)->nome;
     $this->idNatureza = Naturezaocorrencia::findOne($this->idNatureza)->Nome;
     $this->idCategoria = Categoria::findOne($this->idCategoria)->Nome;
     if ($this->status == 1) {
         $this->status = 'Aberto';
     } elseif ($this->status == 2) {
         $this->status = 'Solucionado';
     } elseif ($this->status == 3) {
         $this->status = 'Não Solucionado';
     }
     if ($this->periodo == 1) {
         $this->periodo = 'Manhã';
     } elseif ($this->periodo == 2) {
         $this->periodo = 'Tarde';
     } elseif ($this->periodo == 3) {
         $this->periodo = 'Noite';
     } elseif ($this->periodo == 4) {
         $this->periodo = 'Madrugada';
     }
 }