/**
  * 
  * @param int $id_tipo
  */
 public function setTipo($id_tipo)
 {
     $this->_tipo_emergencia = $this->_emergencia_tipo_model->getById($id_tipo);
     if (is_null($this->_tipo_emergencia)) {
         throw new Exception(__METHOD__ . " - No existe el tipo de emergencia");
     }
 }
 /**
  * 
  * @return string
  */
 protected function _getNombreTipo()
 {
     $estado = $this->_emergencia_tipo_model->getById($this->_emergencia->tip_ia_id);
     if (!is_null($estado)) {
         return $estado->aux_c_nombre;
     } else {
         return "";
     }
 }
 /**
  * Devuelve datos para grafico de cantidad tipos de emergencia
  */
 public function json_cantidad_emergencia_por_tipo()
 {
     $data = array();
     $lista = $this->EmergenciaTipoModel->listCantidadPorTipo();
     if (!is_null($lista)) {
         foreach ($lista as $key => $row) {
             $data[] = array("label" => $row["aux_c_nombre"], "data" => $row["cantidad"]);
         }
     }
     $respuesta = array("correcto" => true, "data" => $data);
     echo json_encode($respuesta);
 }
 /**
  * 
  * @param int $id_tipo
  * @throws Exception
  */
 public function setEmergenciaTipo($id_tipo)
 {
     $this->_emergencia_tipo = $this->_emergencia_tipo_model->getById($id_tipo);
 }
 /**
  * Lista de comunas
  * @return array
  */
 protected function _listar()
 {
     return $this->tipo_emergiencia_model->get();
 }