public function imprime() { //!!!***Validar parámetros de entrada***!!! //get Input or default $viewActive = Input::get('view', 'month'); $day = Input::get('day', date('d')); $month = Input::get('month', date('m')); $year = Input::get('year', date('Y')); $id_recurso = Input::get('idRecurso', ''); //$id_grupo = Input::get('groupID',''); $id_item = Input::get('item', 0); //Todos los items (equipos o puestos) $titulo = Input::get('titulo', false); $nombre = Input::get('nombre', false); $colectivo = Input::get('colectivo', false); $total = Input::get('total', false); //Total de puestos o equipos de una reserva $datatoprint = array('titulo' => $titulo, 'nombre' => $nombre, 'colectivo' => $colectivo, 'total' => $total); //Información a imprimir seleccionada por el usuario //Output $table = array('tCaption' => '', 'tHead' => '', 'tBody' => ''); $fecha = new DateTime($year . '-' . $month . '-1'); $recurso = Recurso::findOrFail($id_recurso); $sgrRecurso = RecursoFactory::getRecursoInstance($recurso->tipo); $sgrRecurso->setRecurso($recurso); $sgrCalendario = new sgrCalendario($fecha, $sgrRecurso); $table['tCaption'] = CalendarController::caption($viewActive, $day, $sgrCalendario->nombreMes(), $sgrCalendario->year()); switch ($viewActive) { case 'month': $table['tHead'] = CalendarController::head($viewActive, $sgrCalendario); $table['tBody'] = View::make('calendario.printBodyMonth')->with('sgrCalendario', $sgrCalendario)->with('id_recurso', $id_recurso)->with('id_grupo', '')->with('datatoprint', $datatoprint); break; case 'week': $horas = array('8:30', '9:30', '10:30', '11:30', '12:30', '13:30', '14:30', '15:30', '16:30', '17:30', '18:30', '19:30', '20:30', '21:30'); $sgrWeek = $sgrCalendario->sgrWeek(strtotime($year . '-' . $month . '-' . $day)); $table['tHead'] = View::make('calendario.print.weekhead')->with('sgrWeek', $sgrWeek); //$table['tBody'] = View::make('calendario.printBodyWeek')->with('horas',$horas)->with('sgrWeek',$sgrWeek)->with('id_recurso',$id_recurso)->with('id_grupo','')->with('datatoprint',$datatoprint); $table['tBody'] = (string) View::make('calendario.print.weekbody')->with('sgrCalendario', $sgrCalendario); break; default: # code... break; } if (0 != $id_recurso) { $nombre = Recurso::find($id_recurso)->nombre; } else { $recurso = Recurso::where('grupo_id', '=', $id_grupo)->first(); $nombre = $recurso->grupo; } $html = View::make('pdf.calendario')->with(compact('table', 'nombre')); //return $html; $nombreFichero = $day . '-' . $month . '-' . $year . '_' . $nombre; //return $html; $result = myPDF::getPDF($html, $nombreFichero); return Response::make($result)->header('Content-Type', 'application/pdf'); }
} if ($action == 'change_hour_state') { HoursController::change_hour_state(); } if ($action == 'booking_get_instructors_list_for_clndr_render') { echo json_encode(instructorController::getInstructors()); } if ($action == 'get_reservations_for_booking_calendar') { CalendarController::booking_get_reservations(); } if ($action == 'sync_google_clndr') { $calController = new InstructorCalendarEvents(); $calController->syncGoogleClndr(); } if ($action == 'get_reservations_for_booking_calendar_by_dayhours') { clientsTable(CalendarController::getDateHoursReservations()); } if ($action == 'booking_add_instructor') { instructorController::addInstructor(); } if ($action == 'booking_edit_instructor') { instructorController::editInstructor(); } if ($action == 'booking_remove_instructor') { instructorController::removeInstructor(); } if ($action == 'booking_change_instructor') { instructorController::changeInstructor(); } if ($action == 'booking_change_instructor_color') { instructorController::changeColor();