tieneAcceso()){ $return["error"] = "No tienes permisos para realizar esta acción."; }else if(!isset($_SESSION["periodo_id"]) || $_SESSION["periodo_id"] ==""){ $return["error"] = "Necesitas seleccionar un periodo."; }else{ $usr = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $stmt = $pdo->prepare('Select * from fs_disponibilidad(:usr)');//Obtiene todo el calendario $stmt->bindParam(":usr", $usr); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $return["error"] = "Ocurrió un error al obtener los horarios ".$t[2]; $error = true; }else{ $horario_rs = $stmt->fetchAll(); $stmt->closeCursor(); $json = array(); foreach($horario_rs as $horario){//crea objeto json $horario_tmp =array(); $horario_tmp["id"] = $horario["Horario_id"]; $horario_tmp["dia"] = $horario["Dia_id"]; $horario_tmp["hora"] = substr($horario["Hora_inicio"], 0, 5);//hh:mm $horario_tmp["duracion"] = $horario["Duracion"]; $horario_tmp["color"] = "#f0b6c0"; $json[] = $horario_tmp; }//fin foreach }//fin tiene datos $return["horario"] = $json; $return["ok"] = "El horario se cargó correctamente"; } $return["json"] = json_encode($return); echo json_encode($return); ?>