<?php

/*
 * proxy para datos de autocompletar
*/
include "config.tematres.php";
header('Content-type: application/json');
$page_encode = in_array($CFG["_CHAR_ENCODE"], array('utf-8', 'iso-8859-1')) ? $CFG["_CHAR_ENCODE"] : 'utf-8';
$searchq = XSSprevent($_GET['query']);
$node = XSSprevent($_GET['node']);
$typeSearch = $_GET["t"] == '0' ? '0' : CFG_SUGGESTxWORD;
if (isset($node)) {
    echo getData4jtree($node);
}
if (!$searchq) {
    return;
}
if (strlen($searchq) >= $CFG["MIN_CHAR_SEARCH"]) {
    echo getData4Autocompleter($searchq, $typeSearch);
}
Ejemplo n.º 2
0
#   TemaTres : aplicación para la gestión de lenguajes documentales #       #
#                                                                        #
#   Copyright (C) 2004-2008 Diego Ferreyra tematres@r020.com.ar
#   Distribuido bajo Licencia GNU Public License, versión 2 (de junio de 1.991) Free Software Foundation
#
###############################################################################################################
#
include "config.tematres.php";
$metadata = do_meta_tag();
/*term reporter*/
if ($_GET[mod] == 'csv' && substr($_GET[task], 0, 3) == 'csv' && $_SESSION[$_SESSION["CFGURL"]][ssuser_id]) {
    return wichReport($_GET[task]);
}
$search_string = '';
$search_string = doValue($_GET, FORM_LABEL_buscar) ? XSSprevent(doValue($_GET, FORM_LABEL_buscar)) : '';
?>
<!DOCTYPE html>
<html lang="<?php 
echo LANG;
?>
">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
   <link href="<?php 
echo T3_WEBPATH;
?>
bootstrap/css/bootstrap.min.css" rel="stylesheet">
   <link href="<?php 
