Ejemplo n.º 1
0
        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'>&nbsp;</td>" << endl;
                            f.WriteLine("<td WIDTH='150'>&nbsp;</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();
        }
Ejemplo n.º 2
0
        public string drawGroupSchedule(int g, Schedule p)
        {
            Group G = p.GetGroupById(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.getName() + "</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 (grupe[g, j, i] == 0)
                        s += "<td WIDTH='150'>&nbsp;</td>";
                    else
                    {
                        string tip;

                        Event t = p.getEventByID(grupe[g, j, i]);
                        if (t.getLType() == 1) tip = "(p)";
                        else tip = "(v)";
                        if (i == 0 || grupe[g, j, i - 1] != grupe[g, j, i])
                        {
                            s += ("<td class='full' rowspan='" + t.Duration.ToString() + "' WIDTH='150'>" + t.getCourse().getName() + " " + tip + "<br />" + p.getRoomByNo(eventi[t.Id, 1]).getID()/*t.getClassroom().getID()*/ + "  " + p.findLecturer(eventi[t.Id, 0]).getName()/*t.getLecturer().getName()*/ + "</td>");
                        }

                    }

                }
                s += "</tr>";
            }

            s += "</table></body></html>";
            return s;
        }