Skip to content
Snippets Groups Projects
Commit 1a78345c authored by Friederike Schwager's avatar Friederike Schwager
Browse files

improve private questions

parent b4a6b3e7
Branches
Tags
No related merge requests found
...@@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die(); ...@@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die();
class comment implements \renderable, \templatable { class comment implements \renderable, \templatable {
private $comments = []; private $comments = [];
private $questionvisibility;
/** /**
* Constructor of renderable for comments. * Constructor of renderable for comments.
...@@ -55,6 +56,7 @@ class comment implements \renderable, \templatable { ...@@ -55,6 +56,7 @@ class comment implements \renderable, \templatable {
$forwardquestions = has_capability('mod/pdfannotator:forwardquestions', $context); $forwardquestions = has_capability('mod/pdfannotator:forwardquestions', $context);
$solve = has_capability('mod/pdfannotator:markcorrectanswer', $context); $solve = has_capability('mod/pdfannotator:markcorrectanswer', $context);
$this->questionvisibility = $data[0]->visibility;
foreach ($data as $comment) { foreach ($data as $comment) {
$comment->buttons = []; $comment->buttons = [];
...@@ -193,7 +195,7 @@ class comment implements \renderable, \templatable { ...@@ -193,7 +195,7 @@ class comment implements \renderable, \templatable {
private function addcloseopenbutton($comment, $closequestion, $closeanyquestion) { private function addcloseopenbutton($comment, $closequestion, $closeanyquestion) {
if (!isset($comment->type) && $comment->isquestion // Only set for textbox and drawing. if (!isset($comment->type) && $comment->isquestion // Only set for textbox and drawing.
&& (($comment->owner && $closequestion) || $closeanyquestion)) { && (($comment->owner && $closequestion) || $closeanyquestion) && $comment->visibility != 'private') {
if ($comment->solved) { if ($comment->solved) {
$comment->buttons[] = ["classes" => "comment-solve-a", "faicon" => ["class" => "fa-unlock"], $comment->buttons[] = ["classes" => "comment-solve-a", "faicon" => ["class" => "fa-unlock"],
...@@ -220,6 +222,10 @@ class comment implements \renderable, \templatable { ...@@ -220,6 +222,10 @@ class comment implements \renderable, \templatable {
} }
private function addhidebutton($comment, $seehiddencomments, $hidecomments) { private function addhidebutton($comment, $seehiddencomments, $hidecomments) {
// Don't need to hide personal notes.
if ($this->questionvisibility == 'private') {
return;
}
if (!empty($comment->ishidden) && !isset($comment->type)) { if (!empty($comment->ishidden) && !isset($comment->type)) {
if ($seehiddencomments) { if ($seehiddencomments) {
$comment->content = $comment->content; $comment->content = $comment->content;
...@@ -256,7 +262,7 @@ class comment implements \renderable, \templatable { ...@@ -256,7 +262,7 @@ class comment implements \renderable, \templatable {
} }
private function addsubscribebutton($comment, $subscribe) { private function addsubscribebutton($comment, $subscribe) {
if (!isset($comment->type) && $comment->isquestion && $subscribe) { // Only set for textbox and drawing. if (!isset($comment->type) && $comment->isquestion && $subscribe && $comment->visibility != 'private') { // Only set for textbox and drawing.
if (!empty($comment->issubscribed)) { if (!empty($comment->issubscribed)) {
$comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"], $comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"],
"text" => get_string('unsubscribeQuestion', 'pdfannotator')]; "text" => get_string('unsubscribeQuestion', 'pdfannotator')];
...@@ -268,7 +274,7 @@ class comment implements \renderable, \templatable { ...@@ -268,7 +274,7 @@ class comment implements \renderable, \templatable {
} }
private function addforwardbutton($comment, $forwardquestions, $cm) { private function addforwardbutton($comment, $forwardquestions, $cm) {
if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions) { if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions && $comment->visibility != 'private') {
global $CFG; global $CFG;
$urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid, 'sesskey' => sesskey()]; $urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid, 'sesskey' => sesskey()];
$url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams);
...@@ -279,7 +285,7 @@ class comment implements \renderable, \templatable { ...@@ -279,7 +285,7 @@ class comment implements \renderable, \templatable {
} }
private function addmarksolvedbutton($comment, $solve) { private function addmarksolvedbutton($comment, $solve) {
if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type)) { if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type) && $this->questionvisibility != 'private') {
if ($comment->solved) { if ($comment->solved) {
$comment->buttons[] = ["classes" => "comment-solve-a", "text" => get_string('removeCorrect', 'pdfannotator'), $comment->buttons[] = ["classes" => "comment-solve-a", "text" => get_string('removeCorrect', 'pdfannotator'),
"moodleicon" => ["key" => "i/completion-manual-n", "component" => "core", "title" => get_string('removeCorrect', 'pdfannotator')]]; "moodleicon" => ["key" => "i/completion-manual-n", "component" => "core", "title" => get_string('removeCorrect', 'pdfannotator')]];
......
...@@ -77,6 +77,9 @@ class index implements renderable, templatable { // Class should be placed elsew ...@@ -77,6 +77,9 @@ class index implements renderable, templatable { // Class should be placed elsew
if ($data->useprotectedcomments) { if ($data->useprotectedcomments) {
$data->protectedhelpicon = $OUTPUT->help_icon('protected_comments', 'mod_pdfannotator'); $data->protectedhelpicon = $OUTPUT->help_icon('protected_comments', 'mod_pdfannotator');
} }
if ($data->useprivatecomments) {
$data->privatehelpicon = $OUTPUT->help_icon('private_comments', 'mod_pdfannotator');
}
$data->printlink = $this->printurl; $data->printlink = $this->printurl;
$data->pixprintdoc = $OUTPUT->image_url('download', 'mod_pdfannotator'); $data->pixprintdoc = $OUTPUT->image_url('download', 'mod_pdfannotator');
$data->pixprintcomments = $OUTPUT->image_url('print_comments', 'mod_pdfannotator'); $data->pixprintcomments = $OUTPUT->image_url('print_comments', 'mod_pdfannotator');
......
...@@ -61,7 +61,6 @@ $string['colorPicker'] = 'Pick a color'; ...@@ -61,7 +61,6 @@ $string['colorPicker'] = 'Pick a color';
$string['comment'] = 'Comment'; $string['comment'] = 'Comment';
$string['commentDeleted'] = 'Comment has been deleted'; $string['commentDeleted'] = 'Comment has been deleted';
$string['comments'] = 'Comments'; $string['comments'] = 'Comments';
$string['continueDiscussion'] = 'Add a comment';
$string['correct'] = 'correct'; $string['correct'] = 'correct';
$string['count'] = 'count'; $string['count'] = 'count';
$string['createAnnotation'] = 'Create Annotation'; $string['createAnnotation'] = 'Create Annotation';
...@@ -333,9 +332,10 @@ $string['privacy:metadata:pdfannotator_votes:commentid'] = "The ID of the commen ...@@ -333,9 +332,10 @@ $string['privacy:metadata:pdfannotator_votes:commentid'] = "The ID of the commen
$string['privacy:metadata:pdfannotator_votes:userid'] = "The ID of the user who marked the comment as interesting or helpful. It is saved in order to prevent users from voting for the same comment repeatedly."; $string['privacy:metadata:pdfannotator_votes:userid'] = "The ID of the user who marked the comment as interesting or helpful. It is saved in order to prevent users from voting for the same comment repeatedly.";
$string['privacy:metadata:pdfannotator_votes'] = "Information about questions and comments that were marked as interesting or helpful."; $string['privacy:metadata:pdfannotator_votes'] = "Information about questions and comments that were marked as interesting or helpful.";
$string['private_comments'] = "Personal notes"; $string['private_comments'] = "Personal notes";
$string['private_comments_help'] = 'Visible only for you.';
$string['protected_answers'] = 'Private answers'; $string['protected_answers'] = 'Private answers';
$string['protected_comments'] = "Private comments"; $string['protected_comments'] = "Private comments";
$string['protected_comments_help'] = 'Visible only for you and managers.'; $string['protected_comments_help'] = 'Visible only for you and teachers.';
$string['protected_questions'] = 'Private questions'; $string['protected_questions'] = 'Private questions';
$string['public_comments'] = 'Public comments'; $string['public_comments'] = 'Public comments';
$string['question'] = 'Question'; $string['question'] = 'Question';
...@@ -401,7 +401,7 @@ $string['setting_useprint_help'] = "Please note that drawings are not anonymous ...@@ -401,7 +401,7 @@ $string['setting_useprint_help'] = "Please note that drawings are not anonymous
$string['setting_use_private_comments'] = "Allow personal notes"; $string['setting_use_private_comments'] = "Allow personal notes";
$string['setting_use_private_comments_help'] = "Allow participants to write personal notes. Other person cannot see this comment."; $string['setting_use_private_comments_help'] = "Allow participants to write personal notes. Other person cannot see this comment.";
$string['setting_use_protected_comments'] = "Allow private comments"; $string['setting_use_protected_comments'] = "Allow private comments";
$string['setting_use_protected_comments_help'] = "Allow participants to write private comments. Only author and manager can see this comment."; $string['setting_use_protected_comments_help'] = "Allow participants to write private comments. Only the author and teachers can see this comment.";
$string['setting_usevotes'] = "Votes/Likes"; $string['setting_usevotes'] = "Votes/Likes";
$string['setting_usevotes_help'] = "With this option enabled, users can like / vote for posts other than their own."; $string['setting_usevotes_help'] = "With this option enabled, users can like / vote for posts other than their own.";
$string['show'] = 'Show'; $string['show'] = 'Show';
......
...@@ -192,7 +192,6 @@ class pdfannotator_comment { ...@@ -192,7 +192,6 @@ class pdfannotator_comment {
} }
if ($data->isdeleted) { if ($data->isdeleted) {
$comment->visibility = 'deleted';
$comment->content = get_string('deletedComment', 'pdfannotator'); $comment->content = get_string('deletedComment', 'pdfannotator');
} else { } else {
$comment->content = $data->content; $comment->content = $data->content;
......
...@@ -194,7 +194,7 @@ class pdfannotator_statistics { ...@@ -194,7 +194,7 @@ class pdfannotator_statistics {
$myprivate[] = $countmyprivateanswers + $countmyprivatequestions; $myprivate[] = $countmyprivateanswers + $countmyprivatequestions;
$myquestions[] = $countmyquestions - $countmyprotectedquestions - $countmyprivatequestions; $myquestions[] = $countmyquestions - $countmyprotectedquestions - $countmyprivatequestions;
$otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedanswers - $countprivatequestions; $otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedquestions - $countprivatequestions;
$myanswers[] = $countmyanswers - $countmyprotectedanswers - $countmyprivateanswers; $myanswers[] = $countmyanswers - $countmyprotectedanswers - $countmyprivateanswers;
$otheranswers[] = $countanswers - $myanswers[$index] - $countprotectedanswers - $countprivateanswers; $otheranswers[] = $countanswers - $myanswers[$index] - $countprotectedanswers - $countprivateanswers;
...@@ -207,7 +207,7 @@ class pdfannotator_statistics { ...@@ -207,7 +207,7 @@ class pdfannotator_statistics {
} }
/** /**
* Returns the number of questions/answers in one PDF-Annotator by one/all users * Returns the number of all questions/answers in one PDF-Annotator by one/all users
* @global type $DB * @global type $DB
* @param type $annotatorid * @param type $annotatorid
* @param type $isquestion '1' for questions, '0' for answers * @param type $isquestion '1' for questions, '0' for answers
......
...@@ -1913,6 +1913,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting ...@@ -1913,6 +1913,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
$("#privateDiv").hide(); $("#privateDiv").hide();
$("#protectedDiv").hide(); $("#protectedDiv").hide();
$("#anonymousDiv").show(); $("#anonymousDiv").show();
$("#myarea").attr("placeholder", M.util.get_string('addAComment', 'pdfannotator'));
} }
$('#comment-wrapper h4')[0].innerHTML = title; $('#comment-wrapper h4')[0].innerHTML = title;
......
...@@ -17,6 +17,7 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer ...@@ -17,6 +17,7 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer
var maxValue = calculateMax(otherquestions, myquestions, otheranswers, myanswers, otherprivate, myprivate, otherprotectedquestions, myprotectedquestions, otherprotectedanswers, myprotectedanswers); var maxValue = calculateMax(otherquestions, myquestions, otheranswers, myanswers, otherprivate, myprivate, otherprotectedquestions, myprotectedquestions, otherprotectedanswers, myprotectedanswers);
var borderCol = 'rgb(250, 245, 235)';
var ctx = document.getElementById('myChart').getContext('2d'); var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, { var myChart = new Chart(ctx, {
type: 'bar', type: 'bar',
...@@ -27,56 +28,80 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer ...@@ -27,56 +28,80 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer
stack: 'questions', stack: 'questions',
data: myquestions, data: myquestions,
backgroundColor: 'rgb(0,84,159)', backgroundColor: 'rgb(0,84,159)',
borderColor: borderCol,
borderWidth: 1,
}, { }, {
label: M.util.get_string('questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), label: M.util.get_string('questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'),
stack: 'questions', stack: 'questions',
data: otherquestions, data: otherquestions,
backgroundColor: 'rgb(142,186,229)', backgroundColor: 'rgb(142,186,229)',
borderColor: borderCol,
borderWidth: 1,
}, { }, {
label: M.util.get_string('myprotectedquestions', 'pdfannotator'), label: M.util.get_string('myprotectedquestions', 'pdfannotator'),
stack: 'questions', stack: 'questions',
data: myprotectedquestions, data: myprotectedquestions,
backgroundColor: 'rgb(137, 204, 207)', backgroundColor: 'rgb(0, 152, 161)',
borderColor: borderCol,
borderWidth: 1,
}, { }, {
label: M.util.get_string('protected_questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), label: M.util.get_string('protected_questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'),
stack: 'questions', stack: 'questions',
data: otherprotectedquestions, data: otherprotectedquestions,
backgroundColor: 'rgb(0, 152, 161)', backgroundColor: 'rgb(137, 204, 207)',
borderColor: borderCol,
borderWidth: 1,
}, },
{ {
label: M.util.get_string('myanswers', 'pdfannotator'), label: M.util.get_string('myanswers', 'pdfannotator'),
stack: 'answers', stack: 'answers',
data: myanswers, data: myanswers,
backgroundColor: 'rgb(87, 171, 39)', backgroundColor: 'rgb(87, 171, 39)',
borderColor: 'rgb(0, 0, 0)',
borderWidth: 1,
borderColor: borderCol,
borderWidth: 1,
}, },
{ {
label: M.util.get_string('answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), label: M.util.get_string('answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'),
stack: 'answers', stack: 'answers',
data: otheranswers, data: otheranswers,
backgroundColor: 'rgb(184, 214, 152)', backgroundColor: 'rgb(184, 214, 152)',
borderColor: 'rgb(0, 0, 0)',
borderWidth: 1,
borderColor: borderCol,
borderWidth: 1,
}, },
{ {
label: M.util.get_string('myprotectedanswers', 'pdfannotator'), label: M.util.get_string('myprotectedanswers', 'pdfannotator'),
stack: 'answers', stack: 'answers',
data: myprotectedanswers, data: myprotectedanswers,
backgroundColor: 'rgb(224, 230, 154)', backgroundColor: 'rgb(189, 205, 0)',
borderColor: borderCol,
borderWidth: 1,
}, { }, {
label: M.util.get_string('protected_answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), label: M.util.get_string('protected_answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'),
stack: 'answers', stack: 'answers',
data: otherprotectedanswers, data: otherprotectedanswers,
backgroundColor: 'rgb(189, 205, 0)', backgroundColor: 'rgb(224, 230, 154)',
borderColor: borderCol,
borderWidth: 1,
}, },
{ {
label: M.util.get_string('myprivate', 'pdfannotator'), label: M.util.get_string('myprivate', 'pdfannotator'),
stack: 'private', stack: 'private',
data: myprivate, data: myprivate,
backgroundColor: 'rgb(246, 168, 0)', backgroundColor: 'rgb(246, 168, 0)',
borderColor: borderCol,
borderWidth: 1,
}, },
{ {
label: M.util.get_string('private_comments', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), label: M.util.get_string('private_comments', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'),
stack: 'private', stack: 'private',
data: otherprivate, data: otherprivate,
backgroundColor: 'rgb(253, 212, 143)', backgroundColor: 'rgb(253, 212, 143)',
borderColor: borderCol,
borderWidth: 1,
}] }]
}, },
options: { options: {
...@@ -91,9 +116,11 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer ...@@ -91,9 +116,11 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer
position: 'bottom' position: 'bottom'
}, },
scales: { scales: {
xAxes: [{ xAxes: [{
stacked: true stacked: true,
ticks: {
autoSkip: false
}
}], }],
yAxes: [{ yAxes: [{
ticks: { ticks: {
......
...@@ -527,8 +527,13 @@ body { ...@@ -527,8 +527,13 @@ body {
margin-bottom: 0; margin-bottom: 0;
} }
.path-mod-pdfannotator #anonymousDiv, .path-mod-pdfannotator #privateDiv, .path-mod-pdfannotator #protectedDiv { .path-mod-pdfannotator #comment-list-form > div {
margin: 5px 0px; margin: 5px 0px;
display: block;
}
.path-mod-pdfannotator #comment-list-form > div > * {
vertical-align: middle;
} }
.path-mod-pdfannotator .helperLayer { .path-mod-pdfannotator .helperLayer {
......
...@@ -137,12 +137,14 @@ ...@@ -137,12 +137,14 @@
</div> </div>
{{# useprivatecomments }} {{# useprivatecomments }}
<div id="privateDiv" class="row-fluid row"> <div id="privateDiv" class="row-fluid row">
<input type="checkbox" name="visibility" value="private" id="privateCheckbox" class="pdfannotator-radio" style="width:auto;"><label id="privateLabel" for="privateCheckbox">{{# str }} sendPrivate, pdfannotator {{/ str }}</label> <input type="checkbox" name="visibility" value="private" id="privateCheckbox" class="pdfannotator-radio" style="width:auto;">
<label id="privateLabel" for="privateCheckbox">{{# str }} sendPrivate, pdfannotator {{/ str }}</label> {{{privatehelpicon}}}
</div> </div>
{{/ useprivatecomments }} {{/ useprivatecomments }}
{{# useprotectedcomments }} {{# useprotectedcomments }}
<div id="protectedDiv" class="row-fluid row"> <div id="protectedDiv" class="row-fluid row">
<input type="checkbox" name="visibility" value="protected" id="protectedCheckbox" class="pdfannotator-radio" style="width:auto;"><label id="protectedLabel" for="protectedCheckbox">{{# str }} sendProtected, pdfannotator {{/ str }} {{{protectedhelpicon}}} </label> <input type="checkbox" name="visibility" value="protected" id="protectedCheckbox" class="pdfannotator-radio" style="width:auto;">
<label id="protectedLabel" for="protectedCheckbox">{{# str }} sendProtected, pdfannotator {{/ str }} </label> {{{protectedhelpicon}}}
</div> </div>
{{/ useprotectedcomments }} {{/ useprotectedcomments }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment