PHP coding style match
This commit is contained in:
parent
a669e34796
commit
1532a0d233
|
@ -9,16 +9,16 @@
|
|||
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
import Vue from 'local_treestudyplan/vue';
|
||||
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/debugger';
|
||||
import Debugger from 'local_treestudyplan/util/debugger';
|
||||
|
||||
import {load_strings} from 'local_treestudyplan/string-helper';
|
||||
import {ProcessStudyplans, fixLineWrappers} from 'local_treestudyplan/studyplan-processor';
|
||||
import {load_strings} from 'local_treestudyplan/util/string-helper';
|
||||
import {ProcessStudyplans} from 'local_treestudyplan/studyplan-processor';
|
||||
|
||||
import PortalVue from 'local_treestudyplan/portal-vue';
|
||||
import BootstrapVue from 'local_treestudyplan/bootstrap-vue';
|
||||
import PortalVue from 'local_treestudyplan/portal-vue/portal-vue.esm';
|
||||
import BootstrapVue from 'local_treestudyplan/bootstrap-vue/bootstrap-vue.esm';
|
||||
Vue.use(TSComponents);
|
||||
Vue.use(RVComponents);
|
||||
Vue.use(PortalVue);
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
use local_treestudyplan\studyplan;
|
||||
|
||||
class block_mytreestudyplan extends \block_base {
|
||||
|
@ -6,28 +27,32 @@ class block_mytreestudyplan extends \block_base {
|
|||
public $levelset;
|
||||
|
||||
public function init() {
|
||||
global $PAGE;
|
||||
}
|
||||
|
||||
public function specialization() {
|
||||
global $CFG;
|
||||
$this->title = get_string('title', 'block_mytreestudyplan');
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
$teachermode = has_capability("local/treestudyplan:viewuserreports",$systemcontext);
|
||||
$teachermode = has_capability("local/treestudyplan:viewuserreports", $systemcontext);
|
||||
|
||||
// Load CSS files from treestudyplan
|
||||
try{
|
||||
$PAGE->requires->css(new \moodle_url($CFG->wwwroot.'/local/treestudyplan/css/bootstrap-vue.min.css'));
|
||||
$PAGE->requires->css(new \moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
|
||||
// include javascript and run studyplan renderer when page loading is complete
|
||||
$PAGE->requires->js_call_amd('block_mytreestudyplan/block_mytreestudyplan', '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
|
||||
// Load CSS files from treestudyplan.
|
||||
try {
|
||||
$this->page->requires->css(new \moodle_url($CFG->wwwroot.'/local/treestudyplan/css/bootstrap-vue.min.css'));
|
||||
$this->page->requires->css(new \moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
|
||||
// Include javascript and run studyplan renderer when page loading is complete.
|
||||
$this->page->requires->js_call_amd('block_mytreestudyplan/block_mytreestudyplan',
|
||||
'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.
|
||||
$off = 0; // Empty statement to satisfy code checker.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function applicable_formats()
|
||||
{
|
||||
// Limit this block to the site index and the dashboard (my) pages
|
||||
public function applicable_formats() {
|
||||
// Limit this block to the site index and the dashboard (my) pages.
|
||||
return [
|
||||
'admin' => false,
|
||||
'site-index' => true,
|
||||
|
@ -37,7 +62,6 @@ class block_mytreestudyplan extends \block_base {
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function get_content() {
|
||||
global $CFG;
|
||||
global $USER;
|
||||
|
@ -48,10 +72,10 @@ class block_mytreestudyplan extends \block_base {
|
|||
return $this->content;
|
||||
}
|
||||
|
||||
$coursecontext = \context_course::instance($COURSE->id);
|
||||
$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);
|
||||
|
||||
// TODO: Check if they have the permission in any relevant context, not just system.
|
||||
$teachermode = has_capability("local/treestudyplan:viewuserreports", $systemcontext);
|
||||
|
||||
$this->content = new \stdClass;
|
||||
$this->content->text = "";
|
||||
|
@ -62,26 +86,23 @@ class block_mytreestudyplan extends \block_base {
|
|||
'teachermode' => $teachermode,
|
||||
];
|
||||
|
||||
$this->content->text = $OUTPUT->render_from_template("block_mytreestudyplan/block",$data);
|
||||
|
||||
$invite_url =$CFG->wwwroot.'/local/treestudyplan/invitations.php';
|
||||
$invite_text = get_string('manage_invites','local_treestudyplan');
|
||||
$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 = " <a class='btn btn-primary' href='{$invite_url}'>{$invite_text}</a>";
|
||||
$this->content->footer = " <a class='btn btn-primary' href='{$inviteurl}'>{$invitetext}</a>";
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function hide_header() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hide_header() { return false; }
|
||||
|
||||
public function has_config() { return false; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function has_config() {
|
||||
return false;
|
||||
}
|
||||
}
|
44
build.php
44
build.php
|
@ -1,15 +1,38 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define('CLI_SCRIPT', true);
|
||||
require_once("../../config.php");
|
||||
$plugin = new stdClass;
|
||||
include('version.php');
|
||||
require_once('version.php');
|
||||
|
||||
$a = explode("_",$plugin->component,2);
|
||||
$a = explode("_", $plugin->component, 2);
|
||||
$plugin->type = $a[0];
|
||||
$plugin->name = $a[1];
|
||||
|
||||
$exclude_paths = [
|
||||
"build", // dir for build zip files
|
||||
$excludepaths = [
|
||||
"build", // Dir for build zip files.
|
||||
"build/*",
|
||||
"build.*",
|
||||
"vuemode.sh",
|
||||
"amd/src",
|
||||
"amd/src/*",
|
||||
".git",
|
||||
|
@ -18,28 +41,28 @@ $exclude_paths = [
|
|||
"*.zip",
|
||||
];
|
||||
|
||||
// Determine some paths
|
||||
// Determine some paths.
|
||||
$wd = realpath(dirname(__FILE__));
|
||||
$parent = dirname($wd);
|
||||
$plugindirname = basename($wd);
|
||||
$builddir = $wd."/"."build";
|
||||
$zipname = $builddir."/"."{$plugin->name}-{$plugin->version}.zip";
|
||||
|
||||
// create the exclude line
|
||||
// Create the exclude line.
|
||||
$exclude = "-x ";
|
||||
foreach($exclude_paths as $x){
|
||||
foreach ($excludepaths as $x) {
|
||||
$exclude .= "'{$plugindirname}/{$x}' ";
|
||||
}
|
||||
|
||||
if(!is_dir($builddir)){
|
||||
if (!is_dir($builddir)) {
|
||||
mkdir($builddir);
|
||||
if(!is_dir($builddir)){
|
||||
if (!is_dir($builddir)) {
|
||||
print("Cannot access dir '{$builddir}' to store zip files\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($zipfile)){
|
||||
if (file_exists($zipfile)) {
|
||||
print("Zip file '{$zipfile}' already exists. Exiting...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -51,4 +74,3 @@ $cmd = "zip -r '{$zipname}' '{$plugindirname}' {$exclude}";
|
|||
system($cmd);
|
||||
|
||||
chdir($cwd);
|
||||
|
||||
|
|
|
@ -1,18 +1,35 @@
|
|||
<?php
|
||||
$capabilities = array(
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
'block/mytreestudyplan:addinstance' => array(
|
||||
$capabilities = [
|
||||
'block/mytreestudyplan:addinstance' => [
|
||||
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
||||
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_BLOCK,
|
||||
'archetypes' => array(
|
||||
'archetypes' => [
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'manager' => CAP_ALLOW
|
||||
),
|
||||
|
||||
],
|
||||
'clonepermissionsfrom' => 'moodle/site:manageblocks'
|
||||
),
|
||||
|
||||
|
||||
);
|
||||
],
|
||||
];
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'My Treestudyplan';
|
||||
$string['mytreestudyplan'] = 'MyTreestudyplan';
|
||||
$string['title'] = 'My Studyplan';
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Mijn Treestudyplan';
|
||||
$string['mytreestudyplan'] = 'MyTreestudyplan';
|
||||
$string['title'] = 'Mijn Studieplan';
|
||||
|
|
20
lib.php
20
lib.php
|
@ -1 +1,21 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
|
21
settings.php
21
settings.php
|
@ -1,2 +1,21 @@
|
|||
<?php
|
||||
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template plugintype_pluginname/template_name
|
||||
@template block_mytreestudyplan/block
|
||||
|
||||
Template purpose and description.
|
||||
Render my treestudyplan block
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
}}
|
||||
|
||||
<div id='block_mytreestudyplan' class='path-local-treestudyplan'>
|
||||
<div id='block_mytreestudyplan' class='features-treestudyplan'>
|
||||
<div class='vue-loader' v-show='false'>
|
||||
<div class='spinner-border text-primary' role='status'>
|
||||
<span class='sr-only'>Loading...</span>
|
||||
|
|
35
version.php
35
version.php
|
@ -1,8 +1,35 @@
|
|||
<?php
|
||||
$plugin->component = 'block_mytreestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
|
||||
$plugin->version = 2023081800; // YYYYMMDDHH (year, month, day, iteration)
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
*
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'block_mytreestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
||||
$plugin->version = 2023081800; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||
|
||||
$plugin->release = "1.0.0";
|
||||
$plugin->maturity = MATURITY_RC;
|
||||
// Supported from Moodle 3.11 to 4.1 (4.2 not yet tested).
|
||||
$plugin->supported = [ 311, 401 ];
|
||||
|
||||
$plugin->dependencies = [
|
||||
'local_treestudyplan' => 2022090800,
|
||||
'local_treestudyplan' => 2023082101,
|
||||
];
|
Loading…
Reference in New Issue
Block a user