为什么 Edwiser 课程格式的移动插件支持代码没有反映为 Moodle 应用程序中的输出?

问题描述 投票:0回答:1

按照创建移动课程格式插件开发指南,我正在为 Moodle 应用程序开发支持 Edwiser 课程格式的移动插件。但是按照指南中的说明创建

db/mobile.php
classes/output/mobile.php
templates/mobile_course.mustache
后,我仍然在移动ie中获得默认的课程格式。不支持课程格式插件时的课程格式。但是,当我将服务器中的课程格式更改为 Flexsections 之类的格式时,它可以在我的移动应用程序中使用。

这些是我的文件: Moodle/course/format/remuiformat/db/mobile.php:

<?php

$addons = [
    'format_remuiformat' => [
        'handlers' => [ // Different places where the plugin will display content.
            'remuiformat' => [ // Handler unique name (alphanumeric).
                'delegate' => 'CoreCourseFormatDelegate', // Delegate (where to display the link to the plugin)
                'method' => 'mobile_course_view', // Main function in \format_remuiformat\output\mobile.
                'styles' => [
                    'url' => $CFG->wwwroot . '/course/format/remuiformat/mobile.css',
                    'version' => 2019041000
                ],
                'displaysectionselector' => true, // Set to false to disable the default section selector.
                'displayenabledownload' => true, // Set to false to hide the "Enable download" option in the course context menu.
                'init' => 'remuiformat_init'
            ]
    ]
    ]
];

moodle/course/format/remuiformat/classes/output/mobile.php:

<?php

class mobile {

    /**
     * Main course page.
     *
     * @param array $args Standard mobile web service arguments
     * @return array
     */
    public static function mobile_course_view($args) {
        global $OUTPUT, $CFG;

        $course = get_course($args['courseid']);
        require_login($course);
        $html = $OUTPUT->render_from_template('format_remuiformat/mobile_course', []);

        return [
            'templates' => [
                [
                    'id' => 'main',
                    'html' => $html
                ]
            ],
            'otherdata' => '',
        ];
    }
}

moodle/course/format/remuiformat/templates/mobile_course.mustache:

{{=<% %>=}}
<core-dynamic-component [component]="allSectionsComponent" [data]="data" class="format-myformat">
    <ng-container *ngFor="let section of sections">
        <h1>Test</h1>
        <ion-item-divider color="light">
            <core-format-text [text]="section.name"></core-format-text>
             <!-- Section download. -->
             <div *ngIf="section && downloadEnabled" class="core-button-spinner" float-end>
                <!-- Download button. -->
                <button *ngIf="section.showDownload && !section.isDownloading && !section.isCalculating" (click)="prefetch($event, section)" ion-button icon-only clear color="dark" [attr.aria-label]="'core.download' | translate">
                    <ion-icon name="cloud-download"></ion-icon>
                </button>
                <!-- Refresh button. -->
                <button *ngIf="section.showRefresh && !section.isDownloading && !section.isCalculating" (click)="prefetch($event, section)" ion-button icon-only clear color="dark" [attr.aria-label]="'core.refresh' | translate">
                    <ion-icon name="refresh"></ion-icon>
                </button>
                <!-- Download progress. -->
                <ion-badge class="core-course-download-section-progress" *ngIf="section.isDownloading && section.total > 0 && section.count < section.total">{{section.count}} / {{section.total}}</ion-badge>
                <!-- Spinner (downloading or calculating status). -->
                <ion-spinner *ngIf="(section.isDownloading && section.total > 0) || section.isCalculating"></ion-spinner>
            </div>
        </ion-item-divider>

        <ion-item text-wrap *ngIf="section.summary">
            <core-format-text [text]="section.summary"></core-format-text>
        </ion-item>

        <ng-container *ngFor="let module of section.modules">
            <ng-container *ngIf="module.visibleoncoursepage !== 0">
                <core-course-module text-wrap [module]="module" [courseId]="course.id" [downloadEnabled]="downloadEnabled" (completionChanged)="onCompletionChange($event)">
                </core-course-module>
            </ng-container>
        </ng-container>
    </ng-container>
</core-dynamic-component>

我已通过应用程序设置 -> 空间使用 -> 删除所有网站下载数据清除了我的移动应用程序数据并 我已经清除了服务器中的所有缓存,但仍然没有运气。

有人可以指出我错在哪里或者我应该做什么吗?我很高兴提供有关此问题所需的更多信息。

谢谢!

moodle moodle-mobile
1个回答
0
投票

在moodle/course/format/remuiformat/classes/output/mobile.php我添加了:

namespace format_remuiformat\output;
defined('MOODLE_INTERNAL') || die();

遵循Moodle应用程序插件开发指南的开发工作流程。我清除了移动应用程序数据,注销并再次登录到我的 Moodle 应用程序,它成功了!

© www.soinside.com 2019 - 2024. All rights reserved.