Exemple #1
0
function doBrowseTermsByDate()
{
    global $MONTHS;
    $sql = SQLtermsByDate();
    $rows .= '<table class="contenido" cellpadding="0" cellspacing="0" summary="' . ucfirst(LABEL_auditoria) . '">';
    $rows .= '<thead>';
    $rows .= '<tr>';
    $rows .= '<th colspan="3" class="titulo_tabla">' . ucfirst(LABEL_auditoria) . '</th>';
    $rows .= '</tr>';
    $rows .= '<tr>';
    $rows .= '<th>' . ucfirst(LABEL_ano) . '</th>';
    $rows .= '<th>' . ucfirst(LABEL_mes) . '</th>';
    $rows .= '<th>' . ucfirst(LABEL_Terminos) . '</th>';
    $rows .= '</tr>';
    $rows .= '</thead>';
    $rows .= '<tbody>';
    while ($array = mysqli_fetch_array($sql[datos])) {
        $fecha_termino = do_fecha($array[cuando]);
        $rows .= '<tr>';
        $rows .= '<td class="centrado">' . $array[years] . '</td>';
        $rows .= '<td class="centrado"><a href="sobre.php?m=' . $array[months] . '&y=' . $array[years] . '" title="' . LABEL_verDetalle . $fecha_termino[descMes] . '">' . $fecha_termino[descMes] . '</a></td>';
        $rows .= '<td class="centrado">' . $array[cant] . '</td>';
        $rows .= '</tr>';
        $TotalTerminos += $array[cant];
    }
    $rows .= '</tbody>';
    $rows .= '<tfoot>';
    $rows .= '<tr>';
    $rows .= '<td colspan="2">' . ucfirst(LABEL_TotalTerminos) . '</td>';
    $rows .= '<td>' . $TotalTerminos . '</td>';
    $rows .= '</tr>';
    $rows .= '</tfoot>';
    $rows .= '</table>        ';
    return $rows;
}
function HTMLformAdvancedTermReport($array)
{
    global $CFG;
    $LABEL_Termino = ucfirst(LABEL_Termino);
    $LABEL_esNoPreferido = ucfirst(LABEL_esNoPreferido);
    $LABEL_CODE = ucfirst(LABEL_CODE);
    $LABEL_NOTE = ucfirst(LABEL_nota);
    $LABEL_TARGET_TERM = ucfirst(LABEL_TargetTerm);
    $LABEL_haveEQ = LABEL_haveEQ;
    $LABEL_nohaveEQ = LABEL_nohaveEQ;
    $LABEL_start = LABEL_start;
    $LABEL_end = LABEL_end;
    $LABEL_equalThisWord = LABEL_equalThisWord;
    $arrayVocabStats = ARRAYresumen($_SESSION["id_tesa"], "G", "");
    $arrayWS = array("t#{$LABEL_Termino}");
    if ($arrayVocabStats["cant_up"] > 0) {
        array_push($arrayWS, "uf#{$LABEL_esNoPreferido}");
    }
    //Notes
    if ($arrayVocabStats["cant_notas"] > 0) {
        array_push($arrayWS, "n#{$LABEL_NOTE}");
        $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()) {
            if ($array[cant] > 0) {
                $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"];
                $varNoteType .= ' (' . $array["cant"] . ')';
                array_push($arrayNoteType, $varNoteType);
            }
        }
    }
    //target vocabularies
    if ($arrayVocabStats["cant_term2tterm"]) {
        $sql = SQLtargetVocabulary("1");
        $array_vocabularios = array();
        while ($array = $sql->FetchRow()) {
            //vocabularios que no sean el vocabulario principal
            array_push($array_vocabularios, $array[tvocab_id] . '#' . FixEncoding($array[tvocab_label]));
        }
    }
    //Evaluar si hay top terms
    $sqlTopTerm = SQLverTopTerm();
    if (SQLcount($sqlTopTerm) > 0) {
        while ($arrayTopTerms = $sqlTopTerm->FetchRow()) {
            $formSelectTopTerms[] = $arrayTopTerms["tema_id"] . '#' . $arrayTopTerms[tema];
        }
    }
    //Evaluar si hay terminos
    $sqlTermsByDates = SQLtermsByDate();
    if (SQLcount($sqlTermsByDates) > 0) {
        global $MONTHS;
        while ($arrayTermsByDates = $sqlTermsByDates->FetchRow()) {
            //normalizacion de fechas
            $arrayTermsByDates[months] = strlen($arrayTermsByDates[months]) == 1 ? '0' . $arrayTermsByDates[months] : $arrayTermsByDates[months];
            $formSelectByDate[] = $arrayTermsByDates["years"] . '-' . $arrayTermsByDates["months"] . '#' . $MONTHS["{$arrayTermsByDates['months']}"] . '/' . $arrayTermsByDates["years"] . ' (' . $arrayTermsByDates["cant"] . ')';
        }
    }
    //internal reference vocabularies
    $sql = SQLdatosVocabulario();
    if (SQLcount($sql) > '1') {
        //Hay vobularios de referencia
        $array_ivocabularios = array();
        while ($array = $sql->FetchRow()) {
            if ($array[vocabulario_id] !== '1') {
                //vocabularios que no sean el vocabulario principal
                array_push($array_ivocabularios, $array[vocabulario_id] . '#' . $array[titulo]);
            }
        }
    }
    $rows = '<form class="form-horizontal" role="form" name="advancedreport" action="index.php#csv" method="get">
