-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortear.php
More file actions
72 lines (57 loc) · 2.1 KB
/
sortear.php
File metadata and controls
72 lines (57 loc) · 2.1 KB
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="https://necolas.github.io/normalize.css/8.0.1/normalize.css"/>
</head>
<body>
<div class="container">
<?php
session_start();
$_SESSION['idGrupo'] = $_POST['sala'];
?>
Quantidade de alunos: <?php INCLUDE("qtdDeAlunos.php"); ?>
<br>
Em quantos grupos você deseja sortear estes alunos?:
<form action="gerarGrupos.php" method="POST" id="gerarGrupos">
<div id="escolha">
<select name="qtdGrupos" onchange="conferir();" id="qtdGrupos">
<?php
$cont = $_SESSION['quantidadeAlunos'];
while($cont>0){
$inteiro = is_int($_SESSION['quantidadeAlunos']/$cont);
if($inteiro) {
echo "<option value='$cont'>$cont</option>";
}
$cont--;
}
echo "<option value='0'>Outro</option>";
?>
</select>
</div>
<script>
function conferir() {
var escolha = document.querySelector('#escolha');
var select = document.querySelector("#qtdGrupos");
if(select.options[select.selectedIndex].value=='0'){
escolha.innerHTML = "<label for='qtdGrupos'>Digite a quantidade: </label><input type='text' name='qtdGrupos'/>";
}
}
</script>
<input type="submit" value="Gerar os grupos" id="btnSortear"/>
</form>
</div>
<script>
function verificar() {
if(document.querySelector('#qtdGrupos').value><?php include("qtdDeAlunos.php")?> || document.querySelector('#qtdGrupos').value == 0) {
alert("Impossível dividir os grupos");
document.querySelector('#qtdGrupos').value = 1;
}
}
</script>
</body>
</html>