Skip to content

Commit 9e92737

Browse files
committed
First try to enable the app
1 parent bb1ac06 commit 9e92737

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

classes/output/mobile.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace mod_learningmap\output;
18+
19+
/**
20+
* Class mobile
21+
*
22+
* @package mod_learningmap
23+
* @copyright 2025 ISB Bayern
24+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25+
*/
26+
class mobile {
27+
/**
28+
* Render the mobile view for the learning map
29+
*
30+
* @param array $args
31+
* @return array
32+
*/
33+
public static function mobile_learningmap_view(array $args): array {
34+
global $OUTPUT;
35+
36+
$cm = get_coursemodule_from_id('learningmap', $args['cmid']);
37+
38+
require_login($cm->course, false, $cm);
39+
$context = context_module::instance($cm->id);
40+
require_capability('mod/learningmap:view', $context);
41+
42+
$result = [
43+
'templates' => [
44+
[
45+
'id' => 'main',
46+
'html' => $OUTPUT->render_from_template(
47+
'mod_learningmap/rendercontainer',
48+
['cmId' => $cm->id, 'enableLiveUpdater' => false, 'contentbeforemap' => '', 'hascontentbeforemap' => false]
49+
),
50+
],
51+
],
52+
'javascript' => '',
53+
'otherdata' => '',
54+
];
55+
56+
return $result;
57+
}
58+
}

db/mobile.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Mobile app areas for Learning map
19+
*
20+
* Documentation: {@link https://moodledev.io/general/app/development/plugins-development-guide}
21+
*
22+
* @package mod_learningmap
23+
* @copyright 2025 ISB Bayern
24+
* @author Stefan Hanauska <stefan.hanauska@csg-in.de>
25+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26+
*/
27+
28+
defined('MOODLE_INTERNAL') || die();
29+
30+
$addons = [
31+
'mod_learningmap' => [
32+
'handlers' => [
33+
'learningmap_view_separate' => [
34+
'delegate' => 'CoreCourseModuleDelegate',
35+
'method' => 'mobile_learningmap_view',
36+
'displaydata' => [
37+
'icon' => $CFG->wwwroot . '/mod/learningmap/pix/icon.svg',
38+
'class' => '',
39+
],
40+
'styles' => [
41+
'url' => $CFG->wwwroot . '/mod/learningmap/styles.css',
42+
],
43+
],
44+
'learningmap_view_embedded' => [
45+
'delegate' => 'CoreCourseModuleDelegate',
46+
'method' => 'mobile_learningmap_view',
47+
'displaydata' => [
48+
'icon' => $CFG->wwwroot . '/mod/learningmap/pix/icon.svg',
49+
'class' => '',
50+
],
51+
'styles' => [
52+
'url' => $CFG->wwwroot . '/mod/learningmap/styles.css',
53+
],
54+
],
55+
],
56+
'lang' => [
57+
['pluginname', 'mod_learningmap'],
58+
],
59+
],
60+
];

0 commit comments

Comments
 (0)