Skip to content

Commit f7ea85a

Browse files
lucaboeschFriederike-cil
authored andcommitted
Coding style adoptions.
1 parent d358e1a commit f7ea85a

22 files changed

+76
-141
lines changed

action.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @package mod_pdfannotator
2929
* @copyright 2018 RWTH Aachen (see README.md)
30-
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
30+
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
3131
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3232
*/
3333

@@ -388,8 +388,6 @@
388388

389389
$comments = pdfannotator_comment::read($documentid, $annotationid, $context);
390390

391-
// require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php');
392-
393391
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
394392
$templatable = new comment($comments, $cm, $context);
395393

@@ -455,7 +453,7 @@
455453

456454
$commentid = required_param('commentId', PARAM_INT);
457455
$content = required_param('content', PARAM_RAW);
458-
456+
459457
$data = pdfannotator_comment::update($commentid, $content, $editanypost);
460458
echo json_encode($data);
461459
}

backup/moodle2/backup_pdfannotator_activity_task.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function define_my_steps() {
7575
* @param string $content some HTML text that eventually contains URLs to the activity instance scripts
7676
* @return string the content with the URLs encoded
7777
*/
78-
static public function encode_content_links($content) {
78+
public static function encode_content_links($content) {
7979

8080
global $CFG, $DB;
8181

backup/moodle2/backup_pdfannotator_stepslib.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,27 @@ protected function define_structure() {
5454

5555
// 2. Define each element separately.
5656
$pdfannotator = new backup_nested_element('pdfannotator', array('id'), array(
57-
'name', 'intro', 'introformat', 'usevotes', 'useprint', 'useprintcomments', 'use_studenttextbox', 'use_studentdrawing', 'useprivatecomments', 'useprotectedcomments', 'timecreated', 'timemodified'));
57+
'name', 'intro', 'introformat', 'usevotes', 'useprint', 'useprintcomments', 'use_studenttextbox', 'use_studentdrawing',
58+
'useprivatecomments', 'useprotectedcomments', 'timecreated', 'timemodified'));
5859

5960
$annotations = new backup_nested_element('annotations');
60-
$annotation = new backup_nested_element('annotation', array('id'), array('page', 'userid', 'annotationtypeid', 'data', 'timecreated', 'timemodified', 'modifiedby'));
61+
$annotation = new backup_nested_element('annotation', array('id'), array('page', 'userid', 'annotationtypeid',
62+
'data', 'timecreated', 'timemodified', 'modifiedby'));
6163

6264
$subscriptions = new backup_nested_element('subscriptions');
6365
$subscription = new backup_nested_element('subscription', array('id'), array('userid'));
6466

6567
$comments = new backup_nested_element('comments');
66-
$c = array('pdfannotatorid', 'userid', 'content', 'timecreated', 'timemodified', 'modifiedby', 'visibility', 'isquestion', 'isdeleted', 'ishidden', 'solved');
68+
$c = array('pdfannotatorid', 'userid', 'content', 'timecreated', 'timemodified', 'modifiedby', 'visibility',
69+
'isquestion', 'isdeleted', 'ishidden', 'solved');
6770
$comment = new backup_nested_element('comment', array('id'), $c);
6871

6972
$votes = new backup_nested_element('votes');
7073
$vote = new backup_nested_element('vote', array('id'), array('userid', 'annotationid'));
7174

7275
$reports = new backup_nested_element('reports');
73-
$report = new backup_nested_element('report', array('id'), array('courseid', 'pdfannotatorid', 'message', 'userid', 'timecreated', 'seen'));
76+
$report = new backup_nested_element('report', array('id'), array('courseid', 'pdfannotatorid', 'message',
77+
'userid', 'timecreated', 'seen'));
7478

7579
// 3. Build the tree (mind the right order!)
7680
$pdfannotator->add_child($annotations);
@@ -97,7 +101,8 @@ protected function define_structure() {
97101
// Add all annotations specific to this annotator instance.
98102
$annotation->set_source_sql('SELECT a.* FROM {pdfannotator_annotations} a '
99103
. 'JOIN {pdfannotator_comments} c ON a.id = c.annotationid '
100-
. "WHERE a.pdfannotatorid = ? AND c.isquestion = 1 AND (c.visibility = 'public' OR c.visibility = 'anonymous') ",
104+
. "WHERE a.pdfannotatorid = ? AND c.isquestion = 1 AND "
105+
. "(c.visibility = 'public' OR c.visibility = 'anonymous') ",
101106
array('pdfannotatorid' => backup::VAR_PARENTID));
102107

103108
// Add any subscriptions to this annotation.

backup/moodle2/restore_pdfannotator_activity_task.class.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function define_my_steps() {
5757
* Define the contents in the activity that must be
5858
* processed by the link decoder.
5959
*/
60-
static public function define_decode_contents() {
60+
public static function define_decode_contents() {
6161
$contents = array();
6262

6363
$contents[] = new restore_decode_content('pdfannotator', array('intro'), 'pdfannotator');
@@ -69,7 +69,7 @@ static public function define_decode_contents() {
6969
* Define the decoding rules for links belonging
7070
* to the activity to be executed by the link decoder
7171
*/
72-
static public function define_decode_rules() {
72+
public static function define_decode_rules() {
7373
$rules = array();
7474

7575
$rules[] = new restore_decode_rule('PDFANNOTATORVIEWBYID', '/mod/pdfannotator/view.php?id=$1', 'course_module');
@@ -85,7 +85,7 @@ static public function define_decode_rules() {
8585
* pdfannotator logs. It must return one array
8686
* of {@see restore_log_rule} objects
8787
*/
88-
static public function define_restore_log_rules() {
88+
public static function define_restore_log_rules() {
8989
$rules = array();
9090

9191
$rules[] = new restore_log_rule('pdfannotator', 'add', 'view.php?id={course_module}', '{pdfannotator}');
@@ -105,7 +105,7 @@ static public function define_restore_log_rules() {
105105
* by the restore final task, but are defined here at
106106
* activity level. All them are rules not linked to any module instance (cmid = 0)
107107
*/
108-
static public function define_restore_log_rules_for_course() {
108+
public static function define_restore_log_rules_for_course() {
109109
$rules = array();
110110

111111
$rules[] = new restore_log_rule('pdfannotator', 'view all', 'index.php?id={course}', null);

classes/event/report_added.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ public function get_description() {
5454
public function get_url() {
5555
return new \moodle_url('/mod/pdfannotator/view.php', array('id' => $this->other['cmid'], 'action' => 'overview'));
5656
}
57-
}
57+
}

classes/output/comment.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
namespace mod_pdfannotator\output;
1818
use moodle_url;
1919

20+
defined('MOODLE_INTERNAL') || die();
21+
2022
/**
2123
* Renderable for comments.
2224
*
@@ -25,8 +27,6 @@
2527
* @author Friederike Schwager
2628
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2729
*/
28-
defined('MOODLE_INTERNAL') || die();
29-
3030
class comment implements \renderable, \templatable {
3131

3232
private $comments = [];

classes/output/printview.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ public function export_for_template(\renderer_base $output) {
5252
return $data;
5353
}
5454

55-
}
55+
}

classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,4 +440,4 @@ public static function empty_or_delete_comment($comment) {
440440
}
441441
}
442442

443-
}
443+
}

constants.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @package mod_pdfannotator
1818
* @copyright 2018 RWTH Aachen (see README.md)
19-
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
19+
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2121
*/
2222

@@ -36,6 +36,6 @@
3636

3737

3838
/**
39-
* Prefix needed for encode64 imaged
39+
* Prefix needed for encode64 images
4040
*/
41-
define('IMAGE_PREFIX', 'data:image/png;base64,');
41+
define('IMAGE_PREFIX', 'data:image/png;base64,');

controller.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* @package mod_pdfannotator
1919
* @copyright 2018 RWTH Aachen (see README.md)
20-
* @author Anna Heynkes, Friederike Schwager
20+
* @author Anna Heynkes, Friederike Schwager
2121
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2222
*/
2323

@@ -570,4 +570,4 @@
570570
$mform->display();
571571
}
572572
return;
573-
}
573+
}

db/events.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17-
defined('MOODLE_INTERNAL') || die();
17+
defined('MOODLE_INTERNAL') || die();

db/messages.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@
5151
'capability' => 'mod/pdfannotator:getforwardedquestions', // Teacher capability.
5252
)
5353

54-
);
54+
);

forward_form.php

-85
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,3 @@
1-
<<<<<<< HEAD
2-
<?php
3-
// This file is part of Moodle - http://moodle.org/
4-
//
5-
// Moodle is free software: you can redistribute it and/or modify
6-
// it under the terms of the GNU General Public License as published by
7-
// the Free Software Foundation, either version 3 of the License, or
8-
// (at your option) any later version.
9-
//
10-
// Moodle is distributed in the hope that it will be useful,
11-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
// GNU General Public License for more details.
14-
//
15-
// You should have received a copy of the GNU General Public License
16-
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17-
/**
18-
* @package mod_pdfannotator
19-
* @copyright 2019 RWTH Aachen (see README.md)
20-
* @author Friederike Schwager
21-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22-
*
23-
*/
24-
defined('MOODLE_INTERNAL') || die();
25-
26-
require_once($CFG->libdir . '/formslib.php');
27-
28-
/**
29-
* Description of reportform
30-
*
31-
* @author Admin
32-
*/
33-
class pdfannotator_forward_form extends moodleform {
34-
35-
public function definition() {
36-
global $CFG;
37-
38-
$mform = $this->_form; // Don't forget the underscore!
39-
// Pass contextual parameters to the form (via set_data() in controller.php)
40-
// Course module id.
41-
$mform->addElement('hidden', 'id');
42-
$mform->setType('id', PARAM_INT);
43-
// Course id.
44-
$mform->addElement('hidden', 'course');
45-
$mform->setType('course', PARAM_INT);
46-
// Pdf id.
47-
$mform->addElement('hidden', 'pdfannotatorid');
48-
$mform->setType('pdfannotatorid', PARAM_INT);
49-
// Pdfname.
50-
$mform->addElement('hidden', 'pdfname');
51-
$mform->setType('pdfname', PARAM_TEXT);
52-
// Comment id.
53-
$mform->addElement('hidden', 'commentid');
54-
$mform->setType('commentid', PARAM_INT);
55-
// Action = 'forwardquestion'.
56-
$mform->addElement('hidden', 'action');
57-
$mform->setType('action', PARAM_ALPHA);
58-
59-
// Display question.
60-
$comment = $this->_customdata['comment'];
61-
$mform->addElement('static', 'description', get_string('question', 'pdfannotator'), $comment->content);
62-
63-
// Select recipients.
64-
$recipients = $this->_customdata['recipients'];
65-
66-
// 'selectgroups' instead of 'select' because the required-rule didn't work properly with a multi-select.
67-
$select = $mform->addElement('selectgroups', 'recipients', get_string('recipient', 'pdfannotator'));
68-
$select->addOptGroup('', $recipients);
69-
$select->setMultiple(true);
70-
$mform->addHelpButton('recipients', 'recipient', 'pdfannotator');
71-
$mform->addRule('recipients', get_string('recipientrequired', 'pdfannotator'), 'required', null, 'client');
72-
73-
// Textarea for message to the recipient.
74-
$mform->addElement('textarea', 'message', get_string('messageforwardform', 'pdfannotator'), 'wrap="virtual" rows="5" cols="109"');
75-
76-
// Add submit and cancel buttons.
77-
$this->add_action_buttons($cancel = true, get_string('send', 'pdfannotator'));
78-
}
79-
80-
public function display() {
81-
$this->_form->display();
82-
}
83-
84-
}
85-
=======
861
<?php
872
// This file is part of Moodle - http://moodle.org/
883
//

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@
146146

147147
echo html_writer::table($table);
148148

149-
echo $OUTPUT->footer();
149+
echo $OUTPUT->footer();

lang/en/pdfannotator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* @package mod_pdfannotator
1919
* @copyright 2018 RWTH Aachen (see README.md)
20-
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
20+
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
2121
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2222
*
2323
*/

lib.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @package mod_pdfannotator
1818
* @copyright 2018 RWTH Aachen (see README.md)
19-
* @author Ahmad Obeid, Rabea de Groot, Anna Heynkes
19+
* @author Ahmad Obeid, Rabea de Groot, Anna Heynkes
2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2121
*/
2222
defined('MOODLE_INTERNAL') || die;
@@ -28,12 +28,18 @@
2828
*/
2929
function pdfannotator_supports($feature) {
3030
switch($feature) {
31-
case FEATURE_GROUPS: return true;
32-
case FEATURE_GROUPINGS: return true;
33-
case FEATURE_MOD_INTRO: return true;
34-
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
35-
case FEATURE_BACKUP_MOODLE2: return true;
36-
case FEATURE_SHOW_DESCRIPTION: return true;
31+
case FEATURE_GROUPS:
32+
return true;
33+
case FEATURE_GROUPINGS:
34+
return true;
35+
case FEATURE_MOD_INTRO:
36+
return true;
37+
case FEATURE_COMPLETION_TRACKS_VIEWS:
38+
return true;
39+
case FEATURE_BACKUP_MOODLE2:
40+
return true;
41+
case FEATURE_SHOW_DESCRIPTION:
42+
return true;
3743

3844
default:
3945
return null;
@@ -608,7 +614,7 @@ function pdfannotator_get_recent_mod_activity(&$activities, &$index, $timestart,
608614
$printposts = array();
609615
$context = context_course::instance($courseid);
610616
foreach ($posts as $post) {
611-
if(!pdfannotator_can_see_comment($post, $context)) {
617+
if (!pdfannotator_can_see_comment($post, $context)) {
612618
continue;
613619
}
614620
$printposts[] = $post;

locallib.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @package mod_pdfannotator
1818
* @copyright 2018 RWTH Aachen (see README)
19-
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
19+
* @author Rabea de Groot, Anna Heynkes, Friederike Schwager
2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2121
*/
2222

@@ -1805,4 +1805,4 @@ function pdfannotator_count_answers($annotationid, $context) {
18051805
$count++;
18061806
}
18071807
return $count;
1808-
}
1808+
}

0 commit comments

Comments
 (0)