formatting, icon, language strings and capapilities

This commit is contained in:
L_DA 2020-09-16 06:59:58 +00:00
parent 951a121dfa
commit 04b0a7ef72
8 changed files with 137 additions and 25 deletions

View file

@ -28,45 +28,70 @@ defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'mod/timetable:view_teacher' => array(
'mod/timetable:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
'mod/timetable:search' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'mod/timetable:viewteacher' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'mod/timetable:view_class' => array(
'mod/timetable:viewclass' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'mod/timetable:view_room' => array(
'mod/timetable:viewroom' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'mod/timetable:view_own_class' => array(
'mod/timetable:viewownclass' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW,
'student' => CAP_ALLOW

View file

@ -53,8 +53,8 @@ class mod_timetable_external extends external_api {
//Capability checking
//OPTIONAL but in most web service it should present
if (!has_capability('moodle/user:viewdetails', $context)) {
throw new moodle_exception('cannotviewprofile');
if (!has_capability('mod/timetable:search', $context)) {
throw new moodle_exception('cannotperformsearch');
}
@ -146,11 +146,10 @@ class mod_timetable_external extends external_api {
//$contextmodule = context_module::instance($cm->id);
$usercontext = context_user::instance($USER->id);
//Capability checking
//OPTIONAL but in most web service it should present
if (!has_capability('mod/timetable:view_'.$params['type'], $usercontext)) {
if (!(($params['type'] == 'class') && has_capability('mod/timetable:view_own_class', $usercontext) && ($params['name'] == str_replace('_','/',$USER->department))))
if (!has_capability('mod/timetable:view'.$params['type'], $usercontext)) {
if (!(($params['type'] == 'class') && has_capability('mod/timetable:viewownclass', $usercontext) && ($params['name'] == str_replace('_','/',$USER->department))))
throw new \moodle_exception('cannotviewtimetable'.$params['type']);
}

View file

@ -26,18 +26,23 @@
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'Timetable';
$string['modulename'] = 'Timetable';
$string['timetablename'] = 'Timetable';
$string['timetablefieldset'] = 'Settings';
$string['timetablesettings'] = 'Timetable settings';
$string['import_data'] = 'import_data';
$string['labelfnamelesson'] = 'lesson import file';
$string['descfnamelesson'] = 'Absolute path and Filename of untis export file lesson.txt';
$string['descfnamelesson'] = 'Absolute path and filename of untis export file lesson.txt';
$string['labelfnamesubst'] = 'substitution import file';
$string['descfnamesubst'] = 'Absolute path and Filename of untis export file GPU014.TXT';
$string['descfnamesubst'] = 'Absolute path and filename of untis export file GPU014.TXT';
$string['labelfnameteacher'] = 'teacher import file';
$string['descfnameteacher'] = 'Absolute path and Filename of untis export file teacher.txt';
$string['descfnameteacher'] = 'Absolute path and filename of untis export file teacher.txt';
$string['labelfnameroom'] = 'room import file';
$string['descfnameroom'] = 'Absolute path and Filename of untis export file room.txt';
$string['descfnameroom'] = 'Absolute path and filename of untis export file room.txt';
$string['labelfnameclass'] = 'class import file';
$string['descfnameclass'] = 'Absolute path and Filename of untis export file class.txt';
$string['descfnameclass'] = 'Absolute path and filename of untis export file class.txt';
$string['labelnumperiod'] = 'max period';
$string['descnumperiod'] = 'max period per day';
$string['labelsaturday'] = 'saturday';
$string['descsaturday'] = 'enabled if saturday in timetable';
$string['descfnamesroom'] = 'Absolute path and filename of untis export file room.txt';

BIN
pix/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

79
pix/icon.svg Normal file
View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="11.011368mm"
height="9.6467371mm"
viewBox="0 0 11.011368 9.6467371"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="icon.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="63.555551"
inkscape:cy="-2.0157551"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1136"
inkscape:window-x="1920"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-31.691679,-51.020183)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="30.994047"
y="58.875"
id="text3715"><tspan
sodipodi:role="line"
id="tspan3713"
x="30.994047"
y="58.875"
style="fill:#0000ff;stroke-width:0.26458332">S</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0074e4;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="36.682743"
y="60.66692"
id="text3719"><tspan
sodipodi:role="line"
id="tspan3717"
x="36.682743"
y="60.66692"
style="fill:#0074e4;stroke-width:0.26458332">P</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -1,7 +1,3 @@
.timetableffffo th {
width: 4rem;
}
.timetable_description {
display:block;
float: left;
@ -31,6 +27,8 @@ div.timetable {
text-align: center;
padding-top:0rem;
padding-bottom:0rem;
padding-left:2px;
padding-right:0px;
margin: 0 auto;
width: 100%;
line-height: 1;
@ -55,11 +53,17 @@ div.timetable {
}
.timetable th,
.timetable td {
.timetable th {
padding: 2px;
font-size: 0.8em;
text-align: center;
width: 5rem;
width: 4rem;
}
.timetable td {
padding: 2px;
padding-left: 2px;
font-size: 0.8em;
text-align: center;
width: 1rem;
}

View file

@ -14,12 +14,12 @@
</caption>
<thead>
<tr ssstyle="text-align:center">
<th></th><th>Mo</th><th>Di</th><th>Mi</th><th>Do</th><th>Fr</th>{{#saturday}}<th ssstyle="width:4rem">Sa</th>{{/saturday}}
<td></td><th>Mo</th><th>Di</th><th>Mi</th><th>Do</th><th>Fr</th>{{#saturday}}<th>Sa</th>{{/saturday}}
</tr>
</thead>
{{#periods}}
<tr sstyle="border:1px black; padding-top:0rem; padding-bottom:0rem">
<th>{{number}}</th>
<td>{{number}}</td>
{{#days}}
<td style="padding-top:0rem; padding-bottom:0rem; vertical-alig:middle; border-left:1px black;" {{#substitution}}bgcolor="pink" data-toggle='tooltip' title='{{substitution}}'{{/substitution}}>
{{#lessons}}

View file

@ -26,6 +26,6 @@ defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_timetable';
$plugin->release = '0.1.0';
$plugin->version = 2020083004;
$plugin->version = 2020091505;
$plugin->requires = 2020061500;
$plugin->maturity = MATURITY_ALPHA;