$pdf->Cell(100, 30, "SEG " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+1 days"); $pdf->Cell(100, 30, "TER " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+2 days"); $pdf->Cell(100, 30, "QUA " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+3 days"); $pdf->Cell(100, 30, "QUI " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+4 days"); $pdf->Cell(100, 30, "SEX " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+5 days"); $pdf->Cell(100, 30, "SAB " . date('d/m/Y', $timestamp), 1, 0, "L"); $timestamp = strtotime($data . "+6 days"); $pdf->Cell(100, 30, "DOM " . date('d/m/Y', $timestamp), 1, 1, "L"); //Insere dados na tabela while ($horafinal >= $soma) { $v = converterHora($soma); $pdf->Cell(45, 30, $v, 1, 0, "L"); for ($i = 0; $i < 7; $i++) { $timestamp = strtotime($data . "+{$i} days"); $sql = "select reserva.id_reserva, usuario.apelido, reserva.id_usuario from reserva join usuario on usuario.id_usuario = reserva.id_usuario where reserva.id_quadra = {$quadra} and reserva.dt_reserva = '" . date("Y.m.d", $timestamp) . "' and TIME_TO_SEC(reserva.horario) = {$soma}"; $res = query($sql); $qtd = mysql_num_rows($res); if ($qtd > 0) { $linha = mysql_fetch_assoc($res); $id_reserva = $linha['id_reserva']; $apelido = $linha['apelido']; if ($_SESSION['id_usuario'] == $linha['id_usuario']) { $exibir = "<a href='tmp.php?id_reserva = {$id_reserva}&id_quadra={$quadra}&data={$timestamp}&hora={$soma}' class='itemreservado'>{$apelido}</a>"; if ($apelido == "DisponÃvel") { $pdf->Cell(100, 30, "", 1, 0, "L"); } else {
$reserva_quadra = ''; $reserva_data = date("Y-m-d"); $reserva_hora = converterHora(1222); $reserva_nome = ''; if (isset($_SESSION['id_usuario']) and isset($_SESSION['reserva_data'])) { $sql = "SELECT nome FROM usuario WHERE id_usuario = {$_SESSION['id_usuario']}"; $result = mysql_query($sql); $linha = mysql_fetch_assoc($result); $reserva_nome = $linha['nome']; $sql = "SELECT desc_quadra, desc_modalidade FROM quadra join modalidade on modalidade.id_modalidade = quadra.id_modalidade WHERE id_quadra = {$_SESSION['reserva_quadra_id']}"; $result = mysql_query($sql) or die(mysql_error()); $linha = mysql_fetch_assoc($result); $reserva_modalidade = $linha['desc_modalidade']; $reserva_quadra = $linha['desc_quadra']; $reserva_data = date("Y-m-d", $_SESSION['reserva_data']); $reserva_hora = converterHora($_SESSION['reserva_hora']); $sql = "SELECT obs FROM reserva WHERE id_reserva = {$_SESSION['reserva_id']}"; $result = mysql_query($sql) or die(mysql_error()); $linha = mysql_fetch_assoc($result); $obs = $linha['obs']; } ?> <div class="wrapper"> <label for="nome"> Nome:</label> <input class="input" type="text" <?php echo "value= '{$reserva_nome}'"; ?> disabled="disabled" onblur="if(this.value=='') this.value='Nome'" onFocus="if(this.value =='Nome' ) this.value=''" > </div>
} $cont = 0; // se os tipos foram preenchidos cont++ if (isset($inicio_alm) && $inicio_alm != '' && isset($inicio_exp) && $inicio_exp != '') { $total_horas_am = $inicio_alm - $inicio_exp; $cont++; } if (isset($fim_exp) && $fim_exp != '' && isset($fim_alm) && $fim_alm != '') { $total_horas_pm = $fim_exp - $fim_alm; $cont++; } echo $total_horas_am . ' : ' . $total_horas_pm; if ($cont == 2) { //se todos os horarios foram preenchidos $time = $total_horas_am + $total_horas_pm; $total_horas_normais = converterHora($time); } else { $total_horas_normais = ''; } if (isset($array[$dia][1])) { $inicio_exp = date('H:i:s', $inicio_exp); } if (isset($array[$dia][2])) { $inicio_alm = date('H:i:s', $inicio_alm); } if (isset($array[$dia][3])) { $fim_alm = date('H:i:s', $fim_alm); } if (isset($array[$dia][0])) { $fim_exp = date('H:i:s', $fim_exp); }
$timestamp = strtotime($data . "+3 days"); echo "\t\t\t<th class='bg'><strong>Quinta " . date('d/m/Y', $timestamp) . "</strong></th> "; $timestamp = strtotime($data . "+4 days"); echo "\t\t\t<th><strong>Sexta " . date('d/m/Y', $timestamp) . "</strong></th> "; $timestamp = strtotime($data . "+5 days"); echo "\t\t\t<th class='bg'><strong>Sábado " . date('d/m/Y', $timestamp) . "</strong></th> "; $timestamp = strtotime($data . "+6 days"); echo "\t\t\t<th><strong>Domingo " . date('d/m/Y', $timestamp) . "</strong></th> "; echo "\t\t</tr> "; echo "\t</thead> "; /* * Carrega os dados na tabela, utiliza a funcao converterHora(), para converter os segundos no formato desejado */ while ($horafinal >= $soma) { echo "<tr>"; echo "<td class='bg'><strong>" . ($v = converterHora($soma) . "</strong></td>"); for ($i = 0; $i < 7; $i++) { $timestamp = strtotime($data . "+{$i} days"); $sql = "select reserva.id_reserva, usuario.apelido, reserva.id_usuario from reserva join usuario on usuario.id_usuario = reserva.id_usuario where reserva.id_quadra = {$quadra} and reserva.dt_reserva = '" . date("Y.m.d", $timestamp) . "' and TIME_TO_SEC(reserva.horario) = {$soma}"; $res = query($sql); $qtd = mysql_num_rows($res); if ($qtd > 0) { $linha = mysql_fetch_assoc($res); $id_reserva = $linha['id_reserva']; $apelido = $linha['apelido']; if ($_SESSION['id_usuario'] == $linha['id_usuario']) { $exibir = "<a href='tmp.php?id_reserva={$id_reserva}&id_quadra={$quadra}&data={$timestamp}&hora={$soma}' class='itemreservado'>{$apelido}</a>"; } else { $exibir = "<a class='itemreservado'>{$apelido}</a>"; } } else {