diff --git a/action.php b/action.php index 39ac2a7..56aeab2 100644 --- a/action.php +++ b/action.php @@ -27,7 +27,7 @@ * * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes, Friederike Schwager + * @author Rabea de Groot, Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -151,7 +151,8 @@ $data['height'] = $annotation['height']; break; case 'drawing': - $studentdrawingsallowed = $DB->get_field('pdfannotator', 'use_studentdrawing', ['id' => $documentid], $strictness = MUST_EXIST); + $studentdrawingsallowed = $DB->get_field('pdfannotator', 'use_studentdrawing', ['id' => $documentid], + $strictness = MUST_EXIST); $alwaysdrawingallowed = has_capability('mod/pdfannotator:usedrawing', $context); if ($studentdrawingsallowed != 1 && !$alwaysdrawingallowed) { echo json_encode(['status' => 'error', 'reason' => get_string('studentdrawingforbidden', 'pdfannotator')]); @@ -174,7 +175,8 @@ $data['rectangles'] = $annotation['rectangles']; break; case 'textbox': - $studenttextboxesallowed = $DB->get_field('pdfannotator', 'use_studenttextbox', array('id' => $documentid), $strictness = MUST_EXIST); + $studenttextboxesallowed = $DB->get_field('pdfannotator', 'use_studenttextbox', array('id' => $documentid), + $strictness = MUST_EXIST); $alwaystextboxallowed = has_capability('mod/pdfannotator:usetextbox', $context); if ($studenttextboxesallowed != 1 && !$alwaystextboxallowed) { echo json_encode(['status' => 'error', 'reason' => get_string('studenttextboxforbidden', 'pdfannotator')]); @@ -386,8 +388,6 @@ $comments = pdfannotator_comment::read($documentid, $annotationid, $context); - // require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php'); - $myrenderer = $PAGE->get_renderer('mod_pdfannotator'); $templatable = new comment($comments, $cm, $context); @@ -453,7 +453,7 @@ $commentid = required_param('commentId', PARAM_INT); $content = required_param('content', PARAM_RAW); - + $data = pdfannotator_comment::update($commentid, $content, $editanypost); echo json_encode($data); } @@ -497,7 +497,8 @@ $thiscourse = $pdfannotator->course; $cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id; - $urlparams = array('action' => 'overviewanswers', 'id' => $cmid, 'page' => 0, 'itemsperpage' => $itemsperpage, 'answerfilter' => 0); + $urlparams = array('action' => 'overviewanswers', 'id' => $cmid, 'page' => 0, 'itemsperpage' => $itemsperpage, + 'answerfilter' => 0); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); redirect($url->out()); return; @@ -537,13 +538,14 @@ } if ($subscriptionid) { - echo json_encode(['status' => 'success', 'annotationid' => $annotationid, 'subscriptionid' => $subscriptionid, 'annotatorid' => $annotatorid]); + echo json_encode(['status' => 'success', 'annotationid' => $annotationid, 'subscriptionid' => $subscriptionid, + 'annotatorid' => $annotatorid]); } else { echo json_encode(['status' => 'error']); } } -/* * ****************************************** Mark a question as closed or an answer as correct ****************************************** */ +/* * ****************************************** Mark a question as closed or an answer as correct ******************************* */ if ($action === 'markSolved') { global $DB; diff --git a/backup/moodle2/backup_pdfannotator_activity_task.class.php b/backup/moodle2/backup_pdfannotator_activity_task.class.php index 09d938e..849257d 100644 --- a/backup/moodle2/backup_pdfannotator_activity_task.class.php +++ b/backup/moodle2/backup_pdfannotator_activity_task.class.php @@ -75,7 +75,7 @@ protected function define_my_steps() { * @param string $content some HTML text that eventually contains URLs to the activity instance scripts * @return string the content with the URLs encoded */ - static public function encode_content_links($content) { + public static function encode_content_links($content) { global $CFG, $DB; diff --git a/backup/moodle2/backup_pdfannotator_stepslib.php b/backup/moodle2/backup_pdfannotator_stepslib.php index 73f5b90..5160537 100644 --- a/backup/moodle2/backup_pdfannotator_stepslib.php +++ b/backup/moodle2/backup_pdfannotator_stepslib.php @@ -54,23 +54,27 @@ 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')); + 'name', 'intro', 'introformat', 'usevotes', 'useprint', 'useprintcomments', 'use_studenttextbox', 'use_studentdrawing', + 'useprivatecomments', 'useprotectedcomments', 'timecreated', 'timemodified')); $annotations = new backup_nested_element('annotations'); - $annotation = new backup_nested_element('annotation', array('id'), array('page', 'userid', 'annotationtypeid', 'data', 'timecreated', 'timemodified', 'modifiedby')); + $annotation = new backup_nested_element('annotation', array('id'), array('page', 'userid', 'annotationtypeid', + 'data', 'timecreated', 'timemodified', 'modifiedby')); $subscriptions = new backup_nested_element('subscriptions'); $subscription = new backup_nested_element('subscription', array('id'), array('userid')); $comments = new backup_nested_element('comments'); - $c = array('pdfannotatorid', 'userid', 'content', 'timecreated', 'timemodified', 'modifiedby', 'visibility', 'isquestion', 'isdeleted', 'ishidden', 'solved'); + $c = array('pdfannotatorid', 'userid', 'content', 'timecreated', 'timemodified', 'modifiedby', 'visibility', + 'isquestion', 'isdeleted', 'ishidden', 'solved'); $comment = new backup_nested_element('comment', array('id'), $c); $votes = new backup_nested_element('votes'); $vote = new backup_nested_element('vote', array('id'), array('userid', 'annotationid')); $reports = new backup_nested_element('reports'); - $report = new backup_nested_element('report', array('id'), array('courseid', 'pdfannotatorid', 'message', 'userid', 'timecreated', 'seen')); + $report = new backup_nested_element('report', array('id'), array('courseid', 'pdfannotatorid', 'message', + 'userid', 'timecreated', 'seen')); // 3. Build the tree (mind the right order!) $pdfannotator->add_child($annotations); @@ -97,7 +101,8 @@ protected function define_structure() { // Add all annotations specific to this annotator instance. $annotation->set_source_sql('SELECT a.* FROM {pdfannotator_annotations} a ' . 'JOIN {pdfannotator_comments} c ON a.id = c.annotationid ' - . "WHERE a.pdfannotatorid = ? AND c.isquestion = 1 AND (c.visibility = 'public' OR c.visibility = 'anonymous') ", + . "WHERE a.pdfannotatorid = ? AND c.isquestion = 1 AND " + . "(c.visibility = 'public' OR c.visibility = 'anonymous') ", array('pdfannotatorid' => backup::VAR_PARENTID)); // Add any subscriptions to this annotation. diff --git a/backup/moodle2/restore_pdfannotator_activity_task.class.php b/backup/moodle2/restore_pdfannotator_activity_task.class.php index 22df8ba..25ca6b9 100644 --- a/backup/moodle2/restore_pdfannotator_activity_task.class.php +++ b/backup/moodle2/restore_pdfannotator_activity_task.class.php @@ -57,7 +57,7 @@ protected function define_my_steps() { * Define the contents in the activity that must be * processed by the link decoder. */ - static public function define_decode_contents() { + public static function define_decode_contents() { $contents = array(); $contents[] = new restore_decode_content('pdfannotator', array('intro'), 'pdfannotator'); @@ -69,7 +69,7 @@ static public function define_decode_contents() { * Define the decoding rules for links belonging * to the activity to be executed by the link decoder */ - static public function define_decode_rules() { + public static function define_decode_rules() { $rules = array(); $rules[] = new restore_decode_rule('PDFANNOTATORVIEWBYID', '/mod/pdfannotator/view.php?id=$1', 'course_module'); @@ -81,11 +81,11 @@ static public function define_decode_rules() { /** * Define the restore log rules that will be applied - * by the {@link restore_logs_processor} when restoring + * by the {@see restore_logs_processor} when restoring * pdfannotator logs. It must return one array - * of {@link restore_log_rule} objects + * of {@see restore_log_rule} objects */ - static public function define_restore_log_rules() { + public static function define_restore_log_rules() { $rules = array(); $rules[] = new restore_log_rule('pdfannotator', 'add', 'view.php?id={course_module}', '{pdfannotator}'); @@ -97,15 +97,15 @@ static public function define_restore_log_rules() { /** * Define the restore log rules that will be applied - * by the {@link restore_logs_processor} when restoring + * by the {@see restore_logs_processor} when restoring * course logs. It must return one array - * of {@link restore_log_rule} objects + * of {@see restore_log_rule} objects * * Note this rules are applied when restoring course logs * by the restore final task, but are defined here at * activity level. All them are rules not linked to any module instance (cmid = 0) */ - static public function define_restore_log_rules_for_course() { + public static function define_restore_log_rules_for_course() { $rules = array(); $rules[] = new restore_log_rule('pdfannotator', 'view all', 'index.php?id={course}', null); diff --git a/backup/moodle2/restore_pdfannotator_stepslib.php b/backup/moodle2/restore_pdfannotator_stepslib.php index c65e782..607bef6 100644 --- a/backup/moodle2/restore_pdfannotator_stepslib.php +++ b/backup/moodle2/restore_pdfannotator_stepslib.php @@ -45,15 +45,21 @@ protected function define_structure() { $userinfo = $this->get_setting_value('userinfo'); // Is 0 //TODO is not used. - $paths[] = new restore_path_element('pdfannotator', '/activity/pdfannotator'); + $paths[] = new restore_path_element('pdfannotator', + '/activity/pdfannotator'); - $paths[] = new restore_path_element('pdfannotator_annotation', '/activity/pdfannotator/annotations/annotation'); + $paths[] = new restore_path_element('pdfannotator_annotation', + '/activity/pdfannotator/annotations/annotation'); - $paths[] = new restore_path_element('pdfannotator_subscription', '/activity/pdfannotator/annotations/annotation/subscriptions/subscription'); - $paths[] = new restore_path_element('pdfannotator_comment', '/activity/pdfannotator/annotations/annotation/comments/comment'); + $paths[] = new restore_path_element('pdfannotator_subscription', + '/activity/pdfannotator/annotations/annotation/subscriptions/subscription'); + $paths[] = new restore_path_element('pdfannotator_comment', + '/activity/pdfannotator/annotations/annotation/comments/comment'); - $paths[] = new restore_path_element('pdfannotator_vote', '/activity/pdfannotator/annotations/annotation/comments/comment/votes/vote'); - $paths[] = new restore_path_element('pdfannotator_report', '/activity/pdfannotator/annotations/annotation/comments/comment/reports/report'); + $paths[] = new restore_path_element('pdfannotator_vote', + '/activity/pdfannotator/annotations/annotation/comments/comment/votes/vote'); + $paths[] = new restore_path_element('pdfannotator_report', + '/activity/pdfannotator/annotations/annotation/comments/comment/reports/report'); // Return the paths wrapped into standard activity structure. return $this->prepare_activity_structure($paths); @@ -143,8 +149,9 @@ protected function process_pdfannotator_report($data) { $data->commentid = $this->get_new_parentid('pdfannotator_comment'); $data->userid = $this->get_mappingid('user', $data->userid); - // $data->timecreated = $this->apply_date_offset($data->timecreated); - $data->pdfannotatorid = $this->get_mappingid('pdfannotator', $data->pdfannotatorid); // Params: 1. Object class as defined in structure, 2. attribute&/column name. + // $data->timecreated = $this->apply_date_offset($data->timecreated); + $data->pdfannotatorid = $this->get_mappingid('pdfannotator', $data->pdfannotatorid); + // Params: 1. Object class as defined in structure, 2. attribute&/column name. $newitemid = $DB->insert_record('pdfannotator_reports', $data); $this->set_mapping('pdfannotator_report', $oldid, $newitemid); diff --git a/classes/event/report_added.php b/classes/event/report_added.php index e0f3384..affbd35 100644 --- a/classes/event/report_added.php +++ b/classes/event/report_added.php @@ -54,4 +54,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/pdfannotator/view.php', array('id' => $this->other['cmid'], 'action' => 'overview')); } -} \ No newline at end of file +} diff --git a/classes/output/answermenu.php b/classes/output/answermenu.php index 5a59974..725376f 100644 --- a/classes/output/answermenu.php +++ b/classes/output/answermenu.php @@ -37,7 +37,6 @@ class answermenu implements \renderable, \templatable { /** * Constructor of renderable for dropdown menu in answerstable. - * @global type $CFG * @param int $annotationid Id of the annotation the answer belongs to * @param bool $issubscribed Is the user subscribed to the question? * @param int $cmid Course module id diff --git a/classes/output/comment.php b/classes/output/comment.php index b5ba9df..b212b83 100644 --- a/classes/output/comment.php +++ b/classes/output/comment.php @@ -17,6 +17,8 @@ namespace mod_pdfannotator\output; use moodle_url; +defined('MOODLE_INTERNAL') || die(); + /** * Renderable for comments. * @@ -25,8 +27,6 @@ * @author Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); - class comment implements \renderable, \templatable { private $comments = []; @@ -94,7 +94,8 @@ public function __construct($data, $cm, $context) { } if (!empty($comment->modifiedby) && ($comment->modifiedby != $comment->userid) && ($comment->userid != 0)) { - $comment->modifiedby = get_string('modifiedby', 'pdfannotator') . ' '. pdfannotator_get_username($comment->modifiedby); + $comment->modifiedby = get_string('modifiedby', 'pdfannotator') . ' '. + pdfannotator_get_username($comment->modifiedby); } else { $comment->modifiedby = null; } @@ -167,9 +168,11 @@ public function setvotes($comment) { public function addsolvedicon($comment) { if ($comment->solved) { if ($comment->isquestion) { - $comment->solvedicon = ["classes" => "icon fa fa-lock fa-fw solvedquestionicon", "title" => get_string('questionSolved', 'pdfannotator')]; + $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')]; + $comment->solvedicon = ["classes" => "icon fa fa-check fa-fw correctanswericon", + "title" => get_string('answerSolved', 'pdfannotator')]; } } } @@ -218,8 +221,9 @@ private function addcloseopenbutton($comment, $closequestion, $closeanyquestion) */ private function addeditbutton($comment, $editanypost) { if (!$comment->isdeleted && !isset($comment->type) && ($comment->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')], + $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')]; } } @@ -235,7 +239,8 @@ private function addhidebutton($comment, $seehiddencomments, $hidecomments) { $comment->dimmed = 'dimmed_text'; $comment->displayhidden = 1; $comment->buttons[] = ["attributes" => ["name" => "id", "value" => "hideButton" . $comment->uuid], - "moodleicon" => ["key" => "i/hide", "component" => "core", "title" => get_string('removehidden', 'pdfannotator')], + "moodleicon" => ["key" => "i/hide", "component" => "core", + "title" => get_string('removehidden', 'pdfannotator')], "text" => get_string('removehidden', 'pdfannotator')]; } else { $comment->visibility = 'anonymous'; @@ -260,12 +265,14 @@ private function addhidebutton($comment, $seehiddencomments, $hidecomments) { private function adddeletebutton($comment, $deleteown, $deleteany) { if (!$comment->isdeleted && ($deleteany || ($deleteown && $comment->owner))) { $comment->buttons[] = ["classes" => "comment-delete-a", "text" => get_string('delete', 'pdfannotator'), - "moodleicon" => ["key" => "delete", "component" => "pdfannotator", "title" => get_string('delete', 'pdfannotator')]]; + "moodleicon" => ["key" => "delete", "component" => "pdfannotator", + "title" => get_string('delete', 'pdfannotator')]]; } } private function addsubscribebutton($comment, $subscribe) { - if (!isset($comment->type) && $comment->isquestion && $subscribe && $comment->visibility != 'private') { // 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)) { $comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"], "text" => get_string('unsubscribeQuestion', 'pdfannotator')]; @@ -277,24 +284,29 @@ private function addsubscribebutton($comment, $subscribe) { } private function addforwardbutton($comment, $forwardquestions, $cm) { - if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions && $comment->visibility != 'private') { + if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions && + $comment->visibility != 'private') { global $CFG; $urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid, 'sesskey' => sesskey()]; $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); - $comment->buttons[] = ["classes" => "comment-forward-a", "attributes" => ["name" => "onclick", "value" => "window.location.href = '$url';"], - "faicon" => ["class" => "fa-share"], "text" => get_string('forward', 'pdfannotator')]; + $comment->buttons[] = ["classes" => "comment-forward-a", "attributes" => ["name" => "onclick", + "value" => "window.location.href = '$url';"], "faicon" => ["class" => "fa-share"], + "text" => get_string('forward', 'pdfannotator')]; } } private function addmarksolvedbutton($comment, $solve) { - if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type) && $this->questionvisibility != 'private') { + if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type) && + $this->questionvisibility != 'private') { 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')]]; + "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')]]; + "moodleicon" => ["key" => "i/completion-manual-enabled", "component" => "core", + "title" => get_string('markCorrect', 'pdfannotator')]]; } } } diff --git a/classes/output/printview.php b/classes/output/printview.php index 5fa9b3f..b6bbff0 100644 --- a/classes/output/printview.php +++ b/classes/output/printview.php @@ -52,4 +52,4 @@ public function export_for_template(\renderer_base $output) { return $data; } -} \ No newline at end of file +} diff --git a/classes/output/reportmenu.php b/classes/output/reportmenu.php index 246d599..bb6ecf3 100644 --- a/classes/output/reportmenu.php +++ b/classes/output/reportmenu.php @@ -36,7 +36,6 @@ class reportmenu implements \renderable, \templatable { /** * Constructor of renderable for dropdown menu in reportstable. - * @global type $CFG * @param object $report Report object * @param int $cmid Course module id * @param int $currentpage Page of the table on overviewpage diff --git a/classes/output/statistics.php b/classes/output/statistics.php index 1689c3c..06825db 100644 --- a/classes/output/statistics.php +++ b/classes/output/statistics.php @@ -42,8 +42,6 @@ class statistics implements \renderable, \templatable { /** * Constructor of renderable for statistics tab. - * @global type $USER - * @global type $PAGE * @param int $annotatorid Id of the annotator * @param int $courseid ID of the course * @param object $capabilities Some of the capabilities the user has- diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index ab9d48c..633817e 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . /** + * Privacy class for requesting user data. + * * @package mod_pdfannotator - * @category backup + * @category privacy * @copyright 2018 RWTH Aachen (see README.md) * @author Anna Heynkes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -309,9 +311,9 @@ public static function delete_data_for_all_users_in_context(\context $context) { /** * - * @global type $DB - * @param \mod_pdfannotator\privacy\approved_contextlist $contextlist - * @return type + * Delete personal data for the user in a list of contexts. + * + * @param \mod_pdfannotator\privacy\approved_contextlist $contextlist List of contexts to delete data from. */ public static function delete_data_for_user(approved_contextlist $contextlist) { @@ -372,8 +374,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { /** * Function deletes an annotation and all comments and subscriptions attached to it. * - * @global \mod_pdfannotator\privacy\type $DB - * @param type $annotationid + * @param int $annotationid One annotationid (int) to delete */ public static function delete_annotation($annotationid) { @@ -400,6 +401,13 @@ public static function delete_annotation($annotationid) { $DB->delete_records('pdfannotator_annotations', array("id" => $annotationid)); } + /** + * Function empties or deletes a comment. + * + * @param \mod_pdfannotator\output\comment $comment comment to be emptied or deleted + * + * @throws \dml_exception + */ public static function empty_or_delete_comment($comment) { global $DB; @@ -432,4 +440,4 @@ public static function empty_or_delete_comment($comment) { } } -} \ No newline at end of file +} diff --git a/constants.php b/constants.php index 56e8f30..803c5a8 100644 --- a/constants.php +++ b/constants.php @@ -16,7 +16,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes, Friederike Schwager + * @author Rabea de Groot, Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -36,6 +36,6 @@ /** - * Prefix needed for encode64 imaged + * Prefix needed for encode64 images */ -define('IMAGE_PREFIX', 'data:image/png;base64,'); \ No newline at end of file +define('IMAGE_PREFIX', 'data:image/png;base64,'); diff --git a/controller.php b/controller.php index 21a8bf9..42fecda 100644 --- a/controller.php +++ b/controller.php @@ -17,7 +17,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Anna Heynkes, Friederike Schwager + * @author Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -87,7 +87,8 @@ if (!isset($errorinfo)) { $errorinfo = get_string('error:forwardquestion', 'pdfannotator'); // Display error notification. } - echo ""; + echo "" . + ""; if ($fromoverview) { // If user forwarded question from overview go back to overview. $action = 'overviewquestions'; @@ -164,8 +165,10 @@ $thiscourse = $pdfannotator->course; $cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id; - pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, $context); - echo $OUTPUT->heading(get_string('questionstab', 'pdfannotator') . ' ' . $OUTPUT->help_icon('questionstabicon', 'mod_pdfannotator')) . " "; + pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, + $context); + echo $OUTPUT->heading(get_string('questionstab', 'pdfannotator') . ' ' . + $OUTPUT->help_icon('questionstabicon', 'mod_pdfannotator')) . " "; $questions = pdfannotator_get_questions($thiscourse, $context, $questionfilter); @@ -179,7 +182,8 @@ } echo ""; } else { - $urlparams = array('action' => 'overviewquestions', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, 'questionfilter' => $questionfilter); + $urlparams = array('action' => 'overviewquestions', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, + 'questionfilter' => $questionfilter); pdfannotator_print_questions($questions, $thiscourse, $urlparams, $currentpage, $itemsperpage, $context); } } @@ -201,7 +205,8 @@ if (!empty($subscriptionid)) { $info = get_string('successfullySubscribed', 'pdfannotator'); - echo ""; + echo "" . + ""; } $action = 'overviewanswers'; @@ -234,7 +239,8 @@ } else { $info = get_string('successfullyUnsubscribed', 'pdfannotator', $entrycount); } - echo ""; + echo "" . + ""; $action = 'overviewanswers'; } @@ -258,8 +264,10 @@ $thiscourse = $pdfannotator->course; $cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id; - pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, $context); - echo $OUTPUT->heading(get_string('answerstab', 'pdfannotator') . ' ' . $OUTPUT->help_icon('answerstabicon', 'pdfannotator')) . " "; + pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, + $context); + echo $OUTPUT->heading(get_string('answerstab', 'pdfannotator') . ' ' . + $OUTPUT->help_icon('answerstabicon', 'pdfannotator')) . " "; $data = pdfannotator_get_answers_for_this_user($thiscourse, $context, $answerfilter); @@ -271,7 +279,8 @@ } echo ""; } else { - $urlparams = array('action' => 'overviewanswers', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, 'answerfilter' => $answerfilter); + $urlparams = array('action' => 'overviewanswers', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, + 'answerfilter' => $answerfilter); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); pdfannotator_print_answers($data, $thiscourse, $url, $currentpage, $itemsperpage, $cmid, $answerfilter); } @@ -293,8 +302,10 @@ $thiscourse = $pdfannotator->course; $cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id; - pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, $context); - echo $OUTPUT->heading(get_string('ownpoststab', 'pdfannotator') . ' ' . $OUTPUT->help_icon('ownpoststabicon', 'mod_pdfannotator')); + pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, + $context); + echo $OUTPUT->heading(get_string('ownpoststab', 'pdfannotator') . ' ' . + $OUTPUT->help_icon('ownpoststabicon', 'mod_pdfannotator')); $posts = pdfannotator_get_posts_by_this_user($thiscourse, $context); @@ -311,7 +322,7 @@ * This section marks a report as read and then rerenders the overview table of reports * (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)). */ -if ($action === 'markreportasread') { // XXX Rename key and move it into $action === 'overviewreports' +if ($action === 'markreportasread') { // XXX Rename key and move it into $action === 'overviewreports'. require_sesskey(); require_capability('mod/pdfannotator:viewreports', $context); @@ -335,10 +346,12 @@ default: $info = get_string('successfullymarkedasread', 'pdfannotator'); } - echo ""; + echo "" . + ""; } else { $info = get_string('error:markasread', 'pdfannotator'); - echo ""; + echo "" . + ""; } $action = 'overviewreports'; // This will do the actual rerendering of the page (see below). @@ -347,7 +360,7 @@ * This section marks a report as read and then rerenders the overview table of reports * (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)). */ -if ($action === 'markreportasunread') { // XXX Rename key and move it into $action === 'overviewreports' +if ($action === 'markreportasunread') { // XXX Rename key and move it into $action === 'overviewreports'. require_sesskey(); require_capability('mod/pdfannotator:viewreports', $context); @@ -362,19 +375,21 @@ // Give feedback to the user. if ($success) { switch ($reportfilter) { - case 1: // i.e.: Filter is currently set to show unread reports only. + case 1: // I.e.: Filter is currently set to show unread reports only. $info = get_string('successfullymarkedasunreadandnolongerdisplayed', 'pdfannotator'); break; - case 2: // i.e.: Filter is currently set to show all reports in this course. + case 2: // I.e.: Filter is currently set to show all reports in this course. $info = get_string('successfullymarkedasunread', 'pdfannotator'); break; default: $info = get_string('successfullymarkedasunread', 'pdfannotator'); } - echo ""; + echo "" . + ""; } else { $info = get_string('error:markasunread', 'pdfannotator'); - echo ""; + echo "" . + ""; } $action = 'overviewreports'; // This will do the actual rerendering of the page (see below). @@ -397,8 +412,10 @@ $thiscourse = $pdfannotator->course; $cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id; - pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, $context); - echo $OUTPUT->heading(get_string('reportstab', 'pdfannotator') . ' ' . $OUTPUT->help_icon('reportstabicon', 'mod_pdfannotator')) . " "; + pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, + $context); + echo $OUTPUT->heading(get_string('reportstab', 'pdfannotator') . ' ' . + $OUTPUT->help_icon('reportstabicon', 'mod_pdfannotator')) . " "; $reports = pdfannotator_get_reports($thiscourse, $reportfilter); @@ -416,7 +433,8 @@ } echo ""; } else { - $urlparams = array('action' => 'overviewreports', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, 'reportfilter' => $reportfilter); + $urlparams = array('action' => 'overviewreports', 'id' => $cmid, 'page' => $currentpage, 'itemsperpage' => $itemsperpage, + 'reportfilter' => $reportfilter); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); pdfannotator_print_reports($reports, $thiscourse, $url, $currentpage, $itemsperpage, $cmid, $reportfilter); } @@ -501,11 +519,13 @@ $report->url = $CFG->wwwroot . '/mod/pdfannotator/view.php?id=' . $cm->id . '&action=overviewreports'; $messagetext = new stdClass(); $modulename = format_string($cm->name, true); - $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, get_string('modulename', 'pdfannotator'), $modulename, $report, 'reportadded'); + $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, + get_string('modulename', 'pdfannotator'), $modulename, $report, 'reportadded'); $messagetext->url = $report->url; try { foreach ($recipients as $recipient) { - $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $modulename, $report, 'reportadded', $recipient->id); + $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, + get_string('modulename', 'pdfannotator'), $modulename, $report, 'reportadded', $recipient->id); $messageid = pdfannotator_notify_manager($recipient, $course, $cm, $name, $messagetext); } // 2. Notify the reporting user that their report has been sent off (display blue toast box at top of page). @@ -550,4 +570,4 @@ $mform->display(); } return; -} \ No newline at end of file +} diff --git a/db/access.php b/db/access.php index 0ce718c..09f9512 100644 --- a/db/access.php +++ b/db/access.php @@ -17,7 +17,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot and Anna Heynkes + * @author Rabea de Groot and Anna Heynkes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/db/events.php b/db/events.php index 933baf5..72330f6 100644 --- a/db/events.php +++ b/db/events.php @@ -14,4 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -defined('MOODLE_INTERNAL') || die(); \ No newline at end of file +defined('MOODLE_INTERNAL') || die(); diff --git a/db/install.php b/db/install.php index 0b59d11..95da194 100644 --- a/db/install.php +++ b/db/install.php @@ -22,7 +22,6 @@ /** * Function initialises the pdfannotator_annotationtypes table with its 6 standard records. * - * @global type $DB */ defined('MOODLE_INTERNAL') || die(); diff --git a/db/messages.php b/db/messages.php index ee76570..f9c94b8 100644 --- a/db/messages.php +++ b/db/messages.php @@ -20,7 +20,7 @@ * * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes and Friederike Schwager + * @author Rabea de Groot, Anna Heynkes and Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -51,4 +51,4 @@ 'capability' => 'mod/pdfannotator:getforwardedquestions', // Teacher capability. ) -); \ No newline at end of file +); diff --git a/db/upgrade.php b/db/upgrade.php index 46454ac..c623f1f 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -17,7 +17,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes, Friederike Schwager + * @author Rabea de Groot, Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -188,7 +188,8 @@ function xmldb_pdfannotator_upgrade($oldversion) { // Define field use_studentdrawing to be added to pdfannotator. $table = new xmldb_table('pdfannotator'); - $field = new xmldb_field('use_studentdrawing', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'use_studenttextbox'); + $field = new xmldb_field('use_studentdrawing', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', + 'use_studenttextbox'); // Conditionally launch add field use_studentdrawing. if (!$dbman->field_exists($table, $field)) { @@ -342,7 +343,8 @@ function xmldb_pdfannotator_upgrade($oldversion) { // Define key annotationtypeid (foreign) to be added to pdfannotator_annotations. $table = new xmldb_table('pdfannotator_annotations'); - $key = new xmldb_key('annotationtypeid', XMLDB_KEY_FOREIGN, array('annotationtypeid'), 'pdfannotator_annotationtypes', array('id')); + $key = new xmldb_key('annotationtypeid', XMLDB_KEY_FOREIGN, array('annotationtypeid'), 'pdfannotator_annotationtypes', + array('id')); // Launch add key annotationtypeid. $dbman->add_key($table, $key); @@ -579,7 +581,8 @@ function xmldb_pdfannotator_upgrade($oldversion) { // Define field useprivatecomments to be added to pdfannotator. $table = new xmldb_table('pdfannotator'); - $field = new xmldb_field('useprivatecomments', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'use_studentdrawing'); + $field = new xmldb_field('useprivatecomments', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', + 'use_studentdrawing'); // Conditionally launch add field useprivatecomments. if (!$dbman->field_exists($table, $field)) { @@ -588,7 +591,8 @@ function xmldb_pdfannotator_upgrade($oldversion) { // Define field useprotectedcomments to be added to pdfannotator. $table = new xmldb_table('pdfannotator'); - $field = new xmldb_field('useprotectedcomments', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'useprivatecomments'); + $field = new xmldb_field('useprotectedcomments', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', + 'useprivatecomments'); // Conditionally launch add field useprotectedcomments. if (!$dbman->field_exists($table, $field)) { diff --git a/forward_form.php b/forward_form.php index 2315554..45d0075 100644 --- a/forward_form.php +++ b/forward_form.php @@ -62,7 +62,7 @@ public function definition() { // Select recipients. $recipients = $this->_customdata['recipients']; - // 'selectgroups' instead of 'select' because the required-rule didn't work properly with a multi-select. + // Use 'selectgroups' instead of 'select' because the required-rule didn't work properly with a multi-select. $select = $mform->addElement('selectgroups', 'recipients', get_string('recipient', 'pdfannotator')); $select->addOptGroup('', $recipients); $select->setMultiple(true); @@ -70,7 +70,8 @@ public function definition() { $mform->addRule('recipients', get_string('recipientrequired', 'pdfannotator'), 'required', null, 'client'); // Textarea for message to the recipient. - $mform->addElement('textarea', 'message', get_string('messageforwardform', 'pdfannotator'), 'wrap="virtual" rows="5" cols="109"'); + $mform->addElement('textarea', 'message', get_string('messageforwardform', 'pdfannotator'), + 'wrap="virtual" rows="5" cols="109"'); // Add submit and cancel buttons. $this->add_action_buttons($cancel = true, get_string('send', 'pdfannotator')); diff --git a/index.php b/index.php index 1cce2bc..250a547 100644 --- a/index.php +++ b/index.php @@ -146,4 +146,4 @@ echo html_writer::table($table); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/lang/en/pdfannotator.php b/lang/en/pdfannotator.php index b510e62..f06bb51 100644 --- a/lang/en/pdfannotator.php +++ b/lang/en/pdfannotator.php @@ -17,7 +17,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes, Friederike Schwager + * @author Rabea de Groot, Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -471,4 +471,4 @@ $string['yesButton'] = 'Yes'; $string['zoom'] = 'zoom'; $string['zoomin'] = 'zoom in'; -$string['zoomout'] = 'zoom out'; \ No newline at end of file +$string['zoomout'] = 'zoom out'; diff --git a/lib.php b/lib.php index 4102a31..85b0433 100644 --- a/lib.php +++ b/lib.php @@ -16,7 +16,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Ahmad Obeid, Rabea de Groot, Anna Heynkes + * @author Ahmad Obeid, Rabea de Groot, Anna Heynkes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; @@ -28,14 +28,21 @@ */ function pdfannotator_supports($feature) { switch($feature) { - case FEATURE_GROUPS: return true; - case FEATURE_GROUPINGS: return true; - case FEATURE_MOD_INTRO: return true; - case FEATURE_COMPLETION_TRACKS_VIEWS: return true; - case FEATURE_BACKUP_MOODLE2: return true; - case FEATURE_SHOW_DESCRIPTION: return true; - - default: return null; + case FEATURE_GROUPS: + return true; + case FEATURE_GROUPINGS: + return true; + case FEATURE_MOD_INTRO: + return true; + case FEATURE_COMPLETION_TRACKS_VIEWS: + return true; + case FEATURE_BACKUP_MOODLE2: + return true; + case FEATURE_SHOW_DESCRIPTION: + return true; + + default: + return null; } } /** @@ -217,7 +224,7 @@ function pdfannotator_delete_instance($id) { * "extra" information that may be needed when printing * this activity in a course listing. * - * See {@link get_array_of_activities()} in course/lib.php + * See {@see get_array_of_activities()} in course/lib.php * * @param stdClass $coursemodule * @return cached_cm_info info @@ -230,7 +237,8 @@ function pdfannotator_get_coursemodule_info($coursemodule) { $context = context_module::instance($coursemodule->id); - if (!$pdfannotator = $DB->get_record('pdfannotator', array('id' => $coursemodule->instance), 'id, name, course, timemodified, timecreated, intro, introformat')) { + if (!$pdfannotator = $DB->get_record('pdfannotator', array('id' => $coursemodule->instance), 'id, name, course, + timemodified, timecreated, intro, introformat')) { return null; } @@ -555,10 +563,15 @@ function mod_pdfannotator_core_calendar_provide_event_action(calendar_event $eve * Returns all annotations comments since a given time in specified annotator. * * @todo Document this functions args - * @global object - * @global object - * @global object - * @global object + * @param $activities + * @param $index + * @param $timestart + * @param $courseid + * @param $cmid + * @param int $userid + * @param int $groupid + * @throws dml_exception + * @throws moodle_exception */ function pdfannotator_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) { global $CFG, $COURSE, $USER, $DB; @@ -601,7 +614,7 @@ function pdfannotator_get_recent_mod_activity(&$activities, &$index, $timestart, $printposts = array(); $context = context_course::instance($courseid); foreach ($posts as $post) { - if(!pdfannotator_can_see_comment($post, $context)) { + if (!pdfannotator_can_see_comment($post, $context)) { continue; } $printposts[] = $post; diff --git a/locallib.php b/locallib.php index 184a3ee..e01ead4 100644 --- a/locallib.php +++ b/locallib.php @@ -16,7 +16,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README) - * @authors Rabea de Groot, Anna Heynkes, Friederike Schwager + * @author Rabea de Groot, Anna Heynkes, Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -221,7 +221,8 @@ function pdfannotator_process_latex_moodle($context, $string) { } $imagedata = file_get_contents($image); $result['image'] = IMAGE_PREFIX . base64_encode($imagedata); - //imageinfo returns an array with the info of the size of the image. In Parameter 1 there is the height, which is the only thing needed here + // Imageinfo returns an array with the info of the size of the image. In Parameter 1 there is the height, which is the only + // thing needed here. $imageinfo = getimagesize($image); $result['imageheight'] = $imageinfo[1]; return $result; @@ -400,7 +401,7 @@ function pdfannotator_print_header($pdfannotator, $cm, $course) { } /** - * Gets details of the file to cache in course cache to be displayed using {@link pdfannotator_get_optional_details()} + * Gets details of the file to cache in course cache to be displayed using {@see pdfannotator_get_optional_details()} * * @param object $pdfannotator pdfannotator table row (only property 'displayoptions' is used here) * @param object $cm Course-module table row @@ -478,7 +479,6 @@ function pdfannotator_print_filenotfound($pdfannotator, $cm, $course) { * *Drawings and textboxes cannot be commented. In their case (only), * therefore, annotations are counted. * - * @global type $DB */ function pdfannotator_get_number_of_new_activities($annotatorid) { @@ -501,7 +501,6 @@ function pdfannotator_get_number_of_new_activities($annotatorid) { * The modification can be the creation of the annotator, a change of title or description, * a new annotation or a new comment. Reports are not considered. * - * @global type $DB * @param int $annotatorid * @return datetime $timemodified * The timestamp can be transformed into a readable string with this moodle method: @@ -623,8 +622,6 @@ function pdfannotator_unsubscribe_all($annotatorid) { /** * Checks wether a user has subscribed to all questions in an annotator. * Returns 1 if all questions are subscribed, 0 if no questions are subscribed and -1 if at least one but not all questions are subscribed. - * @global type $DB - * @global type $USER * @param type $annotatorid */ function pdfannotator_subscribed($annotatorid) { @@ -713,7 +710,6 @@ function pdfannotator_prepare_overviewpage($cmid, $myrenderer, $taburl, $action, * Function serves as subcontroller that tells the annotator model to collect * all or all unsolved/solved questions asked in this course. * - * @global type $OUTPUT * @param int $openannotator * @param int $courseid * @param type $questionfilter @@ -742,7 +738,8 @@ function pdfannotator_get_questions($courseid, $context, $questionfilter) { if ($questionfilter == 1) { $sql = $sql . ' AND NOT c.solved = 0 '; } - $sql = $sql . "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id, a.page, a.pdfannotatorid, c.content, c.userid, c.visibility, c.timecreated, c.isdeleted, c.ishidden, c.isquestion"; + $sql = $sql . "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id, a.page, a.pdfannotatorid, c.content, c.userid, c.visibility," + . "c.timecreated, c.isdeleted, c.ishidden, c.isquestion"; $params = array_merge([$courseid], $inparams); $questions = $DB->get_records_sql($sql, $params); @@ -812,8 +809,6 @@ function pdfannotator_get_questions($courseid, $context, $questionfilter) { * Function serves as subcontroller that tells the annotator model to collect all * questions and answers this user posted in the course. * - * @global type $DB - * @global type $USER * @param int $courseid * @return type */ @@ -886,8 +881,6 @@ function pdfannotator_get_posts_by_this_user($courseid, $context) { * all answers given to questions that the current user asked or subscribed to * in this course. * - * @global type $DB - * @global type $USER * @param int $courseid * @param Moodle object? $context * @param int $answerfilter @@ -906,7 +899,8 @@ function pdfannotator_get_answers_for_this_user($courseid, $context, $answerfilt if ($answerfilter == 0) { // Either: get all answers in this annotator. $sql = "SELECT c.id AS answerid, c.content AS answer, c.userid AS userid, c.visibility, " - . "c.timemodified, c.solved AS correct, c.ishidden AS answerhidden, a.id AS annoid, a.page, q.id AS questionid, q.userid AS questionuserid, c.isquestion, c.annotationid, " + . "c.timemodified, c.solved AS correct, c.ishidden AS answerhidden, a.id AS annoid, a.page, q.id AS questionid," + . "q.userid AS questionuserid, c.isquestion, c.annotationid, " . "q.visibility AS questionvisibility, " . "q.content AS answeredquestion, q.isdeleted AS questiondeleted, q.ishidden AS questionhidden, p.id AS annotatorid, " . "p.name AS pdfannotatorname, cm.id AS cmid, s.id AS issubscribed " @@ -920,7 +914,8 @@ function pdfannotator_get_answers_for_this_user($courseid, $context, $answerfilt . "ORDER BY annoid ASC"; } else { // Or: get answers to those questions the user subscribed to. $sql = "SELECT c.id AS answerid, c.content AS answer, c.userid AS userid, c.visibility, " - . "c.timemodified, c.solved AS correct, c.ishidden AS answerhidden, a.id AS annoid, a.page, q.id AS questionid, q.userid AS questionuserid, c.isquestion, c.annotationid, " + . "c.timemodified, c.solved AS correct, c.ishidden AS answerhidden, a.id AS annoid, a.page, q.id AS questionid, " + . "q.userid AS questionuserid, c.isquestion, c.annotationid, " . "q.visibility AS questionvisibility, " . "q.content AS answeredquestion, q.isdeleted AS questiondeleted, q.ishidden AS questionhidden, p.id AS annotatorid, " . "p.name AS pdfannotatorname, cm.id AS cmid " @@ -1002,7 +997,6 @@ function pdfannotator_get_answers_for_this_user($courseid, $context, $answerfilt * Function retrieves reports and their respective reported comments from db. * Depending on the reportfilter, only read/unread reports or all reports are retrieved. * - * @global type $DB * @param int $courseid * @param int $reportfilter: 0 for unread, 1 for read, 2 for all * @return array of report objects @@ -1354,7 +1348,6 @@ function array_key_first(array $array) { /** * This function renders the table of unsolved questions on the overview page. * - * @global type $CFG * @param array $questions * @param int $thiscourse * @param Moodle url object $url @@ -1410,8 +1403,6 @@ function pdfannotator_print_questions($questions, $thiscourse, $urlparams, $curr * Function prints a table view of all answers to questions the current * user asked or subscribed to. * - * @global type $CFG - * @global type $OUTPUT * @param int $annotator * @param Moodle url object $url * @param int $thiscourse @@ -1455,9 +1446,6 @@ function pdfannotator_print_answers($data, $thiscourse, $url, $currentpage, $ite /** * - * @global type $CFG - * @global type $DB - * @global type $USER * @param type $posts * @param type $url * @param type $thiscourse @@ -1501,7 +1489,6 @@ function pdfannotator_print_this_users_posts($posts, $thiscourse, $url, $current /** * Function prints a table view of all comments that were reported as inappropriate. * - * @global type $CFG * @param array of objects $reports * @param int $thiscourse * @param Moodle url object $url @@ -1591,7 +1578,6 @@ function pdfannotator_questionstable_add_row($thiscourse, $table, $question, $ur * This function adds a row of data to the overview table that displays * answers to any question the user subscribed to. * - * @global type $CFG * @param int $thiscourse * @param answerstable $table * @param object $answer @@ -1660,7 +1646,6 @@ function pdfannotator_userspoststable_add_row($table, $post) { * This function adds a row of data to the overview table that displays all * comments reported in this course. * - * @global type $CFG * @param int $thiscourse * @param reportstable $table * @param object $report @@ -1820,4 +1805,4 @@ function pdfannotator_count_answers($annotationid, $context) { $count++; } return $count; -} \ No newline at end of file +} diff --git a/mod_form.php b/mod_form.php index 260f101..cf4f7fd 100644 --- a/mod_form.php +++ b/mod_form.php @@ -65,10 +65,12 @@ public function definition() { $filemanageroptions['maxfiles'] = 1; // Upload only one file. $filemanageroptions['mainfile'] = true; - $mform->addElement('filemanager', 'files', get_string('setting_fileupload', 'pdfannotator'), null, $filemanageroptions); // Params: 1. type of the element, 2. (html) elementname, 3. label. + $mform->addElement('filemanager', 'files', get_string('setting_fileupload', 'pdfannotator'), null, + $filemanageroptions); // Params: 1. type of the element, 2. (html) elementname, 3. label. $mform->addHelpButton('files', 'setting_fileupload', 'pdfannotator'); - $mform->addElement('advcheckbox', 'usevotes', get_string('setting_usevotes', 'pdfannotator'), get_string('usevotes', 'pdfannotator'), null, array(0, 1)); + $mform->addElement('advcheckbox', 'usevotes', get_string('setting_usevotes', 'pdfannotator'), + get_string('usevotes', 'pdfannotator'), null, array(0, 1)); $mform->setType('usevotes', PARAM_BOOL); $mform->setDefault('usevotes', $config->usevotes); $mform->addHelpButton('usevotes', 'setting_usevotes', 'pdfannotator'); @@ -86,22 +88,26 @@ public function definition() { $mform->addHelpButton('use_studentdrawing', 'setting_use_studentdrawing', 'pdfannotator'); // XXX second checkbox or change to select. - $mform->addElement('advcheckbox', 'useprint', get_string('setting_useprint_document', 'pdfannotator'), get_string('useprint', 'pdfannotator'), null, array(0, 1)); + $mform->addElement('advcheckbox', 'useprint', get_string('setting_useprint_document', 'pdfannotator'), + get_string('useprint', 'pdfannotator'), null, array(0, 1)); $mform->setType('useprint', PARAM_BOOL); $mform->setDefault('useprint', $config->useprint); $mform->addHelpButton('useprint', 'setting_useprint_document', 'pdfannotator'); - $mform->addElement('advcheckbox', 'useprintcomments', get_string('setting_useprint_comments', 'pdfannotator'), get_string('useprint_comments', 'pdfannotator'), null, array(0, 1)); + $mform->addElement('advcheckbox', 'useprintcomments', get_string('setting_useprint_comments', 'pdfannotator'), + get_string('useprint_comments', 'pdfannotator'), null, array(0, 1)); $mform->setType('useprintcomments', PARAM_BOOL); $mform->setDefault('useprintcomments', $config->useprintcomments); $mform->addHelpButton('useprintcomments', 'setting_useprint_comments', 'pdfannotator'); - $mform->addElement('advcheckbox', 'useprivatecomments', get_string('setting_use_private_comments', 'pdfannotator'), get_string('use_private_comments', 'pdfannotator'), null, array(0, 1)); + $mform->addElement('advcheckbox', 'useprivatecomments', get_string('setting_use_private_comments', 'pdfannotator'), + get_string('use_private_comments', 'pdfannotator'), null, array(0, 1)); $mform->setType('useprivatecomments', PARAM_BOOL); $mform->setDefault('useprivatecomments', $config->use_private_comments); $mform->addHelpButton('useprivatecomments', 'setting_use_private_comments', 'pdfannotator'); - $mform->addElement('advcheckbox', 'useprotectedcomments', get_string('setting_use_protected_comments', 'pdfannotator'), get_string('use_protected_comments', 'pdfannotator'), null, array(0, 1)); + $mform->addElement('advcheckbox', 'useprotectedcomments', get_string('setting_use_protected_comments', 'pdfannotator'), + get_string('use_protected_comments', 'pdfannotator'), null, array(0, 1)); $mform->setType('useprotectedcomments', PARAM_BOOL); $mform->setDefault('useprotectedcomments', $config->use_protected_comments); $mform->addHelpButton('useprotectedcomments', 'setting_use_protected_comments', 'pdfannotator'); diff --git a/model/annotation.class.php b/model/annotation.class.php index 8ac2b2a..fb416f4 100644 --- a/model/annotation.class.php +++ b/model/annotation.class.php @@ -22,7 +22,7 @@ * * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes and Friederike Schwager + * @author Rabea de Groot, Anna Heynkes and Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -33,8 +33,6 @@ class pdfannotator_annotation { /** * This method creates a new record in the database table named mdl_pdfannotator_annotations and returns its id * - * @global type $DB - * @global type $USER * @param type $documentid specifies the pdf file to which this annotation belongs * @param type $pageid specifies the page within that pdf file * @param type $type child class (highlight, strikeout, area, textbox, drawing, comment or point) @@ -59,7 +57,6 @@ public static function create_annotation($documentid, $pageid, $type, $itemid) { * Method updates data attribute (consisting of width, color and lines) * in mdl_pdfannotator_drawings after a drawing was shifted in position * - * @global type $DB * @param type $annotationid * @param type $newdata * @return type int 1 for success @@ -94,7 +91,6 @@ public static function update($annotationid, $newdata) { * if the user is allowed to do so. * Teachers are allowed to delete any comment, students may only delete their own comments. * - * @global type $DB * @param type $annotationId * @param type $cmid * @param type $deleteanyway Delete annotation in any case. F.e. if right to be forgotten was invoked or @@ -167,7 +163,8 @@ public static function deletion_allowed($annotation, $cmid) { } else if (($author !== $userid) || !$deleteown) { $result[] = false; $result[] = get_string('onlyDeleteOwnAnnotations', 'pdfannotator'); - } else if ($DB->record_exists_select('pdfannotator_comments', "annotationid = ? AND userid != ?", [$annotation->id, $userid])) { // Check whether other people have commented this annotation.) + } else if ($DB->record_exists_select('pdfannotator_comments', "annotationid = ? AND userid != ?", + [$annotation->id, $userid])) { // Check whether other people have commented this annotation. $result[] = false; $result[] = get_string('onlyDeleteUncommentedPosts', 'pdfannotator'); } else { @@ -182,7 +179,6 @@ public static function deletion_allowed($annotation, $cmid) { * It returns true if the annotation was made by the user who is trying to shift it and no other person has answered * or if that user is an admin. * - * @global type $USER * @param type $annotationId * @return boolean */ @@ -196,7 +192,8 @@ public static function shifting_allowed($annotationid, $context) { } if (!$editownpost || $USER->id != self::get_author($annotationid)) { return false; - } else if ($DB->record_exists_select('pdfannotator_comments', "annotationid = ? AND userid != ?", array($annotationid, $USER->id))) { + } else if ($DB->record_exists_select('pdfannotator_comments', "annotationid = ? AND userid != ?", + array($annotationid, $USER->id))) { // Annotation was answered by other users. return false; } @@ -245,7 +242,6 @@ public static function get_information($annotationid) { /** * Method takes an annotation's id and returns the user id of its author * - * @global type $DB * @param type $itemid * @return type */ @@ -258,7 +254,6 @@ public static function get_author($annotationid) { /** * Method takes an annotation's id and returns the page it was made on * - * @global type $DB * @param type $annotationId * @return type */ @@ -270,7 +265,6 @@ public static function get_pageid($annotationid) { /** * Method takes an annotation's id and returns the content of the underlying question comment * - * @global type $DB * @param type $annotationId * @return type */ diff --git a/model/comment.class.php b/model/comment.class.php index 2c40f42..b282c6b 100644 --- a/model/comment.class.php +++ b/model/comment.class.php @@ -16,7 +16,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot, Anna Heynkes and Friederike Schwager + * @author Rabea de Groot, Anna Heynkes and Friederike Schwager * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -32,8 +32,6 @@ class pdfannotator_comment { /** * This method inserts a new record into mdl_pdfannotator_comments and returns its id * - * @global type $DB - * @global type $USER * @param type $documentid specifies the pdf * @param type $annotationid specifies the annotation (usually a highlight) to be commented * @param type $content the text or comment itself @@ -50,7 +48,7 @@ public static function create($documentid, $annotationid, $content, $visibility, $datarecord->annotationid = $annotationid; $datarecord->userid = $USER->id; $datarecord->content = $content; - $datarecord->timecreated = time(); // Moodle method: DateTime::getTimestamp(); + $datarecord->timecreated = time(); // Moodle method: DateTime::getTimestamp();. $datarecord->timemodified = $datarecord->timecreated; $datarecord->visibility = $visibility; $datarecord->isquestion = $isquestion; @@ -85,12 +83,14 @@ public static function create($documentid, $annotationid, $content, $visibility, $messagetext = new stdClass(); $module = get_string('modulename', 'pdfannotator'); - $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, $module, $modulename, $comment, 'newanswer'); + $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, $module, $modulename, + $comment, 'newanswer'); $messagetext->url = $comment->urltoanswer; $recipients = self::get_subscribed_users($annotationid); foreach ($recipients as $recipient) { if ($recipient != $USER->id) { - $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, $modulename, $comment, 'newanswer', $recipient); + $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, + $modulename, $comment, 'newanswer', $recipient); $messageid = pdfannotator_notify_manager($recipient, $course, $cm, 'newanswer', $messagetext, $anonymous); } } @@ -105,19 +105,23 @@ public static function create($documentid, $annotationid, $content, $visibility, $question->content = $content; $page = $DB->get_field('pdfannotator_annotations', 'page', array('id' => $annotationid), $strictness = MUST_EXIST); - $question->urltoanswer = $CFG->wwwroot . '/mod/pdfannotator/view.php?id=' . $cm->id . '&page=' . $page . '&annoid=' . $annotationid . '&commid=' . $commentuuid; + $question->urltoanswer = $CFG->wwwroot . '/mod/pdfannotator/view.php?id=' . $cm->id . '&page=' . $page . + '&annoid=' . $annotationid . '&commid=' . $commentuuid; $messagetext = new stdClass(); - $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, get_string('modulename', 'pdfannotator'), $modulename, $question, 'newquestion'); + $messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, + get_string('modulename', 'pdfannotator'), $modulename, $question, 'newquestion'); $messagetext->url = $question->urltoanswer; foreach ($recipients as $recipient) { - if (!pdfannotator_can_see_comment($datarecord, $context) ){ + if (!pdfannotator_can_see_comment($datarecord, $context)) { continue; } if ($recipient->id == $USER->id) { continue; } - $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $modulename, $question, 'newquestion', $recipient->id); + $messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, + get_string('modulename', 'pdfannotator'), $modulename, $question, 'newquestion', + $recipient->id); $messageid = pdfannotator_notify_manager($recipient, $course, $cm, 'newquestion', $messagetext, $anonymous); } @@ -132,7 +136,6 @@ public static function create($documentid, $annotationid, $content, $visibility, /** * This method returns an array of all comment objects belonging to the specified annotation. * - * @global type $DB * @param type $documentid * @param type $highlightid * @param $context @@ -143,17 +146,20 @@ public static function read($documentid, $annotationid, $context) { global $DB, $USER; // Get the ids and text content of all comments attached to this annotation/highlight. - $sql = "SELECT c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, c.timemodified, c.modifiedby, c.solved, c.annotationid, SUM(vote) AS votes " + $sql = "SELECT c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, " + . "c.timemodified, c.modifiedby, c.solved, c.annotationid, SUM(vote) AS votes " . "FROM {pdfannotator_comments} c LEFT JOIN {pdfannotator_votes} v" . " ON c.id=v.commentid WHERE annotationid = ?" - . " GROUP BY c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, c.timemodified, c.modifiedby, c.solved, c.annotationid" + . " GROUP BY c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, " + . "c.timemodified, c.modifiedby, c.solved, c.annotationid" . " ORDER BY c.timecreated"; $a = array(); $a[] = $annotationid; $comments = $DB->get_records_sql($sql, $a); // Records taken from table 'comments' as an array of objects. $usevotes = pdfannotator_instance::use_votes($documentid); - $annotation = $DB->get_record('pdfannotator_annotations', ['id' => $annotationid], $fields = 'timecreated, timemodified, modifiedby', $strictness = MUST_EXIST); + $annotation = $DB->get_record('pdfannotator_annotations', ['id' => $annotationid], + $fields = 'timecreated, timemodified, modifiedby', $strictness = MUST_EXIST); $result = array(); foreach ($comments as $data) { @@ -241,8 +247,6 @@ public static function set_username($comment) { /** * Function serves to hide a comment from participants' view while keeping it visibile for managers/teachers/etc. * - * @global type $DB - * @global type $USER * @return type */ public static function hide_comment($commentid, $cmid) { @@ -285,7 +289,7 @@ public static function hide_comment($commentid, $cmid) { if ($workingfine != 0) { $tobedeletedaswell[] = $predecessor->id; if ($predecessor->isquestion) { - $hideannotation = 1; // $annotationid; + $hideannotation = 1; // ... $annotationid; } } } else { @@ -298,7 +302,8 @@ public static function hide_comment($commentid, $cmid) { $success = $DB->update_record('pdfannotator_comments', array("id" => $commentid, "ishidden" => 1), $bulk = false); if ($success == 1) { - return ['status' => 'success', 'hideannotation' => $hideannotation, 'wasanswered' => $wasanswered, 'followups' => $tobedeletedaswell]; + return ['status' => 'success', 'hideannotation' => $hideannotation, 'wasanswered' => $wasanswered, + 'followups' => $tobedeletedaswell]; } else { return ['status' => 'error']; } @@ -426,8 +431,6 @@ public static function update($commentid, $content, $editanypost) { /** * Inserts a vote into the db. - * @global type $DB - * @global type $USER * @param type $commentid * @return boolean */ @@ -458,8 +461,6 @@ public static function insert_vote($documentid, $commentid) { /** * Inserts a subscription into the DB. - * @global type $DB - * @global type $USER * @param type $annotationid * @return boolean */ @@ -470,7 +471,7 @@ public static function insert_subscription($annotationid, $context) { if ($DB->record_exists('pdfannotator_subscriptions', array('annotationid' => $annotationid, 'userid' => $USER->id))) { return false; } - + $comment = $DB->get_record('pdfannotator_comments', array('annotationid' => $annotationid, 'isquestion' => '1')); if (!pdfannotator_can_see_comment($comment, $context)) { return false; @@ -480,15 +481,12 @@ public static function insert_subscription($annotationid, $context) { $datarecord->annotationid = $annotationid; $datarecord->userid = $USER->id; - $subscriptionid = $DB->insert_record('pdfannotator_subscriptions', $datarecord, $returnid = true); return $subscriptionid; } /** * Deletes a subscription. - * @global type $DB - * @global type $USER * @param type $annotationid * @return string */ @@ -504,8 +502,6 @@ public static function delete_subscription($annotationid) { /** * Marks a comment as solved. A question will be closed (or opened) and a answer will be marked as correct. - * @global type $DB - * @global type $USER * @param type $commentid * @return boolean */ @@ -541,8 +537,6 @@ public static function is_solved($commentid) { /** * Returns if the user already voted a comment. - * @global type $DB - * @global type $USER * @param type $commentid * @return type */ @@ -553,7 +547,6 @@ public static function is_voted($commentid) { /** * Returns the number of votes a comment got. - * @global type $DB * @param type $commentid * @return type */ @@ -564,8 +557,6 @@ public static function get_number_of_votes($commentid) { /** * Returns if the user is subscribed to a question. - * @global type $DB - * @global type $USER * @param type $annotationid * @return type */ @@ -576,7 +567,6 @@ public static function is_subscribed($annotationid) { /** * Returns all subscribed users to a question. - * @global type $DB * @param type $annotationid * @return arry of userids as strings */ @@ -636,7 +626,6 @@ public static function get_all_questions($documentid, $context) { /** * Get all questions in an annotator where a comment contains the pattern - * @global type $DB * @param type $documentid * @param type $pattern */ diff --git a/model/overviewtable.php b/model/overviewtable.php index a3baebb..48c7fd5 100644 --- a/model/overviewtable.php +++ b/model/overviewtable.php @@ -64,7 +64,7 @@ class questionstable extends overviewtable { public function __construct($url, $showdropdown) { parent::__construct($this->id); global $OUTPUT; -// $this->collapsible(true); // Concerns the tables columns. + // $this->collapsible(true); // Concerns the tables columns. $this->define_baseurl($url); $columns = array('col0', 'col1', 'col2', 'col3', 'col4', 'col5'); if ($showdropdown) { @@ -80,12 +80,21 @@ public function __construct($url, $showdropdown) { $this->column_style('col5', 'width', '20%'); // In which annotator is the question located. $this->attributes['id'] = $this->id; - $question = get_string('question', 'pdfannotator'); // $OUTPUT->pix_icon('i/unlock', '') . self::wrap(get_string('question', 'pdfannotator')); - $whoasked = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); - $votes = "" . ' ' . $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); // "" . self::wrap(get_string('votes', 'pdfannotator')) . ' ' . $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); - $answers = $OUTPUT->pix_icon('t/message', '') . ' ' . $OUTPUT->help_icon('answercounthelpicon', 'pdfannotator');; // $OUTPUT->pix_icon('t/message', '') . ' ' . self::wrap(get_string('answers', 'pdfannotator')); - $lastanswered = get_string('lastanswered', 'pdfannotator'); // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('lastanswered', 'pdfannotator')); - $document = get_string('pdfannotatorcolumn', 'pdfannotator'); // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); + $question = get_string('question', 'pdfannotator'); + // $OUTPUT->pix_icon('i/unlock', '') . self::wrap(get_string('question', 'pdfannotator')); + $whoasked = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); + // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); + $votes = "" . ' ' . + $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); + // "" . self::wrap(get_string('votes', 'pdfannotator')) . + // ' ' . $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); + $answers = $OUTPUT->pix_icon('t/message', '') . ' ' . $OUTPUT->help_icon('answercounthelpicon', 'pdfannotator'); + // $OUTPUT->pix_icon('t/message', '') . ' ' . self::wrap(get_string('answers', 'pdfannotator')); + $lastanswered = get_string('lastanswered', 'pdfannotator'); + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('lastanswered', 'pdfannotator')); + $document = get_string('pdfannotatorcolumn', 'pdfannotator'); + // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); $headers = array($question, $whoasked, $votes, $answers, $lastanswered, $document); if ($showdropdown) { @@ -125,12 +134,19 @@ public function __construct($url) { $this->column_style('col4', 'width', '10%'); // Annotator in which the question was asked. $this->column_style('col5', 'width', '10%'); // Action dropdown menu. $this->attributes['id'] = $this->id; - $answer = get_string('answer', 'pdfannotator'); // $OUTPUT->pix_icon('t/message', '') . self::wrap(get_string('answer', 'pdfannotator')); - $iscorrect = $OUTPUT->pix_icon('t/check', '') . ' ' . $OUTPUT->help_icon('iscorrecthelpicon', 'pdfannotator'); // . get_string('correct', 'pdfannotator'); - $whoanswered = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); - $question = get_string('myquestion', 'pdfannotator'); // $OUTPUT->pix_icon('i/email', '') . self::wrap(get_string('myquestion', 'pdfannotator')); - $document = get_string('pdfannotatorcolumn', 'pdfannotator'); // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); - $actionmenu = get_string('overviewactioncolumn', 'pdfannotator'); // $OUTPUT->pix_icon('i/settings', '') . self::wrap(get_string('overviewactioncolumn', 'pdfannotator')); + $answer = get_string('answer', 'pdfannotator'); + // $OUTPUT->pix_icon('t/message', '') . self::wrap(get_string('answer', 'pdfannotator')); + $iscorrect = $OUTPUT->pix_icon('t/check', '') . ' ' . $OUTPUT->help_icon('iscorrecthelpicon', 'pdfannotator'); + // . get_string('correct', 'pdfannotator'); + $whoanswered = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); + // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); + $question = get_string('myquestion', 'pdfannotator'); + // $OUTPUT->pix_icon('i/email', '') . self::wrap(get_string('myquestion', 'pdfannotator')); + $document = get_string('pdfannotatorcolumn', 'pdfannotator'); + // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); + $actionmenu = get_string('overviewactioncolumn', 'pdfannotator'); + // $OUTPUT->pix_icon('i/settings', '') . self::wrap(get_string('overviewactioncolumn', 'pdfannotator')); $this->define_headers(array($answer, $iscorrect, $whoanswered, $question, $document, $actionmenu)); $this->no_sorting('col1'); $this->no_sorting('col0'); @@ -158,10 +174,16 @@ public function __construct($url) { $this->column_style('col2', 'width', '7%'); // Number of votes for this post. $this->column_style('col3', 'width', '15%'); // Annotator in which they posted it. $this->attributes['id'] = $this->id; - $mypost = get_string('mypost', 'pdfannotator'); // $OUTPUT->pix_icon('t/message', '') . self::wrap(get_string('mypost', 'pdfannotator')); - $lastedited = get_string('lastedited', 'pdfannotator'); // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('lastedited', 'pdfannotator')); - $votes = "" . ' ' . $OUTPUT->help_icon('voteshelpicontwo', 'pdfannotator');; // "" . self::wrap(get_string('votes', 'pdfannotator')). ' ' . $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); - $document = get_string('pdfannotatorcolumn', 'pdfannotator'); // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); + $mypost = get_string('mypost', 'pdfannotator'); + // $OUTPUT->pix_icon('t/message', '') . self::wrap(get_string('mypost', 'pdfannotator')); + $lastedited = get_string('lastedited', 'pdfannotator'); + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('lastedited', 'pdfannotator')); + $votes = "" . ' ' . + $OUTPUT->help_icon('voteshelpicontwo', 'pdfannotator'); + // "" . self::wrap(get_string('votes', 'pdfannotator')). ' ' . + // $OUTPUT->help_icon('voteshelpicon', 'pdfannotator'); + $document = get_string('pdfannotatorcolumn', 'pdfannotator'); + // "" . self::wrap(get_string('pdfannotatorcolumn', 'pdfannotator')); $this->define_headers(array($mypost, $lastedited, $votes, $document)); $this->no_sorting('col0'); $this->sortable(true, 'col2', SORT_ASC); @@ -187,11 +209,18 @@ public function __construct($url) { $this->column_style('col3', 'width', '20%'); // Who reported the comment and when. $this->column_style('col4', 'width', '10%'); // Action dropdown menu. $this->attributes['id'] = $this->id; - $report = get_string('report', 'pdfannotator'); // $OUTPUT->pix_icon('i/email', '') . self::wrap(get_string('report', 'pdfannotator')); - $reportedby = get_string('by', 'pdfannotator'). ' '. get_string('on', 'pdfannotator'); // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); - $reportedcomment = get_string('reportedcomment', 'pdfannotator'); // $OUTPUT->pix_icon('i/flagged', '') . self::wrap(get_string('reportedcomment', 'pdfannotator')); - $writtenby = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); - $actionmenu = get_string('overviewactioncolumn', 'pdfannotator'); // $OUTPUT->pix_icon('i/settings', '') . self::wrap(get_string('overviewactioncolumn', 'pdfannotator')); + $report = get_string('report', 'pdfannotator'); + // $OUTPUT->pix_icon('i/email', '') . self::wrap(get_string('report', 'pdfannotator')); + $reportedby = get_string('by', 'pdfannotator'). ' '. get_string('on', 'pdfannotator'); + // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); + $reportedcomment = get_string('reportedcomment', 'pdfannotator'); + // $OUTPUT->pix_icon('i/flagged', '') . self::wrap(get_string('reportedcomment', 'pdfannotator')); + $writtenby = get_string('by', 'pdfannotator') . ' ' . get_string('on', 'pdfannotator'); + // $OUTPUT->pix_icon('i/user', '') . self::wrap(get_string('by', 'pdfannotator')) . ' ' . + // $OUTPUT->pix_icon('e/insert_time', '') . self::wrap(get_string('on', 'pdfannotator')); + $actionmenu = get_string('overviewactioncolumn', 'pdfannotator'); + // $OUTPUT->pix_icon('i/settings', '') . self::wrap(get_string('overviewactioncolumn', 'pdfannotator')); $this->define_headers(array($report, $reportedby, $reportedcomment, $writtenby, $actionmenu)); $this->no_sorting('col0'); $this->no_sorting('col2'); @@ -199,4 +228,4 @@ public function __construct($url) { $this->sortable(true, 'col3', SORT_ASC); $this->sortable(true, 'col1', SORT_DESC); } -} \ No newline at end of file +} diff --git a/model/pdfannotator.php b/model/pdfannotator.php index e1b9546..4cc9776 100644 --- a/model/pdfannotator.php +++ b/model/pdfannotator.php @@ -56,7 +56,6 @@ public function __construct($dbrecord) { * This method returns an array containing one pdfannotator_instance object * for each annotator in the specified course. * - * @global type $DB * @param type $courseid * @param type $beginwith optional parameter that specifies the (current) pdfannotator that should come first in the list * @return \pdfannotator_instance: array of pdfannotator_instance objects diff --git a/model/statistics.class.php b/model/statistics.class.php index c95015b..c56932a 100644 --- a/model/statistics.class.php +++ b/model/statistics.class.php @@ -41,7 +41,6 @@ public function __construct($courseid, $annotatorid, $userid, $isteacher = false /** * Returns the number of questions/answers in one PDF-Annotator by one/all users - * @global type $DB * @param type $isquestion '1' for questions, '0' for answers * @param type $user false by default for comments by all users. True for comments by the user * @return type @@ -59,7 +58,6 @@ public function get_comments_annotator($isquestion, $user = false) { /** * Returns the number of questions/answers in all PDF-Annotators in one course by one/all users - * @global type $DB * @param type $isquestion '1' for questions, '0' for answers * @param type $user false by default for comments by all users. userid for comments by a specific user * @return type @@ -77,7 +75,6 @@ public function get_comments_course($isquestion, $user = false) { /** * Returns the average number of questions/answers a user wrote in this pdf-annotator. * Only users that wrote at least one comment are included. - * @global type $DB * @param type $isquestion '1' for questions, '0' for answers * @return type */ @@ -94,7 +91,6 @@ public function get_comments_average_annotator($isquestion) { /** * Returns the average number of questions/answers a user wrote in this course. * Only users that wrote at least one comment are included. - * @global type $DB * @param type $isquestion '1' for questions, '0' for answers * @return type */ @@ -111,7 +107,6 @@ public function get_comments_average_course($isquestion) { /** * Returns the number of reported comments in this annotator. - * @global type $DB * @return type */ public function get_reports_annotator() { @@ -121,7 +116,6 @@ public function get_reports_annotator() { /** * Returns the number of reported comments in this course. - * @global type $DB * @return type */ public function get_reports_course() { @@ -136,19 +130,38 @@ public function get_reports_course() { public function get_tabledata() { $ret = []; - $ret[] = array('row' => array(get_string('all_questions', 'pdfannotator'), $this->get_comments_annotator('1'), $this->get_comments_course('1'))); - $ret[] = array('row' => array(get_string('myquestions', 'pdfannotator'), $this->get_comments_annotator('1', true), $this->get_comments_course('1', true))); - $ret[] = array('row' => array(get_string('average_questions', 'pdfannotator').'' - , round($this->get_comments_average_annotator('1'), 2), round($this->get_comments_average_course('1'), 2))); - $ret[] = array('row' => array(get_string('all_answers', 'pdfannotator'), $this->get_comments_annotator('0'), $this->get_comments_course('0'))); - $ret[] = array('row' => array(get_string('myanswers', 'pdfannotator'), $this->get_comments_annotator('0', true), $this->get_comments_course('0', true))); - $ret[] = array('row' => array(get_string('average_answers', 'pdfannotator').'' - , round($this->get_comments_average_annotator('0'), 2), round($this->get_comments_average_course('0'), 2))); - $ret[] = array('row' => array(get_string('private_comments', 'pdfannotator'), $this->count_private_comments($this->annotatorid, 0) + $this->count_private_comments($this->annotatorid, 1), $this->count_private_comments_in_course())); - $ret[] = array('row' => array(get_string('protected_comments', 'pdfannotator'), $this->count_protected_comments($this->annotatorid, 1) + $this->count_protected_comments($this->annotatorid, 0), $this->count_protected_comments_in_course())); + $ret[] = array('row' => array(get_string('all_questions', 'pdfannotator'), + $this->get_comments_annotator('1'), $this->get_comments_course('1'))); + $ret[] = array('row' => array(get_string('myquestions', 'pdfannotator'), + $this->get_comments_annotator('1', true), $this->get_comments_course('1', true))); + $ret[] = array('row' => array(get_string('average_questions', 'pdfannotator') . + '' , round($this->get_comments_average_annotator('1'), 2), + round($this->get_comments_average_course('1'), 2))); + $ret[] = array('row' => array(get_string('all_answers', 'pdfannotator'), + $this->get_comments_annotator('0'), $this->get_comments_course('0'))); + $ret[] = array('row' => array(get_string('myanswers', 'pdfannotator'), + $this->get_comments_annotator('0', true), $this->get_comments_course('0', true))); + $ret[] = array('row' => array(get_string('average_answers', 'pdfannotator') . + '', round($this->get_comments_average_annotator('0'), 2), + round($this->get_comments_average_course('0'), 2))); + $ret[] = array('row' => array(get_string('private_comments', 'pdfannotator'), + $this->count_private_comments($this->annotatorid, 0) + $this->count_private_comments($this->annotatorid, 1), + $this->count_private_comments_in_course())); + $ret[] = array('row' => array(get_string('protected_comments', 'pdfannotator'), + $this->count_protected_comments($this->annotatorid, 1) + $this->count_protected_comments($this->annotatorid, 0), + $this->count_protected_comments_in_course())); if ($this->isteacher) { - $ret[] = array('row' => array(get_string('reports', 'pdfannotator'), $this->get_reports_annotator(), $this->get_reports_course())); + $ret[] = array('row' => array(get_string('reports', 'pdfannotator'), $this->get_reports_annotator(), + $this->get_reports_course())); } return $ret; @@ -156,7 +169,6 @@ public function get_tabledata() { /** * Returns the data for the chart in the statistics-tab. - * @global type $DB * @param type $pdfannotators * @return type */ @@ -194,21 +206,21 @@ public function get_chartdata() { $myprivate[] = $countmyprivateanswers + $countmyprivatequestions; $myquestions[] = $countmyquestions - $countmyprotectedquestions - $countmyprivatequestions; - $otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedquestions - $countprivatequestions; + $otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedquestions - $countprivatequestions; $myanswers[] = $countmyanswers - $countmyprotectedanswers - $countmyprivateanswers; $otheranswers[] = $countanswers - $myanswers[$index] - $countprotectedanswers - $countprivateanswers; - + $names[] = $pdfannotator->get_name(); } - $ret = array($names, $otherquestions, $myquestions, $otheranswers, $myanswers, $otherprivate, $myprivate, $otherprotectedquestions, $myprotectedquestions, $otherprotectedanswers, $myprotectedanswers); + $ret = array($names, $otherquestions, $myquestions, $otheranswers, $myanswers, $otherprivate, $myprivate, + $otherprotectedquestions, $myprotectedquestions, $otherprotectedanswers, $myprotectedanswers); return $ret; } /** * Returns the number of all questions/answers in one PDF-Annotator by one/all users - * @global type $DB * @param type $annotatorid * @param type $isquestion '1' for questions, '0' for answers * @param type $userid false by default for comments by all users. Userid for comments by a specific user @@ -226,7 +238,7 @@ public static function count_comments_annotator($annotatorid, $isquestion, $user } /** - * Count private comments for annotator. + * Count private comments for annotator. */ public function count_private_comments($annotatorid, $isquestion, $userid=false) { global $DB; @@ -241,7 +253,8 @@ public function count_private_comments($annotatorid, $isquestion, $userid=false) $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 = ? "; + . "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 = ?'; @@ -265,7 +278,8 @@ public function count_protected_comments($annotatorid, $isquestion, $userid=fals $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 = ? "; + . "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 = ?'; @@ -274,7 +288,7 @@ public function count_protected_comments($annotatorid, $isquestion, $userid=fals $count = $DB->count_records_sql($sql, $params); } return $count; - + } public function count_private_comments_in_course() { diff --git a/renderable.php b/renderable.php index b5cd682..7157b1a 100644 --- a/renderable.php +++ b/renderable.php @@ -62,4 +62,4 @@ public static function make_from_comment($comment) { return $info; } -} \ No newline at end of file +} diff --git a/renderer.php b/renderer.php index 49db9e2..4174c28 100644 --- a/renderer.php +++ b/renderer.php @@ -17,7 +17,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Rabea de Groot and Anna Heynkes + * @author Rabea de Groot and Anna Heynkes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ @@ -99,7 +99,8 @@ public function render_pdfannotator_comment_info(pdfannotator_comment_info $info * @param string $nameargs * @return tabobject */ - private function pdfannotator_create_tab(moodle_url $baseurl, $action, $namekey = null, $pdfannotatorname = null, $nameargs = null) { + private function pdfannotator_create_tab(moodle_url $baseurl, $action, $namekey = null, $pdfannotatorname = null, + $nameargs = null) { $taburl = new moodle_url($baseurl, array('action' => $action)); $tabname = get_string($namekey, 'pdfannotator', $nameargs); if ($pdfannotatorname) { diff --git a/settings.php b/settings.php index 5b41d22..d445ca4 100644 --- a/settings.php +++ b/settings.php @@ -30,7 +30,8 @@ get_string('global_setting_useprint', 'pdfannotator'), get_string('global_setting_useprint_desc', 'pdfannotator'), 0)); $settings->add(new admin_setting_configcheckbox('mod_pdfannotator/useprintcomments', - get_string('global_setting_useprint_comments', 'pdfannotator'), get_string('global_setting_useprint_comments_desc', 'pdfannotator'), 0)); + get_string('global_setting_useprint_comments', 'pdfannotator'), + get_string('global_setting_useprint_comments_desc', 'pdfannotator'), 0)); $settings->add(new admin_setting_configcheckbox('mod_pdfannotator/use_studenttextbox', get_string('global_setting_use_studenttextbox', 'pdfannotator'), @@ -48,10 +49,11 @@ get_string('global_setting_use_protected_comments', 'pdfannotator'), get_string('global_setting_use_protected_comments_desc', 'pdfannotator'), 0)); - //Define what API to use for converting latex formulas into png. + // Define what API to use for converting latex formulas into png. $options = array(); $options[LATEX_TO_PNG_MOODLE] = get_string("global_setting_latexusemoodle", "pdfannotator"); $options[LATEX_TO_PNG_GOOGLE_API] = get_string("global_setting_latexusegoogle", "pdfannotator"); - $settings->add(new admin_setting_configselect('mod_pdfannotator/latexapi', get_string('global_setting_latexapisetting', 'pdfannotator'), + $settings->add(new admin_setting_configselect('mod_pdfannotator/latexapi', get_string('global_setting_latexapisetting', + 'pdfannotator'), get_string('global_setting_latexapisetting_desc', 'pdfannotator'), LATEX_TO_PNG_MOODLE, $options)); -} \ No newline at end of file +} diff --git a/styles.css b/styles.css index b526551..ed7f5e2 100644 --- a/styles.css +++ b/styles.css @@ -9,12 +9,12 @@ top: 0; left: 0; right: 0; - padding: 0px 0px 3px 5px; + padding: 0 0 3px 5px; text-shadow: 1px 1px 0 #fff; z-index: 50; - -webkit-box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,1); - -moz-box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,1); - box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,1); + -webkit-box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 1); + -moz-box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 1); + box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 1); } .path-mod-pdfannotator .pdfannotator_index .toolbar .spacer { @@ -30,13 +30,13 @@ .path-mod-pdfannotator .toolbar button { background-color: transparent; - border: 0px solid transparent; - border-radius: 0px; + border: 0 solid transparent; + border-radius: 0; font-size: 15px; padding: 3px; - margin: 0 0 0px 0px; + margin: 0 0 0 0; text-align: center; - text-shadow: 0px 0px 0 #fff; + text-shadow: 0 0 0 #fff; position: relative; min-width: 27px; min-height: 27px; @@ -48,21 +48,21 @@ } .path-mod-pdfannotator .toolbar button.active { /*RWTH-color*/ - background-image: radial-gradient(ellipse at center,#e6f2ff 40%,#8ebae5 100%); + background-image: radial-gradient(ellipse at center, #e6f2ff 40%, #8ebae5 100%); background-color: #8ebae5; border-color: #bababa; - -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0.25); - -moz-box-shadow: inset 0 0 1px rgba(0,0,0,0.25); - box-shadow: inset 0 0 1px rgba(0,0,0,0.25); + -webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.25); + -moz-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.25); + box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.25); } .path-mod-pdfannotator .toolbar select { - margin-bottom: 0px; + margin-bottom: 0; } .path-mod-pdfannotator .toolbar button .icon { - color: #999999; - margin-right: 0px; + color: #999; + margin-right: 0; } .path-mod-pdfannotator .color { @@ -71,7 +71,7 @@ height: 20px; border: 1px solid #000; vertical-align: middle; - margin: 0 0 0px 0px; + margin: 0; } .path-mod-pdfannotator .color-selected { border: 3px solid #666; @@ -82,7 +82,8 @@ margin-right: -2px; } -.path-mod-pdfannotator .text-color, .path-mod-pdfannotator .pen-color { +.path-mod-pdfannotator .text-color, +.path-mod-pdfannotator .pen-color { z-index: 100; display: inline-block; } @@ -137,31 +138,36 @@ } .path-mod-pdfannotator .textLayer .highlight.begin { - border-radius: 4px 0px 0px 4px; + border-radius: 4px 0 0 4px; } .path-mod-pdfannotator .textLayer .highlight.end { - border-radius: 0px 4px 4px 0px; + border-radius: 0 4px 4px 0; } .path-mod-pdfannotator .textLayer .highlight.middle { - border-radius: 0px; + border-radius: 0; } .path-mod-pdfannotator .textLayer .highlight.selected { background-color: rgb(0, 100, 0); } -.path-mod-pdfannotator .textLayer ::selection { background: rgb(0,0,255); } -.path-mod-pdfannotator .textLayer ::-moz-selection { background: rgb(0,0,255); } +.path-mod-pdfannotator .textLayer ::selection { + background: rgb(0, 0, 255); +} + +.path-mod-pdfannotator .textLayer ::-moz-selection { + background: rgb(0, 0, 255); +} .path-mod-pdfannotator .textLayer .endOfContent { display: block; position: absolute; - left: 0px; + left: 0; top: 100%; - right: 0px; - bottom: 0px; + right: 0; + bottom: 0; z-index: -1; cursor: default; -webkit-user-select: none; @@ -170,7 +176,7 @@ } .path-mod-pdfannotator .textLayer .endOfContent.active { - top: 0px; + top: 0; } @@ -187,14 +193,14 @@ height: 100%; } -.path-mod-pdfannotator .annotationLayer .linkAnnotation > a /* -ms-a */ { +.path-mod-pdfannotator .annotationLayer .linkAnnotation > a /* -ms-a */ { background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 repeat; } .path-mod-pdfannotator .annotationLayer .linkAnnotation > a:hover { opacity: 0.2; background: #ff0; - box-shadow: 0px 2px 10px #ff0; + box-shadow: 0 2px 10px #ff0; } .path-mod-pdfannotator .annotationLayer .textAnnotation img { @@ -211,8 +217,8 @@ position: absolute; z-index: 200; max-width: 20em; - background-color: #FFFF99; - box-shadow: 0px 2px 5px #333; + background-color: #ff9; + box-shadow: 0 2px 5px #333; border-radius: 2px; padding: 0.6em; margin-left: 5px; @@ -222,7 +228,7 @@ .path-mod-pdfannotator .annotationLayer .popup h1 { font-size: 1em; - border-bottom: 1px solid #000000; + border-bottom: 1px solid #000; padding-bottom: 0.2em; } @@ -256,7 +262,7 @@ } .path-mod-pdfannotator .pdfViewer.removePageBorders .page { - margin: 0px auto 10px auto; + margin: 0 auto 10px auto; border: none; } @@ -332,7 +338,8 @@ body { } @media only screen and (max-width: 991px) { - .path-mod-pdfannotator #content-wrapper, .path-mod-pdfannotator #comment-wrapper { + .path-mod-pdfannotator #content-wrapper, + .path-mod-pdfannotator #comment-wrapper { height: 50%; } } @@ -348,7 +355,7 @@ body { } .path-mod-pdfannotator #comment-nav .icon { - color: #999999 !important; + color: #999 !important; } .path-mod-pdfannotator #searchForm { @@ -363,7 +370,7 @@ body { .path-mod-pdfannotator #searchClear { margin-left: -25px; - padding: 0px; + padding: 0; } .path-mod-pdfannotator #comment-wrapper .comment-list { @@ -410,7 +417,7 @@ body { .path-mod-pdfannotator .chat-message { border-radius: 4px; padding: 4px 10px; - margin: 0 0px 10px 0; + margin: 0 0 10px 0; background-color: #fefefe; } @@ -438,7 +445,7 @@ body { .path-mod-pdfannotator .chat-message.comment-list-item:not(.questions) { display: flex; - padding-left: 0px !important; + padding-left: 0 !important; } .path-mod-pdfannotator .chat-message .wrappervotessolved { @@ -450,19 +457,19 @@ body { } .path-mod-pdfannotator .chat-message .wrappervotessolved .icon { - margin-right: 0px !important; + margin-right: 0 !important; } .path-mod-pdfannotator .chat-message:not(.questions) .icon { - color: #999999 !important; + color: #999 !important; } .path-mod-pdfannotator .chat-message button:disabled .icon { - color: rgba(0,0,0,.15) !important; + color: rgba(0, 0, 0, .15) !important; } .path-mod-pdfannotator .chat-message .time, -.path-mod-pdfannotator .chat-message .edited { +.path-mod-pdfannotator .chat-message .edited { float: right; font-size: 11px; color: #777; @@ -471,19 +478,20 @@ body { font-weight: 700; } -.path-mod-pdfannotator .chat-message button:not(.dropdown-item), .path-mod-pdfannotator #comment-nav button { +.path-mod-pdfannotator .chat-message button:not(.dropdown-item), +.path-mod-pdfannotator #comment-nav button { border-color: transparent; background-color: transparent; } .path-mod-pdfannotator .chat-message.questioncomment { margin: 0 0 10px 0; - background-color: #C7DDF2; + background-color: #c7ddf2; } .path-mod-pdfannotator .chat-message.questions:not(.page) { background-color: #c7ddf2; - color: rgb(0,84,159); + color: rgb(0, 84, 159); } .path-mod-pdfannotator .chat-message.questions.page { @@ -510,8 +518,8 @@ body { } .path-mod-pdfannotator .questionanswercount { - padding: 0px 2px 0px 2px; - margin: 0px; + padding: 0 2px 0 2px; + margin: 0; border-radius: 8px; } @@ -523,13 +531,15 @@ body { float: right; } -.path-mod-pdfannotator #anonymousLabel, .path-mod-pdfannotator #privateLabel, .path-mod-pdfannotator #protectedLabel { +.path-mod-pdfannotator #anonymousLabel, +.path-mod-pdfannotator #privateLabel, +.path-mod-pdfannotator #protectedLabel { margin-left: 5px; margin-bottom: 0; } .path-mod-pdfannotator #comment-list-form > div { - margin: 5px 0px; + margin: 5px 0; display: block; } @@ -553,9 +563,9 @@ body { } .path-mod-pdfannotator.fullscreenWrapper #region-main { - position: fixed ; - top: 0px; - left: 0px; + position: fixed; + top: 0; + left: 0; max-width: 100%; width: 100%; max-height: 100%; @@ -592,7 +602,8 @@ body { visibility: hidden; } -.path-mod-pdfannotator #myarea, .path-mod-pdfannotator .chat-message textarea { +.path-mod-pdfannotator #myarea, +.path-mod-pdfannotator .chat-message textarea { width: 100%; height: 10em; } @@ -649,7 +660,17 @@ table td, table th { padding: 9px 10px; text-align: left; } table.flexible { margin-bottom: 0; } - .pinned { position: absolute; left: 0; top: 0; background: #fff; width: 35%; overflow: hidden; overflow-x: scroll; border-right: 1px solid #ccc; border-left: 1px solid #ccc; } + .pinned { + position: absolute; + left: 0; + top: 0; + background: #fff; + width: 35%; + overflow: hidden; + overflow-x: scroll; + border-right: 1px solid #ccc; + border-left: 1px solid #ccc; + } .pinned table { border-right: none; border-left: none; width: 100%; } .pinned table th, .pinned table td { white-space: nowrap; } .pinned td:last-child { border-bottom: 0; } @@ -659,7 +680,12 @@ table td, table th { padding: 9px 10px; text-align: left; } div.table-wrapper div.scrollable { overflow: scroll; overflow-y: hidden; } table.flexible td, table.flexible th { position: relative; white-space: nowrap; overflow: hidden; } - table.flexible th:first-child, table.flexible td:first-child, table.flexible td:first-child, table.flexible.pinned td { display: none; } + table.flexible th:first-child, + table.flexible td:first-child, + table.flexible td:first-child, + table.flexible.pinned td { + display: none; + } }*/ @@ -670,7 +696,8 @@ table td, table th { padding: 9px 10px; text-align: left; } }*/ @media only screen and (min-width: 421px) { - .path-mod-pdfannotator h2, .path-mod-pdfannotator .resettable.mdl-right { + .path-mod-pdfannotator h2, + .path-mod-pdfannotator .resettable.mdl-right { display: inline !important; } } @@ -691,29 +718,45 @@ table td, table th { padding: 9px 10px; text-align: left; } }*/ @media only screen and (max-width: 414px) { - #mod-pdfannotator-questions th:nth-child(2), #mod-pdfannotator-questions td:nth-child(2), - #mod-pdfannotator-questions th:nth-child(3), #mod-pdfannotator-questions td:nth-child(3), - #mod-pdfannotator-questions th:nth-child(4), #mod-pdfannotator-questions td:nth-child(4), - #mod-pdfannotator-questions th:nth-child(5), #mod-pdfannotator-questions td:nth-child(5), - #mod-pdfannotator-questions th:nth-child(6), #mod-pdfannotator-questions td:nth-child(6), - #mod-pdfannotator-answers th:nth-child(2), #mod-pdfannotator-answers td:nth-child(2), - #mod-pdfannotator-answers th:nth-child(3), #mod-pdfannotator-answers td:nth-child(3), - #mod-pdfannotator-answers th:nth-child(5), #mod-pdfannotator-answers td:nth-child(5), - #mod-pdfannotator-answers th:nth-child(6), #mod-pdfannotator-answers td:nth-child(6), - #mod-pdfannotator-ownposts th:nth-child(2), #mod-pdfannotator-ownposts td:nth-child(2), - #mod-pdfannotator-ownposts th:nth-child(3), #mod-pdfannotator-ownposts td:nth-child(3), - #mod-pdfannotator-ownposts th:nth-child(4), #mod-pdfannotator-ownposts td:nth-child(4), - #mod-pdfannotator-reports th:nth-child(2), #mod-pdfannotator-reports td:nth-child(2), - #mod-pdfannotator-reports th:nth-child(3), #mod-pdfannotator-reports td:nth-child(3), - #mod-pdfannotator-reports th:nth-child(4), #mod-pdfannotator-reports td:nth-child(4), - #mod-pdfannotator-reports th:nth-child(5), #mod-pdfannotator-reports td:nth-child(5), + #mod-pdfannotator-questions th:nth-child(2), + #mod-pdfannotator-questions td:nth-child(2), + #mod-pdfannotator-questions th:nth-child(3), + #mod-pdfannotator-questions td:nth-child(3), + #mod-pdfannotator-questions th:nth-child(4), + #mod-pdfannotator-questions td:nth-child(4), + #mod-pdfannotator-questions th:nth-child(5), + #mod-pdfannotator-questions td:nth-child(5), + #mod-pdfannotator-questions th:nth-child(6), + #mod-pdfannotator-questions td:nth-child(6), + #mod-pdfannotator-answers th:nth-child(2), + #mod-pdfannotator-answers td:nth-child(2), + #mod-pdfannotator-answers th:nth-child(3), + #mod-pdfannotator-answers td:nth-child(3), + #mod-pdfannotator-answers th:nth-child(5), + #mod-pdfannotator-answers td:nth-child(5), + #mod-pdfannotator-answers th:nth-child(6), + #mod-pdfannotator-answers td:nth-child(6), + #mod-pdfannotator-ownposts th:nth-child(2), + #mod-pdfannotator-ownposts td:nth-child(2), + #mod-pdfannotator-ownposts th:nth-child(3), + #mod-pdfannotator-ownposts td:nth-child(3), + #mod-pdfannotator-ownposts th:nth-child(4), + #mod-pdfannotator-ownposts td:nth-child(4), + #mod-pdfannotator-reports th:nth-child(2), + #mod-pdfannotator-reports td:nth-child(2), + #mod-pdfannotator-reports th:nth-child(3), + #mod-pdfannotator-reports td:nth-child(3), + #mod-pdfannotator-reports th:nth-child(4), + #mod-pdfannotator-reports td:nth-child(4), + #mod-pdfannotator-reports th:nth-child(5), + #mod-pdfannotator-reports td:nth-child(5), .path-mod-pdfannotator .text { display: none; visibility: hidden; } .path-mod-pdfannotator #region-main-box { - padding-right: 0px; - padding-left: 0px; + padding-right: 0; + padding-left: 0; /*overflow: visible;*/ } .path-mod-pdfannotator .text_to_html { @@ -743,7 +786,7 @@ header, section, footer, aside, nav, main, article, figure { /* Dropdown Button */ .path-mod-pdfannotator .dropbtn { - background-color: #3498DB; + background-color: #3498db; color: white; padding: 16px; font-size: 16px; @@ -752,13 +795,15 @@ header, section, footer, aside, nav, main, article, figure { } /* For mobile phones: */ /* Only overview tables. Not table in reportform */ -.path-mod-pdfannotator .flexible .header, .path-mod-pdfannotator .flexible .cell { +.path-mod-pdfannotator .flexible .header, +.path-mod-pdfannotator .flexible .cell { width: 100%; } /* Dropdown button on hover & focus */ -.path-mod-pdfannotator .dropbtn:hover, .path-mod-pdfannotator .dropbtn:focus { - background-color: #2980B9; +.path-mod-pdfannotator .dropbtn:hover, +.path-mod-pdfannotator .dropbtn:focus { + background-color: #2980b9; } /* The container
- needed to position the dropdown content */ @@ -773,7 +818,7 @@ header, section, footer, aside, nav, main, article, figure { position: absolute; background-color: #f1f1f1; min-width: 160px; - box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); z-index: 55; } @@ -794,7 +839,8 @@ header, section, footer, aside, nav, main, article, figure { -webkit-appearance: none; } -/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */ +/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) +*/ .path-mod-pdfannotator .show { display: block; } @@ -845,13 +891,21 @@ header, section, footer, aside, nav, main, article, figure { } @-webkit-keyframes spin { - 0% { -webkit-transform: rotate(0deg); } - 100% { -webkit-transform: rotate(360deg); } + 0% { + -webkit-transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + } } @keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } } /* Add animation to "page content" */ @@ -860,17 +914,29 @@ header, section, footer, aside, nav, main, article, figure { -webkit-animation-name: animatebottom; -webkit-animation-duration: 1s; animation-name: animatebottom; - animation-duration: 1s + animation-duration: 1s; } @-webkit-keyframes animatebottom { - from { bottom:-100px; opacity:0 } - to { bottom:0px; opacity:1 } + from { + bottom: -100px; + opacity: 0; + } + to { + bottom: 0; + opacity: 1; + } } @keyframes animatebottom { - from { bottom:-100px; opacity:0 } - to { bottom:0; opacity:1 } + from { + bottom: -100px; + opacity: 0; + } + to { + bottom: 0; + opacity: 1; + } } .path-mod-pdfannotator .pdfannotator-statistic #chart-container { diff --git a/version.php b/version.php index 974bfa3..93bb2d7 100644 --- a/version.php +++ b/version.php @@ -1,31 +1,31 @@ -. - -/** - * Version information for mod/pdfannotator - * - * @package mod_pdfannotator - * @copyright 2018 RWTH Aachen - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$plugin->component = 'mod_pdfannotator'; -$plugin->version = 2021090100; -$plugin->release = 'PDF Annotator v1.4 release 9'; -$plugin->requires = 2021051700; -$plugin->maturity = MATURITY_STABLE; +. + +/** + * Version information for mod/pdfannotator + * + * @package mod_pdfannotator + * @copyright 2018 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'mod_pdfannotator'; +$plugin->version = 2021090100; +$plugin->release = 'PDF Annotator v1.4 release 9'; +$plugin->requires = 2021051700; +$plugin->maturity = MATURITY_STABLE; diff --git a/view.php b/view.php index 1c147a1..d51af8f 100644 --- a/view.php +++ b/view.php @@ -16,7 +16,7 @@ /** * @package mod_pdfannotator * @copyright 2018 RWTH Aachen (see README.md) - * @authors Ahmad Obeid, Anna Heynkes + * @author Ahmad Obeid, Anna Heynkes * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php');