Kill mega-sena.sh
[lcapit-junk-code.git] / web / horario-oop / horario.php
blobfe50db3cdd29e80d60a0919e3f9e2e84d227f72c
1 <?php
2 class horario {
3 private $dias;
4 private $horario;
5 private $diciplinas;
7 public function add($item)
9 foreach ($this->disciplinas as $dis)
10 $item->check_values($dis, true);
12 $this->disciplinas[] = $item;
15 private function print_dia_cel($h)
17 foreach ($this->dias as $dia) {
18 $show = "-----";
19 foreach ($this->disciplinas as $item)
20 if ($item->has_horario($dia, $h))
21 $show = $item->get_nome();
22 echo("<td> " . $show . "</td>\n");
26 private function print_horario($h)
28 echo("<td>" . $this->horario[$h - 1] . "</td>\n");
31 private function print_table_header()
33 echo("<h1>Quadro de horario</h1>");
35 echo("<tr>\n");
37 echo("<td>hora</td>\n");
38 foreach ($this->dias as $dia)
39 echo("<td>" . $dia . "</td>\n");
41 echo("</tr>\n");
44 public function show()
46 echo("<table border='1'>\n");
48 $this->print_table_header();
50 for ($i = 1; $i <= $this->disciplinas[0]->get_rows(); $i++) {
51 echo("<tr>\n");
52 $this->print_horario($i);
53 $this->print_dia_cel($i);
54 echo("</tr>\n");
57 echo("</table>\n");
60 public function __construct()
62 $this->horario = array("7:30 - 8:20", "8:20 - 9:10", "9:30 - 10:20",
63 "10:20 - 11:10", "11:10 - 12:00", "12:00 - 12:50");
64 $this->dias = array("seg", "ter", "qua", "qui", "sex");
65 $this->disciplinas = array();