<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--
<%@ page import="business.Disciplina"%>
<%@ page import="java.util.ArrayList"%>
-->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Extinguir Disciplina</title>
</head>

<body>
	<h2>Extinguir Disciplina</h2>
	<hr/>
	<%
		/*
		out.println("<table>");
		out.println("<tr>");
		out.println("<th>Codigo</th>");
		out.println("<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>");
		out.println("<th>Nome</th>");
		out.println("<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>");
		out.println("<th>Carga Horaria</th>");
		out.println("</tr>");
		ArrayList<Disciplina> disciplinas = (ArrayList<Disciplina>)request.getAttribute("disciplinas");
		for(int i = 0; i < disciplinas.size(); i ++) {
			Disciplina disciplina = (Disciplina)disciplinas.get(i);
			String codigo = disciplina.getCodigo();
			String nome = disciplina.getNome();
			String cargaHoraria = String.valueOf(disciplina.getCargaHoraria());
			out.println("<tr>");
			out.println("<td>" + codigo + "</td>");
			out.println("<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>");
			out.println("<td>" + nome + "</td>");
			out.println("<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>");
			out.println("<td>" + cargaHoraria + "</td>");
			out.println("</tr>");
		}
		out.println("</table>");
		*/
	%>
	<table>
	<tr>
	<th>Codigo</th>
	<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
	<th>Nome</th>
	<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
	<th>Carga Horaria</th>
	</tr>
	<c:forEach var="disciplina" items="${disciplinas}" varStatus="disciplinaStatus">
		<tr>
		<td><c:out value="${disciplina.codigo}"/></td>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td><c:out value="${disciplina.nome}"/></td>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td><c:out value="${disciplina.cargaHoraria}"/></td>
		</tr>
	</c:forEach>
	</table>
	<!--
	<form action="DisciplinaServlet" method="post">
	-->
	<form action="Command" method="post">
		<hr/>
		<table>
			<tr>
				<td>Codigo:</td>
				<td>
					<select name="codigo" size=1>
						<%
							/*
							out.println("<option value=''></option>");
							ArrayList<Disciplina> disciplinas2 = (ArrayList<Disciplina>)request.getAttribute("disciplinas");
							for(int i = 0; i < disciplinas2.size(); i ++) {
								Disciplina disciplina = (Disciplina)disciplinas2.get(i);
								String codigo = disciplina.getCodigo();
								out.println("<option value='" + codigo + "'>" + codigo + "</option>");
							}
							*/
						%>
						<option value=''></option>
						<c:forEach var="disciplina2" items="${disciplinas}" varStatus="disciplina2Status">
							<option value="<c:out value='${disciplina2.codigo}'/>"><c:out value="${disciplina2.codigo}"/></option>
						</c:forEach>
					</select>
				</td>
			</tr>
		</table>
		<hr/>
		<!--
		<input type="hidden" name="comando" value="extingue"/>
		-->
		<input type="hidden" name="comando" value="DisciplinaExtingue"/>
		<input type="hidden" name="extinguir" value="sim"/>
		<input type="submit" value="Extinguir esta Disciplina"/>
		<a href="disciplina.jsp">
			<input type="button" value="Cancelar"/>
		</a>
	</form>
</body>

</html>