This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_elbp_gradetracker.php
75 lines (58 loc) · 1.81 KB
/
config_elbp_gradetracker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Configure the [Plugin Name] plugin
*
* @copyright 2012 Bedford College
* @package Bedford College Electronic Learning Blue Print (ELBP)
* @version 1.0
* @author Conn Warwicker <cwarwicker@bedford.ac.uk> <conn@cmrwarwicker.com>
*
*/
require_once '../../config.php';
require_once $CFG->dirroot . '/blocks/elbp/lib.php';
$ELBP = ELBP\ELBP::instantiate();
$DBC = new ELBP\DB();
$view = optional_param('view', 'main', PARAM_ALPHA);
$access = $ELBP->getCoursePermissions(1);
if (!$access['god']){
print_error( get_string('invalidaccess', 'block_elbp') );
}
// Need to be logged in to view this page
require_login();
try {
$OBJ = \ELBP\Plugins\Plugin::instaniate("elbp_gradetracker");
} catch (\ELBP\ELBPException $e){
echo $e->getException();
exit;
}
$TPL = new \ELBP\Template();
$MSGS['errors'] = '';
$MSGS['success'] = '';
// Submitted
if (!empty($_POST))
{
$OBJ->saveConfig($_POST);
$TPL->set("saved", get_string('saved', 'block_elbp'));
}
// Set up PAGE
$PAGE->set_context( context_course::instance(1) );
$PAGE->set_url($CFG->wwwroot . $OBJ->getPath() . 'config_elbp_gradetracker.php');
$PAGE->set_title( get_string('config', 'block_elbp') );
$PAGE->set_heading( get_string('config', 'block_elbp') );
$PAGE->set_cacheable(true);
$ELBP->loadJavascript();
$ELBP->loadCSS();
// If course is set, put that into breadcrumb
$PAGE->navbar->add( get_string('config', 'block_elbp'), $CFG->wwwroot . $OBJ->getPath() . '/config.php', navigation_node::TYPE_CUSTOM);
echo $OUTPUT->header();
$TPL->set("OBJ", $OBJ);
$TPL->set("view", $view);
$TPL->set("MSGS", $MSGS);
$TPL->set("OUTPUT", $OUTPUT);
try {
$TPL->load( $CFG->dirroot . $OBJ->getPath() . '/tpl/elbp_gradetracker/config.html' );
$TPL->display();
} catch (\ELBP\ELBPException $e){
echo $e->getException();
}
echo $OUTPUT->footer();