Commit 6c09a349 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1619514: Fixing up annotation progress



Made it have two options now:
1) 'annotation' - Counts the number of annotations a user has added
   to their pages.
2) 'annotationfeedback' - Counts the number of feedbacks left on
   annotations owned by other users

behatnotneeded

Change-Id: Id3ccec9f104c861ce3fe9ed46cf1fcfe92b5d0bb
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit cf5844d2)
parent cb61aaff
......@@ -38,6 +38,7 @@ $string['commentremovedbyauthor'] = 'Feedback removed by the author';
$string['commentremovedbyowner'] = 'Feedback removed by the owner';
$string['commentremovedbyadmin'] = 'Feedback removed by an administrator';
$string['editannotationfeedback'] = 'Edit feedback';
$string['placeannotation'] = 'Add annotation';
$string['placeannotationfeedback'] = 'Place feedback';
$string['annotationfeedbacksubmitted'] = 'Feedback submitted.';
......@@ -105,8 +106,12 @@ $string['nannotationfeedback'] = array(
'%s feedback',
);
$string['progress_annotation'] = array(
'Give 1 feedback on an annotation',
'Give %s feedbacks on annotations',
'Add 1 annotation to a page',
'Add %s annotations to pages',
);
$string['progress_annotationfeedback'] = array(
"Give 1 feedback to another user's annotation",
"Give %s feedbacks to other users' annotations",
);
$string['duplicatedannotation'] = 'Duplicated annotation';
$string['existingannotation'] = 'Existing feedback';
......
......@@ -155,6 +155,9 @@ class PluginArtefactAnnotation extends PluginArtefact {
public static function progressbar_link($artefacttype) {
switch ($artefacttype) {
case 'annotation':
return 'view/index.php';
break;
case 'annotationfeedback':
return 'view/sharedviews.php';
break;
}
......@@ -164,6 +167,14 @@ class PluginArtefactAnnotation extends PluginArtefact {
return array(
(object)array(
'name' => 'annotation',
'title' => get_string('placeannotation', 'artefact.annotation'),
'plugin' => 'annotation',
'active' => true,
'iscountable' => true,
'is_metaartefact' => true,
),
(object)array(
'name' => 'annotationfeedback',
'title' => get_string('placeannotationfeedback', 'artefact.annotation'),
'plugin' => 'annotation',
'active' => true,
......@@ -183,10 +194,16 @@ class PluginArtefactAnnotation extends PluginArtefact {
$sql = "SELECT COUNT(*) AS completed
FROM {artefact}
WHERE artefacttype='annotation'
AND owner = ?";
$meta->completed = count_records_sql($sql, array($USER->get('id')));
break;
case 'annotationfeedback':
$sql = "SELECT COUNT(*) AS completed
FROM {artefact}
WHERE artefacttype='annotationfeedback'
AND owner <> ?
AND author = ?";
$count = get_records_sql_array($sql, array($USER->get('id'), $USER->get('id')));
$meta->completed = $count[0]->completed;
$meta->completed = count_records_sql($sql, array($USER->get('id'), $USER->get('id')));
break;
default:
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment