capabilities

This commit is contained in:
L_DA 2020-09-18 20:02:42 +00:00
parent 71c98918c4
commit 49e28c9956
3 changed files with 66 additions and 15 deletions

View file

@ -61,31 +61,31 @@ class block_timetable extends block_base {
$this->content->icons = array(); $this->content->icons = array();
$this->content->footer = ''; $this->content->footer = '';
/*
$view1 = 'subject'; //$view1 = 'subject';
$view2 = 'teacher'; //$view2 = 'teacher';
if ($this->page->course->idnumber && $this->page->course->shortname) { if ($this->page->course->idnumber && $this->page->course->shortname) {
$class = $this->page->course->shortname; $class = $this->page->course->shortname;
$this->content->text .= "Stundenplan der Klasse $class<br>"; //$this->content->text .= "Stundenplan der Klasse $class<br>";
$ttable = new timetable('class',$class); $ttable = new \mod_timetable\timetable('class',$class);
} elseif ($USER->department == "Lehrer" || $USER->department == "Lehrer_fvs") { } elseif ($USER->department == "Lehrer" || $USER->department == "Lehrer_fvs") {
$teacher = $USER->username; $teacher = $USER->username;
$teacher = str_replace("l_", "", $teacher); $teacher = str_replace("l_", "", $teacher);
$teacher = str_replace("-fvs", "", $teacher); $teacher = str_replace("-fvs", "", $teacher);
$this->content->text .= "Stundenplan von ".(substr($USER->firstname,0,1)).". {$USER->lastname}<br>"; //$this->content->text .= "Stundenplan von ".(substr($USER->firstname,0,1)).". {$USER->lastname}<br>";
$ttable = new \mod\timetable\timetable('teacher',$teacher); $ttable = new \mod_timetable\timetable('teacher',$teacher);
$view1 = 'class'; //$view1 = 'class';
$view2 = 'subject'; //$view2 = 'subject';
$this->content->footer = '<div class="timetable_legend"><a href="javascript:M.block_timetable.view_class()">Klassen</a> - <a href="javascript:M.block_timetable.view_subject()">Fächer</a> - <a href="javascript:M.block_timetable.view_room()">Räume</a></div>'; //$this->content->footer = '<div class="timetable_legend"><a href="javascript:M.block_timetable.view_class()">Klassen</a> - <a href="javascript:M.block_timetable.view_subject()">Fächer</a> - <a href="javascript:M.block_timetable.view_room()">Räume</a></div>';
} elseif ($USER->department) { } elseif ($USER->department) {
$class = $USER->department; $class = $USER->department;
$class = str_replace("_", "/", $class); $class = str_replace("_", "/", $class);
$this->content->text .= "Stundenplan der Klasse $class<br>"; //$this->content->text .= "Stundenplan der Klasse $class<br>";
$ttable = new \mod\timetable\timetable('class',$class); $ttable = new \mod_timetable\timetable('class',$class);
} else { } else {
return $this->content; return $this->content;
} }
*/
$today = new \DateTime(); $today = new \DateTime();
$week = $today->format("W"); $week = $today->format("W");
$dayofweek = $today->format('w'); $dayofweek = $today->format('w');
@ -93,7 +93,7 @@ class block_timetable extends block_base {
$week++; $week++;
} }
$ttable = new \mod_timetable\timetable('teacher','Da'); //$ttable = new \mod_timetable\timetable('teacher','Da');
$ttable->read_db($week); $ttable->read_db($week);
/* /*
for ($i=0; $i<3; $i++) { for ($i=0; $i<3; $i++) {

51
db/access.php Normal file
View file

@ -0,0 +1,51 @@
<?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/>.
/**
* Plugin capabilities
*
* @package block_timetable
* @category upgrade
* @copyright 2020 Raphael Dannecker <raphael.dannecker@steinbeisschule-reutlingen.de>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/timetable:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
'block/timetable:myaddinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
);

View file

@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die();
$plugin->component = 'block_timetable'; $plugin->component = 'block_timetable';
$plugin->release = '0.1.0'; $plugin->release = '0.1.0';
$plugin->version = 2020091200; $plugin->version = 2020091801;
$plugin->requires = 2020061500; $plugin->requires = 2020061500;
$plugin->maturity = MATURITY_ALPHA; $plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = [ $plugin->dependencies = [