-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdelete_level.php
More file actions
49 lines (42 loc) · 1.64 KB
/
delete_level.php
File metadata and controls
49 lines (42 loc) · 1.64 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
<?php
namespace gameme;
use gameme\PHPGamification\DAO;
global $_base_path;
$_user_location = 'admin';
define('AT_INCLUDE_PATH', '../../include/');
require (AT_INCLUDE_PATH.'vitals.inc.php');
if (isset($_POST['submit_no'])) {
$msg->addFeedback('CANCELLED');
if($_SESSION['is_admin'] >0){
header("Location: ".AT_BASE_HREF."mods/gameme/index_instructor.php");
}else{
header("Location: ".AT_BASE_HREF."mods/gameme/index_admin.php");
}
exit;
} else if (isset($_POST['submit_yes']) || isset($_POST['level_id'])) {
if($_SESSION['course_id'] > 0){
$course_id = $_SESSION['course_id'];
}else{
$course_id=0;
}
// remove the level icon file
$sql = "SELECT icon FROM %sgm_levels WHERE course_id = %d AND id=%d";
$level_file = queryDB($sql, array(TABLE_PREFIX, $course_id, $_POST['level_id']), TRUE);
unlink(AT_CONTENT_DIR.$course_id.'/gameme/levels/'.$level_file['icon']);
$sql = "DELETE FROM %sgm_levels WHERE id=%d AND course_id = %d LIMIT 1";
queryDB($sql, array(TABLE_PREFIX, $_POST['level_id'], $course_id));
$msg->addFeedback('GM_LEVEL_REMOVED');
if($_SESSION['is_admin'] >0){
header("Location: ".AT_BASE_HREF."mods/gameme/index_instructor.php");
}else{
header("Location: ".AT_BASE_HREF."mods/gameme/index_admin.php");
}
exit;
}
require (AT_INCLUDE_PATH.'header.inc.php');
unset($hidden_vars);
$hidden_vars['level_id'] = intval($_GET['id']);
//$hidden_vars['course_id'] = intval($_SESSION['course_id']);
$msg->addConfirm(array('GM_DELETE_LEVEL'), $hidden_vars);
$msg->printConfirm();
require (AT_INCLUDE_PATH.'footer.inc.php'); ?>