<fieldset>

<!-- Form Name -->
<legend>' . ucfirst(LABEL_FORM_advancedReport) . '</legend>';
    if (SQLcount($sqlTopTerm) > 0) {
        $rows .= '<!-- Select Basic -->
<div class="form-group">
  <label class="col-md-4 control-label" for="hasTopTerm">' . ucfirst(LABEL_TopTerm) . '</label>
  <div class="col-md-5">
    <select id="hasTopTerm" name="hasTopTerm" class="form-control">
		<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
		' . doSelectForm($formSelectTopTerms, $_GET["hasTopTerm"]) . '
    </select>
  </div>
</div>';
    }
    if ($arrayVocabStats["cant_notas"] > 0) {
        $rows .= '<!-- Select Basic -->
<div class="form-group">
  <label class="col-md-4 control-label" for="hasNote">' . ucfirst(LABEL_FORM_haveNoteType) . '</label>
  <div class="col-md-4">
    <select id="hasNote" name="hasNote" class="form-control">
		<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
		' . doSelectForm($arrayNoteType, $_GET["hasNote"]) . '
    </select>
  </div>
</div>';
    }
    $rows .= '<!-- Select Basic -->
<div class="form-group">
  <label class="col-md-4 control-label" for="fromDate">' . ucfirst(LABEL_DesdeFecha) . '</label>
  <div class="col-md-3">
    <select id="fromDate" name="fromDate" class="form-control">
		<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
		' . doSelectForm($formSelectByDate, $_GET["fromDate"]) . '    </select>
  </div>
