Exemplo n.º 1
0
function get_all_freelancer($conn)
{
    require 'DBconfig.php';
    require_once 'Proyecto.php';
    require_once 'Idioma.php';
    require_once 'Ciudad.php';
    require_once 'Profesion.php';
    $result = $conn->query('SELECT * FROM ' . $mysql_database . '.freelancer');
    $res = $result->fetch_row();
    $return = array();
    $campos = array("freelancer_id", "nombre", "correo", "disponibilidad", "rating", "facebook", "twitter", "instagram", "password", "celular", "competencias", "profesion_id", "ciudad_id");
    while (!is_null($res)) {
        $return[] = limpiar_freelancer($res, $campos);
        $res = $result->fetch_row();
    }
    $size = count($return);
    for ($i = 0; $i < $size; $i++) {
        $return[$i]["proyectos"] = get_proyectos($conn, $return[$i]['freelancer_id']);
        $return[$i]["profesion"] = get_profesion($conn, $return[$i]['profesion_id']);
        $return[$i]["idiomas"] = get_idiomas($conn, $return[$i]['freelancer_id']);
        $return[$i]["ubicacion"] = get_ubicacion($conn, $return[$i]['ciudad_id']);
        unset($return[$i]["ciudad_id"]);
        unset($return[$i]["profesion_id"]);
    }
    return $return;
}
Exemplo n.º 2
0
<?php

