Changing the view of course categories

Re: Changing the view of course categories

by Steven A -
Number of replies: 13
What you want to do is possible, but may be a bit tedious to set up. In brief, you need to create a label on your frontpage (to house your buttons) and hide the list of courses that your site currently displays.

The first thing you need to do is to create a place to house all of your buttons.

1. Go to Administration ▶ Front Page ▶ Front Page settings
2. Turn on "Include a topic section" if it's not already turned on
3. Go back to your frontpage and turn editing on
4. From the dropdown menu in the middle-column, add a label
5. Set up your buttons the way you want them, maybe in an HTML table or something.

The last step is to hide the list of courses that you currently have.

6. Go to Administration ▶ Front Page ▶ Front Page settings
7. Set "Front page items when logged in" to "none".

I think that's all there is to it. wink
Average of ratings: Useful (1)
In reply to Steven A

Re: Changing the view of course categories

by Daniel Brittle -

Thanks for that, ive looked into it and think that may be more hassle to set up and maintain than we really want.

What i could really do with is finding where the file that displays all of these courses is generated then i can work from there.

We are currently upgrading from 1.7 to 1.9 and i am trying to implement a few new features easier navigation being one of these.

Any help in locating the files that generate these course view pages (as pictured) would be a massive help.

Thanks,

Daniel.

Attachment screen_shot.JPG
In reply to Daniel Brittle

Re: Changing the view of course categories

by Steven A -
Mucking around in the core files is always an option. I'm not sure where to start with that though. Maybe course/index.php?

On the other hand, I just had another thought. The list of courses is controlled by the following div tags:

.coursebox (controls both the course title and description)
.coursebox .info (controls the course title, i.e. the text)
.coursebox . summary (controls the course description, i.e. your images)

I guess you could add:

.coursebox .info {
display:none;
}

to the bottom of your stylesheet to hide the course title (the text). But then there'd be a lot of white space and one long, vertical column of course buttons.

So then to center the buttons on the page after hiding the text, you could add:

.coursebox .summary {
margin:0 auto;
}

Maybe you could make the buttons wider too? It'd be nice to have the buttons cascade into a grid, but I'm not sure if that's possible.
Average of ratings: Useful (1)
In reply to Steven A

Re: Changing the view of course categories

by Daniel Brittle -

I'll give that a go now, thanks a lot

Daniel.

In reply to Daniel Brittle

Re: Changing the view of course categories

by Steven A -
I've been playing around a bit with the core files to see if I can have the course descriptions (the buttons) cascade into a grid rather than just be a vertical row, and I think I've done it.

In course/lib.php around line 2043:

echo '<div class="coursebox clearfix">';
echo '<div class="info">';
echo '<div class="name"><a title="'.get_string('entercourse').'"'.
$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.
highlight($highlightterms, format_string($course->fullname)).'</a></div>';

Delete clearfix.
CSS in the standard theme has .clearfix{display:block;}, which is nice for pushing things down the page, but we don't want to vertically "stack" things in this manner anymore.

After that one, small change, now everything looks okay on the frontpage provided your exisiting CSS doesn't get in the way (and it probably will - you'll have to play around with it). However, clicking the "All courses" button sends us to course/index.php. And in this file, there is no clearfix, so there's nothing there to push the footer down the page. Adding the clearfix back in solves this. I suppose it can be added back in any number of places, but I've added it back in here:

course/index.php, around line 85, just before print_footer();

print_course_request_buttons($systemcontext);
echo '</div>';
echo '<div class="clearfix"></div>';
print_footer();
exit;

You'll have to play around with the CSS removing borders, setting widths, setting padding, and so on depending on your theme to make it look right. I should also mention that I have not poked around to see if these small changes mess up anything else around the site, but I don't *think* that will happen. wink
Average of ratings: Useful (2)
In reply to Steven A

Re: Changing the view of course categories

by David Presley -

Hello,

I'm having a problem with the default view of categories.  One of our catagories has changed its view and I can't figure out how it happened or how to change it back.  All categories used to appear with the course name, course description and teacher.  But one category stopped displaying the description and teacher.  Any thoughts or suggestions?

In reply to David Presley

Re: Changing the view of course categories

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Is it number 3 here http://docs.moodle.org/en/Course_FAQ ?

In reply to Mary Cooch

Re: Changing the view of course categories

by Miriam Laidlaw -
Picture of Plugin developers

Hi Mary,

I have to say, it's an issue that has been bugging me and I hadn't noticed that particular information in the docs before. Hooray.

Unfortunately, the information says:

Some of my courses have the course summaries showing but some only have an information icon.Why?

  • Categories which have fewer than ten courses will show the full summary but those with more will only show the information icon. If you want them all to show the full summary then change the number to a number lower in Settings>Site Administration>Front Page>Front page settings. The courses will then display over more than one page but with the full summary

But it doesn't say which setting. And looking through the settings, it's not obvious to me (and I'm not a Moodle novice) which setting I need to set lower to alter the 10 course threshold?

Also, the information may be wrong? Why would the category view be affected by Front page settings?

In reply to Miriam Laidlaw

Re: Changing the view of course categories

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I think Mary made a type as the one related to Teacher names is item 2 no 3.

I must admit I don't ever recall seeing that setting...ever!

I think I need to go on a crash couse on How to Moodle! LOL

MLE

In reply to Mary Evans

Re: Changing the view of course categories

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Miriam - I think it was courses per page setting.

Mary- I did mean 3 but 2 is a useful one to note as well.

(I'll swap you a crash course on How to Moodle with a crash course on Git LOLbig grin)

In reply to Mary Cooch

Re: Changing the view of course categories

by Miriam Laidlaw -
Picture of Plugin developers

Hi again Mary!

Courses per page setting is by default 20, so I'm not sure where the 10 limit figures into the equation. And why setting it (whichever setting it is) LOWER would fix the problem, as is indicated by the information in that docs passage I copied...?

In reply to Miriam Laidlaw

Re: Changing the view of course categories

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi Miriam - afaik - the way it works is that if you have more than 10 courses per page then Moodle will not show the full course details but if you have fewer than 10 courses per page it WILL. So by setting it lower you actually end up with more pages of courses in edit mode but each course actually displays its full details.