</div>';
    //target vocabularies
    if ($arrayVocabStats["cant_term2tterm"]) {
        $rows .= '<!-- Select Basic -->
<div class="form-group">
  <label class="col-md-4 control-label" for="csv_tvocab_id">' . ucfirst(LABEL_TargetTerms) . '</label>
  <div class="col-md-3">
    <select id="csv_tvocab_id" name="csv_tvocab_id" class="form-control">
		<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
		' . doSelectForm($array_vocabularios, $_GET["csv_tvocab_id"]) . '
    </select>
  </div>
  <div class="col-md-3">
    <select id="mapped" name="mapped" class="form-control">
		' . doSelectForm(array("y#{$LABEL_haveEQ}", "n#{$LABEL_nohaveEQ}"), $_GET["mapped"]) . '
    </select>
  </div>
</div>';
    }
    if (SQLcount($sql) > '1') {
        $rows .= '<!-- Select Basic -->
<div class="form-group">
  <label class="col-md-4 control-label" for="csv_itvocab_id">' . ucfirst(LABEL_vocabulario_referencia) . '</label>
  <div class="col-md-3">
    <select id="csv_itvocab_id" name="csv_itvocab_id" class="form-control">
		<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
		' . doSelectForm($array_ivocabularios, $_GET["csv_itvocab_id"]) . '
    </select>
  </div>
	<div class="col-md-3">
    <select id="int_mapped" name="int_mapped" class="form-control">
		' . doSelectForm(array("y#{$LABEL_haveEQ}", "n#{$LABEL_nohaveEQ}"), $_GET["int_mapped"]) . '
    </select>
  </div>
</div>';
    }
    //only for admin
    if ($_SESSION[$_SESSION["CFGURL"]][ssuser_nivel] == '1') {
        $sqlUsers = SQLdatosUsuarios();
        if (SQLcount($sqlUsers) > 1) {
            while ($arrayUsers = $sqlUsers->FetchRow()) {
                $formSelectUsers[] = $arrayUsers[id] . '#' . $arrayUsers[apellido] . ', ' . $arrayUsers[nombres];
            }
            $rows .= '<!-- Select Basic -->
		<div class="form-group">
		  <label class="col-md-4 control-label" for="byuser_id">' . ucfirst(MENU_Usuarios) . '</label>
		  <div class="col-md-4">
		    <select id="user_id" name="byuser_id" class="form-control">
				<option value="">' . ucfirst(LABEL_FORM_nullValue) . '</option>
				' . doSelectForm($formSelectUsers, $_GET["byuser_id"]) . '
		    </select>
		  </div>
		</div>';
        }
    }
    $rows .= '<div class="form-group">
  <label class="col-md-4 control-label" for="w_string">' . ucfirst(LABEL_haveWords) . '</label>
  <div class="col-md-3">
    <select id="w_string" name="w_string" class="form-control">
		' . doSelectForm(array("x#{$LABEL_equalThisWord}", "s#{$LABEL_start}", "e#{$LABEL_end}"), $_GET["w_string"]) . '
    </select>
  </div>
	<div class="col-md-3">
		<input id="csvstring" name="csvstring" class="form-control" placeholder="' . LABEL_haveWords . '" type="text">
  </div>
</div>


<!--  Checkboxes (inline) -->
<div class="form-group">
  <label class="col-md-4 control-label" for="csv_encodeAdvance">' . ucfirst(LABEL_encode) . ' latin1</label>
  <div class="col-md-4">
      <input name="csv_encode" id="csv_encodeAdvance" value="latin1" type="checkbox">
  </div>
</div>

<!-- Button -->
<div class="form-group">
<div class="text-center">
	<input type="submit" class="btn btn-primary" id="boton" name="boton" value="' . ucfirst(LABEL_Guardar) . '"/>
	</div>