require_once "Models/DBconfig.php";
require_once "Models/Freelancer.php";
require_once "Models/Proyecto.php";
header("Access-Control-Allow-Origin: *");
if (!isset($conn)) {
    $conn = new mysqli($mysql_host, $mysql_user, $mysql_password, $mysql_database);
}
$result = array();
$result['user'] = array();
$result['proyectos'] = array();
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $usuario = get_freelancer($conn, $id);
    if (!is_null($usuario)) {
        $result['user'] = $usuario;
        $result['proyectos'] = get_proyectos($conn, $usuario['freelancer_id']);
        $conn->close();
        echo json_encode($result);
    } else {
        $conn->close();
        die(json_encode($result));
    }
} else {
    $conn->close();
    die(json_encode($result));
}
Exemplo n.º 3
0
function listado($f_linea, $f_area, $f_estacion, $pagina)
{
    $s_1 = "delete from tmp_lineas";
    $r_1 = mysql_query($s_1);
    if (!$pagina) {
        $pagina = '1';
    }
    if (!$f_linea) {
        $f_linea = '%';
    }
    if (!$f_area) {
        $f_area = '%';
    }
    if (!$f_estacion) {
        $f_estacion = '%';
    }
    ?>
	<div align="center" class="aviso">Los encabezados de la tabla permiten ordenar los campos. Seleccione cualquiera de los filtros para mostrar los registros.</div><br>

<?php 
    $s_1 = "select areas.nombre as area, estaciones.nombre as estacion, lineas.* from areas, estaciones, lineas where lineas.activo!='2' and areas.activo='1' and ";
    $s_1 .= "estaciones.activo='1' and lineas.id_estacion = estaciones.id and lineas.id_area = areas.id and lineas.id_area like '{$f_area}' and lineas.id_estacion like ";
    $s_1 .= "'{$f_estacion}' and lineas.nombre like '{$f_linea}' order by activo DESC, area, estacion, nombre";
    $r_1 = mysql_query($s_1);
    $n_1 = mysql_num_rows($r_1);
    $pags = ceil($n_1 / 200);
    $ini_ = ($pagina - 1) * 200;
    $fin_ = 200;
    $i = 1;
    if ($pags > 0) {
        echo "<table align='center' border='0' cellpadding='0' cellspacing='0' class='texto'>";
        echo "<tr height='25'>";
        echo "<td width='120' align='center' bgcolor='#D8D8D8' style='border:#CCCCCB solid 1px;'>{$n_1}&nbsp;Registros</td>";
        echo "<td width='3'></td>";
        while ($i <= $pags) {
            if ($pagina == $i) {
                $bg_img = '../imagenes/pag_on.jpg';
            } else {
                $bg_img = '../imagenes/pag_off.jpg';
            }
            echo "<td width='25' align='center' background='{$bg_img}' style='border:#CCCCCB solid 1px;'>";
            echo "<a href='?op=listado&f_area={$f_area}&f_linea={$f_linea}&f_estacion={$f_estacion}&pagina={$i}' class='link_paginas'>{$i}</a></td>";
            echo "<td width='3'></td>";
            $i++;
            $j++;
        }
        echo "</tr>";
        echo "</table><br>";
    }
    $s_1 .= " limit {$ini_},{$fin_}";
    $i = $ini_ + 1;
    $r_1 = mysql_query($s_1);
    $n1 = mysql_num_rows($r_1);
    ?>
	
<form action="?op=listado" method="post" name="form1">
<div align="center">
	<input type="button" value="Exportar" class="submit" onclick="excel();">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="Borrar" class="submit" onclick="borrar_lineas();">
    </div><br>
<table align="center" class="tabla">
<thead>
	<tr bgcolor="#E6E6E6" height="20">
    	<td width="50" align="center"><input type="checkbox" name="casillas" onclick="select_all('<?php 
    echo $n1;
    ?>
');"></td>
    	<td width="50" align="center">No.</td>
		<td width="50" align="center"><a href="?op=listado&orden=activo&filtro=<?php 
    echo $filtro;
    ?>
" class="linkTabla">Estado</a></td>
		<td width="200" align="center">
	<select name="f_area" style="width:200px;" class="texto" onchange="submit();">
		<option value="%" <?php 
    if ($f_area == '%') {
        ?>
 selected="selected"<?php 
    }
    ?>
>Área</option>
	<?php 
    $s_3 = "select * from areas where activo='1' order by nombre";
    $r_3 = mysql_query($s_3);
    while ($d_3 = mysql_fetch_array($r_3)) {
        ?>
	   <option value="<?php 
        echo $d_3['id'];
        ?>
" <?php 
        if ($d_3['id'] == $f_area) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	   	<?php 
        echo $d_3['nombre'];
        ?>
</option>
	   <?php 
    }
    ?>
	</select>			
		</td>
		<td width="150" align="center">
	<select name="f_estacion" style="width:150px;" class="texto" onchange="submit();">
		<option value="%" <?php 
    if ($f_estacion == '%') {
        ?>
 selected="selected"<?php 
    }
    ?>
>Tecnología</option>
	<?php 
    $s_3 = "select estaciones.* from areas, estaciones where estaciones.activo='1' and areas.activo='1' and estaciones.id_area = areas.id and id_area='{$f_area}' ";
    $s_3 .= "order by estaciones.nombre";
    $r_3 = mysql_query($s_3);
    while ($d_3 = mysql_fetch_array($r_3)) {
        ?>
	   <option value="<?php 
        echo $d_3['id'];
        ?>
" <?php 
        if ($d_3['id'] == $f_estacion) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	   	<?php 
        echo $d_3['nombre'];
        ?>
</option>
	   <?php 
    }
    ?>
	</select>		
		</td>
		<td width="200" align="center">
	<?php 
    $s_3 = "select distinct(lineas.nombre) from areas, estaciones, lineas where estaciones.activo='1' and areas.activo='1' and lineas.activo='1' and ";
    $s_3 .= "lineas.id_area = areas.id and lineas.id_estacion = estaciones.id and lineas.id_area like '{$f_area}' and lineas.id_estacion like '{$f_estacion}' ";
    $s_3 .= "order by lineas.nombre";
    ?>
	<select name="f_linea" style="width:200px;" class="texto" onchange="submit();">
		<option value="%" <?php 
    if ($f_linea == '%') {
        ?>
 selected="selected"<?php 
    }
    ?>
>Nombre</option>
	   <?php 
    $r_3 = mysql_query($s_3);
    while ($d_3 = mysql_fetch_array($r_3)) {
        ?>
	   <option value="<?php 
        echo $d_3['nombre'];
        ?>
" <?php 
        if ($d_3['nombre'] == $f_linea) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	   	<?php 
        echo $d_3['nombre'];
        ?>
</option>
	   <?php 
    }
    ?>
	</select>
		</td>
		<td width="80" align="center" colspan="2">Proyectos</td>
		<td width="40" align="center">Editar</td>
		<td width="40" align="center">Borrar</td>
	</tr>
</thead>
<tbody>
<?php 
    while ($d_1 = mysql_fetch_array($r_1)) {
        $ruta = "&nombre={$d_1['nombre']}&f_area={$f_area}&f_estacion={$f_estacion}&f_linea={$f_linea}";
        ?>
<tr onMouseOut="this.style.background='#F7F7F7'" onMouseOver="this.style.background='#FFDD99'" bgcolor="#F7F7F7" height="20">
	<td align="center"><input type="checkbox" name="casilla[]" id="casilla" value="<?php 
        echo $d_1['id'];
        ?>
"></td>
	<td align="center"><?php 
        echo $i;
        ?>
</td>
	<td align="center">
		<?php 
        if ($d_1['activo'] == '1') {
            echo "<a href='?op=estado&id_={$d_1['id']}&estado=0{$ruta}'>\r\n\t\t\t\t\t\t\t\t\t      <img src='../imagenes/tick.png' alt='Activo' border='0'>";
        }
        if ($d_1['activo'] == '0') {
            echo "<a href='?op=estado&&id_={$d_1['id']}&estado=1{$ruta}'>\r\n\t\t\t\t\t\t\t\t\t      <img src='../imagenes/cross.png' alt='Inactivo' border='0'>";
        }
        ?>
	</td>
	<td align="left">&nbsp;&nbsp;<?php 
        echo $d_1['area'];
        ?>
</td>
	<td align="left">&nbsp;&nbsp;<?php 
        echo $d_1['estacion'];
        ?>
</td>
	<td>&nbsp;&nbsp;<?php 
        echo $d_1['nombre'];
        ?>
</td>
	<td align="center" width="50"><?php 
        echo get_proyectos($d_1['id']);
        ?>
</td>
	<td align="center" width="30"><a class="frame_relacionado_grande" href="detalles.php?op=lineas&id_=<?php 
        echo $d_1['id'];
        ?>
"><img src="../imagenes/right.gif" border="0"></a></td>	
	<td align="center">
		<a href="?op=editar&id_=<?php 
        echo $d_1['id'];
        echo $ruta;
        ?>
"><img src="../imagenes/pencil.gif" alt="Editar" border="0"></a></td>
	<td align="center">
		<a href="?op=borrar&id_=<?php 
        echo $d_1['id'];
        echo $ruta;
        ?>
" onclick='return confirm("¿Borrar Registro?")'>
		<img src="../imagenes/delete.gif" alt="Borrar" border="0"></a></td>
</tr>
<?php 
        $i++;
    }
    ?>
</tbody>
</table>
</form>
<?php 
}