Ejemplo n.º 1
0
function index($columnas, $vista)
{
    extract(recoger_parametros($columnas));
    $params = compact('columnas', 'columna', 'criterio', 'orden', 'sentido');
    formulario_busqueda($params);
    $con = conectar();
    list($where, $pqp) = filtro($columnas, $columna, $criterio);
    $res = pg_query_params($con, "select *\n                                    from {$vista}\n                                   where {$where}\n                                order by {$orden} {$sentido}", $pqp);
    $params['res'] = $res;
    generar_resultado($params);
    ?>

    <a href="insertar.php"><input type="button" value="Insertar" /></a><?php 
}
Ejemplo n.º 2
0
function listadoventa($query, $pagina, $siguiente)
{
    filtro($pagina);
    echo '<table name = "venta">';
    echo '<tr>';
    echo '<th>ID_PERSONA</th>';
    echo '<th>ISBN</th>';
    echo '<th>Descripcion</th>';
    echo '<th>Elegir libro</th>';
    echo '</tr>';
    $result = mysql_query($query);
    if ($result) {
        $isbn = 0;
        $id = 0;
        $long = -1000;
        $_POST[$long] = '?';
        echo '<form action= "' . $siguiente . '"method = "POST">';
        $odd = True;
        while ($row = mysql_fetch_assoc($result)) {
            echo $odd == True ? '<tr class = "odd_row">' : '<tr class = "even_row">';
            $odd = !$odd;
            $_POST['isbn' . $isbn] = $row['isbn'];
            $_POST['id' . $id] = $row['id_vendedor'];
            echo '<input name ="isbn' . $isbn . '" type ="hidden" value = "' . $_POST['isbn' . $isbn] . '"/>';
            echo '<input name ="id' . $id . '" type ="hidden" value = "' . $_POST['id' . $id] . '"/> ';
            echo '<input name = "Addrow" type = "hidden"/>';
            echo '<td>' . $row['id_vendedor'] . '</td>';
            echo '<td>' . $row['isbn'] . '</td>';
            echo '<td>' . $row['descripcion'] . '</td>';
            echo '<td><input name = "' . $long . '" type = "submit" value = "Vender libro"/></td>';
            echo '<tr>';
            $id = $id + 1;
            $long = $long + 1;
            $isbn = $isbn + 1;
        }
        echo '</form>';
        mysql_free_result($result);
    } else {
        echo 'No ha funcionado la consulta' . mysql_error();
    }
}
Ejemplo n.º 3
0
function index($columnas, $vista, $modulo, $bol = false)
{
    $res = pg_query("select * from {$vista}");
    $nfilas = pg_num_rows($res);
    $npags = ceil($nfilas / FPP);
    extract(recoger_parametros($columnas, $modulo, $npags));
    $params = compact('columnas', 'columna', 'criterio', 'orden', 'sentido', 'npag');
    formulario_busqueda($params);
    list($where, $pqp) = filtro($columnas, $columna, $criterio);
    $res = pg_query_params("select * from {$vista}\n                             where {$where}\n                          order by {$orden} {$sentido}\n                          limit " . FPP . "\n                          offset " . FPP . "*({$npag}-1)", $pqp);
    $params['npags'] = $npags;
    $params['res'] = $res;
    generar_resultado($params, $bol);
    if (!$bol) {
        ?>
        <a href="insertar.php"><input type="button" value="Insertar" /></a><?php 
    }
    if (es_admin()) {
        volver();
    }
}
Ejemplo n.º 4
0
 /**
  * MANGASTREAM VERSION
  * Eg. $obj->download('http://mangastream.com/read/one_piece_green/59213718/1');
  * @param string $manga_url
  */
 function download($manga_url)
 {
     if (urlParameters(6, $manga_url) == "end") {
         die;
     }
     $html = file_get_contents($manga_url);
     $doc = new DOMDocument();
     $doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement');
     @$doc->loadHTML($html);
     $doc->preserveWhiteSpace = false;
     $i = 0;
     /*BUSCAMOS EN EL DOCUMENTO EL NUMERO DE CAPITULO */
     $option = $doc->getElementsByTagName('option')->item($i);
     $chapter = $option->nodeValue;
     /*RECORREMOS EL DOCUMENTO HASTA ENCONTRAR LO QUE SERIA UNA CAPA AJUSTADA */
     do {
         $elem = $doc->getElementsByTagName('div')->item($i);
         $str = $elem->getAttribute('style');
         if (strstr($str, "position:relative")) {
             break;
         }
         $i++;
     } while ($i < 20);
     $ireal = $i;
     /*CUANDO LO TENEMOS PODEMOS CREAR UN ARREGLO CON TODOS LOS DATOS QUE NECESITAREMOS */
     $elem = $doc->getElementsByTagName('div')->item($i);
     $data[$i]['style'] = $elem->getAttribute('style');
     do {
         $i++;
         $elem = $doc->getElementsByTagName('div')->item($i);
         if ($elem->getAttribute('style') == "") {
             break;
         }
         $a = $elem->getElementsByTagName('a');
         $img = $elem->getElementsByTagName('img');
         $data[$i]['img'] = $img->item(0)->getAttribute('src');
         $data[$i]['style'] = $elem->getAttribute('style');
         $data[$i]['a'] = $a->item(0)->getAttribute('href');
     } while ($elem->getAttribute('style') != "");
     $imax = $i;
     $i = $ireal;
     /* En este punto solo tenemos los estilos de las capas que forman la imagen, la url de la siguiente pagina y el link a la imagen :-(
      * Filtraremos los style para conseguir width, height y las posiciones exactas top y left de cada imagen, la primera solo sirve de marco */
     $data[$i]['width'] = filtro("width", "px", $data[$i]['style']);
     $data[$i]['height'] = filtro("height", "px", $data[$i]['style']);
     for ($i++; $i < $imax; $i++) {
         $data[$i]['width'] = filtro("width", "px", $data[$i]['style']);
         $data[$i]['height'] = filtro("height", "px", $data[$i]['style']);
         $data[$i]['top'] = filtro("top", "px", $data[$i]['style']);
         $data[$i]['left'] = filtro("left", "px", $data[$i]['style']);
     }
     if (urlParameters(6, $manga_url) != "end") {
         //echo "<br>FILE_NAME 6: ".urlParameters(6, $manga_url)." <br>URLPARAMETERS DIR 4: ".urlParameters(4, $manga_url);
         $file = combine_data($data, $ireal, $imax, urlParameters(4, $manga_url) . "-" . $chapter, urlParameters(6, $manga_url));
         //echo "<br>http://mangastream.com".$data[$ireal+1]['a'];
         set_time_limit(20);
         $this->download("http://mangastream.com" . $data[$ireal + 1]['a']);
     } else {
         die;
     }
 }
/**
 * Muestra una lista de checkboxs con los valores del filtro.
 *
 * @param string $id ID del filtro.
 * @param array $filtro Los valores del filtro a mostrar.
 * @param string $titulo Titulo opcional para el filtro.
 */
function filtros($filtros)
{
    // verificamos que existan filtros.
    if (!empty($filtros) && is_array($filtros)) {
        $contador = 1;
        //usado para agregar filas.
        foreach ($filtros as $id => $filtro) {
            ?>

			<?php 
            if ($contador == 1) {
                ?>

				<div class="row">

			<?php 
            }
            ?>

			<div id="<?php 
            echo $id;
            ?>
" class="filtro col-sm-6"><?php 
            filtro($id, $filtro['valores'], $filtro['titulo']);
            ?>
</div>

			<?php 
            if ($contador == 2) {
                ?>

				</div>

				<?php 
                $contador = 1;
                // cerramos la fila y reiniciamos.
                ?>

			<?php 
            } elseif ($contador < 2) {
                ?>

				<?php 
                $contador += 1;
                ?>
					
			<?php 
            }
            ?>

		<?php 
        }
        ?>

	<?php 
    }
}