-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheditar.php
158 lines (118 loc) · 6.98 KB
/
editar.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
<?php
// Include the file for database connection
include 'conexao.php';
// Check if the IDs were passed
if (isset($_GET['id_en']) && isset($_GET['id_es']) && isset($_GET['id_pt']) && isset($_GET['id_en_mobile']) && isset($_GET['id_es_mobile']) && isset($_GET['id_pt_mobile'])) {
// Get the IDs passed via GET
$id_en = $_GET['id_en'];
$id_es = $_GET['id_es'];
$id_pt = $_GET['id_pt'];
$id_en_mobile = $_GET['id_en_mobile'];
$id_es_mobile = $_GET['id_es_mobile'];
$id_pt_mobile = $_GET['id_pt_mobile'];
// Check if the form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form data
$task_date = $_POST['task_date'];
$task_done = isset($_POST['task_done']) ? 1 : 0;
$task_highlighted = isset($_POST['task_highlighted']) ? 1 : 0;
$semester = $_POST['semester'];
$task_goal_en = $_POST['task_goal_en'];
$task_goal_es = $_POST['task_goal_es'];
$task_goal_pt = $_POST['task_goal_pt'];
$task_goal_en_mobile = $_POST['task_goal_en_mobile'];
$task_goal_es_mobile = $_POST['task_goal_es_mobile'];
$task_goal_pt_mobile = $_POST['task_goal_pt_mobile'];
// Update data in the English table
$sql_update_en = "UPDATE granna80_bdlinks.roadmap_en SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_en' WHERE task_id=$id_en";
$conn->query($sql_update_en);
// Update data in the Spanish table
$sql_update_es = "UPDATE granna80_bdlinks.roadmap_es SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_es' WHERE task_id=$id_es";
$conn->query($sql_update_es);
// Update data in the Portuguese table
$sql_update_pt = "UPDATE granna80_bdlinks.roadmap_pt SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_pt' WHERE task_id=$id_pt";
$conn->query($sql_update_pt);
// Update data in the English table for mobile devices
$sql_update_en_mobile = "UPDATE granna80_bdlinks.roadmap_en_mobile SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_en_mobile' WHERE task_id=$id_en_mobile";
$conn->query($sql_update_en_mobile);
// Update data in the Spanish table for mobile devices
$sql_update_es_mobile = "UPDATE granna80_bdlinks.roadmap_es_mobile SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_es_mobile' WHERE task_id=$id_es_mobile";
$conn->query($sql_update_es_mobile);
// Update data in the Portuguese table for mobile devices
$sql_update_pt_mobile = "UPDATE granna80_bdlinks.roadmap_pt_mobile SET task_date='$task_date', task_done=$task_done, task_highlighted=$task_highlighted, semester='$semester', task_goal='$task_goal_pt_mobile' WHERE task_id=$id_pt_mobile";
$conn->query($sql_update_pt_mobile);
// Redirect after update
header("Location: ".$_SERVER['REMOTE_HOST']. "/plataforma/painel/roadmap/index.php");
exit();
}
$sql_select_en = "SELECT * FROM granna80_bdlinks.roadmap_en WHERE task_id = $id_en";
$result_select_en = $conn->query($sql_select_en);
$row_en = $result_select_en->fetch_assoc();
$sql_select_es = "SELECT * FROM granna80_bdlinks.roadmap_es WHERE task_id = $id_es";
$result_select_es = $conn->query($sql_select_es);
$row_es = $result_select_es->fetch_assoc();
$sql_select_pt = "SELECT * FROM granna80_bdlinks.roadmap_pt WHERE task_id = $id_pt";
$result_select_pt = $conn->query($sql_select_pt);
$row_pt = $result_select_pt->fetch_assoc();
$sql_select_en_mobile = "SELECT * FROM granna80_bdlinks.roadmap_en_mobile WHERE task_id = $id_en_mobile";
$result_select_en_mobile = $conn->query($sql_select_en_mobile);
$row_en_mobile = $result_select_en_mobile->fetch_assoc();
$sql_select_es_mobile = "SELECT * FROM granna80_bdlinks.roadmap_es_mobile WHERE task_id = $id_es_mobile";
$result_select_es_mobile = $conn->query($sql_select_es_mobile);
$row_es_mobile = $result_select_es_mobile->fetch_assoc();
$sql_select_pt_mobile = "SELECT * FROM granna80_bdlinks.roadmap_pt_mobile WHERE task_id = $id_pt_mobile";
$result_select_pt_mobile = $conn->query($sql_select_pt_mobile);
$row_pt_mobile = $result_select_pt_mobile->fetch_assoc();
} else {
echo "Error";
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit Task</title>
</head>
<body>
<h2>Edit Task</h2>
<!-- Example form for editing data -->
<form method="POST" action="">
<!-- Form field to edit task date -->
<label>Task Date:</label>
<input type="date" name="task_date" value="<?php echo $row_en['task_date']; ?>"><br>
<!-- Form field to edit task completion -->
<label>Task Done:</label>
<input type="checkbox" name="task_done" <?php echo ($row_en['task_done'] == 1) ? 'checked' : ''; ?>><br>
<!-- Form field to edit task highlight -->
<label>Task Highlighted:</label>
<input type="checkbox" name="task_highlighted" <?php echo ($row_en['task_highlighted'] == 1) ? 'checked' : ''; ?>><br>
<!-- Form field to edit semester -->
<label>Semester:</label>
<input type="text" name="semester" value="<?php echo $row_en['semester']; ?>"><br>
<h3>Desktop</h3>
<!-- Form fields to edit task data in English -->
<label>Task Goal EN:</label>
<input type="text" name="task_goal_en" value="<?php echo $row_en['task_goal']; ?>"><br>
<!-- Form fields to edit task data in Spanish -->
<label>Task Goal ES:</label>
<input type="text" name="task_goal_es" value="<?php echo $row_es['task_goal']; ?>"><br>
<!-- Form fields to edit task data in Portuguese -->
<label>Task Goal PT:</label>
<input type="text" name="task_goal_pt" value="<?php echo $row_pt['task_goal']; ?>"><br>
<h3>Mobile</h3>
<!-- Form fields to edit task data in English for mobile devices -->
<label>Task Goal EN Mobile:</label>
<input type="text" name="task_goal_en_mobile" value="<?php echo $row_en_mobile['task_goal']; ?>"><br>
<!-- Form fields to edit task data in Spanish for mobile devices -->
<label>Task Goal ES Mobile:</label>
<input type="text" name="task_goal_es_mobile" value="<?php echo $row_es_mobile['task_goal']; ?>"><br>
<!-- Form fields to edit task data in Portuguese for mobile devices -->
<label>Task Goal PT Mobile:</label>
<input type="text" name="task_goal_pt_mobile" value="<?php echo $row_pt_mobile['task_goal']; ?>"><br>
<!-- Add more form fields as needed -->
<!-- Form submission button -->
<a href="index.php">Back</a>
<button type="submit">Save Changes</button>
</form>
</body>
</html>