示例#1
0
function ARRAYresumen($id_tesa, $tipo, $idUser = "")
{
    $sql_cant_rel = SQLcantTR($tipo, $idUser);
    while ($cant_rel = mysqli_fetch_row($sql_cant_rel[datos])) {
        if ($cant_rel[0] == '2') {
            $cant_terminos_relacionados = $cant_rel[1];
        } elseif ($cant_rel[0] == '4') {
            $cant_terminos_up = $cant_rel[1];
        }
    }
    $sql_cant_term = SQLcantTerminos($tipo, $idUser);
    $cant_term = mysqli_fetch_array($sql_cant_term[datos]);
    $sqlCantNotas = SQLcantNotas();
    while ($arrayCantNotas = mysqli_fetch_array($sqlCantNotas[datos])) {
        $cant_notas[$arrayCantNotas[tipo_nota]] = $arrayCantNotas[cant];
    }
    $resumen = array("cant_rel" => $cant_terminos_relacionados, "cant_up" => $cant_terminos_up, "cant_total" => $cant_term[cant], "cant_candidato" => $cant_term[cant_candidato], "cant_rechazado" => $cant_term[cant_rechazado], "cant_notas" => $cant_notas);
    return $resumen;
}
function SQLreportNullNotes($t_note)
{
    global $DBCFG;
    if ($t_note == 0) {
        $sql = SQL("select", "t.tema_id, t.tema as term, t.cuando as date_created, t.cuando_final as date_modicated,t.isMetaTerm,\r\n\t\t\t\t\t\te.value as status_term\r\n\t\t\t\t\t\tfrom {$DBCFG['DBprefix']}values e,{$DBCFG['DBprefix']}tema t\r\n\t\t\t\t\t\tleft join {$DBCFG['DBprefix']}notas n on n.id_tema=t.tema_id\r\n\t\t\t\t\t\twhere\r\n\t\t\t\t\t\te.value_id=t.estado_id\r\n\t\t\t\t\t\tand n.id is null\r\n\t\t\t\t\t\torder by t.tema");
    } else {
        //check if is valid note type
        $sqlNoteType = SQLcantNotas();
        $arrayNoteType = array();
        while ($array = $sqlNoteType->FetchRow()) {
            if ($array[cant] > 0) {
                array_push($arrayNoteType, $array["tipo_nota"]);
            }
        }
        if (in_array($t_note, $arrayNoteType)) {
            $sql = SQL("select", "t.tema_id, t.tema as term, t.cuando as date_created, t.cuando_final as date_modicated,t.isMetaTerm,\r\n\t\t\t\t\t\t\te.value as status_term\r\n\t\t\t\t\t\t\tfrom {$DBCFG['DBprefix']}values e,{$DBCFG['DBprefix']}tema t\r\n\t\t\t\t\t\t\tleft join {$DBCFG['DBprefix']}notas n on n.id_tema=t.tema_id\r\n\t\t\t\t\t\t\tand n.tipo_nota='{$t_note}'\r\n\t\t\t\t\t\t\twhere\r\n\t\t\t\t\t\t\te.value_id=t.estado_id\r\n\t\t\t\t\t\t\tand n.id is null\r\n\t\t\t\t\t\t\torder by t.tema");
        } else {
            //empy set
            $sql = SQL("select", "'no_data'");
        }
    }
    return $sql;
}
        $hidden .= '<input type="hidden" name="taskNota" value="edit" />';
        $buttons .= '<button type="submit" class="btn btn-primary" name="guardarCambioNota" value="' . LABEL_Cambiar . '"/>' . ucfirst(LABEL_Cambiar) . '</button>';
        $buttons .= '<a href="index.php?tema=' . $metadata["arraydata"]["tema_id"] . '&amp;idTema=' . $metadata["arraydata"]["tema_id"] . '&amp;idNota=' . $arrayNota["idNota"] . '&amp;taskNota=rem" role="button" class="btn btn-danger" name="eliminarNota" title="' . LABEL_EliminarNota . '"/>' . ucfirst(LABEL_EliminarNota) . '</a>';
        $buttons .= '<button type="button" class="btn btn-default"  name="cancelar" type="button" onClick="location.href=\'index.php?tema=' . $metadata["arraydata"]["tema_id"] . '\'" value="' . ucfirst(LABEL_Cancelar) . '"/>' . ucfirst(LABEL_Cancelar) . '</button>';
    } else {
        $hidden .= '<input type="hidden" name="taskNota" value="alta" />';
        $buttons .= '<button type="submit" class="btn btn-primary" name="LABEL_Enviar" value="' . LABEL_Enviar . '"/>' . ucfirst(LABEL_Enviar) . '</button>';
        $buttons .= '<button type="button" class="btn btn-default"  name="cancelar" type="button" onClick="location.href=\'index.php?tema=' . $metadata["arraydata"]["tema_id"] . '\'" value="' . ucfirst(LABEL_Cancelar) . '"/>' . ucfirst(LABEL_Cancelar) . '</button>';
    }
}
$LabelNB = 'NB#' . LABEL_NB;
$LabelNH = 'NH#' . LABEL_NH;
$LabelNA = 'NA#' . LABEL_NA;
$LabelNP = 'NP#' . LABEL_NP;
$LabelNC = 'NC#' . LABEL_NC;
$sqlNoteType = SQLcantNotas();
$arrayNoteType = array();
while ($array = $sqlNoteType->FetchRow()) {
    $varNoteType = in_array($array["value_id"], array(8, 9, 10, 11, 15)) ? arrayReplace(array(8, 9, 10, 11, 15), array($LabelNA, $LabelNH, $LabelNB, $LabelNP, $LabelNC), $array["value_id"]) : $array["value_code"] . '#' . $array["value"];
    array_push($arrayNoteType, $varNoteType);
}
// Preparado de datos para el formulario ///
$arrayLang = array();
foreach ($CFG["ISO639-1"] as $langs) {
    array_push($arrayLang, "{$langs['0']}#{$langs['1']}");
}
//idioma de la nota
$arrayNota[lang_nota] = !$arrayNota[lang_nota] ? $_SESSION["CFGIdioma"] : $arrayNota[lang_nota];
?>
<div class="container" id="bodyText">
<a class="topOfPage" href="index.php?tema=<?php 
function HTMLformUserNotes()
{
    //ALTA
    if ($_POST['value'] != '' and $_POST['orden'] != '' and $_POST['alias'] != '' and $_POST['doAdmin'] == '') {
        $arrayValues = array("value" => $_POST['value'], "orden" => $_POST['orden'], "alias" => $_POST['alias']);
        $task = abm_userNotes("A", $arrayValues);
        if ($task[cant] > 0) {
            echo "<script>javascript:alert('" . ucfirst(LABEL_saved) . "');</script>";
        }
    }
    //MOD
    if ($_POST['doAdmin'] == 'modUserNotes') {
        $arrayValues = array("value" => $_POST['value'], "orden" => $_POST['orden'], "alias" => $_POST['alias']);
        $task = abm_userNotes("M", $arrayValues, $_POST['valueid']);
        if ($task[cant] > 0) {
            echo "<script>javascript:alert('" . ucfirst(LABEL_saved) . "');</script>";
        }
        $_POST['value'] = '';
        $_POST['orden'] = '';
        $_POST['alias'] = '';
        $_POST['ac'] = '';
    }
    //BAJA
    if ($_POST['doAdmin'] == 'deleteUserNotes') {
        $task = abm_userNotes("B", array(), $_POST['value']);
    }
    $sql = SQLcantNotas();
    $rows .= '<form id="morenotas" name="morenotas" method="POST" action="admin.php?vocabulario_id=list#morenotas">';
    $rows .= '<input type="hidden" name="doAdmin" id="doAdmin" value="">  ';
    $rows .= ' <input type="hidden" name="valueid" id="valueid"> ';
    $rows .= '<div class="table-responsive"> ';
    $rows .= '<h3>' . ucfirst(LABEL_configTypeNotes) . ' </h3>';
    $rows .= '<table class="table table-striped table-bordered table-condensed table-hover"  summary="' . ucfirst(LABEL_configTypeNotes) . '">';
    $rows .= '<thead>';
    $rows .= '<tr>';
    $rows .= ' <th>' . ucfirst(LABEL_tipoNota) . '</th>';
    $rows .= '<th>' . ucfirst(alias) . ':</th>';
    $rows .= '<th>' . ucfirst(orden) . '</th>';
    $rows .= '<th></th>';
    $rows .= '</tr>';
    $rows .= '<tr>';
    $rows .= '<th class="izq"><input type="text" name="value" id="value"/></td>';
    $rows .= '<th class="izq"><input type="text" name="alias" size="2" id="alias"/></td>';
    $rows .= '<th class="izq"><input type="text" name="orden" size="2"  id="orden"/></td>';
    $rows .= '<th><a onclick="envianota()" href="#"><strong>' . ucfirst(LABEL_Enviar) . '</strong></a></td>';
    $rows .= '</tr>';
    $rows .= ' </thead>';
    $rows .= ' <tbody>';
    while ($array = $sql->FetchRow()) {
        $i = ++$i;
        if (in_array($array["value_id"], array(8, 9, 10, 11, 15))) {
            $array["value"] = in_array($array["value_id"], array(8, 9, 10, 11)) ? arrayReplace(array(8, 9, 10, 11, 15), array(LABEL_NA, LABEL_NH, LABEL_NB, LABEL_NP, LABEL_NC), $array["value_id"]) : $array["value"];
            $rows .= '<tr>';
            $rows .= ' <td class="izq">' . $array["value"] . '</a></td>';
            $rows .= '<td>' . $array["value_code"] . '</td>';
            $rows .= '<td>' . $array["value_order"] . '</td>';
            $rows .= '<td>' . $array["cant"] . ' ' . LABEL_notes . '</td>';
            $rows .= '</tr>';
        } else {
            $rows .= '<tr>';
            $rows .= ' <td class="izq"><a title="' . $array["value"] . '"  href="javascript:recargaedit(\'' . $array["value"] . '\',\'' . $array["value_order"] . '\',\'' . $array["value_code"] . '\',\'' . $array["value_id"] . '\')">' . $array["value"] . '</a></td>';
            $rows .= '<td>' . $array["value_code"] . '</td>';
            $rows .= '<td>' . $array["value_order"] . '</td>';
            $rows .= $array["cant"] > 0 ? '<td>' . $array["cant"] . ' ' . LABEL_notes . '</td>' : '<td><a onclick=preparaborrado2(\'' . $array["value_id"] . '\') title="' . ucfirst(borrar) . '" href="#")><strong>' . ucfirst(borrar) . '</strong></a></td>';
            $rows .= '</tr>';
        }
    }
    $rows .= ' </tbody>';
    $rows .= '<tfoot>';
    $rows .= '<tr><td colspan="4">' . $i . '</th></tr>';
    $rows .= '</tfoot>';
    $rows .= '</table> </div>';
    $rows .= '</form>';
    return $rows;
}
function HTMLformNullNotesTermReport($array)
{
    global $CFG;
    $LabelNB = LABEL_NB;
    $LabelNH = LABEL_NH;
    $LabelNA = LABEL_NA;
    $LabelNP = LABEL_NP;
    $LabelNC = LABEL_NC;
    $rows .= '<form class="" role="form" name="NULLnotesreport" id="NULLnotesreport" action="index.php" method="get">';
    $rows .= '	<div class="row">
	    <div class="col-sm-12">
	        <legend>' . ucfirst(LABEL_FORM_NULLnotesTermReport) . '</legend>
	    </div>
	    <!-- panel  -->
			<div class="col-lg-7">
	        <div class="panel panel-default">
	            <div class="panel-body form-horizontal"><div class="panel-heading">' . ucfirst(MSG_FORM_NULLnotesTermReport) . '</div>';
    $sqlNoteType = SQLcantNotas();
    while ($ARRAYnoteType = $sqlNoteType->FetchRow()) {
        $i_note = ++$i_note;
        $varNoteType = in_array($ARRAYnoteType["value_id"], array(8, 9, 10, 11, 15)) ? arrayReplace(array(8, 9, 10, 11, 15), array($LabelNA, $LabelNH, $LabelNB, $LabelNP, $LabelNC), $ARRAYnoteType["value_id"]) : $ARRAYnoteType["value"];
        $rows .= '<div class="form-group">
		<div class="col-sm-4">
		<label for="note_type' . $ARRAYnoteType["value_id"] . '">' . $varNoteType . '</label>
		</div>
		<div class="col-sm-2">
		<input name="note_type_null" type="radio" id="note_type' . $ARRAYnoteType["value_id"] . '" value="' . $ARRAYnoteType["tipo_nota"] . '" />
			</div>
		</div>';
    }
    $rows .= '<div class="form-group">
	<div class="col-sm-4">
	<label for="note_typeNULL0">' . ucfirst(LABELnoNotes) . '</label>
	</div>
	<div class="col-sm-2">
	<input name="note_type_null" type="radio" id="note_typeNULL0" value="0" />
		</div>
	</div>';
    $rows .= '	<div class="form-group">
		  <label class="col-md-4 control-label" for="csv_encodeNotes">' . ucfirst(LABEL_encode) . ' latin1</label>
		  <div class="col-md-4">
		      <input name="csv_encode" id="csv_encodeNotes" value="latin1" type="checkbox">
		  </div>
		</div>';
    $rows .= '<div class="form-group">
							<div class="col-sm-12 text-center">
							<input type="submit" class="btn btn-primary" id="boton" name="boton" value="' . ucfirst(LABEL_Guardar) . '"/>
							</div>
					</div>';
    $rows .= '				</div>
					</div>
			</div>
		</div> <!-- / panel  -->';
    $rows .= '<input type="hidden"  name="mod" id="mod" value="csv"/>';
    $rows .= '<input type="hidden"  name="task" id="simpleMappedTermReport" value="csv14"/>';
    $rows .= '</form>';
    return $rows;
}
 $error = array();
 if ($ok && utf8_encode(utf8_decode($content_text)) == $content_text) {
     $content_text = NULL;
 } else {
     $ok = false;
     $error[] = "ERROR : encodage of import file must be UTF-8";
     // sinon faire conversion automatique
 }
 if ($_POST['taskAdmin'] == 'importTag' && file_exists($_FILES["file"]["tmp_name"])) {
     $src_txt = $_FILES["file"]["tmp_name"];
     //tag separator
     $separador = ":";
     $t_relacion = '';
     $tabulador = '====';
     //get for notes tag
     $sqlNotesTag = SQLcantNotas();
     $arrayTiposNotas = array();
     while ($arrayNotesTag = $sqlNotesTag->FetchRow()) {
         array_push($arrayTiposNotas, $arrayNotesTag["value_code"]);
     }
     //admited tags
     $arrayTiposTermino = array("BT", "NT", "RT", "UF", "Use", "CODE", $tabulador);
     //lang
     $thes_lang = $_SESSION["CFGIdioma"];
     /*
     Procesamiento del file
     */
     $fd = fopen($src_txt, "r");
     while (($contents = fgets($fd)) !== false) {
         $rw = trim($contents);
         $rwTerms = explode($separador, $rw);