Skip to content
Snippets Groups Projects
Commit e32c5c1d authored by hendrik.donath's avatar hendrik.donath
Browse files

fixes for Postgresql

parent aea06172
No related branches found
No related tags found
No related merge requests found
......@@ -516,7 +516,7 @@ function pdfannotator_get_datetime_of_last_modification($annotatorid) {
$timemodified = $timemodified->timemodified;
// 2. When was the last time an annotation or a comment was added in the specified annotator?
$sql = "SELECT max(a.timecreated) as 'last_annotation', max(c.timemodified) as 'last_comment' "
$sql = "SELECT max(a.timecreated) AS last_annotation, max(c.timemodified) AS last_comment "
. "FROM {pdfannotator_annotations} a LEFT OUTER JOIN {pdfannotator_comments} c ON a.id = c.annotationid "
. "WHERE a.pdfannotatorid = ?";
$newposts = $DB->get_records_sql($sql, array($annotatorid));
......
......@@ -66,8 +66,8 @@ class pdfannotator_statistics {
*/
public function get_comments_course($isquestion, $user = false) {
global $DB;
$sql = 'SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON '
. 'a.course = ? AND a.id = c.pdfannotatorid WHERE c.isquestion = ? AND c.isdeleted = ?';
$sql = "SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON "
. "a.course = ? AND a.id = c.pdfannotatorid WHERE c.isquestion = ? AND c.isdeleted = ?";
if ($user) {
$sql .= " AND c.userid = ?";
}
......@@ -238,10 +238,10 @@ class pdfannotator_statistics {
$count = $DB->count_records('pdfannotator_comments', $params);
} else {
// Count answers to private questions if they were saved as public in the database.
$sql = 'SELECT COUNT(*) FROM {pdfannotator_comments} answers '
. 'JOIN {pdfannotator_comments} questions '
. 'ON answers.annotationid = questions.annotationid '
. 'WHERE questions.visibility = "private" AND answers.visibility = "public" AND questions.pdfannotatorid = ? AND answers.isdeleted = ? ';
$sql = "SELECT COUNT(*) FROM {pdfannotator_comments} answers "
. "JOIN {pdfannotator_comments} questions "
. "ON answers.annotationid = questions.annotationid "
. "WHERE questions.visibility = 'private' AND answers.visibility = 'public' AND questions.pdfannotatorid = ? AND answers.isdeleted = ? ";
$params = [$annotatorid, "0"];
if ($userid) {
$sql .= ' AND answers.userid = ? AND questions.userid = ?';
......@@ -262,10 +262,10 @@ class pdfannotator_statistics {
$count = $DB->count_records('pdfannotator_comments', $params);
} else {
// Count answers to private questions if they were saved as public in the database.
$sql = 'SELECT COUNT(*) FROM {pdfannotator_comments} answers '
. 'JOIN {pdfannotator_comments} questions '
. 'ON answers.annotationid = questions.annotationid '
. 'WHERE questions.visibility = "protected" AND answers.visibility = "public" AND questions.pdfannotatorid = ? AND answers.isdeleted = ? ';
$sql = "SELECT COUNT(*) FROM {pdfannotator_comments} answers "
. "JOIN {pdfannotator_comments} questions "
. "ON answers.annotationid = questions.annotationid "
. "WHERE questions.visibility = 'protected' AND answers.visibility = 'public' AND questions.pdfannotatorid = ? AND answers.isdeleted = ? ";
$params = [$annotatorid, "0"];
if ($userid) {
$sql .= ' AND answers.userid = ? AND questions.userid = ?';
......@@ -279,15 +279,15 @@ class pdfannotator_statistics {
public function count_private_comments_in_course() {
global $DB;
$sql = 'SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON '
. 'a.course = ? AND a.id = c.pdfannotatorid WHERE c.visibility = ? AND c.isdeleted = ?';
$sql = "SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON "
. "a.course = ? AND a.id = c.pdfannotatorid WHERE c.visibility = ? AND c.isdeleted = ?";
return $DB->count_records_sql($sql, array($this->courseid, "private", '0'));
}
public function count_protected_comments_in_course() {
global $DB;
$sql = 'SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON '
. 'a.course = ? AND a.id = c.pdfannotatorid WHERE c.visibility = ? AND c.isdeleted = ?';
$sql = "SELECT COUNT(*) FROM {pdfannotator_comments} c JOIN {pdfannotator} a ON "
. "a.course = ? AND a.id = c.pdfannotatorid WHERE c.visibility = ? AND c.isdeleted = ?";
return $DB->count_records_sql($sql, array($this->courseid, "protected", '0'));
}
......
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator';
$plugin->version = 2021060100;
$plugin->version = 2021071600;
$plugin->release = 'PDF Annotator v1.4 release 7';
$plugin->requires = 2016112900;
$plugin->maturity = MATURITY_STABLE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment