public String outputTimetable(String user, Calendar cal) throws FileNotFoundException, IOException
    {

        DBManager db = new DBManager();
        ArrayList<Event> events = db.getEventsForUser(user);
        String output = "";
        
        //Output last days of previous month:
        Calendar cal2 = cal;
        cal2.set(cal.get(cal.YEAR),cal.get(cal.MONTH),1);
        cal2.setFirstDayOfWeek(Calendar.MONDAY);
        int lastMonthCount = cal2.get(cal2.DAY_OF_WEEK) - 2;
        if(lastMonthCount < 0) lastMonthCount = 6;
        cal2.add(Calendar.DAY_OF_MONTH,-lastMonthCount);
        
        
        int dayCount = 1;
        for(int i=0; i<42; i++) {
            ArrayList<Event> todaysEvents = new ArrayList<Event>();
                for(Event e : events)
                {
                    if(e.getStartDateDay() == cal2.get(Calendar.DAY_OF_MONTH) && e.getStartDateMonth() == cal2.get(Calendar.MONTH)+1 && e.getStartDateYear() ==  cal2.get(Calendar.YEAR))
                    {
                        todaysEvents.add(e);
                    }
                }
                if(dayCount == 7)
                {
                    output += outputDayBrn(cal2.get(Calendar.DAY_OF_MONTH), todaysEvents);
                    dayCount = 0;
                    output += "</div>";
                    if(i != 41)
                    {
                        output += "<div class=\"week\">";
                    }
                    
                }
                else
                {
                    output += outputDay(cal2.get(Calendar.DAY_OF_MONTH), todaysEvents);
                }
                cal2.add(Calendar.DAY_OF_MONTH,1);
                dayCount++;
        }
        return output;
    }