public function destroy($id) { $horario = Horario::find($id); $horario->delete(); Flash::error('El Horario de ' . $horario->name . ' ha sido borrado con exito!'); return redirect()->route('horarios.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { try { $horario = Horario::find($id); $horario->delete(); return JsonResponse::create(array('message' => "Horario Eliminada Correctamente", "request" => json_encode($id)), 200); } catch (Exception $ex) { return JsonResponse::create(array('message' => "No se pudo Eliminar la marca", "exception" => $ex->getMessage(), "request" => json_encode($id)), 401); } }
public function index() { $L = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '1')->get(); $M = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '2')->get(); $Mi = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '3')->get(); $J = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '4')->get(); $V = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '5')->get(); $S = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '6')->get(); $D = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', '7')->get(); //dd($horarios->count()); return view('admin.viernes.index')->with('L', $L)->with('M', $M)->with('Mi', $Mi)->with('J', $J)->with('V', $V)->with('S', $S)->with('D', $D); }
public function edit($dia) { if ($dia != '0') { $L = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', $dia)->get(); } else { //$dia = date('w'); if ($dia == '0') { $dia = 7; } $L = Horario::orderBy('hora_inicio', 'ASC')->where('dia_id', '=', $dia)->get(); } switch ($dia) { case 7: $dia = "Domingo"; break; case 1: $dia = "Lunes"; break; case 2: $dia = "Martes"; break; case 3: $dia = "Miercoles"; break; case 4: $dia = "Jueves"; break; case 5: $dia = "Viernes"; break; case 6: $dia = "Sabado"; break; } return view('admin.parrilla.index')->with('L', $L)->with('dia', $dia); }
public function index() { $horarios = Horario::orderBy('hora_inicio', 'ASC')->orderBy('dia_id', 'ASC')->get(); return view('admin.horario_pdf.index')->with('horarios', $horarios); }
public function getvalidar($dia, $hora_inicio, $hora_termino) { $verifica = Horario::orderBy('id', 'ASC')->where('dia_id', '=', $dia)->where('hora_inicio', '<', $hora_inicio)->where('hora_termino', '>', $hora_termino)->lists('programa_id', 'id'); $var = $verifica->count(); if ($var > 0) { $this->respuesta = 'si'; return 0; } $verifica2 = Horario::orderBy('id', 'ASC')->where('dia_id', '=', $dia)->whereBetween('hora_inicio', [$hora_inicio, $hora_termino])->lists('id', 'hora_inicio'); if ($verifica->count() > 0) { dd($verifica2->count()); $cont = 1; while ($verifica2->count() >= $cont) { if ($hora_termino == substr($verifica[0], 0, 5)) { $this->respuesta = 'no'; } else { $this->respuesta = 'si'; return 0; } $cont++; } } else { $this->respuesta = 'si'; } $verifica3 = Horario::orderBy('id', 'ASC')->where('dia_id', '=', $dia)->whereBetween('hora_termino', [$hora_inicio, $hora_termino])->lists('hora_termino'); if ($verifica3->count() > 0) { if ($hora_inicio == substr($verifica3[0], 0, 5)) { $this->respuesta = 'no'; } else { $this->respuesta = 'si'; return 0; } } else { $this->respuesta = 'no'; } }
public function index() { $horarios = Horario::orderBy('hora_inicio', 'ASC')->orderBy('dia_id', 'ASC')->get(); $filas = ''; $contenido = '<html><style>table {font-size: 30;} td{ height: 30;}</style> <table id="thorario" style="width:100% height:100%" cellpadding="0" cellspacing="0" border="1"> <thead> <tr> <th>Hora</th> <th>Lunes</th> <th>Martes</th> <th>Miercoles</th> <th>Jueves</th> <th>Viernes</th> <th>Sabado</th> <th>Domingo</th> </tr> </thead> <tbody id="lis_horario">'; //$contenido=''; $dia = 1; $inicio = 0; $termino = $inicio + 10000; $hora = 0; $filas = 1; $tipo = ""; $tipo_hora = "am"; $contenido .= '<tr> <td rowspan="2" align="center" height="50"> 12:00 am</td>'; foreach ($horarios as $horario) { $h_ini = str_replace(":", "", $horario->hora_inicio); $h_end = str_replace(":", "", $horario->hora_termino); if ($horario->tipo == "vivo") { $tipo = "V"; } if ($horario->tipo == "estelar") { $tipo = "E"; } if ($horario->tipo == "repeticion") { $tipo = "R"; } if ($dia == 7) { $contenido .= '</tr> <tr>'; } if ($h_ini < $termino) { /*while ($horario->dia_id>$dia){ echo "<td>vacio </td>"; $dia++; }*/ if ($h_end >= $termino) { $filas++; } $contenido .= '<td rowspan="' . $filas . '" align="center" >' . $horario->programa->nombre . ' (' . $tipo . ')</td>'; $dia = $horario->dia_id; $filas = 1; } else { $hora++; if ($hora == 12) { $tipo_hora = 'pm'; } if ($hora > 12) { $hora = 1; } $contenido .= '</tr> <tr> <td rowspan="2" align="center" height="50"> ' . $hora . ':00 ' . $tipo_hora . '</td>'; $filas = 1; $dia = 1; $inicio = $inicio + 10000; $termino = $inicio + 10000; if ($h_ini < $termino) { if ($h_end >= $termino) { $filas++; } $contenido .= '<td rowspan="' . $filas . '" align="center">' . $horario->programa->nombre . ' (' . $tipo . ')</td>'; } } } $contenido .= '</tbody></table>'; //$html = view('admin.impresion.index')->render(); //$contenido='http://localhost:8000/admin/horario_pdf'; //$html = '<html><body>'. $contenido. '</body></html>'; $html = '' . $contenido; //$html=$html->render(); /* $this->pdf->filename('my_pdf.pdf'); $this->pdf->setPaper('A4','portrait'); */ //$this->pdf->setPaper('A4','landscape'); $this->pdf->load($html); $this->pdf->filename('Horarios_Canal_10.pdf'); $this->pdf->setPaper('A0', 'landscape'); return $this->pdf->show(); // 顯示 //return $this->pdf->download(); // 下載 //return $this->pdf->load($html)->show(); }
public function horarios($horariosini, $horariosfin, $tourid) { $cuantosini = count($horariosini); $cuantosfin = count($horariosfin); if ($cuantosini === $cuantosfin) { for ($a = 0; $a < $cuantosfin; $a++) { $tourhorario = new Horario(); $tourhorario->id_tour = $tourid; $tourhorario->horario_inicio = $horariosini[$a]; $tourhorario->horario_fin = $horariosfin[$a]; $tourhorario->save(); } } }