public function deleteItem() { $dbc = new DatabaseConnector(); if (isset($_POST['courseID'])) { $courseID = $_POST['courseID']; } else { $courseID = ""; $this->log->toLog(3, __METHOD__, "course is null"); } $params = array($courseID, $this->userID); $dbc->query("UPDATE StudentCourse SET grade ='ND' WHERE courseInfoID in (SELECT courseInfoID FROM CourseInfo\n WHERE courseID = ?) AND userID = ?", $params); $result = array('success' => true); echo json_encode($result); }
function modifyWeightAndRelevance() { $db = new DatabaseConnector(); if (isset($_POST['courseID'])) { $courseID = $_POST['courseID']; } else { $courseID = ""; } if (isset($_POST['modifiedRelevance'])) { $modifiedRelevance = $_POST['modifiedRelevance']; } else { $modifiedRelevance = ""; } if (isset($_POST['modifiedWeight'])) { $modifiedWeight = $_POST['modifiedWeight']; } else { $modifiedWeight = ""; } $stmt = "UPDATE StudentCourse SET relevance = ?, weight = ? WHERE courseInfoID = (SELECT courseInfoID FROM CourseInfo WHERE courseID = ?) AND userID = ?"; $params = array($modifiedRelevance, $modifiedWeight, $courseID, $this->userID); $db->query($stmt, $params); $this->log->toLog(1, __METHOD__, "weight and relevance have been modified"); }
function removeBucket($assessment, $course) { $db = new DatabaseConnector(); $stmt = "DELETE from AssessmentType WHERE AssessmentName = ? AND studentCourseID in (SELECT studentCourseID FROM StudentCourse WHERE grade = 'IP' and userID = ? and courseInfoID IN (SELECT courseInfoID FROM CourseInfo WHERE courseID = ?))"; $params = array($assessment, $this->userID, $course); $db->query($stmt, $params); $this->log->toLog(1, 'INFO', __METHOD__, "Bucket removed from database"); $return = ["success"]; echo json_encode($return); }
public function resetPass($list) { $db = new DatabaseConnector(); $userName = $list['username']; $password = $userName . "123!"; $hash_password = password_hash($password, PASSWORD_DEFAULT); $params = array($hash_password, $list['id']); $db->query("UPDATE Users set password = ? WHERE userID = ?", $params); $params = array($list['id']); $this->log->toLog(2, __METHOD__, "Password reset for user {$params['0']}"); }