Example #1
0
function HTMLformAssociateTargetTerms($ARRAYtermino, $term_id = "0")
{
    $sql = SQLtargetVocabulary("1");
    $rows = '<div id="bodyText">';
    $rows .= '<a class="topOfPage" href="javascript: history.go(-1);">' . LABEL_Anterior . '</a>';
    $rows .= '<h1>' . LABEL_EditorTermino . '</h1>';
    $rows .= '  <fieldset>';
    $rows .= '    <legend>' . LABEL_relacion_vocabulario . ' <a href="index.php?tema=' . $ARRAYtermino[idTema] . '">' . $ARRAYtermino[titTema] . '</a></legend>';
    if (!$sql[cant]) {
        //No hay vocabularios de referencia, solo vocabulario principal
        $rows .= '<p class="error">' . ucfirst(LABEL_NO_vocabulario_referencia) . '</p>';
    } else {
        //Hay vobularios de referencia
        $array_vocabularios = array();
        while ($array = mysqli_fetch_array($sql[datos])) {
            if ($array[vocabulario_id] !== '1') {
                //vocabularios que no sean el vocabulario principal
                array_push($array_vocabularios, $array[tvocab_id] . '#' . FixEncoding($array[tvocab_label]));
            }
        }
        $rows .= '<form class="formdiv" name="alta_tt" action="index.php" method="get" onsubmit="return checkrequired(this)">';
        $rows .= '<div>';
        $rows .= '<label for="tvocab_id" accesskey="t">';
        $rows .= FORM_LABEL_nombre_vocabulario . '*</label>';
        $rows .= '<select id="tvocab_id" name="tvocab_id">';
        $rows .= '<optgroup label="' . FORM_LABEL_nombre_vocabulario . '">';
        $rows .= doSelectForm($array_vocabularios, "");
        $rows .= '</optgroup>';
        $rows .= '</select><br/>';
        $rows .= '</div>';
        $rows .= '<div>';
        $rows .= '<label for="string2search" accesskey="s">';
        $rows .= LABEL_Buscar . '</label>';
        $rows .= '<input name="string2search" type="text" id="string2search" size="15" maxlength="50"/>';
        $rows .= '</div>';
        $rows .= '<div class="submit_form" align="center">';
        $rows .= '  <input type="submit" name="boton" value="' . LABEL_Buscar . '"/>
	  <input type="button"  name="cancelar" type="button" onClick="location.href=\'index.php?tema=' . $ARRAYtermino[idTema] . '\'" value="' . ucfirst(LABEL_Cancelar) . '"/>
	  <input type="hidden" name="tema" value="' . $ARRAYtermino[idTema] . '"/>
	  <input type="hidden" name="taskterm" value="findTargetTerm"/>';
        $rows .= '</div>';
        $rows .= '</form>';
    }
    $rows .= '  </fieldset>';
    if ($_GET[string2search] && $_GET[tvocab_id]) {
        require 'vocabularyservices.php';
        $arrayVocab = ARRAYtargetVocabulary($_GET[tvocab_id]);
        $arrayTerm = xmlVocabulary2array($arrayVocab[tvocab_uri_service] . '?task=search&arg=' . urlencode($_GET[string2search]));
        $rows .= HTMLtargetVocabularySearchResult($arrayTerm, $_GET[string2search], $arrayVocab, $ARRAYtermino[idTema]);
    }
    //fin de if buscar
    $rows .= '   </div>';
    return $rows;
}
function do_target_temaXcode($tema_id, $code, $tvocab_id)
{
    global $DBCFG;
    $userId = $_SESSION[$_SESSION["CFGURL"]][ssuser_id];
    // 	check valid data
    $tema_id = secure_data($tema_id, "int");
    $tvocab_id = secure_data($tvocab_id, "int");
    $code = secure_data($code, "alnum");
    // 	retrieve data about target vocabulary
    $arrayVocab = ARRAYtargetVocabulary($tvocab_id);
    require_once T3_ABSPATH . 'common/include/vocabularyservices.php';
    $dataTterm = getURLdata($arrayVocab[tvocab_uri_service] . '?task=fetchCode&arg=' . $code);
    $tterm_id = (int) $dataTterm->result->term->term_id;
    $tterm_string = (string) $dataTterm->result->term->string;
    if ((int) $dataTterm->result->term->term_id > 0) {
        $arrayTterm["tterm_uri"] = $arrayVocab["tvocab_uri_service"] . '?task=fetchTerm&arg=' . $tterm_id;
        $arrayTterm["tterm_url"] = $arrayVocab["tvocab_url"] . '?tema=' . $tterm_id;
        $arrayTterm["tterm_string"] = secure_data($tterm_string, "ADOsql");
        $sql = SQLo("insert", "into {$DBCFG['DBprefix']}term2tterm (tema_id,tvocab_id,tterm_url,tterm_uri,tterm_string,cuando,uid)\r\n\t\t\t\tvalues (?,?,?,?,{$arrayTterm['tterm_string']},now(),?)", array($tema_id, $arrayVocab[tvocab_id], $arrayTterm[tterm_url], $arrayTterm[tterm_uri], $userId));
        $target_relation_id = $sql[cant];
    }
    return array("tterm_id" => $target_relation_id);
}
Example #3
0
function HTMLlistaTermsTargetVocabularios($tvocab_id, $from = "0")
{
    $ARRAYtargetVocabulary = ARRAYtargetVocabulary($tvocab_id);
    $from = is_numeric($from) ? $from : '0';
    $from = $from < $ARRAYtargetVocabulary[cant] ? $from : '0';
    if ($ARRAYtargetVocabulary[cant] > 20) {
        $linkMore = $from < $ARRAYtargetVocabulary[cant] - 20 ? '<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . ($from + 20) . '"> + 20</a>' : "";
        $linkLess = $from > 0 ? '<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . ($from - 20) . '"> - 20</a>' : "";
        $linkFirst = $from > 0 ? '<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=0"><<</a> &middot; ' : "";
        $linkLast = $from < $ARRAYtargetVocabulary[cant] - 20 ? ' &middot; <a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . ($ARRAYtargetVocabulary[cant] - 20) . '">>></a>' : "";
        $next20 = $from + 20 < $ARRAYtargetVocabulary[cant] ? $from + 20 : $ARRAYtargetVocabulary[cant];
        $labelShow = $from > 0 ? ' | ' . $from . ' - ' . $next20 . ' | ' : $from . ' - ' . $next20 . ' | ';
    }
    $sql = SQLtargetTermsVocabulary($tvocab_id, $from);
    $rows .= '<tbody>';
    while ($array = mysqli_fetch_array($sql[datos])) {
        $status_tterm = '1';
        $last_term_update = $array[cuando_last] ? $array[cuando_last] : $array[cuando];
        if ($_GET["doAdmin2"] == 'checkDateTermsTargetVocabulary') {
            $iUpd = 0;
            $ARRAYSimpleChkUpdateTterm = ARRAYSimpleChkUpdateTterm("tematres", $array[tterm_uri]);
            /*
            		El término no existe más en el vocabulario de destino
            */
            if (!$ARRAYSimpleChkUpdateTterm[result][term][tema_id]) {
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<ul class="errorNoImage">';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li><strong>' . ucfirst(LABEL_notFound) . '</strong></li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li>[<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;doAdmin2=checkDateTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . $from . '&amp;tterm_id=' . $array[tterm_id] . '&amp;tema=' . $array[tema_id] . '&amp;taskrelations=delTgetTerm" title="' . ucfirst(LABEL_borraRelacion) . '">' . ucfirst(LABEL_borraRelacion) . '</a>]</li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '</ul>';
                $status_tterm = 'x';
            } elseif ($ARRAYSimpleChkUpdateTterm[result][term][date_mod] > $last_term_update) {
                $iUpd = ++$iUpd;
                $ARRAYupdateTterm["{$array['tterm_uri']}"]["string"] = FixEncoding($ARRAYSimpleChkUpdateTterm[result][term]["string"]);
                $ARRAYupdateTterm["{$array['tterm_uri']}"]["date_mod"] = $ARRAYSimpleChkUpdateTterm[result][term]["date_mod"];
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<ul class="warningNoImage">';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li><strong>' . $ARRAYupdateTterm["{$array['tterm_uri']}"]["string"] . '</strong></li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li>' . $ARRAYupdateTterm["{$array['tterm_uri']}"]["date_mod"] . '</li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li>[<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;doAdmin2=checkDateTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . $from . '&amp;tterm_id=' . $array[tterm_id] . '&amp;tgetTerm_id=' . $array[tterm_id] . '&amp;tema=' . $array[tema_id] . '&amp;taskrelations=updTgetTerm" title="' . ucfirst(LABEL_actualizar) . '">' . ucfirst(LABEL_actualizar) . '</a>]</li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '<li>[<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;doAdmin2=checkDateTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . $from . '&amp;tterm_id=' . $array[tterm_id] . '&amp;tema=' . $array[tema_id] . '&amp;taskrelations=delTgetTerm" title="' . ucfirst(LABEL_borraRelacion) . '">' . ucfirst(LABEL_borraRelacion) . '</a>]</li>';
                $linkUpdateTterm["{$array['tterm_uri']}"] .= '</ul>';
                $status_tterm = '1';
            }
        }
        /*
        	else
        	{
        			$status_tterm='1';
        	}
        */
        $rows .= '<tr>';
        $rows .= '<td class="izq"><a href="index.php?tema=' . $array[tema_id] . '" title="' . LABEL_verDetalle . ' ' . $array[tema] . '">' . $array[tema] . '</a></td>';
        $rows .= '<td class="izq">';
        $rows .= $status_tterm == '1' ? ' <a href="' . $array[tterm_url] . '" title="' . LABEL_verDetalle . ' ' . FixEncoding($array[tterm_string]) . '" >' . FixEncoding($array[tterm_string]) . '</a>' : FixEncoding($array[tterm_string]);
        $rows .= ' ' . $linkUpdateTterm["{$array['tterm_uri']}"] . '</td>';
        $rows .= '<td class="izq">' . $last_term_update . '</td>';
        $rows .= '</tr>';
    }
    $rows .= '</tbody>';
    $rows .= '<tfoot>';
    $rows .= '<tr>';
    $rows .= '<td class="izq" colspan="3">' . $ARRAYtargetVocabulary[cant] . ' ' . FORM_LABEL_Terminos . ': ' . $linkFirst . $linkLess . ' ' . $labelShow . ' ' . $linkMore . $linkLast . ' ';
    if ($ARRAYtargetVocabulary[cant] > 0) {
        $rows .= '&middot;  <a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;doAdmin2=checkDateTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . $from . '">' . ucfirst(LABEL_ShowTargetTermsforUpdate) . '</a>';
    }
    if (isset($iUpd)) {
        $rows .= ': ' . $iUpd . ' ' . LABEL_targetTermsforUpdate;
    }
    $rows .= '</td>';
    $rows .= '</tr>';
    $rows .= '</tfoot>';
    $rows .= '</table>        ';
    $thead .= '<table cellpadding="0" cellspacing="0" summary="' . LABEL_lcConfig . '" >';
    $thead .= '<thead>';
    $thead .= '<tr>';
    $thead .= '<th class="izq" colspan="3"><a href="admin.php" title="' . ucfirst(LABEL_lcConfig) . '">' . ucfirst(LABEL_lcConfig) . '</a> &middot; ' . $ARRAYtargetVocabulary[tvocab_title] . ' &middot ' . ($array[tvocab_status] == '1' ? LABEL_enable : LABEL_disable) . '</th>';
    $thead .= '</tr>';
    $thead .= '<tr>';
    $thead .= '<th class="izq" colspan="3">' . $ARRAYtargetVocabulary[cant] . ' ' . FORM_LABEL_Terminos . ': ' . $linkFirst . $linkLess . ' ' . $labelShow . ' ' . $linkMore . $linkLast . ' ';
    if ($ARRAYtargetVocabulary[cant] > 0) {
        $thead .= '&middot;  <a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;doAdmin2=checkDateTermsTargetVocabulary&amp;tvocab_id=' . $ARRAYtargetVocabulary[tvocab_id] . '&amp;f=' . $from . '">' . ucfirst(LABEL_ShowTargetTermsforUpdate) . '</a>';
    }
    if (isset($iUpd)) {
        $thead .= ': ' . $iUpd . ' ' . LABEL_targetTermsforUpdate;
    }
    $thead .= '</th>';
    $thead .= '</tr>';
    $thead .= '<tr>';
    $thead .= '<th>' . ucfirst(LABEL_Termino) . '</th>';
    $thead .= '<th>' . ucfirst($ARRAYtargetVocabulary[tvocab_label]) . '</th>';
    $thead .= '<th>' . ucfirst(LABEL_Fecha) . '</th>';
    $thead .= '</tr>';
    $thead .= '</thead>';
    $rows = $thead . $rows;
    return $rows;
}
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;
}