Вопрос

I'm having problem with understanding where moodle is rendering templates. I have page which url endings: /enrol/index.php?id=4 so i assume that template is from enrol catalogue. In page from this url I want to add some custom php and html , can you tell me where I can find frontend of this page and backend ?

Best regards

Это было полезно?

Решение

In Moodle 2.5, the following code in enrol\index.php, line #57, is responsible for retrieving all the content to be displayed:

foreach($enrolinstances as $instance) {
    if (!isset($enrols[$instance->enrol])) {
        continue;
    }
    $form = $enrols[$instance->enrol]->enrol_page_hook($instance);
    if ($form) {
        $forms[$instance->id] = $form;
    }
}

The actual content is printed to the users on #line 90 with

foreach ($forms as $form) {
    echo $form;
}

Anywhere around here you can inject custom content ..., ideally, your code should go after the header and before the footer, e.g.

echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolmentoptions','enrol'));

... your code goes here

echo $OUTPUT->footer();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top