-
Notifications
You must be signed in to change notification settings - Fork 0
/
default_task_exam.php
175 lines (134 loc) · 6.01 KB
/
default_task_exam.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
<?php require_once('config/tank_config.php'); ?>
<?php require_once('session.php'); ?>
<?php
$restrictGoTo = "user_error3.php";
if ($_SESSION['MM_rank'] < "2") {
header("Location: ". $restrictGoTo);
exit;
}
$taskid = $_GET['taskid'];
$nowuser = $_SESSION['MM_uid'];
mysql_select_db($database_tankdb, $tankdb);
$query_Recordset_task = sprintf("SELECT csa_to_user, csa_text, csa_remark2, csa_from_user, test01
FROM tk_task
WHERE TID = %s", GetSQLValueString($taskid, "int"));
$Recordset_task = mysql_query($query_Recordset_task, $tankdb) or die(mysql_error());
$row_Recordset_task = mysql_fetch_assoc($Recordset_task);
$mailto = $row_Recordset_task['csa_to_user'];
$title = $row_Recordset_task['csa_text'];
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["task_update"])) && ($_POST["task_update"] == "form3")) {
$updatetask = sprintf("UPDATE tk_task SET csa_remark2=%s, csa_remark8=%s, csa_last_user=%s WHERE TID=%s",
GetSQLValueString($_POST['csa_to_user'], "text"),
GetSQLValueString($_POST['examtext'], "text"),
GetSQLValueString($nowuser, "text"),
GetSQLValueString($taskid, "int"));
mysql_select_db($database_tankdb, $tankdb);
$Result2 = mysql_query($updatetask, $tankdb) or die(mysql_error());
$statusid = "-1";
if (isset($_POST['csa_to_user'])) {
$statusid = $_POST['csa_to_user'];
}
$examtext = "-1";
if (isset($_POST['examtext'])) {
$examtext = $_POST['examtext'];
}
if ($examtext <> null){
$examtitle = $multilingual_log_exam1.$examtext;
}
mysql_select_db($database_tankdb, $tankdb);
$query_tkstatus1 = sprintf("SELECT * FROM tk_status WHERE id = %s ", GetSQLValueString($statusid, "text"));
$tkstatus1 = mysql_query($query_tkstatus1, $tankdb) or die(mysql_error());
$row_tkstatus1 = mysql_fetch_assoc($tkstatus1);
$totalRows_tkstatus1 = mysql_num_rows($tkstatus1);
$newID = $taskid;
$logstatus = $row_tkstatus1['task_status'];
$newName = $_SESSION['MM_uid'];
$action = $multilingual_log_exam.$multilingual_log_exam2." ".$logstatus.$examtitle;
$insertSQL2 = sprintf("INSERT INTO tk_log (tk_log_user, tk_log_action, tk_log_type, tk_log_class, tk_log_description) VALUES (%s, %s, %s, 1, '')",
GetSQLValueString($newName, "text"),
GetSQLValueString($action, "text"),
GetSQLValueString($newID, "text"));
$Result3 = mysql_query($insertSQL2, $tankdb) or die(mysql_error());
$updateGoTo = "default_task_edit.php?editID=".$taskid;
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
$title = $row_Recordset_task['csa_text'];
$msg_to = $mailto;
$msg_from = $nowuser;
$msg_type = "examtask";
$msg_id = $taskid;
$msg_title = $title;
$mail = send_message( $msg_to, $msg_from, $msg_type, $msg_id, $msg_title );
if($row_Recordset_task['test01'] <> null){
$cc_arr = json_decode($row_Recordset_task['test01'], true);
foreach($cc_arr as $k=>$v){
send_message( $v['uid'], $msg_from, $msg_type, $msg_id, $msg_title, 1 );
}
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_tankdb, $tankdb);
$query_Recordset_user = "SELECT * FROM tk_status WHERE task_status_backup2 = '1' ORDER BY task_status_backup1 ASC";
$Recordset_user = mysql_query($query_Recordset_user, $tankdb) or die(mysql_error());
$row_Recordset_user = mysql_fetch_assoc($Recordset_user);
$totalRows_Recordset_user = mysql_num_rows($Recordset_user);
$restrictGoTo = "user_error3.php";
if (($_SESSION['MM_rank'] < "2" || $row_Recordset_task['csa_from_user'] <> $_SESSION['MM_uid'])&&$_SESSION['MM_rank'] < "5") {
header("Location: ". $restrictGoTo);
exit;
}
?>
<form action="<?php echo $editFormAction; ?>" method="post" name="form3" id="form3">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><?php echo $multilingual_exam_poptitle; ?></h4>
</div>
<div class="modal-body">
<div class="form-group col-xs-12">
<label for="tk_user_pass"><?php echo $multilingual_exam_select; ?></label>
<div>
<select id="select4" name="csa_to_user" class="form-control">
<?php
do {
?>
<option value="<?php echo $row_Recordset_user['id']?>"<?php if (!(strcmp($row_Recordset_user['id'], $row_Recordset_task['csa_remark2']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset_user['task_status']?></option>
<?php
} while ($row_Recordset_user = mysql_fetch_assoc($Recordset_user));
$rows = mysql_num_rows($Recordset_user);
if($rows > 0) {
mysql_data_seek($Recordset_user, 0);
$row_Recordset_user = mysql_fetch_assoc($Recordset_user);
}
?>
</select>
</div>
</div>
<div class="form-group col-xs-12">
<label for="examtext"><?php echo $multilingual_exam_text; ?></label>
<div>
<textarea name="examtext" id="examtext" class="form-control" rows="5"></textarea>
</div>
<span class="help-block"><?php echo $multilingual_exam_tip2; ?></span>
</div>
<div class="clearboth"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal"><?php echo $multilingual_global_action_cancel; ?></button>
<button type="submit" class="btn btn-primary btn-sm" data-loading-text="<?php echo $multilingual_global_wait; ?>"><?php echo $multilingual_global_action_save; ?></button>
<input type="hidden" name="task_update" value="form3" />
</div>
<script type="text/javascript">
$('button[data-loading-text]').click(function () {
var btn = $(this).button('loading');
setTimeout(function () {
btn.button('reset');
}, 3000);
});
</script>
</form>