function get_graph_by_type($graph_by, $graph_title, $module, $where, $query) { global $user_id, $date_start, $end_date, $type; //Giving the Cached image name $cache_file_name = abs(crc32($user_id)) . "_" . $type . "_" . crc32($date_start . $end_date) . ".png"; $html_imagename = $graph_by; //Html image name for the graph $graph_details = module_Chart($user_id, $date_start, $end_date, $query, $graph_by, $graph_title, $where, $module, $type); if ($graph_details != 0) { $name_val = $graph_details[0]; $cnt_val = $graph_details[1]; $graph_title = $graph_details[2]; $target_val = $graph_details[3]; $graph_date = $graph_details[4]; $urlstring = $graph_details[5]; $cnt_table = $graph_details[6]; $test_target_val = $graph_details[7]; $width = 600; $height = 400; $top = 30; $left = 140; $bottom = 120; $title = $graph_title; return get_graph($cache_file_name, $html_imagename, $cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date); } else { } }
public function detalhe($id = 1) { //print_r($_SERVER); $data['content'] = '<div class="detalhe">'; $data['breadcrumbs'][] = array('title' => 'Página principal', 'link' => ''); $data['breadcrumbs'][] = array('title' => 'Lista desaparecidos', 'link' => 'lista_desaparecidos'); $fields = array('nome', 'sexo', 'situacao', 'datadesaparecimento', 'fonte', 'estado', 'cidade'); $query = 'prefix DES: <' . get_schema() . '> select * where{ ?a DES:id "' . $id . '". '; foreach ($fields as $value) { $query .= '?a DES:' . $value . ' ?' . $value . '. '; } $query .= ' }'; $url = url_virtuoso() . '/sparql?default-graph-uri=' . urlencode(get_graph()) . '&query=' . urlencode($query) . '&' . urlencode('format=text/html') . '&debug=on&timeout='; $url_rdf = url_virtuoso() . '/sparql?default-graph-uri=' . urlencode(get_graph()) . '&query=' . urlencode($query) . '&' . urlencode('application/rdf+xml') . '&debug=on&timeout='; $str = file_get_contents($url); $xml = simplexml_load_string($str); if (sizeof($xml->results->result) == 0) { $data['title'] = 'Endereço inválido'; $data['content'] .= 'Nenhum registro encontrado para esta identificação.'; } foreach ($xml->results->result as $value) { $data['title'] = $value->binding[1]->literal; $data['content'] .= '<img class="img-desaparecido" src="' . base_url() . '/images/img-desaparecido.png" />'; $data['content'] .= '<a title="Download do RDF" href="' . $url_rdf . '"><img class="img-download-rdf" src="' . base_url() . '/images/rdf_icon.gif" /></a>'; $data['content'] .= '<div class="field"><label>Sexo: </label>' . $value->binding[2]->literal . '</div>'; $data['content'] .= '<div class="field"><label>Situação: </label>' . $value->binding[3]->literal . '</div>'; $data['content'] .= '<div class="field"><label>Data de desaparecimento: </label>' . $value->binding[4]->literal . '</div>'; $data['content'] .= '<div class="field"><label>Estado: </label>' . $value->binding[6]->literal . '</div>'; $data['content'] .= '<div class="field"><label>Cidade: </label>' . $value->binding[7]->literal . '</div>'; $data['content'] .= '<div class="field"><label>Fonte: </label><a href="' . $value->binding[5]->literal . '">' . $value->binding[5]->literal . '</a></div>'; } $data['content'] .= '</div>'; $this->load->view('tema/page', $data); }
function format_row_flags($col, &$def, &$data) { global $LINK; global $GRAPH_POPUP_WIDTH; global $GRAPH_POPUP_HEIGHT; echo "<span>"; if ($data['TYPE'] == "svc") { echo "<a href=\"{$LINK}?type=2&host={$data['HOSTNAME']}&service={$data['SERVICE']}\" target=\"_blank\">" . "<img src=\"img/flag_svc.png\" border=\"0\" alt=\"S\" title=\"" . ucfirst(_('service')) . "\" />" . "</a>"; } else { if ($data['TYPE'] == "host") { echo "<a href=\"{$LINK}?type=1&host={$data['HOSTNAME']}\" target=\"_blank\">" . "<img src=\"img/flag_host.png\" border=\"0\" alt=\"H\" title=\"" . ucfirst(_('host')) . "\" />" . "</a>"; } } $g = get_graph('popup', $data['HOSTNAME'], $data['SERVICE']); if (!empty($g)) { echo "<a href=\"#\" target=\"_blank\" " . " onclick=\"return pop('{$g}', '{$data['STATUSID']}', {$GRAPH_POPUP_WIDTH}, {$GRAPH_POPUP_HEIGHT});\">" . "<img src=\"img/flag_graph.png\" border=\"0\" alt=\"G\" title=\"" . ucfirst(_('graph_icon')) . "\" />" . "</a>"; } if ($data['ACK'] == '1') { echo '<img src="img/flag_ack.gif" alt="A" title="' . ucfirst(_('acknowledge')) . '" />'; } if ($data['NOTIF'] == '0') { echo '<img src="img/flag_notify.png" alt="N" title="' . ucfirst(_('disable_title')) . '" />'; } if ($data['DOWNTIME'] > 0) { echo '<img src="img/flag_downtime.png" alt="D" title="' . ucfirst(_('downtime')) . '" />'; } if ($data['COMMENT'] & ENTRY_COMMENT_NORMAL) { echo '<img src="img/flag_comment.gif" alt="C" title="' . ucfirst(_('comment')) . '" />'; } if (!$data['ACTIVE'] && !$data['PASSIVE']) { echo '<img src="img/flag_no_active_passive.png" />'; } else { if (!$data['ACTIVE']) { echo '<img src="img/flag_no_active.png" />'; } else { if (!$data['PASSIVE']) { echo '<img src="img/flag_no_passive.png" />'; } } } echo "</span>"; }
function get_graph_by_type($graph_by, $graph_title, $module, $where, $query, $width = 900, $height = 900, $frompage = '') { global $user_id, $date_start, $end_date, $type, $mod_strings; $time = time(); //Giving the Cached image name $cache_file_name = abs(crc32($user_id)) . "_" . $type . "_" . crc32($date_start . $end_date) . $time . ".png"; $html_imagename = $graph_by; //Html image name for the graph $graph_details = module_Chart($user_id, $date_start, $end_date, $query, $graph_by, $graph_title, $where, $module, $type); if ($graph_details != 0) { $name_val = $graph_details[0]; $cnt_val = $graph_details[1]; $graph_title = $graph_details[2]; $target_val = $graph_details[3]; $graph_date = $graph_details[4]; $urlstring = $graph_details[5]; $cnt_table = $graph_details[6]; $test_target_val = $graph_details[7]; if (isset($_REQUEST['display_view']) && $_REQUEST['display_view'] == 'MATRIX') { $width = 250; $height = 250; } else { $width = 850; $height = 500; } $top = 20; $left = 140; $bottom = 120; $title = $graph_title; if ($frompage != '') { //echo $width.'------'.$height.'------'.$left.'------'.$right.'------'.$top.'------'.$bottom.'------'.$title.'------'.$test_target_val.'------'.$date_start.'------'.$end_date; //die; return get_graph_homepg($cache_file_name, $html_imagename, $cnt_val, $name_val, 280, 285, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date); } else { return get_graph($cache_file_name, $html_imagename, $cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date); } } else { sleep(1); echo '<h3>' . $mod_strings['LBL_NO_DATA'] . '</h3>'; } }
public function rdf($id = -1) { if ($id == -1) { redirect('desaparecido'); exit; } ////////////////////////////Alterado/////////////////////// $ID1 = '"' . $id . '"'; //Carrega a classe de consulta no virtuoso $this->load->library('virtuoso_query'); //Carrega a classe para gerar consultas sparql $this->load->library('sparql'); //Montando a consulta SPARQL $fields = array('foaf:name' => 'nome', 'foaf:nick' => 'apelido', 'foaf:birthday' => 'data_nascimento', 'foaf:gender' => 'sexo', 'foaf:img' => 'imagem', 'foaf:age' => 'idade', 'des:cityDes' => 'cidade', 'des:stateDes' => 'estado', 'dbpprop:height' => 'altura', 'dbpprop:weight' => 'peso', 'des:skin' => 'pele', 'dbpprop:hairColor' => 'cor_cabelo', 'dbpprop:eyeColor' => 'cor_olho', 'des:moreCharacteristics' => 'mais_caracteristicas', 'des:disappearanceDate' => 'data_desaparecimento', 'des:disappearancePlace' => 'local_desaparecimento', 'des:circumstanceLocation' => 'circunstancia_desaparecimento', 'des:dateLocation' => 'data_localizacao', 'des:additionalData' => 'dados_adicionais', 'des:status' => 'status', 'des:source' => 'fonte'); //Defini os prefixos que serão usados $this->sparql->prefix("foaf", "http://xmlns.com/foaf/0.1/"); $this->sparql->prefix("des", get_schema()); $this->sparql->prefix("dbpprop", "http://dbpedia.org/property/"); //Tripla quer será retornada - Está condição deve ser satisfeita para retornar um resultado $this->sparql->new_ptrn("?recurso des:id {$ID1}"); foreach ($fields as $key => $value) { $this->sparql->select("?{$value}"); $this->sparql->optional($this->sparql->new_ptrn("?recurso {$key} ?{$value}")); } //Ordena por nome $this->sparql->order("?nome"); //processa a consulta $query = $this->sparql->query(); //Carregando os dados para consulta no virtuoso /////////////////////////Alterado/////////////////////////////// $dados = new Constant(); $this->virtuoso_query->load_sparql_http(getProperty($dados->DB_HOST)); //http://localhost:8890/sparql/ //'http://localhost:10035/repositories/desaparecidos' $this->virtuoso_query->load_graph(get_graph()); $this->virtuoso_query->load_query_sparql($query); ///////////////////////Alterado/////////////////////////////// $this->virtuoso_query->load_format('application/sparql-results+json'); //application/json //Executa a query SPARQL $this->virtuoso_query->execute(); //Retorna o resultado no formato especificado //$obj_json = $this->virtuoso_query->get_result(); //Retorna como um objeto mais simples ////////////////////Alterado////////////////////////// //$desaparecido = $this->virtuoso_query->convert_json_to_simple_object(0); $retorno[] = $this->virtuoso_query->convert_json_to_simple_object(0); $desaparecido = $retorno[0]; if (sizeof($desaparecido) != 0) { $rdf = '<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dbpprop="http://dbpedia.org/property/" xmlns:being="http://purl.org/ontomedia/ext/common/being#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:des="http://www.desaparecidos.com.br/rdf/"> <rdf:description rdf:about="http://www.desaparecidos.ufjf.br/desaparecidos/' . $id . '"> <foaf:name>' . (!isset($desaparecido[0]->nome) ? $desaparecido[0]->nome : "vazio") . '</foaf:name> <foaf:nick>' . (isset($desaparecido[0]->apelido) ? $desaparecido[0]->apelido : "") . '</foaf:nick> <foaf:birthday>' . (isset($desaparecido[0]->data_nascimento) ? $desaparecido[0]->data_nascimento : "") . '</foaf:birthday> <foaf:gender>' . (isset($desaparecido[0]->sexo) ? $desaparecido[0]->sexo : "") . '</foaf:gender> <foaf:img>' . (isset($desaparecido[0]->imagem) ? $desaparecido[0]->imagem : "") . '</foaf:img> <foaf:age>' . (isset($desaparecido[0]->idade) ? $desaparecido[0]->idade : "") . '</foaf:age> <des:cityDes>' . (isset($desaparecido[0]->cidade) ? $desaparecido[0]->cidade : "") . '</des:cityDes> <des:cityDes rdf:resource="http://rdf.freebase.com/ns/en.juiz_de_fora" /> <des:cityDes rdf:resource="http://dbpedia.org/resource/Juiz_de_Fora" /> <des:cityDes rdf:resource="" /> <des:cityDes rdf:resource="" /> <des:stateDes>' . (isset($desaparecido[0]->estado) ? $desaparecido[0]->estado : "") . '</des:stateDes> <dbpprop:height>' . (isset($desaparecido[0]->altura) ? $desaparecido[0]->altura : "") . '</dbpprop:height> <dbpprop:weight>' . (isset($desaparecido[0]->peso) ? $desaparecido[0]->peso : "") . '</dbpprop:weight> <des:skin>' . (isset($desaparecido[0]->pele) ? $desaparecido[0]->pele : "") . '</des:skin> <dbpprop:hairColor>' . (isset($desaparecido[0]->cor_cabelo) ? $desaparecido[0]->cor_cabelo : "") . '</dbpprop:hairColor> <dbpprop:eyeColor>' . (isset($desaparecido[0]->cor_olho) ? $desaparecido[0]->cor_olho : "") . '</dbpprop:eyeColor> <des:moreCharacteristics>' . (isset($desaparecido[0]->mais_caracteristicas) ? $desaparecido[0]->mais_caracteristicas : "") . '</des:moreCharacteristics> <des:disappearanceDate>' . (isset($desaparecido[0]->data_desaparecimento) ? $desaparecido[0]->data_desaparecimento : "") . '</des:disappearanceDate> <des:disappearancePlace>' . (isset($desaparecido[0]->local_desaparecimento) ? $desaparecido[0]->local_desaparecimento : "") . '</des:disappearancePlace> <des:circumstanceLocation>' . (isset($desaparecido[0]->circunstancia_desaparecimento) ? $desaparecido[0]->circunstancia_desaparecimento : "") . '</des:circumstanceLocation> <des:dateLocation>' . (isset($desaparecido[0]->data_localizacao) ? $desaparecido[0]->data_localizacao : "") . '</des:dateLocation> <des:additionalData>' . (isset($desaparecido[0]->dados_adicionais) ? $desaparecido[0]->dados_adicionais : "") . '</des:additionalData> <des:status>' . (isset($desaparecido[0]->status) ? $desaparecido[0]->status : "") . '</des:status> <des:source>' . (isset($desaparecido[0]->fonte) ? $desaparecido[0]->fonte : "") . '</des:source> </rdf:description> </rdf:RDF>'; $this->load->helper('download'); force_download('desaparecido-' . $id . '.rdf', $rdf); } else { $this->load->view('tema/pages/pessoa-nao-encontrada'); } }
require_once "lang.php"; $pat = '/[' . preg_quote($ILLEGAL_CHAR) . ']/'; /* query string: host */ if (isset($_GET['host']) && !preg_match($pat, $_GET['host'])) { $host = $_GET['host']; } else { die('Call error: host'); } /* query string: service */ if (isset($_GET['service']) && !preg_match($pat, $_GET['service'])) { $service = $_GET['service']; } else { $service = ''; } /* graph image */ $graph = get_graph('status', $host, $service); if (empty($graph)) { die('Error: no graph target'); } /* query string: period */ if (isset($_GET['period'])) { $period = $_GET['period']; } else { $period = $GRAPH_POPUP_DEFAULT; } if (!in_array($period, array_keys($GRAPH_POPUP_PERIODS))) { die('Call error: period'); } /* add start/end parameters to the query string of image URI */ $start = strtotime($GRAPH_POPUP_PERIODS[$period][0]); $end = strtotime($GRAPH_POPUP_PERIODS[$period][1]);
return preg_replace_callback('@([a-z]+)://([^\\s]+)@', 'cvar_link_replace_cb', $out); } /* This function returns a more human-readable string value * for a custom variable name. */ function cvar_alias($cvar) { $out = strtolower($cvar); if ($out[0] == '_') { $out = substr($out, 1); } return str_replace('_', '-', $out); } $STATUSHEAD = array('ackcur' => '<img class="inline-middle" src="img/flag_ack.gif" /><span class="inline-middle" > (' . $ACKCOMMENT[0] . ')</span>', 'downcur' => '<img class="inline-middle" src="img/flag_downtime.png" /><span class="inline-middle" > (' . $DOWNCOMMENT[0] . ')</span>', 'notifycur' => '<img class="inline-middle" src="img/flag_notify.png" /><span class="inline-middle" > (' . $NOTIFCOMMENT[0] . ')</span>', 'commentcur' => '<img class="inline-middle" src="img/flag_comment.gif" /><span class="inline-middle"> (' . $COMMENT[0] . ')</span>'); if (isset($_GET['fix']) || isset($_SESSION['STATUS']['graph'])) { $g = get_graph('status', $HOSTNAME, $SERVICE); } else { $g = ""; } /* bottom section (override RRD graph) */ $bottom_fct = 'status_nagios__' . preg_replace('/[^a-z0-9]/i', '_', $CHECKNAME); ?> <?php if (isset($_GET['fix'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <title><?php echo "{$SERVICE} " . _('on') . " {$HOSTNAME}";
<h2><?php if (!empty($title)) { echo $title; } ?> </h2> <div class="form"> <!-- ALTERADO <form method='GET' action='<?php url_virtuoso(true); ?> /sparql'> <input type="hidden" name="default-graph-uri" value="<?php get_graph(true); ?> " /> --> <form method='GET' action='<?php url_allegrograph(true); ?> '> <div class="field"> <label>Query:</label> <textarea name='query'> prefix foaf: <http://xmlns.com/foaf/0.1/> select ?nome ?idade Where{ ?recurso foaf:name ?nome. ?recurso foaf:age ?idade
public function total_cadastros() { $this->load->library('virtuoso_query'); //Carrega a classe para gerar consultas sparql $this->load->library('sparql'); //Montando a consulta SPARQL //Defini os prefixos que serão usados $this->sparql->prefix("foaf", "http://xmlns.com/foaf/0.1/"); $this->sparql->prefix("des", get_schema()); //Defini os campos quer serão exibidos $this->sparql->select("?id"); $this->sparql->select("?nome"); $this->sparql->select("?situacao"); $this->sparql->select("?sexo"); //Tripla quer será retornada - Está condição deve ser satisfeita para retornar um resultado $this->sparql->new_ptrn("?recurso des:id ?id"); //Condições opcionais $this->sparql->optional($this->sparql->new_ptrn("?recurso foaf:name ?nome")); $this->sparql->optional($this->sparql->new_ptrn("?recurso des:status ?situacao")); $this->sparql->optional($this->sparql->new_ptrn("?recurso foaf:gender ?sexo")); //Ordena por nome $query = $this->sparql->query(); //Carregando os dados para consulta no virtuoso $dados = new Constant(); $this->virtuoso_query->load_sparql_http(getProperty($dados->DB_HOST)); //http://desaparecidos.ice.ufjf.br:8890/sparql/ //'http://localhost:10035/repositories/desaparecidos' $this->virtuoso_query->load_graph(get_graph()); $this->virtuoso_query->load_query_sparql($query); $this->virtuoso_query->load_format('application/sparql-results+json'); //Executa a query SPARQL $this->virtuoso_query->execute(); //Retorna o resultado no formato especificado //$obj_json = $this->virtuoso_query->get_result(); //Retorna como um objeto mais simples $desaparecidos = $this->virtuoso_query->convert_json_to_simple_object(); return sizeof($desaparecidos); }
"useGraphSettings": true, "backgroundAlpha": 0.56, "aabackgroundColor": "#b5b3b3", "borderColor": "#E10E0E" }, "titles": [{ "id": "Title-1", "size": 15, "text": "Usage of ' . $name . '" }], "dataProvider": [ ' . $g_data . ' ] }); </script>'; return $ret; } echo '<script type="text/javascript" src="../js/amcharts.js"></script><script type="text/javascript" src="../js/serial.js"></script>'; $o_usage = ""; $o_data = ""; $o_show = ""; $req2 = 'SELECT `id` FROM `mach` where active=1'; $stmt2 = $db->prepare($req2); $stmt2->execute(); foreach ($stmt2 as $row2) { //echo "<br>taking a look at this machine ".$db_mach[$row2["id"]]["name"]."<br>"; $data = get_graph($row2["id"]); if ($data[2] > 0) { $o_data .= $data[0]; $o_show .= $data[1]; } } $o_usage = $o_data . $o_show;
public function detalhe($id = 0, $busca = '') { //Carrega a classe de consulta no virtuoso $this->load->library('virtuoso_query'); //Carrega a classe para gerar consultas sparql $this->load->library('sparql'); //Montando a consulta SPARQL $fields = array('foaf:name' => 'nome', 'foaf:nick' => 'apelido', 'foaf:birthday' => 'data_nascimento', 'foaf:gender' => 'sexo', 'foaf:img' => 'imagem', 'foaf:age' => 'idade', 'des:cityDes' => 'cidade', 'des:stateDes' => 'estado', 'dbpprop:height' => 'altura', 'dbpprop:weight' => 'peso', 'des:skin' => 'pele', 'dbpprop:hairColor' => 'cor_cabelo', 'dbpprop:eyeColor' => 'cor_olho', 'des:moreCharacteristics' => 'mais_caracteristicas', 'des:disappearanceDate' => 'data_desaparecimento', 'des:disappearancePlace' => 'local_desaparecimento', 'des:circumstanceLocation' => 'circunstancia_desaparecimento', 'des:dateLocation' => 'data_localizacao', 'des:additionalData' => 'dados_adicionais', 'des:status' => 'status', 'des:source' => 'fonte'); //Defini os prefixos que serão usados $this->sparql->prefix("foaf", "http://xmlns.com/foaf/0.1/"); $this->sparql->prefix("des", get_schema()); $this->sparql->prefix("dbpprop", "http://dbpedia.org/property/"); //Tripla quer será retornada - Está condição deve ser satisfeita para retornar um resultado $this->sparql->new_ptrn("?recurso des:id {$id}"); foreach ($fields as $key => $value) { $this->sparql->select("?{$value}"); $this->sparql->optional($this->sparql->new_ptrn("?recurso {$key} ?{$value}")); } //Ordena por nome $this->sparql->order("?nome"); //processa a consulta $query = $this->sparql->query(); //Carregando os dados para consulta no virtuoso // //////////////////////////Alterado///////////////////// $dados = new Constant(); $this->virtuoso_query->load_sparql_http($dados->DB_HOST); //http://localhost:8890/sparql/ //'http://172.18.40.9:10035/repositories/desaparecidos1' $this->virtuoso_query->load_graph(get_graph()); $this->virtuoso_query->load_query_sparql($query); //////////////////////////Alterado///////////////////// $this->virtuoso_query->load_format('application/sparql-results+json'); //application/json //Executa a query SPARQL $this->virtuoso_query->execute(); //Retorna o resultado no formato especificado //$obj_json = $this->virtuoso_query->get_result(); //Retorna como um objeto mais simples $data['id'] = trim($id); $data['link'] = site_url('access/busca_nome') . '/' . trim($busca); $data['desaparecido'] = $this->virtuoso_query->convert_json_to_simple_object(0); $this->load->view('addon/detalhe', $data); }