-
Notifications
You must be signed in to change notification settings - Fork 0
/
cproftur.php
201 lines (161 loc) · 6.39 KB
/
cproftur.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
include "conex.php";
if (!isset($_SESSION)) session_start();
$nivel_necessario = 3;
if (!isset($_SESSION['UsuarioID']) OR ($_SESSION['UsuarioNivel'] != $nivel_necessario)) {
session_destroy();
header("Location: index.php"); exit;
}
?>
<html>
<head>
<title> Autenticação de Usuários </title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/estiloaluno.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<link rel="stylesheet" href="/css/cprofturm.css">
</head>
<script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery.mask.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("#turmas").val("");
$("#disciplinas").val("");
$("#prof").val("");
$("#turmas option").hide();
$("#disciplinas option").hide();
$('#cursos').change(function() {
$("#turmas").val("");
$("#disciplinas").val("");
$("#prof").val("");
$("#turmas option").hide();
var val = $(this).val();
$('option[class^='+val+']').show();
});
$("#turmas").change(function(){
$("#disciplinas").val("");
$("#prof").val("");
$("#disciplinas option").hide();
var val = $(this).val();
$('option[class^='+val+']').show();
});
});
$(function($){
$("#enviar").click(function(){
var idturma = $("#turmas").val();
var iddisc = $("#disciplinas").val();
var idprof = $("#prof").val();
$.post("cadastro.php",{turma:idturma,disciplina:iddisc, professor:idprof,acao:"cadastrar_protur"},function(){
$(".result").html("Professor definido com Sucesso!");
setTimeout(function() { $(".result").html(""); }, 1000);
});
});
});
</script>
<style>
.div1 {
width:250px; /* Tamanho final do select */
overflow:hidden; /* Esconde o conteúdo que passar do tamanho especificado */
}
.div1 select {
cursor: pointer;
background-color: #00528e;
background-position: 205px center; /*Posição da imagem do background*/
width: 100%; /* Tamanho do select, maior que o tamanho da div "div-select" */
height:48px; /* altura do select, importante para que tenha a mesma altura em todo os navegadores */
font-family:Arial, Helvetica, sans-serif; /* Fonte do Select */
font-size:18px; /* Tamanho da Fonte */
border: none;
padding:13px 20px 13px 12px; /* Configurações de padding para posicionar o texto no campo */
color:#fff; /* Cor da Fonte */
text-indent: 0.01px; /* Remove seta padrão do FireFox */
text-overflow: ""; /* Remove seta padrão do FireFox */
select:-ms-expand {display: none;} /* Remove seta padrão do IE*/
}
.botaovoltar{
cursor: pointer;
background: #00528e;
margin-left: 2px;
border: 0;
width: 8%;
height: 40px;
border-radius: 3px;
color: #ffffff;
text-decoration:none;
transition: background 0.3s ease-in-out;
}
.botaovoltar:hover {
background: #003056;
color:wheat;
}
</style>
<body>
<center>
<table>
<br><br><br><br>
<img src="img/cd.png">
<td><div class="div1"><h1>Curso</h1><select name="cursos" id='cursos'>
<option class='curso_zero'>Selecione o Curso</option>
<?php
$link = openDb();
$sql = "SELECT * FROM curso";
$query = $link->query($sql);
while($result = mysqli_fetch_array($query)){
?>
<option value="<?php echo $result['cur_id'];?>"><?php echo $result['cur_nome'];?>
</option> <?php
}
?>
</select></div>
<br><br>
<div class="div1"><h1>Disciplina</h1><select name="disc" id='disciplinas' >
<option class='curso_zero'>Selecione a Disciplina</option>
<?php
$link = openDb();
$sql = "SELECT d.disc_nome, d.disc_id, td.tur_id FROM disciplina d, turma_disciplina td WHERE d.disc_id=td.disc_id";
$query = $link->query($sql);
while($result = mysqli_fetch_array($query)){
?>
<option class="<?php echo $result['tur_id'];?>" value="<?php echo $result['disc_id'];?>"><?php echo $result['disc_nome'];?>
</option> <?php
}
?>
</select></div></td>
<br><br>
<td><div class="div1"><h1>Turma</h1><select name="turmas" id="turmas" >
<option class='curso_zero'>Selecione a Turma</option>
<?php
$link = openDb();
$sql = "SELECT t.cur_id,tur_id,tur_nome FROM turma t,curso c WHERE t.cur_id = c.cur_id";
$query = $link->query($sql);
while($result = mysqli_fetch_array($query)){
?>
<option class="<?php echo $result['cur_id'];?>" value="<?php echo $result['tur_id'];?>"><?php echo $result['tur_nome'];?>
</option> <?php
}
?>
</select></div>
<br><br>
<div class="div1"><h1>Professor</h1><select name="prof" id="prof" >
<option>Selecione a Turma</option>
<?php
$link = openDb();
$sql = "SELECT * FROM professor";
$query = $link->query($sql);
while($result = mysqli_fetch_array($query)){
?>
<option class="<?php echo $result['pro_id'];?>" value="<?php echo $result['pro_id'];?>"><?php echo $result['pro_nome'];?>
</option> <?php
}
?>
</select></div></td>
<br><br>
</table><br><br>
<a href="2telaturma.php"><td><input type="button" value="Voltar" id="Voltar" class="botaovoltar"></a></td>
<input type="button" value="Cadastrar" id="enviar" class="botaovoltar"></td>
</center>
</center>
<div class="result"></div>
</body>
</html>