function HTMLformEditTerms($taskterm, $ARRAYtermino = "0")
{
    //SEND_KEY to prevent duplicated
    session_start();
    $_SESSION['SEND_KEY'] = md5(uniqid(rand(), true));
    switch ($taskterm) {
        case 'addTerm':
            // add term
            $nombre_pantalla = LABEL_AgregarT;
            $hidden = '<input type="hidden"  name="alta_t" value="new" />';
            $hidden .= '<div><input type="checkbox" name="estado_id" id="estado_id" value="12" alt="' . ucfirst(LABEL_Candidato) . '" /> <label for="estado_id" accesskey="e">' . ucfirst(LABEL_Candidato) . '</label></div>';
            $hidden .= '<div><input type="checkbox" name="isMetaTerm" id="isMetaTerm" value="1" alt="' . ucfirst(LABEL_meta_term) . '" /> <label for="isMetaTerm" accesskey="e">' . ucfirst(LABEL_meta_term) . '</label>
			<div class="alert alert-info" role="alert">' . NOTE_isMetaTermNote . '</div>
			</div>';
            $help_rows = '<p class="text-primary">' . HELP_variosTerminos . '</p>';
            $extra_button = '<a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=addTermSuggested" title="' . ucfirst(LABEL__getForRecomendation) . '">' . ucfirst(LABEL__getForRecomendation) . '</a>';
            break;
        case 'editTerm':
            //Edici�n de un t�rmino $edit_id
            $nombre_pantalla = LABEL_editT . ' <a href="index.php?tema=' . $ARRAYtermino["idTema"] . '">' . $ARRAYtermino["titTema"] . '</a>';
            $vista_titulo_tema = $ARRAYtermino["titTema"];
            $vista_desc_tema = $ARRAYtermino[descTema];
            $hidden = '<input type="hidden"  name="edit_id_tema" value="' . $ARRAYtermino["idTema"] . '" />';
            break;
        case 'addNT':
            // add narowwer term
            $nombre_pantalla = LABEL_AgregarTE . ' <a href="index.php?tema=' . $ARRAYtermino["idTema"] . '">' . $ARRAYtermino["titTema"] . '</a>';
            $hidden .= '<input type="hidden"  name="id_termino_sub" value="' . $ARRAYtermino["idTema"] . '" />';
            $help_rows = '<p class="text-primary">' . HELP_variosTerminos . '</p>';
            $extra_button = '<a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=addFreeNT&amp;tema=' . $ARRAYtermino["idTema"] . '" title="' . ucfirst(MENU_AgregarTEexist) . '">' . ucfirst(MENU_AgregarTEexist) . '</a>';
            $extra_button .= ' <a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=findSuggestionTargetTerm&amp;tema=' . $ARRAYtermino["idTema"] . '&amp;t_relation=3" title="' . ucfirst(LABEL__getForRecomendation) . '">' . ucfirst(LABEL__getForRecomendation) . '</a>';
            $t_relation = '3';
            break;
        case 'addUF':
            //Alta de un t�rmino no preferido a $id_uf
            $nombre_pantalla = LABEL_AgregarUP . ' <a href="index.php?tema=' . $ARRAYtermino["idTema"] . '">' . $ARRAYtermino["titTema"] . '</a>';
            $hidden = '<input type="hidden"  name="id_termino_uf" value="' . $ARRAYtermino["idTema"] . '" />';
            $help_rows = '<p class="text-primary">' . HELP_variosTerminos . '</p>';
            $extra_button = '<a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=addFreeUF&amp;tema=' . $ARRAYtermino["idTema"] . '" title="' . ucfirst(MENU_AgregarUPexist) . '">' . ucfirst(MENU_AgregarUPexist) . '</a>';
            $extra_button .= ' <a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=findSuggestionTargetTerm&amp;tema=' . $ARRAYtermino["idTema"] . '&amp;t_relation=4" title="' . ucfirst(LABEL__getForRecomendation) . '">' . ucfirst(LABEL__getForRecomendation) . '</a>';
            $t_relation = '4';
            break;
        case 'addRTnw':
            //Alta de un término RT
            $nombre_pantalla = LABEL_AgregarTR . ' <a href="index.php?tema=' . $ARRAYtermino["idTema"] . '">' . $ARRAYtermino["titTema"] . '</a>';
            $hidden = '<input type="hidden"  name="id_termino_rt" value="' . $ARRAYtermino["idTema"] . '" />';
            $help_rows = '<p class="text-primary">' . HELP_variosTerminos . '</p>';
            $extra_button = '<a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=addRT&amp;tema=' . $ARRAYtermino["idTema"] . '" title="' . ucfirst(MENU_selectExistTerm) . '">' . ucfirst(MENU_selectExistTerm) . '</a>';
            $extra_button .= ' <a class="btn btn-second btn-xs" role="button" href="index.php?taskterm=findSuggestionTargetTerm&amp;tema=' . $ARRAYtermino["idTema"] . '&amp;t_relation=2" title="' . ucfirst(LABEL__getForRecomendation) . '">' . ucfirst(LABEL__getForRecomendation) . '</a>';
            $t_relation = '2';
            break;
    }
    $rows .= '<div class="container" id="bodyText">';
    $rows .= '<div class="row">';
    $rows .= '<a class="topOfPage" href="index.php?tema=' . $ARRAYtermino["idTema"] . '" title="' . LABEL_Anterior . '">' . LABEL_Anterior . '</a>
		<h3>' . LABEL_EditorTermino . '</h3>';
    $rows .= '<form class="form-horizontal col-xs-12 col-md-8" role="form" id="alta_t" name="alta_t" action="index.php" method="post">
		<fieldset>
		<legend>' . $nombre_pantalla . '</legend>

		<div class="form-group form-group-chk">
		<label for="' . FORM_LABEL_termino . '" accesskey="t">' . LABEL_Termino . '</label>
		' . $extra_button . '
		<textarea class="form-control" type="text" required autofocus rows="2" cols="60" name="' . FORM_LABEL_termino . '" id="addTerms">' . $vista_titulo_tema . '</textarea>';
    $rows .= $help_rows;
    $rows .= $extra_tag;
    $rows .= '</div>';
    if (in_array($t_relation, array(2, 3, 4))) {
        $SQLtypeRelations = SQLtypeRelations($t_relation);
        if (SQLcount($SQLtypeRelations) > 0) {
            while ($ARRAYtypeRelations = $SQLtypeRelations->FetchRow()) {
                $arraySelectTypeRelations[] = $ARRAYtypeRelations[rel_rel_id] . '#' . $ARRAYtypeRelations[rr_value];
                $neutralLabel = LABELrelTypeSYS($ARRAYtypeRelations[t_relation]);
            }
            $rows .= '<div class="form-group"><label for="rel_rel_id" accesskey="r">' . ucfirst(LABEL_relationSubType) . '<span class="small">(' . LABEL_optative . ')</span></label>';
            $rows .= '<select class="form-control" id="t_rel_rel_id" name="t_rel_rel_id"><option>' . ucfirst(LABEL_seleccionar) . '</option>';
            $rows .= doSelectForm($arraySelectTypeRelations, "");
            $rows .= '</select>';
            $rows .= '</div>';
        }
    }
    $rows .= '<div class="text-center">';
    $rows .= '<input type="submit" class="btn btn-primary" role="button" name="boton" value="' . LABEL_Enviar . '"/>';
    $rows .= ' <input type="button" class="btn btn-default" role="button" name="cancelar" type="button" onClick="location.href=\'index.php?tema=' . $ARRAYtermino["idTema"] . '\'" value="' . ucfirst(LABEL_Cancelar) . '"/>';
    $rows .= '</div>';
    $rows .= $hidden;
    $rows .= '<input type="hidden"  name="ks" id="ks" value="' . $_SESSION["SEND_KEY"] . '"/>';
    $rows .= '  </fieldset>';
    $rows .= '</form>';
    $rows .= '		</div>';
    //row
    $rows .= '</div>';
    //container
    return $rows;
}
                    echo ' ' . $_POST[code_tema] . ': ' . MSG_ERROR_CODE . ' (' . LABEL_Termino . ' ' . $task[tema] . ')';
                    break;
            }
        }
    }
    //gestión de codigo de tema
    if ($_POST["edit_tema_id"]) {
        $tema_id = str_replace("edit_tema", "", $_POST["edit_tema_id"]);
        //additional secure check
        $string_term = trim($_POST["edit_tema"]);
        if (is_numeric($tema_id) && strlen($string_term) > 0) {
            $task = abm_tema('mod', $string_term, $tema_id);
        }
        $arrayTerm = ARRAYverTerminoBasico($tema_id);
        echo $arrayTerm[tema];
    }
    //abm for relations defined by user
    if ($_POST["edit_rel_id"]) {
        $rel_id = str_replace("edit_rel_id", "", $_POST["edit_rel_id"]);
        //eliminar relación ==
        if ($_POST[rel_rel_id] == '0') {
            $task = abm_rel_rel("BAJA", $rel_id, $_POST[rel_rel_id]);
        } elseif (is_numeric($_POST[rel_rel_id])) {
            $task = abm_rel_rel("ALTA", $rel_id, $_POST[rel_rel_id]);
        }
        $arrayRelData = ARRAYdataRelation($task[rel_id]);
        $labelRel = LABELrelTypeSYS($arrayRelData[t_relation]);
        //reverse or not view of the relation
        echo $_POST[relativeLabel] == 'X' ? $labelRel[rx_code] . $arrayRelData[rr_code] : $labelRel[r_code] . $arrayRelData[rr_code];
    }
}