diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/wiki/ImportarExperiencia/index.php | 59 | ||||
-rw-r--r-- | bin/wiki/ImportarExperiencia/noimport.php | 12 | ||||
-rw-r--r-- | bin/wiki/ImportarExperiencia/noseimport.php | 147 |
3 files changed, 204 insertions, 14 deletions
diff --git a/bin/wiki/ImportarExperiencia/index.php b/bin/wiki/ImportarExperiencia/index.php index 5ef48b39..26bd53a7 100644 --- a/bin/wiki/ImportarExperiencia/index.php +++ b/bin/wiki/ImportarExperiencia/index.php @@ -26,20 +26,30 @@ function ObtenerExperiencia($id) { if ($exp[0] == $id) { $titulo = $exp[1]; $estado = $exp[2]; - if ($estado === 'si') { - echo '<div class="alert alert-warning"> - <strong>CUIDADO!</strong> Esta experiencia ya fue importada con anterioridad. <b><a target="_blank" href="/Experiencia:'.$titulo.'">Ir a la pagina</a></b> - </div>'; - break; - } else { - echo '<div class="alert alert-warning"> - <strong>CUIDADO!</strong> Esta experiencia ya fue procesada y omitida con anterioridad. - </div>'; - break; - } + break; } } + if ($estado == 'si') { + echo '<div class="alert alert-warning"> + <strong>CUIDADO!</strong> Esta experiencia ya fue importada con anterioridad. <b><a target="_blank" href="/Experiencia:'.$titulo.'">Ir a la pagina</a></b> + </div>'; + } else { + if ($estado == 'no') { + echo '<div class="alert alert-danger"> + <strong>CUIDADO!</strong> Esta experiencia ya fue procesada y omitida con anterioridad. + </div>'; + + } else { + echo '<div class="alert alert-warning"> + <strong>ATENTI!</strong> Esta experiencia fue analizada y no se determinó si cumplía el criterio. + </div>'; + + } + } + + + # Carga datos de experiencia $strJsonFileContents = file_get_contents("export-mapa.json"); $array_experiencia = json_decode($strJsonFileContents, true); @@ -91,13 +101,30 @@ function ObtenerExperiencia($id) { <input value="Si no cumple los critrios, hay que omitirla" type="text" class="form-control" placeholder='' readonly> <span class="input-group-btn"> - <button class="btn btn-warning" type="submit">NO Importar (excluir)</button> + <button class="btn btn-danger" type="submit">NO Importar (excluir)</button> + </span> + </div><!-- /input-group --> + </div><!-- /.col-lg-6 --> + </div><!-- /.row --> + </form> + <form action="noseimport.php" method="post" class="form-horizontal" id="xxx"> + <div class="row"> + <div class="col-lg-12"> + <div class="input-group col-lg-10"> + <input value='<?php echo $id; ?>' name="uid" type="text" class="form-control" placeholder='' style='display:none;'> + <input value='<?php echo $titulo; ?>' name="titulo" type="text" class="form-control" placeholder='' style='display:none;'> + + <input value="Si no está claro si cumple los criterios, marcarla como en duda" type="text" class="form-control" placeholder='' readonly> + <span class="input-group-btn"> + <button class="btn btn-warning" type="submit">Marcar como dudosa</button> </span> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> </div><!-- /.row --> </form> + + <br><hr> <?php @@ -244,10 +271,14 @@ function accessProtected($obj, $prop) { $file = fopen('procesados.log', 'r'); while (($line = fgetcsv($file)) !== FALSE) { - if ($line[2] === 'si') { // diferencia si esta importado o omitido + if ($line[2] === 'si') { // diferencia si esta importado $collect[] = "<tr><th scope='row'>$line[0]</th><td>$line[1]</td><td><a target='_blank' href='/Experiencia:$line[1]'>/Experiencia:$line[1]</a></td></tr>"; } else { - $collect[] = "<tr class='danger'><th scope='row'>$line[0]</th><td>$line[1]</td><td><b>No importado</b></td></tr>"; + if ($line[2] === 'no') { // diferencia si ya se marco como omitido o aun esta en duda + $collect[] = "<tr class='danger'><th scope='row'>$line[0]</th><td>$line[1]</td><td><b>No importado</b></td></tr>"; + } else { + $collect[] = "<tr class='warning'><th scope='row'>$line[0]</th><td>$line[1]</td><td><b>EN DUDA</b> <a href='?id=$line[0]'>[Revisar]</a></td></tr>"; + } } } fclose($file); diff --git a/bin/wiki/ImportarExperiencia/noimport.php b/bin/wiki/ImportarExperiencia/noimport.php index 1f22bba9..5b3b42fc 100644 --- a/bin/wiki/ImportarExperiencia/noimport.php +++ b/bin/wiki/ImportarExperiencia/noimport.php @@ -15,6 +15,7 @@ function Omitir($uid, $titulo) { $exp = explode(',',$line); if ($exp[0] == $uid) { $existe = TRUE; + $lineNumber = $lineNumber; break; } } @@ -24,6 +25,17 @@ function Omitir($uid, $titulo) { $estado = 'no'; $salida = "$uid,$titulo,$estado\r\n"; file_put_contents($file, $salida, FILE_APPEND); + } else { + # Si ya estaba en el log, cambio su estado + $fileName = 'procesados.log'; + $estado = 'no'; + $salida = "$uid,$titulo,$estado\r\n"; + // Load file into array + $contents = file($fileName); + // Replace line + $contents[$lineNumber] = $salida; + // Implode and save + file_put_contents($fileName, implode('',$contents)); } $proximo = $uid + 1; diff --git a/bin/wiki/ImportarExperiencia/noseimport.php b/bin/wiki/ImportarExperiencia/noseimport.php new file mode 100644 index 00000000..4d3fa8bd --- /dev/null +++ b/bin/wiki/ImportarExperiencia/noseimport.php @@ -0,0 +1,147 @@ +<?php +# ---- +# Copyright (C) 2013-2020 - Reevo Project (http://reevo.org) +# License: Affero GPL version 3 - http://www.gnu.org/licenses/agpl.html +# ES: Este script importa los datos de usuario desde el perfil de Elgg hacia la paginade usuario en MW +# ---- + +$uid = $_POST['uid']; +$titulo = $_POST['titulo']; + +function Omitir($uid, $titulo) { + $lines = file('./procesados.log'); + $existe = FALSE; + foreach ($lines as $lineNumber => $line) { + $exp = explode(',',$line); + if ($exp[0] == $uid) { + $existe = TRUE; + break; + } + } + if ($existe === FALSE) { + # Solo lo agrego al log si antes no estaba + $file = 'procesados.log'; + $estado = 'nose'; + $salida = "$uid,$titulo,$estado\r\n"; + file_put_contents($file, $salida, FILE_APPEND); + } else { + # Si ya estaba en el log, cambio su estado + $fileName = 'procesados.log'; + $estado = 'nose'; + $salida = "$uid,$titulo,$estado\r\n"; + // Load file into array + $contents = file($fileName); + // Replace line + $contents[$lineNumber] = $salida; + // Implode and save + file_put_contents($fileName, implode('',$contents)); + } + + $proximo = $uid + 1; + $html = '<br/><p>No se importó y se marcó como dudosa: '.$titulo.' ('.$uid.')</p><br/> + <a href="/ImportarExperiencia/?id='.$proximo.'" class="btn btn-secondary active" role="button" aria-pressed="true">Importar siguiente experiencia</a> + <a href="/ImportarExperiencia/" class="btn btn-warning active" role="button" aria-pressed="true">Importar otra experiencia</a>'; + + return $html; +} +?> + + + +<!DOCTYPE html> +<html lang="en"> + <head> + <!-- ================================================== --> + <meta charset="UTF-8"> + <!-- ================================================== --> + <!-- Optional support for older (IE9 or older) Microsoft browsers: --> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <!-- ================================================== --> + <title>REEVO - Importar Experiencia</title> + <!-- ================================================== --> + <!-- Bootstrap CSS: --> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> + <link rel="stylesheet" href="../bootstrap.min.css"/> + <!-- ================================================== --> + <!-- Bootstrap CSS optional theme: --> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"> + <link rel="stylesheet" href="../bootstrap-theme.min.css"/> + <!-- ================================================== --> + <!-- Optional Font Awesome library: --> + <link rel="stylesheet" href="https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css"/> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/> + <link rel="stylesheet" href="../font-awesome.min.css"/> + <!-- + Font Awesome attribution is appreciated, but not required, as of version 3.0: "Font Awesome by Dave Gandy - http://fontawesome.io". + Font Awesome CDN: https://fontawesomecdn.com/ + Font Awesome cheat sheet: http://fontawesome.io/cheatsheet/ + Font Awesome examples: http://fontawesome.io/examples/ + Font Awesome icons: http://fontawesome.io/icons/ + --> + <!-- ================================================== --> + <style> + * {/*INCLUDE BORDER AND PADDING WITHIN HEIGHT AND WIDTH*/ + box-sizing: border-box; + } + article, aside, figure, footer, header, main, nav, section {/*BACKWARD COMPATIBILITY*/ + display: block; + } + blockquote,body,button,code,div,footer,h1,h2,h3,h4,h5,h6,html,i,img,li,.nowrap,ol,p,pre,.row,ul {/*CSS RESET*/ + margin:0; + max-width: 100%; + padding:0; + word-wrap: break-word; + } + unknown-element-name {/*UNKNOWN ELEMENT*/ + display: block; + } + + pre { + white-space: pre-wrap; /* Since CSS 2.1 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + } + </style> + </head> + <body> + <div class="panel panel-default col-md-8 col-md-offset-2"> + <div class="panel-body"> + + <h1>Experiencia en duda</h1> + + <?php echo Omitir($uid,$titulo);?> + + </body> + <!-- ================================================== --> + <!-- JavaScript at bottom for faster page loading. --> + <!-- ================================================== --> + <!-- jQuery library: --> + <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> --> + <!-- <script src="js/bootstrap.min.js"></script> --> + <!-- ================================================== --> + <!-- jQuery library: --> + <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js"></script> + <script type="application/javascript">window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js">\x3C/script>')</script> + <script type="application/javascript">window.jQuery || document.write('<script src="../jquery.min.js">\x3C/script>')</script> + <script> + $(document).ready(function(){ + }); + </script> + <!-- ================================================== --> + <!-- Bootstrap JavaScript library: --> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> + <script type="application/javascript">$.fn.modal || document.write('<script src="../bootstrap.min.js">\x3C/script>')</script> + <!-- ================================================== --> + <!-- Bootstrap hack for Windows 8 IE10 viewport Surface/desktop bug (local fall-back) --> + <script src="../ie10-viewport-bug-workaround.js"></script> + <!-- ================================================== --> + <!-- Optional support for handling unknown elements in older browsers: --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> + <script src="/js/html5shiv.js"></script> + <![endif]--> + <!-- ================================================== --> +</html> |