diff --git a/amd/src/block_bibleblock.js b/amd/src/block_bibleblock.js
new file mode 100644
index 0000000..2b23dca
--- /dev/null
+++ b/amd/src/block_bibleblock.js
@@ -0,0 +1,24 @@
+/*eslint no-var: "error" */
+/*eslint no-unused-vars: "off" */
+/*eslint linebreak-style: "off" */
+/*eslint no-trailing-spaces: "off" */
+/*eslint-env es6*/
+// Put this file in path/to/plugin/amd/src
+// You can call it anything you like
+
+
+import {call} from 'core/ajax';
+import notification from 'core/notification';
+
+
+/**
+ * Initialize the Page
+ */
+/**
+ * Initialize the Page
+ */
+ export function init() {
+
+ }
+
+
diff --git a/amd/src/block_mytreestudyplan.js b/amd/src/block_mytreestudyplan.js
deleted file mode 100644
index 1070f19..0000000
--- a/amd/src/block_mytreestudyplan.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/*eslint no-var: "error" */
-/*eslint no-unused-vars: "off" */
-/*eslint linebreak-style: "off" */
-/*eslint no-trailing-spaces: "off" */
-/*eslint-env es6*/
-// Put this file in path/to/plugin/amd/src
-// You can call it anything you like
-
-
-import {call} from 'core/ajax';
-import notification from 'core/notification';
-import Vue from 'local_treestudyplan/vue/vue';
-import RVComponents from 'local_treestudyplan/report-viewer-components';
-import TSComponents from 'local_treestudyplan/treestudyplan-components';
-import Debugger from 'local_treestudyplan/util/debugger';
-
-import {load_strings} from 'local_treestudyplan/util/string-helper';
-import {ProcessStudyplans} from 'local_treestudyplan/studyplan-processor';
-
-import PortalVue from 'local_treestudyplan/portal-vue/portal-vue.esm';
-import BootstrapVue from 'local_treestudyplan/bootstrap-vue/bootstrap-vue';
-Vue.use(TSComponents);
-Vue.use(RVComponents);
-Vue.use(PortalVue);
-Vue.use(BootstrapVue);
-
-
-let debug = new Debugger("mytreestudyplan");
-debug.enable();
-
-let strings = load_strings({
- studyplan: {
-
- },
-});
-
-/**
- * Initialize the Page
- */
-/**
- * Initialize the Page
- * @param {string} type Type of page to show
- * @param {Object} arg Arguments passed
- */
- export function init(type="myreport",arg) {
- // Save time by only starting up the Vue app if the required block element is present
- const blockelement = document.getElementById('block_mytreestudyplan');
- if(blockelement){
- const app = new Vue({
- el: '#block_mytreestudyplan',
- data: {
- "studyplans": [],
- },
- mounted() {
- let call_method;
- let call_args;
- if(type == "teacher"){
- call_method = 'local_treestudyplan_get_teacher_studyplan';
- call_args = {};
- }
- else if(type == "teaching"){
- call_method = 'local_treestudyplan_get_teaching_studyplans';
- call_args = {};
- }
- else{
- call_method = 'local_treestudyplan_get_own_studyplan';
- call_args = {};
- }
- call([{
- methodname: call_method,
- args: call_args
- }])[0].done(function(response){
- debug.info("Studyplans:",response);
- const timingval = { future: 0, present: 1, past: 2, };
- response.sort((a,b) => {
- const timinga = TSComponents.studyplanTiming(a);
- const timingb = TSComponents.studyplanTiming(b);
-
- let t = timingval[timinga] - timingval[timingb];
- if(t == 0){
- // sort by start date if timing is equal
- t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();
-
- if (t == 0) {
- // sort by name if timing is equal
- t = a.name.localeCompare(b.name);
- }
- }
- return t;
- });
- app.studyplans = ProcessStudyplans(response);
- }).fail(notification.exception);
-
- },
- created() {
-
- },
- updated() {
- },
- methods: {
-
- },
- });
- }
-}
-
-
diff --git a/block_mytreestudyplan.php b/block_bibleblock.php
similarity index 59%
rename from block_mytreestudyplan.php
rename to block_bibleblock.php
index 155dce9..93177bd 100644
--- a/block_mytreestudyplan.php
+++ b/block_bibleblock.php
@@ -16,17 +16,16 @@
/**
* Main block code
*
- * @package block_mytreestudyplan
+ * @package block_bibleblock
* @copyright 2023 P.M. Kuipers
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-use local_treestudyplan\studyplan;
/**
* MyTreestudyplan block base code
*/
-class block_mytreestudyplan extends \block_base {
+class block_bibleblock extends \block_base {
/**
* Plugin initialization (before $this->config and $this->page are loaded)
@@ -39,22 +38,14 @@ class block_mytreestudyplan extends \block_base {
*/
public function specialization() {
global $CFG;
- $this->title = get_string('title', 'block_mytreestudyplan');
-
- $systemcontext = \context_system::instance();
- $teachermode = has_capability("local/treestudyplan:viewuserreports", $systemcontext);
+ $this->title = get_string('title', 'block_bibleblock');
// Load CSS files from treestudyplan.
try {
- $this->page->requires->css(new \moodle_url($CFG->wwwroot.'/local/treestudyplan/css/bootstrap-vue/bootstrap-vue.min.css'));
- if($CFG->debugdeveloper){
- $this->page->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
- }
- $this->page->add_body_class("features-treestudyplan"); // Mark body as containing treestudyplan content.
// Include javascript and run studyplan renderer when page loading is complete.
- $this->page->requires->js_call_amd('block_mytreestudyplan/block_mytreestudyplan',
+ $this->page->requires->js_call_amd('block_bibleblock/block_bibleblock',
'init',
- [$teachermode ? 'teaching' : 'myreport']);
+ []);
} catch (Exception $x) {
// On some occasions (Plugin management), the plugin is loaded after HEAD has been printed.
// In those cases we don't want to show the block anyway, so ignore the error that gets inevitably thrown.
@@ -70,8 +61,8 @@ class block_mytreestudyplan extends \block_base {
return [
'admin' => false,
'site-index' => true,
- 'course-view' => false,
- 'mod' => false,
+ 'course-view' => true,
+ 'mod' => true,
'my' => true
];
}
@@ -80,37 +71,15 @@ class block_mytreestudyplan extends \block_base {
* Render block content
*/
public function get_content() {
- global $CFG;
- global $USER;
- global $COURSE;
global $OUTPUT;
if ($this->content !== null) {
return $this->content;
}
- $systemcontext = \context_system::instance();
-
- // TODO: Check if they have the permission in any relevant context, not just system.
- $teachermode = has_capability("local/treestudyplan:viewuserreports", $systemcontext);
-
+ $data = [];
$this->content = new \stdClass;
- $this->content->text = "";
-
- $mystudyplans = studyplan::find_for_user($USER->id);
-
- $data = [
- 'teachermode' => $teachermode,
- ];
-
- $this->content->text = $OUTPUT->render_from_template("block_mytreestudyplan/block", $data);
-
- $inviteurl = $CFG->wwwroot.'/local/treestudyplan/invitations.php';
- $invitetext = get_string('manage_invites', 'local_treestudyplan');
-
- if ( (!$teachermode ) && count($mystudyplans) > 0) {
- $this->content->footer = " {$invitetext}";
- }
+ $this->content->text = $OUTPUT->render_from_template("block_bibleblock/block", $data);
return $this->content;
}
diff --git a/db/access.php b/db/access.php
index 2cd8c8a..463c6b2 100644
--- a/db/access.php
+++ b/db/access.php
@@ -15,14 +15,14 @@
// along with Moodle. If not, see