function delete_course($course) { global $cmdb; cm_unjoin(0, $course); return $cmdb->query($cmdb->prepare("DELETE FROM {$cmdb->courses} WHERE ID=%d", $course)); }
$redirect = admin_url() . "student.php?action=edit&student={$student}"; $cmdb->update($cmdb->users, $new_user_data, array("ID" => $student, "type" => "student")); cm_redirect($redirect); break; case 'new': $new_user_data = $_POST; $user_new_pass = $new_user_data['password']; _fill_user($new_user_data); if (empty($user_new_pass)) { $message = "Mật khẩu không được để trống"; } else { $new_user_data['password'] = md5($user_new_pass); } $new_user_data['type'] = "student"; $redirect = admin_url() . "student-manager.php"; //print_r($new_user_data); $cmdb->insert($cmdb->users, $new_user_data); cm_redirect($redirect); break; case 'addcourse': cm_join($student, $student_course); $redirect = admin_url() . "student.php?action=edit&student={$student}"; cm_redirect($redirect); break; case 'rmcourse': cm_unjoin($student, $student_course); $redirect = admin_url() . "student.php?action=edit&student={$student}"; cm_redirect($redirect); break; } require_once 'template-loader.php';