diff --git a/db/access.php b/db/access.php
index 94191d8..2bd3f2e 100644
--- a/db/access.php
+++ b/db/access.php
@@ -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
diff --git a/externallib.php b/externallib.php
index 35782fb..c8b6125 100644
--- a/externallib.php
+++ b/externallib.php
@@ -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']);
}
diff --git a/lang/en/timetable.php b/lang/en/timetable.php
index 47579ea..18c105c 100644
--- a/lang/en/timetable.php
+++ b/lang/en/timetable.php
@@ -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';
\ No newline at end of file
+$string['descsaturday'] = 'enabled if saturday in timetable';
+$string['descfnamesroom'] = 'Absolute path and filename of untis export file room.txt';
diff --git a/pix/icon.png b/pix/icon.png
new file mode 100644
index 0000000..2d5e88d
Binary files /dev/null and b/pix/icon.png differ
diff --git a/pix/icon.svg b/pix/icon.svg
new file mode 100644
index 0000000..3b7354f
--- /dev/null
+++ b/pix/icon.svg
@@ -0,0 +1,79 @@
+
+
+
+
diff --git a/styles.css b/styles.css
index fe2c476..12df7e3 100644
--- a/styles.css
+++ b/styles.css
@@ -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;
+}
diff --git a/templates/timetable.mustache b/templates/timetable.mustache
index 3cd0fdc..acae7b7 100644
--- a/templates/timetable.mustache
+++ b/templates/timetable.mustache
@@ -14,12 +14,12 @@
-
{{#periods}}
Mo Di Mi Do Fr {{#saturday}}Sa {{/saturday}}
+Mo Di Mi Do Fr {{#saturday}}Sa {{/saturday}}