69 changed files with 6924 additions and 4336 deletions
Split View
Diff Options
-
8README.md
-
361action.php
-
18backup/moodle2/backup_pdfannotator_activity_task.class.php
-
72backup/moodle2/backup_pdfannotator_stepslib.php
-
28backup/moodle2/restore_pdfannotator_activity_task.class.php
-
43backup/moodle2/restore_pdfannotator_stepslib.php
-
15classes/event/course_module_instance_list_viewed.php
-
14classes/event/course_module_viewed.php
-
4classes/event/report_added.php
-
179classes/output/comment.php
-
151classes/output/index.php
-
447classes/output/overview.php
-
51classes/output/printview.php
-
32classes/output/statistics.php
-
333classes/privacy/provider.php
-
34constants.php
-
553controller.php
-
250db/access.php
-
16db/events.php
-
37db/install.php
-
16db/install.xml
-
81db/messages.php
-
16db/mobile.php
-
504db/upgrade.php
-
72feedback_form.php
-
21index.php
-
331lang/de/pdfannotator.php
-
280lang/en/pdfannotator.php
-
147lib.php
-
1171locallib.php
-
111mod_form.php
-
174model/annotation.class.php
-
391model/comment.class.php
-
160model/overviewtable.php
-
650model/pdfannotator.php
-
21model/report.class.php
-
409model/statistics.class.php
-
BINpix/area.PNG
-
3pix/delete.svg
-
3pix/download.svg
-
BINpix/flagged.png
-
BINpix/highlight.png
-
0pix/link_small.png
-
BINpix/pin.PNG
-
5pix/print.svg
-
22pix/print_comments.svg
-
BINpix/strikeout.PNG
-
27renderable.php
-
82renderer.php
-
131reportform.php
-
43settings.php
-
1416shared/index.js
-
220shared/locallib.js
-
1158shared/overview.js
-
2shared/statistic.js
-
4shared/textclipper.js
-
245styles.css
-
76templates/comment.mustache
-
101templates/index.mustache
-
98templates/overview.mustache
-
55templates/overview_administrate_entries.mustache
-
54templates/overview_answers.mustache
-
53templates/overview_hidden_reports.mustache
-
46templates/overview_my_posts.mustache
-
45templates/overview_new_questions.mustache
-
54templates/overview_reports.mustache
-
48templates/statistic.mustache
-
12version.php
-
56view.php
@ -0,0 +1,179 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/
|
|||
//
|
|||
// Moodle is free software: you can redistribute it and/or modify
|
|||
// it under the terms of the GNU General Public License as published by
|
|||
// the Free Software Foundation, either version 3 of the License, or
|
|||
// (at your option) any later version.
|
|||
//
|
|||
// Moodle is distributed in the hope that it will be useful,
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
// GNU General Public License for more details.
|
|||
//
|
|||
// You should have received a copy of the GNU General Public License
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
|||
/** |
|||
* The purpose of this script is to collect the output data for the statistic template and |
|||
* make it available to the renderer. The data is collected via the statistic model and then processed. |
|||
* Therefore, class statistic can be seen as a view controller. |
|||
* |
|||
* @package mod_pdfannotator |
|||
* @copyright 2018 RWTH Aachen, Friederike Schwager (see README.md) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
class comment implements \renderable, \templatable { |
|||
|
|||
private $comments = []; |
|||
|
|||
public function __construct($data, $cm, $context) { |
|||
global $USER; |
|||
|
|||
if (!is_array($data)) { |
|||
$data = [$data]; |
|||
} |
|||
$editanypost = has_capability('mod/pdfannotator:editanypost', $context); |
|||
foreach ($data as $comment) { |
|||
|
|||
$comment->buttons = []; |
|||
|
|||
$comment->isdeleted = boolval($comment->isdeleted); |
|||
$comment->isquestion = boolval($comment->isquestion); |
|||
$comment->solved = boolval($comment->solved); |
|||
|
|||
$owner = ($comment->userid == $USER->id); |
|||
|
|||
$comment->wrapperClass = 'chat-message comment-list-item'; |
|||
if ($comment->isquestion) { |
|||
$comment->wrapperClass .= ' questioncomment'; |
|||
} else if ($comment->solved) { |
|||
$comment->wrapperClass .= ' correct'; |
|||
} |
|||
if ($owner) { |
|||
$comment->wrapperClass .= ' owner'; |
|||
} |
|||
if ($comment->usevotes) { |
|||
$comment->wrapperClass .= ' usevotes'; |
|||
if (!$comment->isdeleted) { |
|||
if ($owner) { |
|||
$comment->voteBtn = get_string('likeOwnComment', 'pdfannotator'); |
|||
} else if ($comment->isvoted) { |
|||
if ($comment->isquestion) { |
|||
$comment->voteBtn = get_string('likeQuestionForbidden', 'pdfannotator'); |
|||
} else { |
|||
$comment->voteBtn = get_string('likeAnswerForbidden', 'pdfannotator'); |
|||
} |
|||
} else { |
|||
if ($comment->isquestion) { |
|||
$comment->voteBtn = get_string('likeQuestion', 'pdfannotator'); |
|||
} else { |
|||
$comment->voteBtn = get_string('likeAnswer', 'pdfannotator'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (!$comment->votes) { |
|||
$comment->votes = "0"; |
|||
} |
|||
if ($comment->isquestion) { |
|||
$comment->voteTitle = $comment->votes . " " . get_string('likeCountQuestion', 'pdfannotator'); |
|||
} else { |
|||
$comment->voteTitle = $comment->votes . " " . get_string('likeCountAnswer', 'pdfannotator'); |
|||
} |
|||
} |
|||
|
|||
if ($comment->isdeleted || isset($comment->type)) { |
|||
$comment->content = '<em>' . $comment->content . '</em>'; |
|||
} |
|||
|
|||
if (!$comment->isdeleted) { |
|||
$deleteany = has_capability('mod/pdfannotator:deleteany', $context); |
|||
$deleteown = has_capability('mod/pdfannotator:deleteown', $context); |
|||
$report = has_capability('mod/pdfannotator:report', $context); |
|||
if ($deleteany || ($deleteown && $owner)) { // Delete.
|
|||
$comment->buttons[] = ["classes" => "comment-delete-a", "text" => get_string('delete', 'pdfannotator'), |
|||
"moodleicon" => ["key" => "delete", "component" => "pdfannotator", "title" => get_string('delete', 'pdfannotator')]]; |
|||
} |
|||
// Report (textbox/drawing can't be reported because of a missing commentid).
|
|||
if ($report && !$owner && !isset($comment->type) ) { |
|||
$comment->report = true; |
|||
$comment->cm = json_encode($cm); // Course module object.
|
|||
$comment->cmid = $cm->id; |
|||
} |
|||
if (!isset($comment->type) && ($owner || $editanypost)) { |
|||
$comment->buttons[] = ["classes" => "comment-edit-a", "attributes" => ["name" => "id", "value" => "editButton" . $comment->uuid], |
|||
"moodleicon" => ["key" => "i/edit", "component" => "core", "title" => get_string('edit', 'pdfannotator')], |
|||
"text" => get_string('edit', 'pdfannotator')]; |
|||
} |
|||
} |
|||
|
|||
if (!empty($comment->modifiedby) && ($comment->modifiedby != $comment->userid)) { |
|||
$comment->modifiedby = get_string('modifiedby', 'pdfannotator') . pdfannotator_get_username($comment->modifiedby); |
|||
} else { |
|||
$comment->modifiedby = null; |
|||
} |
|||
|
|||
if ($comment->isquestion || !$comment->isdeleted) { |
|||
$comment->dropdown = true; |
|||
} |
|||
|
|||
if (!isset($comment->type) && $comment->isquestion) { // 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')]; |
|||
} |
|||
// Open/Close.
|
|||
$closequestion = has_capability('mod/pdfannotator:closequestion', $context); |
|||
$closeanyquestion = has_capability('mod/pdfannotator:closeanyquestion', $context); |
|||
if (($owner && $closequestion) || $closeanyquestion) { |
|||
if ($comment->solved) { |
|||
$comment->buttons[] = ["classes" => "comment-solve-a", "faicon" => ["class" => "fa-unlock"], |
|||
"text" => get_string('markUnsolved', 'pdfannotator')]; |
|||
} else { |
|||
$comment->buttons[] = ["classes" => "comment-solve-a", "faicon" => ["class" => "fa-lock"], |
|||
"text" => get_string('markSolved', 'pdfannotator')]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
$solve = has_capability('mod/pdfannotator:markcorrectanswer', $context); |
|||
if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type)) { |
|||
if ($comment->solved) { |
|||
$comment->buttons[] = ["classes" => "comment-solve-a", "text" => get_string('removeCorrect', 'pdfannotator'), |
|||
"moodleicon" => ["key" => "i/completion-manual-n", "component" => "core", "title" => get_string('removeCorrect', 'pdfannotator')]]; |
|||
} else { |
|||
$comment->buttons[] = ["classes" => "comment-solve-a", "text" => get_string('markCorrect', 'pdfannotator'), |
|||
"moodleicon" => ["key" => "i/completion-manual-enabled", "component" => "core", "title" => get_string('markCorrect', 'pdfannotator')]]; |
|||
} |
|||
} |
|||
if ($comment->solved) { |
|||
if ($comment->isquestion) { |
|||
$comment->solvedicon = ["classes" => "icon fa fa-lock fa-fw solvedquestionicon", "title" => get_string('questionSolved', 'pdfannotator')]; |
|||
} else if (!$comment->isdeleted) { |
|||
$comment->solvedicon = ["classes" => "icon fa fa-check fa-fw correctanswericon", "title" => get_string('answerSolved', 'pdfannotator')]; |
|||
} |
|||
} |
|||
$this->comments[] = $comment; |
|||
} |
|||
return; |
|||
} |
|||
|
|||
/** |
|||
* This function is required by any renderer to retrieve the data structure |
|||
* passed into the template. |
|||
* @param \renderer_base $output |
|||
* @return type |
|||
*/ |
|||
public function export_for_template(\renderer_base $output) { |
|||
$data = []; |
|||
$data['comments'] = $this->comments; |
|||
return $data; |
|||
} |
|||
|
|||
} |
@ -1,45 +1,106 @@ |
|||
<?php |
|||
|
|||
/* |
|||
* To change this license header, choose License Headers in Project Properties. |
|||
* To change this template file, choose Tools | Templates |
|||
* and open the template in the editor. |
|||
*/ |
|||
|
|||
/** |
|||
* Description of index |
|||
* |
|||
* @author degroot |
|||
*/ |
|||
class index implements renderable, templatable { // should be placed elsewhere
|
|||
|
|||
private $use_studenttextbox; |
|||
private $use_studentdrawing; |
|||
|
|||
public function __construct($pdfannotator, $isAllowedForUser) { |
|||
// if the textbox should be allowed for students, the array should have a single value.
|
|||
$this->use_studenttextbox = array(); |
|||
if($pdfannotator->use_studenttextbox || $isAllowedForUser){ |
|||
$this->use_studenttextbox = array('use'); |
|||
} |
|||
|
|||
// if the drawing should be allowed for students, the array should have a single value.
|
|||
$this->use_studentdrawing = array(); |
|||
if($pdfannotator->use_studentdrawing || $isAllowedForUser){ |
|||
$this->use_studentdrawing = array('use'); |
|||
} |
|||
} |
|||
|
|||
public function export_for_template(renderer_base $output) { |
|||
global $OUTPUT,$PAGE; |
|||
$url = $PAGE->url; |
|||
$data = new stdClass(); |
|||
$data->use_studenttextbox = $this->use_studenttextbox; |
|||
$data->use_studentdrawing = $this->use_studentdrawing; |
|||
$data->pixhide = $OUTPUT->image_url('/e/accessibility_checker'); |
|||
$data->pixopenbook = $OUTPUT->image_url('openbook', 'mod_pdfannotator'); |
|||
$data->pixsinglefile = $OUTPUT->image_url('/e/new_document'); |
|||
|
|||
return $data; |
|||
} |
|||
} |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/
|
|||
//
|
|||
// Moodle is free software: you can redistribute it and/or modify
|
|||
// it under the terms of the GNU General Public License as published by
|
|||
// the Free Software Foundation, either version 3 of the License, or
|
|||
// (at your option) any later version.
|
|||
//
|
|||
// Moodle is distributed in the hope that it will be useful,
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
// GNU General Public License for more details.
|
|||
//
|
|||
// You should have received a copy of the GNU General Public License
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
|||
/** |
|||
* The purpose of this script is to collect the output data for the index.mustache template |
|||
* and make it available to the renderer. The data is collected via the pdfannotator model |
|||
* and then processed. Therefore, class teacheroverview can be seen as a view controller. |
|||
* |
|||
* @package mod_pdfannotator |
|||
* @copyright 2018 RWTH Aachen, Anna Heynkes (see README.md) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
* |
|||
* Description of index |
|||
* |
|||
* @author degroot |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
class index implements renderable, templatable { // Class should be placed elsewhere.
|
|||
|
|||
private $usestudenttextbox; |
|||
private $usestudentdrawing; |
|||
private $useprint; |
|||
private $printurl; |
|||
private $pdfannotatortextboxvisibility; |
|||
private $pdfannotatorpenvisibility; |
|||
private $pdfannotatorprintvisibility; |
|||
|
|||
public function __construct($pdfannotator, $isallowedforuser, $file) { |
|||
|
|||
global $CFG, $USER; |
|||
|
|||
// If the textbox/drawing is allowed for students, the array should have a single value.
|
|||
$this->usestudenttextbox = array(); |
|||
if ($pdfannotator->use_studenttextbox || $isallowedforuser) { |
|||
$this->usestudenttextbox = array('use'); |
|||
if (!$pdfannotator->use_studenttextbox) { |
|||
$this->pdfannotatortextboxvisibility = 'teachersonly'; |
|||
} else { |
|||
$this->pdfannotatortextboxvisibility = ''; |
|||
} |
|||
} |
|||
$this->usestudentdrawing = array(); |
|||
if ($pdfannotator->use_studentdrawing || $isallowedforuser) { |
|||
$this->usestudentdrawing = array('use'); |
|||
if (!$pdfannotator->use_studentdrawing) { |
|||
$this->pdfannotatorpenvisibility = 'teachersonly'; |
|||
} else { |
|||
$this->pdfannotatorpenvisibility = ''; |
|||
} |
|||
} |
|||
|
|||
$this->useprint = array(); |
|||
$studentsmayprint = pdfannotator_instance::useprint($pdfannotator->id); |
|||
if ($studentsmayprint || $isallowedforuser) { |
|||
$this->useprint = array('use'); |
|||
if (!$studentsmayprint) { |
|||
$this->pdfannotatorprintvisibility = 'teachersonly'; |
|||
} else { |
|||
$this->pdfannotatorprintvisibility = ''; |
|||
} |
|||
} |
|||
|
|||
$contextid = $file->get_contextid(); |
|||
$component = $file->get_component(); |
|||
$filearea = $file->get_filearea(); |
|||
$itemid = $file->get_itemid(); |
|||
$filename = $file->get_filename(); |
|||
|
|||
$this->printurl = "$CFG->wwwroot/pluginfile.php/$contextid/$component/$filearea/$itemid/$filename?forcedownload=1"; |
|||
|
|||
} |
|||
|
|||
public function export_for_template(renderer_base $output) { |
|||
global $OUTPUT, $PAGE; |
|||
$url = $PAGE->url; |
|||
$data = new stdClass(); |
|||
$data->usestudenttextbox = $this->usestudenttextbox; |
|||
$data->usestudentdrawing = $this->usestudentdrawing; |
|||
$data->pixhide = $OUTPUT->image_url('/e/accessibility_checker'); |
|||
$data->pixopenbook = $OUTPUT->image_url('openbook', 'mod_pdfannotator'); |
|||
$data->pixsinglefile = $OUTPUT->image_url('/e/new_document'); |
|||
$data->useprint = $this->useprint; |
|||
$data->printlink = $this->printurl; |
|||
$data->pixprintdoc = $OUTPUT->image_url('download', 'mod_pdfannotator'); |
|||
$data->pixprintcomments = $OUTPUT->image_url('print_comments', 'mod_pdfannotator'); |
|||
$data->pdfannotatorprintvisibility = $this->pdfannotatorprintvisibility; |
|||
$data->pdfannotatortextboxvisibility = $this->pdfannotatortextboxvisibility; |
|||
$data->pdfannotatorpenvisibility = $this->pdfannotatorpenvisibility; |
|||
|
|||
return $data; |
|||
} |
|||
} |
@ -1,447 +0,0 @@ |
|||
<?php |
|||
/** |
|||
* The purpose of this script is to collect the output data for the teacheroverview template |
|||
* and make it available to the renderer. The data is collected via the pdfannotator model |
|||
* and then processed. Therefore, class teacheroverview can be seen as a view controller. |
|||
* |
|||
* @package mod_pdfannotator |
|||
* @copyright 2018 RWTH Aachen, Anna Heynkes (see README.md) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
* |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
class overview implements \renderable, \templatable { |
|||
|
|||
private $courseid; |
|||
private $openannotator; |
|||
private $newsspan; |
|||
private $viewreports; |
|||
private $viewanswers; |
|||
private $viewquestions; |
|||
private $viewposts; |
|||
private $annotators_with_reports = []; |
|||
private $annotators_with_answers = []; |
|||
private $annotators_with_questions = []; |
|||
private $annotators_with_posts_by_this_user = []; |
|||
private $annotators_with_hiddenentries = []; |
<