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 1
/
preview.php
87 lines (68 loc) · 3.1 KB
/
preview.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
76
77
78
79
80
81
82
83
84
85
86
87
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Electronic Learning Blue Print
*
* ELBP is a moodle block plugin, which provides one singular place for all of a student's key academic information to be stored and viewed, such as attendance, targets, tutorials,
* reports, qualification progress, etc... as well as unlimited custom sections.
*
* @package block_elbp
* @copyright 2017-onwards Conn Warwicker
* @author Conn Warwicker <[email protected]>
* @link https://github.com/cwarwicker/moodle-block_elbp
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* Originally developed at Bedford College, now maintained by Conn Warwicker
*
*/
require_once '../../config.php';
require_once $CFG->dirroot . '/blocks/elbp/lib.php';
$s = required_param('s', PARAM_TEXT);
$t = optional_param('t', get_string('blockconfig:plugintitle', 'block_elbp'), PARAM_TEXT);
$attributes = unserialize(urldecode($s));
$t = urldecode($t);
$ELBP = \ELBP\ELBP::instantiate( array("load_plugins" => false) );
$FORM = new \ELBP\ELBPForm();
$FORM->loadStudentID($USER->id); # As an example, load ourselves as the student
$PAGE->set_context( context_course::instance(SITEID) );
$PAGE->set_url($CFG->wwwroot . '/blocks/elbp/preview.php?s='.$s);
$PAGE->set_title( get_string('formpreview', 'block_elbp') );
$PAGE->set_heading( $ELBP->getELBPMyName() );
$PAGE->set_cacheable(true);
$ELBP->loadCSS();
$ELBP->loadJavascript();
$PAGE->navbar->add( get_string('formpreview', 'block_elbp') , null, navigation_node::TYPE_COURSE);
echo $OUTPUT->header();
echo $OUTPUT->heading( get_string('formpreview', 'block_elbp') );
echo "<p>".get_string('formpreview:desc', 'block_elbp')."</p>";
echo "<br>";
if ($attributes)
{
echo "<table>";
echo "<tr><th style='border:1px solid #000;' class='elbp_centre' colspan='2'>{$t}</th></tr>";
foreach($attributes as $attribute)
{
if (!isset($attribute['options'])){
$attribute['options'] = false;
}
echo "<tr>";
echo "<td style='border:1px solid #000;'>{$attribute['name']}</td>";
echo "<td style='border:1px solid #000;'>".$FORM->convertDataIntoFormElement($attribute['name'], $attribute['type'], $attribute['options'], "", $attribute['validation'], $attribute['default'])."</td>";
echo "</tr>";
}
echo "</table>";
}
echo $OUTPUT->footer();