function HTMLformAssociateTargetTerms($ARRAYtermino, $term_id = "0")
{
    $sql = SQLtargetVocabulary("1");
    $rows = '<div class="container" id="bodyText">';
    $rows .= '<a class="topOfPage" href="index.php?tema=' . $ARRAYtermino["idTema"] . '" title="' . LABEL_Anterior . '">' . LABEL_Anterior . '</a>';
    if (SQLcount($sql) == '0') {
        //No hay vocabularios de referencia, solo vocabulario principal
        $rows .= HTMLalertNoTargetVocabulary();
    } else {
        //Hay vobularios de referencia
        $array_vocabularios = array();
        while ($array = $sql->FetchRow()) {
            if ($array[vocabulario_id] !== '1') {
                //vocabularios que no sean el vocabulario principal
                array_push($array_vocabularios, $array[tvocab_id] . '#' . FixEncoding($array[tvocab_label]));
            }
        }
        $arrayOptions = strlen($ARRAYtermino["code"]) > 0 ? array('string#' . ucfirst(LABEL_string2search), 'reverse#' . ucfirst(LABEL_reverseMappign), 'code#' . LABEL_CODE) : array('string#' . ucfirst(LABEL_string2search), 'reverse#' . ucfirst(LABEL_reverseMappign));
        $display = in_array($_GET[search_by], array('reverse', 'code')) ? 'style="display: none;"' : '';
        $string2search = $_GET[string2search] ? XSSprevent($_GET[string2search]) : $ARRAYtermino["titTema"];
        $rows .= '<form class="" role="form" name="alta_tt" id="alta_tt" action="index.php" method="get">';
        $rows .= '	<div class="row">
		    <div class="col-sm-12">
		        <legend>' . ucfirst(LABEL_relacion_vocabulario) . ' <a href="index.php?tema=' . $ARRAYtermino["idTema"] . '">' . $ARRAYtermino["titTema"] . '</a></legend>
		    </div>
		    <!-- panel  -->

		    <div class="col-lg-7">
		        <div class="panel panel-default">
		            <div class="panel-body form-horizontal">

		            <div class="form-group">
		            <label for="tvocab_id" class="col-sm-3 control-label">' . ucfirst(FORM_LABEL_nombre_vocabulario) . '</label>
		                <div class="col-sm-9">
		                    <select class="form-control" id="tvocab_id" name="tvocab_id">
		                    ' . doSelectForm($array_vocabularios, $_GET["tvocab_id"]) . '
		                    </select>
		                </div>
		            </div>';
        //Configurar opcion búsqueda por código
        $rows .= '<div class="form-group">
		<label for="search_by" class="col-sm-3 control-label">' . ucfirst(LABEL_selectMapMethod) . '</label>
				<div class="col-sm-9">
						<select class="form-control" id="search_by" name="search_by" onChange="mostrar(this.value);">
						' . doSelectForm($arrayOptions, $_GET["search_by"]) . '
						</select>
				</div>
		</div>';
        $rows .= '<div id="by_string" class="form-group" ' . $display . '>
		                    <label for="string2search" class="col-sm-3 control-label">' . ucfirst(LABEL_Buscar) . '</label>
		                    <div class="col-sm-9">
		                        <input type="text" class="form-control" required type="search" required id="string2search" name="string2search" value="' . $string2search . '">
		                    </div>
            </div>

		                <div class="form-group">
		                    <div class="col-sm-12 text-right">
		                     <button type="submit" class="btn btn-primary" value="' . LABEL_Buscar . '"/>' . ucfirst(LABEL_Buscar) . '</button>
		                      <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema=' . $ARRAYtermino["idTema"] . '\'" value="' . ucfirst(LABEL_Cancelar) . '"/>' . ucfirst(LABEL_Cancelar) . '</button>
		                    </div>
		                </div>
		            </div>
		        </div>
		    </div> <!-- / panel  -->';
        $rows .= '<input type="hidden" name="tema" value="' . $ARRAYtermino["idTema"] . '"/>
				<input type="hidden" name="taskterm" value="findTargetTerm"/>';
        $rows .= '</form>';
    }
    $rows .= '</div>';
    if ($string2search && $_GET["tvocab_id"]) {
        require_once T3_ABSPATH . 'common/include/vocabularyservices.php';
        $arrayVocab = ARRAYtargetVocabulary($_GET["tvocab_id"]);
        switch ($_GET["search_by"]) {
            case 'string':
                $dataTerm = getURLdata($arrayVocab[tvocab_uri_service] . '?task=search&arg=' . urlencode($string2search));
                break;
            case 'code':
                $dataTerm = getURLdata($arrayVocab[tvocab_uri_service] . '?task=fetchCode&arg=' . urlencode($ARRAYtermino["code"]));
                break;
            case 'reverse':
                $dataTerm = getURLdata($arrayVocab[tvocab_uri_service] . '?task=fetchSourceTerms&arg=' . rawurlencode($ARRAYtermino["titTema"]));
                break;
            default:
                $dataTerm = getURLdata($arrayVocab[tvocab_uri_service] . '?task=search&arg=' . urlencode($string2search));
                break;
        }
        $rows .= HTMLtargetVocabularySearchResult($dataTerm, $_GET[string2search], $arrayVocab, $ARRAYtermino["idTema"]);
    }
    //fin de if buscar
    $rows .= '   </div>';
    $rows .= '<script type="text/javascript">
	function mostrar(id) {
		((id == "string") ?	$("#by_string").show() : $("#by_string").hide());
	}
	</script>';
    return $rows;
}
# Include para seleccionar include o función de visualizaicon de listas de términos #
//Mostrar alfabeto
if ($_GET[letra]) {
    // sanitice $letra
    $letra = isValidLetter($_GET[letra]);
}
if (strlen($letra) > 0 && strlen($letra) < 5) {
    echo '<div class="container" id="bodyText">';
    echo '<div class="row">';
    echo HTMLlistaAlfabeticaUnica($letra);
    echo HTMLterminosLetra($letra);
    echo '</div>';
    echo '</div>';
} elseif (strlen($search_string) > 0) {
    //check again
    $search_string = XSSprevent($search_string);
    echo resultaBusca($search_string, $_GET["tipo"]);
} elseif (is_numeric($metadata["arraydata"]["tema_id"]) || $_GET["taskterm"] == 'addTerm' || $_GET["taskterm"] == 'addTermSuggested') {
    require_once T3_ABSPATH . 'common/include/inc.vistaTermino.php';
} elseif (is_numeric($_GET[estado_id])) {
    echo '<div class="container" id="bodyText">';
    echo HTMLlistaTerminosEstado($_GET[estado_id], CFG_NUM_SHOW_TERMSxSTATUS);
    echo '</div>';
} elseif ($_GET["s"] == 'n') {
    echo '<div class="container" id="bodyText">';
    echo HTMLlistaTerminosFecha();
    echo '</div>';
} elseif ($_GET[xsearch] == '1') {
    echo '<div class="container" id="bodyText">';
    echo HTMLformAdvancedSearch($_GET);
    echo '</div>';
function isValidLetter($string)
{
    global $CFG;
    $string = trim($string);
    $string = in_array($string, $CFG["_EXCLUDED_CHARS"]) ? '' : $string;
    $string = XSSprevent(urldecode($string));
    return $string;
}