Logo Moodle Mobile App

Moodle Mobile App

Cộng đồng
SaadRahman01
moodle-mobile-app

Use when integrating a Moodle plugin with the Moodle Mobile app — db/mobile.php remote templates, Ionic/Angular components delivered server-side, mobile.php view types, addons, push notifications, and offline support.

Tổng quan

Nhà phát hànhSaadRahman01
Kho mãclaude-moodle-dev
Tên kỹ năngmoodle-mobile-app
Sao
42
Bản fork
7
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được SaadRahman01 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Moodle Mobile App trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/SaadRahman01/claude-moodle-dev/tree/main/skills/moodle-mobile-app
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git /tmp/claude-moodle-dev
mkdir -p .claude/skills
cp -r /tmp/claude-moodle-dev/skills/moodle-mobile-app .claude/skills/moodle-mobile-app
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Moodle Mobile App trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Moodle Mobile App ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Moodle Mobile App với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Moodle Mobile App Integration

Overview

Moodle Mobile app (Ionic/Angular) loads plugin UI as remote templates declared in db/mobile.php. The server returns Mustache-like templates + JS that the app renders inline. No app rebuild required — works on any user's installed app once the site declares the addon.

When to Use

  • Adding plugin UI to mobile app
  • Surfacing notifications, dashboard items, or activity views in the app
  • Offline-capable content
  • Push notifications for plugin events

Skip when: plugin only used in browser admin UI.

Architecture

Moodle server                          Moodle Mobile app
─────────────                          ─────────────────
db/mobile.php          ────────────►   Discovers addons via
classes/output/mobile.php              tool_mobile_get_plugins_supporting_mobile

Returns                ────────────►   Renders Ionic components
  templates (.html)
  initial JS
  styles

App calls a server function which returns:

  • A Mustache-like template (Ionic + custom directives)
  • Optional JS to run client-side
  • Optional initial data
  • Optional offline functions

db/mobile.php

php
<?php
defined('MOODLE_INTERNAL') || die();

$addons = [
    'local_example' => [
        'handlers' => [
            'mainmenu' => [
                'displaydata' => [
                    'title' => 'pluginname',
                    'icon'  => 'list',
                    'class' => '',
                ],
                'delegate'    => 'CoreMainMenuDelegate',
                'method'      => 'mobile_main_menu_view',
                'styles'      => [
                    'url'     => '/local/example/mobile/styles.css',
                    'version' => 1,
                ],
                'offlinefunctions' => [
                    'mobile_main_menu_view' => [],
                ],
            ],
            'courseoption' => [
                'displaydata' => [
                    'title' => 'attendance',
                    'class' => '',
                ],
                'delegate' => 'CoreCourseOptionsDelegate',
                'method'   => 'mobile_course_view',
            ],
        ],
        'lang' => [
            ['pluginname', 'local_example'],
            ['attendance', 'local_example'],
        ],
    ],
];

Delegates

DelegateWhere it shows
CoreMainMenuDelegateMain menu (bottom tab bar)
CoreUserDelegateUser profile page
CoreCourseOptionsDelegateCourse menu
CoreCourseModuleDelegateActivity in course (for mod_* plugins)
CoreBlockDelegateSidebar block (for block_*)
CoreSettingsDelegateApp settings page
CoreMessageOutputDelegateMessage output handler

classes/output/mobile.php

php
<?php
namespace local_example\output;
defined('MOODLE_INTERNAL') || die();

class mobile {

    public static function mobile_main_menu_view(array $args): array {
        global $DB, $USER;

        $items = $DB->get_records('local_example_items',
            ['userid' => $USER->id], 'timecreated DESC', '*', 0, 20);

        return [
            'templates' => [
                [
                    'id'   => 'main',
                    'html' => self::render_main_template(),
                ],
            ],
            'javascript' => self::get_javascript(),
            'otherdata'  => [
                'items' => json_encode(array_values($items)),
                'sesskey' => sesskey(),
            ],
            'files' => [],
        ];
    }

