Changing default course format

Changing default course format

by Charlie Owen -
Number of replies: 6
I'm currently trying to change the default format from "Weekly" to "Topics" when creating a new course. Does anybody have any experience of this?

The following in "/course/edit.html" seems relevant:
<tr valign="top">
    <td align="right"><?php  print_string("format") ?>:</td>
<td><?php
           choose_from_menu ($form->courseformats, "format", "$form->format",  "");
           helpbutton("courseformats", get_string("courseformats"));
        ?>
    </td>
</tr>

as does this in "/course/edit.php":

    $courseformats = get_list_of_plugins("course/format");
$form->courseformats = array();

foreach ($courseformats as $courseformat) {
$form->courseformats["$courseformat"] = get_string("format$courseformat");
}

I've tried adding the following at the start of "/course/edit.html":

    if (!isset($form->courseformat)) {
        $form->courseformat = 'topics';
    }

All to no avail. sad

Average of ratings: -
In reply to Charlie Owen

Re: Changing default course format

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Charlotte,

Please try changing the line

$form->format = "weeks";

in course/edit.php to

$form->format = "topics";

In reply to Helen Foster

Re: Changing default course format

by Charlie Owen -
Nooooooooooo! It can't be that simple can it? ::Slaps forehead::

Thanks for that Helen!
In reply to Helen Foster

Re: Changing default course format

by David Burnett -

Seems a simple solution. Just one question. How do I get to the code shown? Told you I'm a beginner!

Thanks.

In reply to Helen Foster

Re: Changing default course format

by Mark Haskins -

Hi there,

Does this work in 1.9? What I mean by that is; I can't find the code in 1.9!

Cheers

In reply to Mark Haskins

Re: Changing default course format

by Mark Haskins -

So, do you post first and then think? I do. For 1.9:

In course/edit_form.php

change

$mform->setDefault('format', 'weeks');

to

$mform->setDefault('format', 'topics');