wooclap / moodle-mod_wooclap

Moodle plugin for Wooclap (https://www.wooclap.com/).
2 stars 5 forks source link

Activity description not showing in mod_wooclap #1

Closed jrm-unamur closed 2 years ago

jrm-unamur commented 3 years ago

Nous avons repéré un soucis dans le module Wooclap pour Moodle. Lorsqu'on ajoute une description à l'activité Wooclap et qu'on demande son affichage sur la page de cours, rien ne s'affiche. Ce comportement est normalement géré dans la fonction wooclap_supports($feature) en réglant FEATURE_SHOW_DESCRIPTION à "true", ce qui est bien le cas dans le code du module, mais ça ne s'affiche tout de même pas. Pouvez-vous y regarder?

Jean-Roch Meurisse - Université de Namur

chiaravicere commented 3 years ago

News about this? The activity description does not show on the course page when required.

Kemmotar83 commented 2 years ago

Hi,

the feature FEATURE_SHOW_DESCRIPTION is actually supported but description is not yet displayed since it is not included in the _cached_cminfo object, returned by function _wooclap_get_coursemoduleinfo.

The function code should be like the following one:

function wooclap_get_coursemodule_info($coursemodule) {
    global $DB;

    $dbparams = ['id' => $coursemodule->instance];
    $fields = 'id, name, intro, introformat';
    if (!$wooclap = $DB->get_record('wooclap', $dbparams, $fields)) {
        return false;
    }

    $info = new cached_cm_info();
    $info->name = $wooclap->name;

    if ($coursemodule->showdescription) {
        // Convert intro to html. Do not filter cached version, filters run at display time.
        $info->content = format_module_intro('wooclap', $wooclap, $coursemodule->id, false);
    }

    $url = new moodle_url('/mod/wooclap/view.php', ['id' => $coursemodule->id, 'redirect' => 1]);
    $fullurl = $url->out();
    $info->onclick = "window.open('$fullurl'); return false;";

    return $info;
}

I can provide you a pull request in you need.

Regards, Giorgio

mehira-wooclap commented 2 years ago

Thank you @Kemmotar83. We will deploy your fix in the next release. hopefully very soon,

mehira-wooclap commented 2 years ago

The next release will fix the issue

dfdeagle47 commented 2 years ago

@jrm-unamur @chiaravicere @Kemmotar83

This should be fixed in the new release here and here. The activity description should now appear as expected in the course page if there is one.

Thanks again for your help!