</div>
<input type="hidden"  name="mod" id="mod" value="csv"/><input type="hidden"  name="task" id="mod" value="csv1"/>
</fieldset>
</form>
';
    return $rows;
}
function HTMLformAdvancedSearch($array)
{
    global $CFG;
    $rows .= ' <fieldset>
    <legend>' . ucfirst(LABEL_BusquedaAvanzada) . '</legend>
   <form class="formdiv" name="advancedsearch" action="index.php#xstring" method="get" onsubmit="return checkrequired(this)">';
    $LABEL_Termino = ucfirst(LABEL_Termino);
    $LABEL_esNoPreferido = ucfirst(LABEL_esNoPreferido);
    $LABEL_CODE = ucfirst(LABEL_CODE);
    $rows .= '<div><label for="ws" accesskey="f">' . ucfirst(LABEL_QueBuscar) . '</label>';
    $rows .= '<select id="ws" name="ws">';
    $arrayWS = $CFG["_USE_CODE"] == '1' ? array("t#{$LABEL_Termino}", "uf#{$LABEL_esNoPreferido}", "c#{$LABEL_CODE}") : array("t#{$LABEL_Termino}", "uf#{$LABEL_esNoPreferido}");
    $rows .= doSelectForm($arrayWS, "{$_GET['ws']}");
    $rows .= '</select>';
    //	$rows.='<input name="isUF" type="checkbox" id="isUF" value="1" '.do_check('1',$_GET[isUF],"checked").'/>';
    $rows .= '</div>';
    $rows .= '<div><label for="xstring" accesskey="s">' . ucfirst(LABEL_BuscaTermino) . '</label>';
    $rows .= '<input name="xstring" type="text" id="xstring" size="25" maxlength="50" value="' . $_GET[xstring] . '"/>';
    $rows .= '</div>';
    $rows .= '<div><label for="isExactMatch" accesskey="f">' . ucfirst(LABEL_esFraseExacta) . '</label>';
    $rows .= '<input name="isExactMatch" type="checkbox" id="isExactMatch" value="1" ' . do_check('1', $_GET[isExactMatch], "checked") . '/>';
    $rows .= '</div>';
    //Evaluar si hay top terms
    $sqlTopTerm = SQLverTopTerm();
    if ($sqlTopTerm[cant]) {
        while ($arrayTopTerms = mysqli_fetch_array($sqlTopTerm[datos])) {
            $formSelectTopTerms[] = $arrayTopTerms[tema_id] . '#' . $arrayTopTerms[tema];
        }
        $rows .= '<div><label for="hasTopTerm" accesskey="t">' . ucfirst(LABEL_TopTerm) . '</label>';
        $rows .= '<select id="hasTopTerm" name="hasTopTerm">';
        $rows .= '<option value="">' . ucfirst(LABEL_Todos) . '</option>';
        $rows .= doSelectForm($formSelectTopTerms, "{$_GET['hasTopTerm']}");
        $rows .= '</select>';
        $rows .= '</div>';
    }
    //Evaluar si hay notas
    $resumen = ARRAYresumen($_SESSION[id_tesa], "G", "");
    if (is_array($resumen["cant_notas"])) {
        $arrayTiposNotas = array('NA' => LABEL_NA, 'NH' => LABEL_NH, 'NC' => LABEL_NC, 'NB' => LABEL_NB, 'NP' => LABEL_NP);
        foreach ($resumen["cant_notas"] as $knotas => $vnotas) {
            $formSelectTipoNota[] = $knotas . '#' . $arrayTiposNotas[$knotas] . ' (' . $vnotas . ')';
        }
        $rows .= '<div><label for="hasNote" accesskey="n">' . ucfirst(LABEL_tipoNota) . '</label>';
        $rows .= '<select id="hasNote" name="hasNote">';
        $rows .= '<option value="">' . ucfirst(LABEL_Todos) . '</option>';
        $rows .= doSelectForm($formSelectTipoNota, "{$_GET['hasNote']}");
        $rows .= '</select>';
        $rows .= '</div>';
    }
    //Evaluar si hay terminos
    $sqlTermsByDates = SQLtermsByDate();
    if ($sqlTermsByDates[cant]) {
        global $MONTHS;
        while ($arrayTermsByDates = mysqli_fetch_array($sqlTermsByDates[datos])) {
            //normalizacion de fechas
            $arrayTermsByDates[months] = strlen($arrayTermsByDates[months]) == 1 ? '0' . $arrayTermsByDates[months] : $arrayTermsByDates[months];
            $formSelectByDate[] = $arrayTermsByDates[years] . '-' . $arrayTermsByDates[months] . '#' . $MONTHS["{$arrayTermsByDates['months']}"] . '/' . $arrayTermsByDates[years] . ' (' . $arrayTermsByDates[cant] . ')';
        }
        $rows .= '<div><label for="fromDate" accesskey="d">' . ucfirst(LABEL_DesdeFecha) . '</label>';
        $rows .= '<select id="fromDate" name="fromDate">';
        $rows .= '<option value="">' . ucfirst(LABEL_Todos) . '</option>';
        $rows .= doSelectForm($formSelectByDate, "{$_GET['fromDate']}");
        $rows .= '</select>' . ucfirst(LABEL_mes) . '/' . ucfirst(LABEL_ano);
        $rows .= '</div>';
    }
    //Evaluar si hay candidatos
    $sqlTermsByDeep = SQLTermDeep();
    if ($sqlTermsByDeep[cant] > 1) {
        while ($arrayTermsByDeep = mysqli_fetch_array($sqlTermsByDeep[datos])) {
            $formSelectByDeep[] = $arrayTermsByDeep[tdeep] . '#' . $arrayTermsByDeep[tdeep] . ' (' . $arrayTermsByDeep[cant] . ')';
        }
        $rows .= '<div><label for="termDeep" accesskey="e">' . ucfirst(LABEL_ProfundidadTermino) . '</label>';
        $rows .= '<select id="termDeep" name="termDeep">';
        $rows .= '<option value="">' . ucfirst(LABEL_Todos) . '</option>';
        $rows .= doSelectForm($formSelectByDeep, "{$_GET['termDeep']}");
        $rows .= '</select>';
        $rows .= '</div>';
    }
    $rows .= '<div class="submit_form" align="center">';
    $rows .= '<input type="submit"  id="boton" name="boton" value="' . LABEL_Enviar . '"/>';
    $rows .= '<input type="hidden"  name="xsearch" id="xsearch" value="1"/>';
    $rows .= '<input type="button"  name="cancelar" type="button" onClick="location.href=\'index.php\'" value="' . ucfirst(LABEL_Cancelar) . '"/>';
    $rows .= '</div>';
    $rows .= '</form>';
    $rows .= '  </fieldset>';
    if ($_GET[boton] == LABEL_Enviar) {
        $rows .= HTMLadvancedSearchResult($_GET);
    }
    return $rows;
}
function doBrowseTermsByDate()
{
    global $MONTHS;
    $sql = SQLtermsByDate();
    $rows .= '<div class="table-responsive"> ';
    $rows .= '<table class="table table-striped table-bordered table-condensed table-hover" summary="' . ucfirst(LABEL_auditoria) . '">';
    $rows .= '<thead>';
    $rows .= '<tr>';
    $rows .= '<th colspan="3" class="titulo_tabla">' . ucfirst(LABEL_auditoria) . '</th>';
    $rows .= '</tr>';
    $rows .= '<tr>';
    $rows .= '<th>' . ucfirst(LABEL_ano) . '</th>';
    $rows .= '<th>' . ucfirst(LABEL_mes) . '</th>';
    $rows .= '<th>' . ucfirst(LABEL_Terminos) . '</th>';
    $rows .= '</tr>';
    $rows .= '</thead>';
    $rows .= '<tbody>';
    while ($array = $sql->FetchRow()) {
        $fecha_termino = do_fecha($array[cuando]);
        $rows .= '<tr>';
        $rows .= '<td class="centrado">' . $array[years] . '</td>';
        $rows .= '<td class="centrado"><a href="sobre.php?m=' . $array[months] . '&y=' . $array[years] . '" title="' . LABEL_verDetalle . $fecha_termino[descMes] . '">' . $fecha_termino[descMes] . '</a></td>';
        $rows .= '<td class="centrado">' . $array["cant"] . '</td>';
        $rows .= '</tr>';
        $TotalTerminos += $array["cant"];
    }
    $rows .= '</tbody>';
    $rows .= '<tfoot>';
    $rows .= '<tr>';
    $rows .= '<td colspan="2">' . ucfirst(LABEL_TotalTerminos) . '</td>';
    $rows .= '<td>' . $TotalTerminos . '</td>';
    $rows .= '</tr>';
    $rows .= '</tfoot>';
    $rows .= '</table>        ';
    $rows .= '</div>        ';
    return $rows;
}