Skip to content

Commit 81658f5

Browse files
add namespace for classes in classes/output
1 parent c2d3962 commit 81658f5

File tree

10 files changed

+45
-12
lines changed

10 files changed

+45
-12
lines changed

action.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
* @authors Rabea de Groot, Anna Heynkes, Friederike Schwager
3131
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3232
*/
33+
34+
use mod_pdfannotator\output\comment;
35+
use mod_pdfannotator\output\printview;
36+
3337
require_once('../../config.php');
3438
require_once('model/annotation.class.php');
3539
require_once('model/comment.class.php');
@@ -325,7 +329,6 @@
325329

326330
require_capability('mod/pdfannotator:create', $context);
327331

328-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php');
329332
// Get the annotation to be commented.
330333
$annotationid = required_param('annotationId', PARAM_INT);
331334
$PAGE->set_context($context);
@@ -359,7 +362,6 @@
359362

360363
if ($action === 'getInformation') { // This concerns only textbox and drawing.
361364

362-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php');
363365
$annotationid = required_param('annotationId', PARAM_INT);
364366

365367
$comment = pdfannotator_annotation::get_information($annotationid);
@@ -384,7 +386,8 @@
384386

385387
$comments = pdfannotator_comment::read($documentid, $annotationid, $context);
386388

387-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php');
389+
// require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/comment.php');
390+
388391
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
389392
$templatable = new comment($comments, $cm, $context);
390393

@@ -604,8 +607,6 @@
604607
return;
605608
}
606609

607-
require_once($CFG->dirroot.'/mod/pdfannotator/classes/output/printview.php');
608-
609610
global $DB;
610611

611612
// The model retrieves and selects data.

classes/output/answermenu.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
* @author Friederike Schwager
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
25+
26+
namespace mod_pdfannotator\output;
27+
use moodle_url;
28+
2529
defined('MOODLE_INTERNAL') || die();
2630

2731
class answermenu implements \renderable, \templatable {

classes/output/comment.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
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+
namespace mod_pdfannotator\output;
18+
use moodle_url;
19+
1720
/**
1821
* Renderable for comments.
1922
*

classes/output/index.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@
2828
*
2929
* @author degroot
3030
*/
31+
32+
namespace mod_pdfannotator\output;
33+
34+
use stdClass;
35+
3136
defined('MOODLE_INTERNAL') || die();
3237

33-
class index implements renderable, templatable { // Class should be placed elsewhere.
38+
class index implements \renderable, \templatable { // Class should be placed elsewhere.
3439

3540
private $usestudenttextbox;
3641
private $usestudentdrawing;
@@ -61,7 +66,7 @@ public function __construct($pdfannotator, $capabilities, $file) {
6166

6267
}
6368

64-
public function export_for_template(renderer_base $output) {
69+
public function export_for_template(\renderer_base $output) {
6570
global $OUTPUT, $PAGE;
6671
$url = $PAGE->url;
6772
$data = new stdClass();

classes/output/printview.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2626
*
2727
*/
28+
29+
namespace mod_pdfannotator\output;
30+
2831
defined('MOODLE_INTERNAL') || die();
2932

3033
class printview implements \renderable, \templatable {

classes/output/questionmenu.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
* @author Friederike Schwager
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
25+
26+
namespace mod_pdfannotator\output;
27+
use moodle_url;
28+
2529
defined('MOODLE_INTERNAL') || die();
2630

2731
class questionmenu implements \renderable, \templatable {

classes/output/reportmenu.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
* @author Friederike Schwager
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
25+
26+
namespace mod_pdfannotator\output;
27+
use moodle_url;
28+
2529
defined('MOODLE_INTERNAL') || die();
2630

2731
class reportmenu implements \renderable, \templatable {

classes/output/statistics.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* @author Friederike Schwager
2525
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2626
*/
27+
28+
namespace mod_pdfannotator\output;
29+
30+
use pdfannotator_statistics;
31+
2732
defined('MOODLE_INTERNAL') || die();
2833

2934
/**

controller.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
* @authors Anna Heynkes, Friederike Schwager
2121
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2222
*/
23+
24+
use mod_pdfannotator\output\statistics;
25+
2326
defined('MOODLE_INTERNAL') || die();
2427

2528
$action = optional_param('action', 'view', PARAM_ALPHA); // The default action is 'view'.
@@ -435,7 +438,6 @@
435438
require_capability('mod/pdfannotator:viewstatistics', $context);
436439

437440
require_once($CFG->dirroot . '/mod/pdfannotator/model/statistics.class.php');
438-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/statistics.php');
439441

440442
echo $myrenderer->pdfannotator_render_tabs($taburl, $action, $pdfannotator->name, $context);
441443
$PAGE->set_title("statisticview");

locallib.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
* @authors Rabea de Groot, Anna Heynkes, Friederike Schwager
2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2121
*/
22+
23+
use mod_pdfannotator\output\answermenu;
24+
use mod_pdfannotator\output\questionmenu;
25+
use mod_pdfannotator\output\reportmenu;
26+
use mod_pdfannotator\output\index;
27+
2228
defined('MOODLE_INTERNAL') || die;
2329

2430
require_once("$CFG->libdir/filelib.php");
@@ -35,7 +41,6 @@
3541
*/
3642
function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page = 1, $annoid = null, $commid = null) {
3743
global $CFG, $PAGE, $OUTPUT, $USER;
38-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/index.php');
3944

4045
// The revision attribute's existance is demanded by moodle for versioning and could be saved in the pdfannotator table in the future.
4146
// Note, however, that we forbid file replacement in order to prevent a change of meaning in other people's comments.
@@ -1575,7 +1580,6 @@ function pdfannotator_questionstable_add_row($thiscourse, $table, $question, $ur
15751580
$data = array($content, $author . '<br>' . $time, $question->votes, $question->answercount, $lastanswered, $pdfannotatorname);
15761581

15771582
if ($showdropdown) {
1578-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/questionmenu.php');
15791583
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
15801584
$dropdown = $myrenderer->render_dropdownmenu(new questionmenu($question->commentid, $urlparams));
15811585
$data[] = $dropdown;
@@ -1627,7 +1631,6 @@ function pdfannotator_answerstable_add_row($thiscourse, $table, $answer, $cmid,
16271631
$classname = 'dimmed_text';
16281632
}
16291633

1630-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/answermenu.php');
16311634
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
16321635
$dropdown = $myrenderer->render_dropdownmenu(new answermenu($answer->annoid, $issubscribed, $cmid, $currentpage, $itemsperpage, $answerfilter));
16331636

@@ -1684,7 +1687,6 @@ function pdfannotator_reportstable_add_row($thiscourse, $table, $report, $cmid,
16841687
}
16851688

16861689
// Create action dropdown menu.
1687-
require_once($CFG->dirroot . '/mod/pdfannotator/classes/output/reportmenu.php');
16881690
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
16891691
$dropdown = $myrenderer->render_dropdownmenu(new reportmenu($report, $cmid, $currentpage, $itemsperpage, $reportfilter));
16901692

0 commit comments

Comments
 (0)