Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdfannotator comment subscription like forum fixes #20. #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,13 @@ jobs:
moodle-branch: MOODLE_401_STABLE
database: mariadb

- php: 8.0
moodle-branch: MOODLE_400_STABLE
database: pgsql
- php: 8.0
moodle-branch: MOODLE_400_STABLE
database: mariadb

- php: 7.4
moodle-branch: MOODLE_401_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_401_STABLE
database: mariadb

- php: 7.4
moodle-branch: MOODLE_400_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_400_STABLE
database: mariadb

- php: 7.4
moodle-branch: MOODLE_311_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_311_STABLE
database: mariadb

steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_pdfannotator_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function define_structure() {
// 2. Define each element separately.
$pdfannotator = new backup_nested_element('pdfannotator', array('id'), array(
'name', 'intro', 'introformat', 'usevotes', 'useprint', 'useprintcomments', 'use_studenttextbox', 'use_studentdrawing',
'useprivatecomments', 'useprotectedcomments', 'timecreated', 'timemodified'));
'useprivatecomments', 'useprotectedcomments', 'forcesubscribe', 'timecreated', 'timemodified'));

$annotations = new backup_nested_element('annotations');
$annotation = new backup_nested_element('annotation', array('id'), array('page', 'userid', 'annotationtypeid',
Expand Down
29 changes: 20 additions & 9 deletions classes/output/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function __construct($data, $cm, $context) {
$this->addeditbutton($comment, $editanypost);
$this->addhidebutton($comment, $seehiddencomments, $hidecomments);
$this->adddeletebutton($comment, $deleteown, $deleteany);
$this->addsubscribebutton($comment, $subscribe);
$this->addsubscribebutton($comment, $subscribe, $cm);
$this->addforwardbutton($comment, $forwardquestions, $cm);
$this->addmarksolvedbutton($comment, $solve);

Expand Down Expand Up @@ -270,15 +270,26 @@ private function adddeletebutton($comment, $deleteown, $deleteany) {
}
}

private function addsubscribebutton($comment, $subscribe) {
/**
* Add a subscribe button
*
* @param object $comment
* @param bool $subscribe
* @param stdClass $cm course module object
* @throws \coding_exception
*/
private function addsubscribebutton($comment, $subscribe, $cm) {
if (!isset($comment->type) && $comment->isquestion && $subscribe && $comment->visibility != 'private') {
// Only set for textbox and drawing.
if (!empty($comment->issubscribed)) {
$comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"],
"text" => get_string('unsubscribeQuestion', 'pdfannotator')];
} else {
$comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell"],
"text" => get_string('subscribeQuestion', 'pdfannotator')];
// Only set for textbox and drawing, and only if subscription mode is not disabled or forced.
if ((pdfannotator_get_subscriptionmode($cm->instance) == PDFANNOTATOR_CHOOSESUBSCRIBE) ||
(pdfannotator_get_subscriptionmode($cm->instance) == PDFANNOTATOR_INITIALSUBSCRIBE)) {
if (!empty($comment->issubscribed)) {
$comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"],
"text" => get_string('unsubscribeQuestion', 'pdfannotator')];
} else {
$comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell"],
"text" => get_string('subscribeQuestion', 'pdfannotator')];
}
}
}
}
Expand Down
Loading
Loading