コード例 #1
0
ファイル: modal.php プロジェクト: wgviana/SaudeNaCopa
    foreach ($args as $n => $field) {
        if (is_string($field)) {
            $tmp = array();
            foreach ($data as $key => $row) {
                $tmp[$key] = $row[$field];
            }
            $args[$n] = $tmp;
        }
    }
    $args[] =& $data;
    call_user_func_array('array_multisort', $args);
    return array_pop($args);
}
$sql = "SELECT\n\t\t\tcount(us.id) as total,\n\t\t\tcount(us.sentimento) as sentimento,\n\t\t\tus.cidade_regiao_metro as nome,\n\n\t\t\tsum(us.campo1) as campo1,\n\t\t\tsum(us.campo2) as campo2,\n\t\t\tsum(us.campo3) as campo3,\n\t\t\tsum(us.campo4) as campo4,\n\t\t\tsum(us.campo5) as campo5,\n\t\t\tsum(us.campo6) as campo6,\n\t\t\tsum(us.campo7) as campo7,\n\t\t\tsum(us.campo8) as campo8,\n\t\t\tsum(us.campo9) as campo9,\n\t\t\tsum(us.campo10) as campo10,\n\t\t\tsum(us.campo11) as campo11,\n\t\t\tsum(us.campo12) as campo12\n\t\t\tFROM usuarios u\n\t\t\tINNER JOIN usuario_sentimento us ON us.usuario_id = u.id\n\n\t\t\twhere us.sentimento in (3,4)\n\t\t\tand us.cidade_regiao_metro <> ''\n\t\t\tGROUP BY us.cidade_regiao_metro";
//INNER JOIN cidades c ON c.id = us.cidade_id
$conn->ExecuteSQL($sql);
$dados = $conn->ArrayResults();
/*
$sql = "select * from sentimentos";
$conn->ExecuteSQL($sql);
$sentimentos = $conn->ArrayResults();
*/
$arrayCidadeSedes = array("Recife", "Natal", "Manaus", "Fortaleza", "Salvador", "Cuiabá", "Brasília", "Belo Horizonte", "São Paulo", "Rio de Janeiro", "Curitiba", "Porto Alegre");
sort($arrayCidadeSedes);
$arrayCidadeSedesLimpo = array();
for ($i = 0; $i <= 11; $i++) {
    $arrayCidadeSedesLimpo[] = replaceChars($arrayCidadeSedes[$i]);
}
//print_r($arrayCidadeSedesLimpo);
?>
<!doctype html>
コード例 #2
0
ファイル: inc.funcoes.php プロジェクト: wgviana/SaudeNaCopa
function graficoVigilancia($numero)
{
    $db = new MySQL();
    switch ($numero) {
        case '1':
            $query = CONSULTA_ATENDIMENTOS_VIGILANCIA_HORA_EM_HORA;
            break;
        case '2':
            //MEDIDAS APLICADAS
            $query = "select ivs.nome as label, count(vs.id) as y, \n\t\t\t\t\tROUND(((count(vs.id) * 100)/t.contagem),2) as percent\n\t\t\t\t\tfrom vigilancia_sanitaria vs, vigilancia_sanitaria_medida_aplicadas vsi, medidas_aplicadas ivs,\n\t\t\t\t\t(select count(medida_aplicadas_id) as contagem from vigilancia_sanitaria_medida_aplicadas) t \n\t\t\t\t\twhere vs.locais_id IN ( 1, 2, 3, 4 )\n\t\t\t\t\tand vs.id = vsi.vigilancia_sanitaria_id\n\t\t\t\t\tand ivs.id = vsi.medida_aplicadas_id\n\t\t\t\t\tand vs.data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'\n\t\t\t\t\tand vs.ativo = 1\n\t\t\t\t\tGROUP by ivs.nome ";
            break;
        case '3':
            //PRODUTOS
            $query = "SELECT e.nome as label,\n\t\t\t\t\t q.vigilancia_sanitaria as rel, \n\t\t\t\t\tcount(q.vigilancia_sanitaria) as y, \n\t\t\t\t\tROUND(((count(q.vigilancia_sanitaria) * 100)/t.contagem),2) as percent \n\t\t\t\t\tFROM (vigilancia_sanitaria q, \n\t\t\t\t\t\t(SELECT count(q.id) as contagem \n\t\t\t\t\t\tFROM vigilancia_sanitaria q where locais_id = 1) t) \n\t\t\t\t\t\t\tLEFT JOIN produtos_vigilancia_sanitaria e ON e.id = q.vigilancia_sanitaria\n\t\t\t\t\twhere q.locais_id IN ( 1, 2, 3, 4 )\n\t\t\t\t\tand q.data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'\n\t\t\t\t\tand q.ativo = 1\t\t \n\t\t\t\t\tGROUP BY q.vigilancia_sanitaria";
            break;
        case '4':
            //INFRACAO
            $query = "select\n\t\t\t\t\tvsi.infracao_id as x, \n\t\t\t\t\tivs.nome as label, count(vs.id) as y, \n\t\t\t\t\tROUND(((count(vs.id) * 100)/t.contagem),2) as percent\n\t\t\t\t\tfrom vigilancia_sanitaria vs, vigilancia_sanitaria_infracao vsi, infracao_vigilancia_sanitaria ivs,\n\t\t\t\t\t(select count(vigilancia_sanitaria_id) as contagem from vigilancia_sanitaria_infracao) t \n\t\t\t\t\twhere vs.locais_id IN ( 1, 2, 3, 4 ) \n\t\t\t\t\tand vs.id = vsi.vigilancia_sanitaria_id\n\t\t\t\t\tand ivs.id = vsi.infracao_id\n\t\t\t\t\tand vs.data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'\n\t\t\t\t\tand vs.ativo = 1\n\t\t\t\t\tGROUP by ivs.nome";
            break;
        default:
            $query = CONSULTA_ATENDIMENTOS_VIGILANCIA_HORA_EM_HORA;
            break;
    }
    $db->ExecuteSQL($query);
    $resultados = $db->ArrayResults();
    return $resultados;
}
コード例 #3
0
ファイル: usuario_login.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
include "class.Auth.php";
$conn = new MySQL();
$auth = new Auth();
header("Content-type: application/json; charset=utf-8");
$email = $_POST["email"];
$senha = $_POST["senha"];
$password = $auth->hashpass($senha);
//$activekey = $auth->randomkey(15);
if ($auth->validaCadastroLogin($password, $email)) {
    $conn->ExecuteSQL("select * from usuarios where email = '{$email}'");
    $lista = $conn->ArrayResult();
    $resultado = array("status" => TRUE, "hash" => $hash);
} else {
    $erros = "";
    foreach ($auth->errormsg as $erro) {
        $erros .= $erro;
    }
    $resultado['status'] = FALSE;
    $resultado['mensagem'] = "Mensagem de erro. " . $erros . " " . time();
}
echo json_encode($resultado);
コード例 #4
0
<?php

include "../php/class.MySQL.php";
$conn = new MySQL();
$sqlTotal = "SELECT count(id) as total FROM usuario_sentimento";
$conn->ExecuteSQL($sqlTotal);
$total = $conn->ArrayResult();
$totalTodos = (int) $total["total"];
$sql = "SELECT\n\t\t\tcount(us.id) as total, \n\t\t\tus.cidade_regiao_metro as nome,\n\t\t\t\n\t\t\tsum(us.campo1) as campo1, \n\t\t\tsum(us.campo2) as campo2, \n\t\t\tsum(us.campo3) as campo3,\n\t\t\tsum(us.campo4) as campo4,\n\t\t\tsum(us.campo5) as campo5,\n\t\t\tsum(us.campo6) as campo6,\n\t\t\tsum(us.campo7) as campo7,\n\t\t\tsum(us.campo8) as campo8,\n\t\t\tsum(us.campo9) as campo9,\n\t\t\tsum(us.campo10) as campo10,\n\t\t\tsum(us.campo11) as campo11,\n\t\t\tsum(us.campo12) as campo12\n\t\t\tFROM usuario_sentimento us\n\t\t\t\n\t\t\twhere us.sentimento in (3,4)\n\t\t\tand us.cidade_regiao_metro <> ''\n\t\t\t\n\t\t\tGROUP BY us.cidade_regiao_metro";
$conn->ExecuteSQL($sql);
$dados = $conn->ArrayResults();
$sql = "select * from sentimentos";
$conn->ExecuteSQL($sql);
$sentimentos = $conn->ArrayResults();
$campo1 = 0;
foreach ($dados as $dado) {
    //$total+=$dado["total"];
    $campo1 += $dado["campo1"];
    $campo2 += $dado["campo2"];
    $campo3 += $dado["campo3"];
    $campo4 += $dado["campo4"];
    $campo5 += $dado["campo5"];
    $campo6 += $dado["campo6"];
    $campo7 += $dado["campo7"];
    $campo8 += $dado["campo8"];
    $campo9 += $dado["campo9"];
    $campo10 += $dado["campo10"];
    $campo11 += $dado["campo11"];
    $campo12 += $dado["campo12"];
}
//$totalTodos = $campo1 + $campo2 + $campo3 + $campo4 + $campo5 + $campo6 + $campo7 + $campo8 + $campo9 + $campo10;
コード例 #5
0
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "bibliotecas/php/class.MySQL.php";
include "bibliotecas/php/inc.consultas.php";
include "bibliotecas/php/inc.funcoes.php";
$db = new MySQL();
$dados = array();
$db->ExecuteSQL(CONSULTA_ATENDIMENTOS_PERIODICA);
$total_assistencia = $db->ArrayResults();
$db->ExecuteSQL(CONSULTA_VIGILANCIA_PERIODICA);
$total_vigilancia = $db->ArrayResults();
//ASSISTENCIA E QUANTITATIVOS POR UNIDADE
//=====================================================================================================
$dados['graficoAssistencia1'] = grafico("assistencia", 1);
if (count($dados['graficoAssistencia1']) <= 0) {
    $dados['graficoAssistencia1'] = array(array("x" => 0, "y" => 0));
}
//$dados['graficoAssistencia2'] = grafico("assistencia", 2);
$colocaAspas = array();
$contadorArray = 0;
foreach (grafico("assistencia", 2) as $listaGraficoAssistencia) {
    $colocaAspas[$contadorArray]["y"] = $listaGraficoAssistencia["y"];
    $colocaAspas[$contadorArray]["x"] = $contadorArray + 1;
    $colocaAspas[$contadorArray]["legendText"] = array(utf8_encode($listaGraficoAssistencia["legendText"]));
    $contadorArray++;
コード例 #6
0
{
    // disable caching
    $now = gmdate("D, d M Y H:i:s");
    header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
    header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
    header("Last-Modified: {$now} GMT");
    // force download
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    // disposition / encoding on response body
    header("Content-Disposition: attachment;filename={$filename}");
    header("Content-Transfer-Encoding: binary");
}
include "class.MySQL.php";
$conn = new MySQL();
$arquivo = 'planilha_download_saude_na_copa.xls';
$titulo = array("ID_REG_SEQ", "ID_USUARIO", "APELIDO", "IDADE", "SEXO", "EMAIL", "IDIOMA", "DT_CADASTRO", "DT_REGISTRO_DIA", "DT_REGISTRO_HORA", "LOC_REGISTRO", "REGIAO", "EQUIPAMENTO", "LAT", "LONG", "STATUS", "FEBRE", "TOSSE", "DORGARGANTA", "FALTAR", "NAUSEA", "DIARREIA", "ARTRALGIA", "CEFALEIA", "HEMORRAGIA", "EXANTEMA", "CONTATO", "SERVSAUDE", "CADASTRO", "SINTOMA", "SIND_DIA", "SIND_RES", "SIND_EXA", "TOTAL");
//, "ATUALIZA");
$sql = "SELECT ID_REG_SEQ, ID_USUARIO ,APELIDO,IDADE, SEXO, EMAIL, IDIOMA , DT_CADASTRO,\nDT_REGISTRO_DIA, DT_REGISTRO_HORA,   LOC_REGISTRO  ,  REGIAO , EQUIPAMENTO,\nLATITUDE ,LONGITUDE, STATUS, FEBRE, TOSSE, DORGARGANTA, FALTAR, NAUSEA,\nDIARREIA, ARTRALGIA, CEFALEIA, HEMORRAGIA, EXANTEMA, CONTATO, SERVSAUDE,\nCADASTRO, SINTOMA, SIND_DIA, SIND_RES, SIND_EXA, total FROM `csv_leve` inner join lastinsert on ultimo = csv_leve.ID_REG_SEQ";
$conn->ExecuteSQL($sql);
$array[0] = $titulo;
$array[1] = $conn->ArrayResults();
$recife = new DateTimeZone("America/Recife");
$HoraBrasilia = new DateTime();
$HoraBrasilia->setTimezone($recife);
$Hora = $HoraBrasilia->format("H_i_s");
//download_send_headers("SaudeNaCopa_" . date("Y-m-d-H-i-s") . ".csv");
download_send_headers("saudenacopa_" . date("Y_m_d") . "_" . $Hora . ".csv");
echo array2csv($array, $conn);
die;
コード例 #7
0
ファイル: jsonLocais.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$db = new MySQL();
$db->ExecuteSQL("select unidades.id as id_unidade, unidades.nome as nome_unidade, \n\t\t\t\t\t\tsub_unidades.id as id_sub_unidade, sub_unidades.nome as nome_sub_unidade \n\t\t\t\t\t\tfrom unidades, sub_unidades\n\t\t\t\t\t\twhere unidades.id = sub_unidades.unidade_id");
$locais = $db->ArrayResults();
foreach ($locais as $local) {
    $array[] = array("id_unidade" => $local["id_unidade"], "nome_unidade" => utf8_encode($local["nome_unidade"]), "id_sub_unidade" => utf8_encode($local["id_sub_unidade"]), "nome_sub_unidade" => utf8_encode($local["nome_sub_unidade"]));
}
echo json_encode($array);
コード例 #8
0
ファイル: cron.job.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$conn = new MySQL();
$conn->ExecuteSQL("select * from usuario_sentimento where atualizado = 0");
$num_rows = $conn->ArrayResults();
$total = count($num_rows);
if ($total > 0) {
    foreach ($num_rows as $row) {
        $url = "http://maps.google.com/maps/api/geocode/json?latlng={$row['latitude']},{$row['longitude']}&sensor=false";
        $data = json_decode(file_get_contents($url));
        $cidade = $data->results[0]->address_components[3]->long_name;
        $sql = "select * from cidade where nome like '{$cidade}'";
        $conn->ExecuteSQL($sql);
        $listaCidade = $conn->ArrayResult();
        $sql = $conn->ExecuteSQL("update usuario_sentimento set atualizado = 1, cidade_id = {$listaCidade['id']} where id = {$row['id']}");
    }
} else {
    echo "Não ha dados a serem atualizados";
}
コード例 #9
0
ファイル: jsonCidade.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$db = new MySQL();
if (!isset($_POST["id"])) {
    $db->ExecuteSQL("select * from cidade");
} else {
    $db->ExecuteSQL("select * from cidade where estado = " . $_POST["id"]);
}
$cidades = $db->ArrayResults();
foreach ($cidades as $cidade) {
    $array[] = array("id" => $cidade["id"], "nome" => utf8_encode($cidade["nome"]));
}
echo json_encode($array);
コード例 #10
0
                           campo1, campo2, campo3, campo4, campo5, campo6, campo7, campo8, campo9, campo10, cidade_regiao_metro as regiao_metro
                           FROM usuario_sentimento us
                           where usuario_id = " . $lista_sentimento["id"] . " and cidade_regiao_metro <> ''
                           order by us.data_cadastro desc limit 0,1";
*/
/*              
            $sub = "SELECT us.id as Id, us.latitude as Latitude, us.longitude as Longitude,  us.sentimento as Icone, us.data_cadastro as data_cadastro,
                           campo1, campo2, campo3, campo4, campo5, campo6, campo7, campo8, campo9, campo10, cidade_regiao_metro as regiao_metro
                           FROM usuario_sentimento us
                           where usuario_id = " . 
                           $lista_sentimento["id"] .
                            $range.
                           " order by us.data_cadastro desc limit 0,1";
*/
$sub = "SELECT \n                        distinct(us.id) as Id, \n                        us.latitude as Latitude, \n                        us.longitude as Longitude,  \n                        us.sentimento as Icone, us.data_cadastro as data_cadastro,\n                        campo1, campo2, campo3, campo4, campo5, campo6, campo7, \n                        campo8, campo9, campo10, cidade_regiao_metro as regiao_metro\n                    FROM \n                        usuario_sentimento us\n                    where \n                        {$range} \n                    group by us.id\n                    limit 0, 10000";
$db->ExecuteSQL($sub);
$result = $db->ArrayResults();
$assistencias = $result;
// }
$contador = 0;
$listagem = array();
$listagem["locais"] = array();
foreach ($assistencias as $lista) {
    $listagem["locais"][$contador]["Id"] = $lista["Id"];
    $listagem["locais"][$contador]["Latitude"] = $lista["Latitude"];
    $listagem["locais"][$contador]["Longitude"] = $lista["Longitude"];
    $listagem["locais"][$contador]["regiao_metro"] = $lista["regiao_metro"];
    $data = new DateTime($lista["data_cadastro"]);
    $dataEncontrado = $data->format("d-m-Y");
    $horaEncontrado = $data->format("H:i:s");
    $listagem["locais"][$contador]["data"] = $dataEncontrado;
コード例 #11
0
ファイル: home.php プロジェクト: nakoukal/raspi_www
<?php

require_once "globals.php";
include_once 'class/class.MySQL.php';
$oMySQL = new MySQL('temperature', $GLOBALS["dblogin"], $GLOBALS["dbpwd"], $GLOBALS["dbhost"], 3306);
$sql_temp = "\n\t\tSELECT DATE_FORMAT(timestamp, '%d.%m.%Y %H:%i') as time , \n\t\t\t   temp02 as venku, \n\t\t\t   temp01 as obyvak, \n\t\t\t   temp04 as podlaha,\n\t\t\t   temp03 as krb,\n\t\t\t   temp11 as aku,\n\t\t\t   temp08 as tom,\n\t\t\t   temp09 as nela\n\t\tFROM temp  \n\t\tORDER BY timestamp DESC LIMIT 1";
$oMySQL->ExecuteSQL($sql_temp);
$temp = $oMySQL->arrayedResult;
//Set the Content Type
header('Content-type: image/jpeg');
// Create Image From Existing File
$jpg_image = imagecreatefromjpeg('home.jpg');
// Allocate A Color For The Text
$black = imagecolorallocate($jpg_image, 0, 0, 0);
$white = imagecolorallocate($jpg_image, 255, 255, 255);
// Set Path to Font File
$font_path = 'font/px_sans_nouveaux.ttf';
imagettftext($jpg_image, 15, 0, 100, 15, $black, 'font/Inconsolata.otf', $temp['time']);
$text = "krb: " . $temp['krb'] . "°C";
imagettftext($jpg_image, 6, 0, 85, 260, $white, $font_path, $text);
$text = "aku: " . $temp['aku'] . "°C";
imagettftext($jpg_image, 6, 0, 250, 240, $black, $font_path, $text);
$text = "venku: " . $temp['venku'] . "°C";
imagettftext($jpg_image, 6, 0, 45, 45, $black, $font_path, $text);
$text = "obyvak: " . $temp['obyvak'] . "°C";
imagettftext($jpg_image, 6, 0, 150, 190, $black, $font_path, $text);
$text = "tom: " . $temp['tom'] . "°C";
imagettftext($jpg_image, 6, 0, 110, 100, $black, $font_path, $text);
$text = "nela: " . $temp['nela'] . "°C";
imagettftext($jpg_image, 6, 0, 200, 100, $black, $font_path, $text);
$text = "podlaha: " . $temp['podlaha'] . "°C";
コード例 #12
0
ファイル: actualTemp2.php プロジェクト: nakoukal/raspi_www
<?php

require_once 'globals.php';
require_once 'class/class.HTTPAnswer.php';
require_once 'class/class.MySQL.php';
$HTTPAnswer = new HTTPAnswer();
$oMySQL = new MySQL('temperature', $dblogin, $dbpwd, $dbhost, 3306);
$Res = $oMySQL->ExecuteSQL("CALL get_last_temp();");
$retval['temp'] = $Res;
$HTTPAnswer->HTTPAnswer(HTTP_ANSWER_STATUS_200, json_encode($retval), true);
コード例 #13
0
ファイル: jsonPais.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$db = new MySQL();
if (!isset($_POST["id"])) {
    $db->ExecuteSQL("select id,nome from paises");
} else {
    $db->ExecuteSQL("select id,nome from pais where paises = " . $_POST["id"]);
}
$paises = $db->ArrayResults();
foreach ($paises as $pais) {
    $array[] = array("id" => $pais["id"], "nome" => utf8_encode($pais["nome"]));
}
echo json_encode($array);
コード例 #14
0
ファイル: jsonUsuarios.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$db = new MySQL();
$db->ExecuteSQL("select * from users");
$users = $db->ArrayResults();
foreach ($users as $user) {
    if ($user["ponto_monitoramento"] != 0) {
        $sql = "select * from sub_unidades where id = " . $user["ponto_monitoramento"];
        $db->ExecuteSQL($sql);
        $unidade = $db->ArrayResult();
    } else {
        $unidade["nome"] = "";
    }
    $array[] = array("id" => $user["id"], "nome" => utf8_encode($user["username"]), "senha" => utf8_encode($user["password"]), "email" => utf8_encode($user["email"]), "ponto_monitoramento" => utf8_encode($user["ponto_monitoramento"]), "unidade" => utf8_encode($unidade["nome"]));
}
echo json_encode($array);
コード例 #15
0
ファイル: index.php プロジェクト: wgviana/SaudeNaCopa
<?php

@session_start();
include "../bibliotecas/php/class.MySQL.php";
$db = new MySQL();
if (isset($_GET["assistencia"]) == 1) {
    $db->ExecuteSQL("SELECT * FROM sub_unidades where ativo=1");
    $subUnidade = $db->ArrayResults();
    $listagem = array();
    foreach ($subUnidade as $listaSub) {
        $subUnidade = "SELECT sub_unidades.latitude AS latitude, sub_unidades.longitude AS longitude\n\t\t\t\t\t\tFROM assistencia, sub_unidades\n\t\t\t\t\t\tWHERE assistencia.local_id = sub_unidades.id\n\t\t\t\t\t\tAND assistencia.local_id = " . $listaSub["id"] . " AND assistencia.data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'";
        $db->ExecuteSQL($subUnidade);
        $assistencias = $db->ArrayResults();
        $listagem[$listaSub["id"]]["nome"] = $listaSub["nome"];
        $listagem[$listaSub["id"]]["locais"] = $assistencias;
    }
}
if (isset($_GET["vigilancia"]) == 1) {
    $sql = "SELECT * FROM vigilancia_sanitaria where ativo=1 and data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'";
    $db->ExecuteSQL($sql);
    $vigilancia_sanitaria = $db->ArrayResults();
    $listagem = array();
    foreach ($vigilancia_sanitaria as $lista) {
        $locais = array("", "Vigilancia Sanitaria", "Servico de Alimentacao", "Posto de Saude", "Transporte");
        $listagem[$lista["id"]]["nome"] = $locais[$lista["locais_id"]];
        $listagem[$lista["id"]]["locais"] = $vigilancia_sanitaria;
    }
}
?>
<!DOCTYPE html>
  <head>
コード例 #16
0
ファイル: cron.job.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "../php/class.MySQL.php";
$conn = new MySQL();
$conn->ExecuteSQL("select * from usuario_sentimento where atualizado = 0 and latitude <> 0");
$num_rows = $conn->ArrayResults();
echo "Total:" . ($total = count($num_rows));
echo "<br>";
$contador = 0;
if ($total > 0) {
    try {
        foreach ($num_rows as $row) {
            $contador++;
            echo $url = "http://maps.google.com/maps/api/geocode/json?latlng={$row['latitude']},{$row['longitude']}&sensor=false";
            echo "<br>";
            $data = json_decode(file_get_contents($url));
            if (isset($data->error_message)) {
                die($data->error_message);
            }
            foreach ($data->results[0]->address_components as $address_components) {
                //echo "<pre>";
                $nomeAchado = utf8_decode($address_components->long_name);
                //echo $nomeAchado = stringExpresaoRegular($nomeAchado);
                echo "<br>";
                echo $sql = "select * from cidades where nome LIKE '{$nomeAchado}'";
コード例 #17
0
ファイル: index2.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "bibliotecas/php/class.MySQL.php";
include "bibliotecas/php/class.Auth.php";
include "bibliotecas/php/inc.consultas.php";
include "bibliotecas/php/inc.funcoes.php";
$auth = new Auth();
$auth->notLogged("login.php");
$db = new MySQL();
$db->ExecuteSQL(CONSULTA_ATENDIMENTOS);
$atendimentos = $db->ArrayResults();
$vigilancias = casosVigilancia();
$surto = casoSurto();
$total_atendimentos = 0;
foreach ($atendimentos as $atendimento) {
    $total_atendimentos += $atendimento['total'];
}
$total_vigilancias = 0;
foreach ($vigilancias as $vigilancia) {
    $total_vigilancias += $vigilancia['total'];
}
?>
<!doctype html>
<html lang="en">
<head>
コード例 #18
0
ファイル: actualTemp.php プロジェクト: nakoukal/picuntu_www
<?php

include_once 'globals.php';
include_once 'class/class.HTTPAnswer.php';
include_once 'class/class.MySQL.php';
$HTTPAnswer = new HTTPAnswer();
$oMySQL = new MySQL('temperature', $dblogin, $dbpwd, $dbhost, 3306);
function getRequiredTemp($oMySQL, $sensorName)
{
    $Sql = "SELECT TT.Temp reqTemp FROM sensors S \n\tJOIN time_temp TT ON S.id = TT.SensorID\n\tWHERE WEEKDAY(NOW())+1 = TT.Day \n\tAND TIME(NOW()) BETWEEN TT.TimeFrom AND TT.TimeTo\n\tAND S.name = '{$sensorName}';";
    $Res = $oMySQL->ExecuteSQL($Sql);
    return $Res['reqTemp'];
}
$Sql = "SELECT temp01 oby,temp02 ven,temp03 krb,temp04 pod,temp11 aku, temp08 pokt, temp09 pokn FROM temp ORDER BY timestamp DESC LIMIT 1";
$Res = $oMySQL->ExecuteSQL($Sql);
$retval['temp'][] = array('name' => 'Venek', 'act' => $Res['ven'], 'req' => getRequiredTemp($oMySQL, 'temp02'));
$retval['temp'][] = array('name' => 'Obyvak', 'act' => $Res['oby'], 'req' => getRequiredTemp($oMySQL, 'temp01'));
$retval['temp'][] = array('name' => 'Tom', 'act' => $Res['pokt'], 'req' => getRequiredTemp($oMySQL, 'temp08'));
$retval['temp'][] = array('name' => 'Nela', 'act' => $Res['pokn'], 'req' => getRequiredTemp($oMySQL, 'temp09'));
$retval['temp'][] = array('name' => 'Krb', 'act' => $Res['krb'], 'req' => getRequiredTemp($oMySQL, 'temp03'));
$retval['temp'][] = array('name' => 'Podlaha', 'act' => $Res['pod'], 'req' => getRequiredTemp($oMySQL, 'temp04'));
$retval['temp'][] = array('name' => 'Aku', 'act' => $Res['aku'], 'req' => getRequiredTemp($oMySQL, 'temp11'));
$HTTPAnswer->HTTPAnswer(HTTP_ANSWER_STATUS_200, json_encode($retval), true);
コード例 #19
0
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "bibliotecas/php/class.Auth.php";
$auth = new Auth();
$auth->notLogged("login.php");
include "bibliotecas/php/class.MySQL.php";
$db = new MySQL();
$db->ExecuteSQL("select * from paises");
$paises = $db->ArrayResults();
$db->ExecuteSQL("select * from sinais_sintomas order by sinais_desc");
$sinais_sintomas = $db->ArrayResults();
$db->ExecuteSQL("select * from hipotese_diagnostica order by hip_dia_desc");
$hipotese_diagnostica = $db->ArrayResults();
$session = $auth->sessioninfo($_COOKIE["auth_session"]);
$sql = "select ponto_monitoramento from users where id = " . $session['uid'];
$db->ExecuteSQL($sql);
$user = $db->ArrayResult();
$subUnidade = false;
$sqlComplemento = "";
if ($user["ponto_monitoramento"] > 0) {
    $sql = "select id, unidade_id from sub_unidades where id = " . $user["ponto_monitoramento"];
    $db->ExecuteSQL($sql);
    $subUnidade = $db->ArrayResult();
    $sqlComplemento .= " and id = " . $subUnidade["unidade_id"];
}
コード例 #20
0
ファイル: download.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
session_start();
include "class.MySQL.php";
$conn = new MySQL();
$arquivo = 'planilha_download_saude_na_copa.xls';
try {
    $sql = "SELECT * FROM usuario_sentimento";
    $conn->ExecuteSQL($sql);
    $listagemGeral = $conn->ArrayResults();
    $conn->ExecuteSQL("SELECT * FROM sentimentos");
    $sentimentos = $conn->ArrayResults();
} catch (Exception $e) {
    echo $e->getMenssage();
}
// Criamos uma tabela HTML com o formato da planilha
$html = '';
$html .= '<table border=1>';
$html .= '<tr>';
$html .= '<td colspan="4">Download Saude Na Copa</td>';
$html .= "<td colspan='" . count($sentimentos) . "'>Sinais e Sintomas</td>";
$html .= '</tr>';
$contadorMenu = 0;
$contadorAssistencia = 0;
foreach ($listagemGeral as $geral) {
コード例 #21
0
ファイル: index.php プロジェクト: wgviana/SaudeNaCopa
 */
session_start();
include "bibliotecas/php/class.MySQL.php";
include "bibliotecas/php/class.Auth.php";
include "bibliotecas/php/inc.consultas.php";
include "bibliotecas/php/inc.funcoes.php";
include "bibliotecas/php/class.Entidade.php";
$auth = new Auth();
$auth->notLogged("login.php");
$db = new MySQL();
$data_inicio = date("d/m/Y");
$data_final = date("d/m/Y");
$validar = 0;
$auth->setSession(date("d/m/Y"), date("d/m/Y"), 0, false);
//Geral de totais
$db->ExecuteSQL("select count(us.sentimento_id) as total, s.nome, s.id\n          from usuario_sentimento us\n          left join sentimentos s on us.sentimento_id = s.id\n          group by sentimento_id");
$atendimentos = $db->ArrayResults();
$db->ExecuteSQL("select count(us.sentimento_id) as total\n          from usuario_sentimento us where us.sentimento_id = 0");
$vigilancias = $db->ArrayResults();
$total_atendimentos = 0;
foreach ($atendimentos as $atendimento) {
    $total_atendimentos += $atendimento['total'];
}
$total_vigilancias = 0;
foreach ($vigilancias as $vigilancia) {
    $total_vigilancia += $vigilancia['total'];
}
$total_surtos = 0;
//foreach($surtos as $surto) {
//  $total_surtos += $surto['total'];
//}
コード例 #22
0
ファイル: render_graph.php プロジェクト: nakoukal/raspi_www
        $SQLString = "\n\t\t\tcall get_temp(unix_timestamp(NOW() - INTERVAL 1 WEEK),unix_timestamp(NOW()),86400,'{$SensorID}');\n\t\t";
        break;
    case "day":
        $SQLString = "\n\t\t\tcall get_temp(unix_timestamp(NOW() - INTERVAL 1 DAY),unix_timestamp(NOW()),3600,'{$SensorID}');\n\t\t";
        break;
    case "hour":
        $SQLString = "\n\t\t\t";
        break;
    case "eighthour":
        $SQLString = "\n\t\t\t";
        break;
    case "month":
        $SQLString = "\n\t\t\t";
        break;
}
$oMySQL->ExecuteSQL($SQLString);
foreach ($oMySQL->arrayedResult as $row) {
    switch ($Type) {
        case "day":
            $time = date('h:m', $row["unixtime"]);
            break;
        case "week":
            $time = date('d.m.', $row["unixtime"]);
            break;
    }
    $myData->addPoints($time, "time");
    $venku = $row["value"] == NULL ? VOID : $row["value"];
    $myData->addPoints($venku, "value");
}
$myData->setSerieWeight("value", 1.5);
$myData->setAxisName(0, "Teplota");
コード例 #23
0
ファイル: add_temp.php プロジェクト: nakoukal/raspi_www
require_once "globals.php";
if (isset($_GET["id"])) {
    $id = filter_var($_GET["id"], FILTER_SANITIZE_STRING);
}
if (isset($_GET["value"])) {
    $value = filter_var($_GET["value"], FILTER_SANITIZE_STRING);
}
if (isset($_GET["desc"])) {
    $desc = filter_var($_GET["desc"], FILTER_SANITIZE_STRING);
}
if (isset($_POST["id"])) {
    $id = filter_var($_POST["id"], FILTER_SANITIZE_STRING);
}
if (isset($_POST["value"])) {
    $value = filter_var($_POST["value"], FILTER_SANITIZE_STRING);
}
if (isset($_POST["desc"])) {
    $desc = filter_var($_POST["desc"], FILTER_SANITIZE_STRING);
}
$oMySQL = new MySQL($dbname, $dblogin, $dbpwd, $dbhost);
$Mail = new PHPMailer();
$HTTPAnswer = new HTTPAnswer();
$temp = round($value, 1);
//echo "CALL insert_value('$desc','$id',$value)";
$res = $oMySQL->ExecuteSQL("CALL insert_value('{$desc}','{$id}',{$value})");
if (!$res) {
    echo $oMySQL->lastError;
} else {
    //echo "DATA_OK";
    $HTTPAnswer->HTTPAnswer(HTTP_ANSWER_STATUS_200, "1|DATA_OK", true);
}
コード例 #24
0
ファイル: pointMaps.php プロジェクト: wgviana/SaudeNaCopa
<?php

include "bibliotecas/php/class.MySQL.php";
$db = new MySQL();
$listagem = array();
$subUnidade = "SELECT c.nome, us.latitude, us.longitude \n\t\t\t\t\t\tFROM usuario_sentimento us\n\t\t\t\t\t\tINNER JOIN cidade c ON us.cidade_id = c.id";
$db->ExecuteSQL($subUnidade);
$assistencias = $db->ArrayResults();
$listagem[$listaSub["id"]]["locais"] = $assistencias;
echo json_encode($listagem);
コード例 #25
0
ファイル: init.php プロジェクト: proea/IPManager.pro
         require_once ENGINE_DIR . '/modules/error.php';
         break;
     default:
         require_once ENGINE_DIR . '/modules/index.php';
         //if(LEVEL==1) //require_once ENGINE_DIR. '/modules/dashboard/list.php';
         //require_once ENGINE_DIR. '/modules/dashboard/dashboard.php';
         $thispage = "Главная";
         break;
 }
 $tpl->assign("USERNAME", ADMINLOGIN);
 $tpl->assign("USERID", ADMINID);
 $tpl->assign("USERLEVEL", LEVEL);
 $tpl->assign("HEAD", $HEAD);
 $tpl->assign("END", $END);
 $tpl->assign("AJAX", $AJAX);
 $dataMySQL->ExecuteSQL("SELECT COUNT(*) from `" . DB_PREFIX . "users` WHERE 1 ;");
 $allUSERS = $dataMySQL->ArrayResult();
 $dataMySQL->ExecuteSQL("SELECT COUNT(*) FROM `" . DB_PREFIX . "users` WHERE `idc` > 4150;");
 $cUSERS = $dataMySQL->ArrayResult();
 $COUS = $cUSERS['COUNT(*)'] / $allUSERS['COUNT(*)'] * 100;
 $NCOUS = $cUSERS['COUNT(*)'];
 $ACOUS = $allUSERS['COUNT(*)'] - $cUSERS['COUNT(*)'];
 $tpl->assign("COUS", $COUS);
 $tpl->assign("COUS2", 100 - $COUS);
 $tpl->assign("NCOUS", $NCOUS);
 $tpl->assign("ACOUS", $ACOUS);
 $tpl->assign("DATE", date("Y") . " " . $version);
 $tpl->assign("IP", $_SERVER["REMOTE_ADDR"]);
 $tpl->assign("module", $thispage);
 //echo $dataMySQL->sLastQuery;
 //if($ajaxer!==3 && LEVEL!=="1") $content.="<script>console.log('".LEVEL." {$thispage}');$(\".current\").html(\"{$thispage}\")</script>";
コード例 #26
0
ファイル: export.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$conn = new MySQL();
$conn->ExecuteSQL("select * from questionario_transporte");
$num_rows = $conn->ArrayResults();
$total = count($num_rows);
if ($total > 0) {
    $handle = fopen('venice_relatorio.csv', 'w+');
    fwrite($handle, "Veiculos; Recurso Humanos; Medidas Aplicadas; Data e Hora; Usuario; Celular; Unidade; Sub Unidade; Latitude; Longitude");
    foreach ($num_rows as $row) {
        if ($handle) {
            $quebra = chr(13) . chr(10);
            $linha = $row["veiculos"] . ';' . $row["recursos_humanos"] . ';' . $row["medidas_aplicadas"] . ';' . $row["data_hora"] . ';' . $row["usuario_id"] . ';' . $row["celular_id"] . ';' . $row["unidade"] . ';' . $row["subunidade"] . ';' . $row["latitude"] . ';' . $row["longitude"];
            //$linha .= "\n";
            fwrite($handle, $linha . $quebra);
        }
    }
    fclose($handle);
}
//forca o download do arquivo
//header("Content-Type: $tipo");
//header("Content-Length: $size");
header("Content-Disposition: attachment; filename=venice_relatorio.csv;");
//readfile($dir);
コード例 #27
0
ファイル: jsonEstado.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$db = new MySQL();
if (!isset($_POST["id"])) {
    $db->ExecuteSQL("select id,nome from estado");
} else {
    $db->ExecuteSQL("select id,nome from estado where pais = " . $_POST["id"]);
}
$paises = $db->ArrayResults();
foreach ($paises as $pais) {
    $array[] = array("id" => $pais["id"], "nome" => utf8_encode($pais["nome"]));
}
echo json_encode($array);
コード例 #28
0
ファイル: cron.job.php プロジェクト: wgviana/SaudeNaCopa
<?php

/**
 * Amber
 * @package principal
 * @author César Martins
 * @version 1.0
 */
include "class.MySQL.php";
$conn = new MySQL();
$conn->ExecuteSQL("select * from usuario_sentimento where atualizado = 0 order by id asc ");
$num_rows = $conn->ArrayResults();
$total = count($num_rows);
echo "{$total}";
if ($total > 2) {
    //foreach($num_rows as $row){
    //count($num_rows)
    for ($i = 0; $i < $total; $i++) {
        $row = $num_rows[$i];
        $url = "http://maps.google.com/maps/api/geocode/json?latlng={$row['latitude']},{$row['longitude']}&sensor=false";
        $data = json_decode(file_get_contents($url));
        for ($j = 0; $j < count($data->results[0]->address_components); $j++) {
            if ($data->results[0]->address_components[$j]->types[0] == "administrative_area_level_2") {
                $cidade = $data->results[0]->address_components[$j]->long_name;
                break;
            }
        }
        echo $cidade;
        echo "<br>";
        if (!$cidade) {
            echo "erro";
コード例 #29
0
ファイル: deactivate.php プロジェクト: proea/IPManager.pro
}
header('Content-Type: text/html; charset=windows-1251');
error_reporting(E_ALL);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE);
define('IPMANAGER', true);
define('ROOT_DIR', realpath(dirname(__FILE__) . "/../.."));
define('ENGINE_DIR', ROOT_DIR . '/root');
require_once ENGINE_DIR . '/config/config.php';
require_once ENGINE_DIR . '/config/dbconfig.php';
require_once ENGINE_DIR . '/classes/class.mysql.php';
$dataMySQL = new MySQL();
$_dateend = date('Y-m-d', time());
$query = "SELECT * from `" . DB_PREFIX . "tvusers` WHERE status=1 AND end < '" . $_dateend . "';";
$seldata = $dataMySQL->ExecuteSQL($query);
$seldataArray = $dataMySQL->ArrayResults();
for ($i = 0; $i < count($seldataArray); $i++) {
    $lnn = array();
    $dataMySQL->ExecuteSQL("UPDATE `ip_tvusers` SET `status` =  '0' WHERE `id` =" . $seldataArray[$i]['id']);
    $lnn[] = file_get_contents("http://192.168.174.23:83/api.php?key=YT56BH3I9T7BDKJ72NG93BF73NAKGWGFHON82NA&s=deactivate&ip=" . $seldataArray[$i]['ip']);
    $lnn[] = file_get_contents("http://192.168.174.25:83/api.php?key=YT56BH3I9T7BDKJ72NG93BF73NAKGWGFHON82NA&s=deactivate&ip=" . $seldataArray[$i]['ip']);
    $content .= implode(' ', $lnn);
    $Ilog = array('login' => ADMINLOGIN, 'type' => 'success', 'action' => 'deactivation', 'message' => "АВТО-Деактивация ТВ-пользователя id" . $seldataArray[$i]['id'] . " " . $seldataArray[$i]['ip'] . " " . implode(' ', $lnn));
    if (!$dataMySQL->Insert($Ilog, DB_PREFIX . "logs")) {
        $errors[] = "Ошибка добавления лога";
    }
}
unset($seldataArray);
/*	Генерайция новой конфигурации	*/
$nameTablE_T = "ip_tvusers";