    private static function render_main_template(): string {
        return '
<ion-list>
    <ion-item-divider><ion-label>{{ \'plugin.local_example.attendance\' | translate }}</ion-label></ion-item-divider>
    <ion-item *ngFor="let item of CONTENT_OTHERDATA.items">
        <ion-label>
            <h2>{{ item.name }}</h2>
            <p>{{ item.timecreated | coreFormatDate }}</p>
        </ion-label>
        <ion-button slot="end" (click)="markPresent(item.id)">
            {{ \'plugin.local_example.markpresent\' | translate }}
        </ion-button>
    </ion-item>
</ion-list>';
    }

    private static function get_javascript(): string {
        return "
this.markPresent = (id) => {
    const params = {sessionid: id, userid: this.CoreSitesProvider.getCurrentSite().getUserId()};
    return this.CoreSitesProvider.getCurrentSite()
        .write('local_example_mark_present', params)
        .then((result) => {
            this.CoreDomUtilsProvider.showToast('plugin.local_example.marked', true, 2000);
        });
};";
    }
}

Required web services

The function name in db/mobile.php ('method' => 'mobile_main_menu_view') must be exposed as a web service in db/services.php:

php
$functions = [
    'local_example_mobile_main_menu_view' => [
        'classname'    => 'local_example\output\mobile',
        'methodname'   => 'mobile_main_menu_view',
        'description'  => 'Main menu mobile view',
        'type'         => 'read',
        'capabilities' => '',
        'services'     => [MOODLE_OFFICIAL_MOBILE_SERVICE],
    ],
];

Plus the AJAX/REST functions used inside the template (local_example_mark_present).

Template syntax

Mobile templates use Angular + Ionic with Moodle directives:

DirectiveUse
{{ 'plugin.local_example.foo' | translate }}Lang string
{{ value | coreFormatDate }}Format unix timestamp
{{ html | coreFormatText }}Format Moodle text
<core-format-text [text]="html" />Same, component form
*ngFor="let item of CONTENT_OTHERDATA.items"Loop
*ngIf="condition"Conditional
(click)="handler()"Event
<ion-item>, <ion-list>, <ion-button>Ionic UI
<core-empty-box>"Nothing here" placeholder

CONTENT_OTHERDATA = data passed via 'otherdata'. Strings JSON-decoded automatically.

JavaScript scope

Helpers injected into JS scope:

ObjectUse
this.CoreSitesProviderCurrent site, current user, web service calls
this.CoreDomUtilsProviderToasts, alerts, modals
this.CoreFilepoolProviderCache files for offline
this.CoreUtilsProviderMisc helpers
this.refreshContent(false)Reload current view

Offline support

Add functions to 'offlinefunctions':

php
'offlinefunctions' => [
    'mobile_main_menu_view' => [],
    'local_example_get_items' => [],
],

App pre-fetches results during sync — they survive offline. For mutations (mark present), use the offline write API:

javascript
this.CoreSitesProvider.getCurrentSite().write(
    'local_example_mark_present',
    params,
    {forceOffline: false, getFromCache: false}
).catch((error) => {
    if (this.CoreUtilsProvider.isWebServiceError(error)) {
        return Promise.reject(error);
    }
    // Queue for later sync
    return this.CoreCourseProvider.storeOfflineAction(...);
});

Push notifications

Push delivery via Moodle's airnotifier service. Plugin events trigger notifications via \core\message\manager::send_message(). Mobile app receives them automatically when:

  • Site has airnotifier configured (Site admin > Mobile > Push notifications)
  • User logged into mobile app
  • User has the addon's notification preference enabled

Testing

  1. Local dev: install Moodle Mobile app, point at http://10.0.2.2:8000 (Android emulator) or your LAN IP
  2. Site admin > Mobile > Enable web services for mobile devices
  3. Log in to app — addon appears
  4. To force template re-fetch after server change: pull-to-refresh, or app settings > Synchronisation > Synchronise now
  5. Browser-based dev: npx ionic serve against moodle-mobile-app source pointing at your site

Styles

local/example/mobile/styles.css (referenced from db/mobile.php):

css
.local_example-marked {
    color: var(--ion-color-success);
    font-weight: bold;
}

Bumping 'version' => N in db/mobile.php invalidates app's cached styles.

Common Mistakes

MistakeFix
Method not exposed as web serviceDeclare in db/services.php with MOODLE_OFFICIAL_MOBILE_SERVICE
Lang strings not declared in db/mobile.phpApp can't render `{{ 'plugin...'
<div> instead of Ionic <ion-*>Use Ionic components for native look
Forgetting MOODLE_OFFICIAL_MOBILE_SERVICEWeb service callable but not for mobile
Heavy DB queries on every refreshCache via MUC + invalidate on update
Hand-formatting timestampsUse coreFormatDate filter
Embedding HTML directlyUse coreFormatText for format_text-equivalent escaping
No offlinefunctions for read viewsPre-fetch fails — declare them
Not bumping styles versionApp keeps old CSS
Calling fetch() directlyUse CoreSitesProvider — handles auth + tokens

References

Câu hỏi thường gặp

Kỹ năng AI Moodle Mobile App làm được gì?

Use when integrating a Moodle plugin with the Moodle Mobile app — db/mobile.php remote templates, Ionic/Angular components delivered server-side, mobile.php view types, addons, push notifications, and offline support.

Vì sao nên dùng Moodle Mobile App trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Moodle Mobile App là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Moodle Mobile App trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/SaadRahman01/claude-moodle-dev/tree/main/skills/moodle-mobile-app. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Moodle Mobile App?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Moodle Mobile App với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Moodle Mobile App với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Moodle Mobile App có miễn phí không?

Có. Kỹ năng này được SaadRahman01 phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