getResourceID().","; $sql .= $this->getAssignmentID().","; $sql .= $this->getUserID().","; $sql .= $this->getGrade().","; $sql .= "'".$this->getComment()."',"; $sql .= $this->getExponate().")"; global $kdb; $kdb->query($sql); $dbuid = mysql_insert_id(); $this->setAnswerID((int)$dbuid); } public function getAnswerID() { return $this->answerID; } public function setAnswerID($val) { $this->answerID = $val; } public function getResourceID() { return $this->resourceID; } public function setResourceID($val) { $this->resourceID = $val; } public function getAssignmentID() { return $this->assignmentID; } public function setAssignmentID($val) { $this->assignmentID = $val; } public function getUserID() { return $this->userID; } public function setUserID($val) { $this->userID = $val; } public function getCreated() { return $this->created; } public function setCreated($val) { $this->created = $val; } public function getFormattedCreated() { date_default_timezone_set('UTC'); $d = strtotime($this->created); return strftime("%e %B %G, [%H:%M]", $d); } public function getGrade() { return $this->grade; } public function setGrade($val) { $this->grade = $val; } public function getComment() { return $this->comment; } public function setComment($val) { $this->comment = $val; } public function getExponate() { return $this->exponate; } public function setExponate($val) { $this->exponate = $val; } public function gradeWords($percent) { $word = ""; if ($percent >= 100) { $word = "grade_5"; } else if ($percent >= 90) { $word = "grade_4"; } else if ($percent >= 75) { $word = "grade_3"; } else if ($percent >= 65) { $word = "grade_2"; } else if ($percent >= 50) { $word = "grade_1"; } else { $word = "grade_0"; } return gettext($word); } public function getResourceObj() { global $kdb; $ret = $kdb->query("SELECT * FROM resources WHERE deleted=0 AND resourceID=".$this->getResourceId()); while ( $row = mysql_fetch_array($ret) ) { return $row; } } public function getFullname($uid=false) { if ($uid) { $userid = $uid; } else { $userid = $this->getUserID(); } $user = new User((int)$userid); return $user->getDetails()->getFullnameDisplay(); } } ?>