-
Notifications
You must be signed in to change notification settings - Fork 0
/
flightplan_edit.php
98 lines (79 loc) · 2.59 KB
/
flightplan_edit.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
<?php
/**
* Created by JetBrains PhpStorm.
* User: DATTWOOD
* Date: 02/08/11
* Time: 16:02
* To change this template use File | Settings | File Templates.
*/
include('moodle_connection_mysqli.php');
require_once("../../../../config.php");
if (empty($_SESSION['stuid'])) {
$_SESSION['stuid'] = $_GET['student'];
}
$courseid = $_GET['courseid'];
echo 'courseid is: ' . $courseid . '<br/>';
if (empty($_SESSION['corid'])) {
$_SESSION['corid'] = $courseid;
}
if (empty($_SESSION['stumid'])) {
$_SESSION['stumid'] = $_GET['stunum'];
}
echo 'var:';
echo 'Student: ', $_GET['student'], ' stunum: ', $_GET['stunum'], ' courseid: ', $_GET['courseid'];
if (isset($_POST['update'])) {
// echo 'test';
// Write in the effectiveness scores
echo 'Update the effectiveness <br/>';
$query = 'UPDATE flightplan SET score="' . $_POST['score'] . '" date="' . $_POST['date'] . '" WHERE id="' . $_POST['id'] . '"';
echo $query . '<br/>';
$mysqli->query($query);
echo 'update button';
}
if (isset($_POST['delete'])) {
$query = "DELETE FROM flightplan WHERE id='" . $_POST['id'] . "'";
echo $query;
$mysqli->query($query);
echo 'delete button';
}
$studentNumber = $_SESSION['stuid'];
//echo $_SESSION['corid'];
// echo $_SESSION['stumid'];
echo '<h1>Edit Existing Flightplan Scores for ', $studentNumber, '</h1>';
echo '<a href="', $CFG->wwwroot, '/blocks/ilp/view.php?courseid=', $_SESSION['corid'], '&id=', $_SESSION['stumid'], '"><img src="./pix/back-icon.png" width="30px" border="0">Back to students plp</a>';
$query = "SELECT * FROM flightplan WHERE student_id='" . $studentNumber . "'";
//echo $query;
$result = $mysqli->query($query);
?>
<table>
<tr>
<th>ID</th>
<th>Score</th>
<th>Date</th>
<th>Edit Buttons</th>
<th></th>
</tr>
<?php
while ($row = $result->fetch_object()) {
echo '<form action="flightplan_edit.php" method="POST" >';
echo '<tr><td>';
echo $row->id;
echo '</td><td>';
echo '<input type="input" name="score" value="' . $row->score . '"/>';
echo '</td><td>';
echo '<input type="text" name="date" value="' . $row->date . '"/>';
echo '<input type="hidden" name="id" value="' . $row->id . '"/>';
echo '</td><td>';
echo '<input type="submit" name="update" value="Update"/>';
echo '</form>';
echo '</td><td>';
echo '<form action="flightplan_edit.php" method="POST" >';
echo '<input type="hidden" name="id" value="' . $row->id . '"/>';
echo '<input type="submit" name="delete" value="Delete"/>';
echo '</form>';
echo '</td></tr>';
}
?>
</table>
<?php
?>