public string drawClassroomSchedule(int g, Schedule p) { Classroom G = p.getRoomByNo(g); string s = "<html><head><style type='text/css'>" + "body{margin:50px 0px; padding:0px; text-align:center;}" + "table, td, th{ border: 1px solid black; border-collapse:collapse;}" + "td{font-size:10pt; text-align:center;}" + " td.full{background-color=#CCCCFF}</style></head><body><h3>"; s += (G.getID() + "</h3><table border='2'>"); s += "<tr><th WIDTH='70'>SAT</th><th WIDTH='150'>PONEDJELJAK</th>" + "<th WIDTH='150'>UTORAK</th><th WIDTH='150'>SRIJEDA</th>" + "<th WIDTH='150'>CETVRTAK</th><th WIDTH='150'>PETAK</th></tr>"; for (int i = 0; i < 12; i++) { s += ("<tr style='height:40px'><td WIDTH='70'>" + (i + 8).ToString() + "<sup>00</sup> - " + (i + 9).ToString() + "<sup>00</sup></td>"); for (int j = 0; j < 5; j++) { if (sobe[g, j, i] == 0) s += "<td WIDTH='150'> </td>"; else { Event t = p.getEventByID(sobe[g, j, i]); if (i == 0 || sobe[g, j, i - 1] != sobe[g, j, i]) { s += ("<td class='full'rowspan='" + t.Duration.ToString() + "' WIDTH='150'>" + t.getCourse().getName() + " " + "<br />" + p.findLecturer(eventi[t.Id, 0]).getName()/*t.getLecturer().getName()*/ + "</td>"); } } } s += "</tr>"; } s += "</table></body></html>"; return s; }
/* Removes an Event from Scedules of all the groups, lecturers * and classrooms assosciated with that event */ public void RemoveEvent(Schedule s, int EventId) { Event e = s.getEventByID(EventId); //e.getClassroom().week[]--; int t = e.Duration; int i = eventi[EventId, 2]; int j = eventi[EventId, 3]; int c = eventi[EventId, 1]; int l = eventi[EventId, 0]; foreach (string g in s.getEventByID(EventId).getGroups()) { int gId = s.findGroup(g).Id; for (int k = 0; k < t; k++) { grupe[gId, i, j + k] = 0; } } for (int k = 0; k < t; k++) { sobe[c, i, j + k] = 0; } for (int k = 0; k < t; k++) { profesori[l, i, j + k] = 0; } for (int k = 0; k < t; k++) { kolegiji[e.getCourse().getID(), i, j + k] --; } //e.getCourse().removeEvent(i, j, t); eventi[EventId, 2] = 0; eventi[EventId, 3] = 0; }
public void SetEvent(Schedule s, int EventId, int classroomId, int i, int j) { Event e = s.getEventByID(EventId); int t = e.Duration; eventi[EventId, 2] = i; eventi[EventId, 3] = j; eventi[EventId, 1] = classroomId; int l = eventi[EventId, 0]; foreach (string g in s.getEventByID(EventId).getGroups()) { int gId = s.findGroup(g).Id; for (int k = 0; k < t; k++) { grupe[gId, i, j + k] = EventId; } } for (int k = 0; k < t; k++) { sobe[classroomId, i, j + k] = EventId; } for (int k = 0; k < t; k++) { profesori[l, i, j + k] = EventId; } //e.getCourse().setEvent(i, j, e); for (int k = 0; k < t; k++) { kolegiji[e.getCourse().getID(), i, j + k]++; } }
public void generateHtml(string s, Schedule r) { TextWriter f = new StreamWriter(s); // f.open(s, ifstream::out); f.WriteLine("<html><head><style type='text/css'>body{margin:50px 0px; padding:0px; text-align:center;}table, td, th{ border: 1px solid black; border-collapse:collapse;}td{font-size:10pt; text-align:center;}</style></head>");// << "<html>" << endl; f.WriteLine("<body>");// << << endl; //list<Group>::iterator it; // for (it = groupList.begin(); it != groupList.end(); it++) { for (int id = 0; id < r.GroupList.Count; id++) { Group it = r.GetGroupById(id); f.WriteLine("<h3>{0}</h3>", it.getName()); f.WriteLine("<table border='1'>"); f.WriteLine("<tr><th WIDTH='80'>SAT</th><th WIDTH='150'>PONEDJELJAK</th><th WIDTH='150'>UTORAK</th><th WIDTH='150'>SRIJEDA</th><th WIDTH='150'>CETVRTAK</th><th WIDTH='150'>PETAK</th></tr>"); for (int i = 0; i < 12; i++) { //f << "<tr>"<< "<td WIDTH='70'>" << i + 8 << "<sup>00</sup> - " << i + 9 << "<sup>00</sup>" << "</td>" << endl; f.WriteLine("<tr><th WIDTH='80'>{0}<sup>00</sup> - {1}<sup>00</sup></td>", i + 8, i + 9); for (int j = 0; j < 5; j++) { if (grupe[id, j, i] == 0) //f << "<td WIDTH='150'> </td>" << endl; f.WriteLine("<td WIDTH='150'> </td>"); else { string tip; Event t = r.getEventByID(grupe[id, j, i]); if (t.getLType() == 1) tip = "(p)"; else tip = "(v)"; if (i == 0 || grupe[id, j, i - 1] != grupe[id, j, i]) { //f << "<td rowspan='" << t->getDuration() << "' WIDTH='150'>" << t->getCourse()->getName() << " " << t->soba << " " << t->getLecturer() << "</td>" << endl; f.WriteLine("<td rowspan='{0}' WIDTH='150'>{1} {2} <br /> {3} {4}</td>", t.Duration, t.getCourse().getName(), tip, eventi[t.getID(), 1], r.findLecturer(eventi[t.getID(), 0]).getName()); } } } f.WriteLine("</tr>");//f << "</tr>" << endl; } f.WriteLine("</table>");//f << "</table>" << endl; } f.WriteLine("</body>");//f << "</body>" << endl; f.WriteLine("</html>");//f << "</html>" << endl; f.Close(); }