Course "main menu" block

Course "main menu" block

by Chardelle Busch -
Number of replies: 84
Picture of Core developers
I've created a block that allows you to add resources and activities to a block in a course (similar to the site main menu block). Since I really don't know what I'm doing, be sure to test it first, and let me know if it seems okay. What I've done is made it so the block adds resources/activities to "section 100" of the course--hence it is called course section block since its like adding a course section to a blocksmile. It seems to work okay for the site homepage too, so it could also be used for a second site main menu block. The only thing is it looks a little funky to have topic "100" show up, like on the activity index pages, but I didn't know how else to do this (also, I don't use the Activities block, and I've taken this link out of my breadcrumb so my users don't ever see these pages).

To try it, 1. add a string to the lang/en/moodle.php file:
"coursesectionblock" for the block title. You can call it whatever you want, e.g. Resources, etc. So, it would look like this:
$string['coursesectionblock'] = 'Resources';

2. upload the course_section block folder to the moodle blocks folder.


Edited: attachment deleted by Chardelle request

(Editado por Eloy Lafuente (stronk7) - sábado, 18 de febrero de 2006, 01:35)

Average of ratings: -
In reply to Chardelle Busch

Re: Course "main menu" block

by James Robertson -

So this is like a floating topic that sits in a block, untied to any particular week or topic number in the main course menu?  Sounds intriguing!  Or am I misunderstanding completely?

Jim.

In reply to James Robertson

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
When you say untied to any week or topic well, yes and no. It is just like the main menu block on the site home page--you can add activities and resources to it--so in essence it is like adding a topic section to a block (but no summary, of course). However, to get it to be able to work in a course with no fussy coding (all you do is upload the block), I just made it so you are adding resources/activities to topic (or week) 100 of the course (so if you have 100 topics already, this will be a problemtongueout, really all it means is that in the activity index pages and reports these activities will show up listed under topic 100). So, if that isn't a problem for you, and you want to be able to add activities or resources to a block in your course as opposed to a topic/week, this might be handy. Here's an example screenshot of how I am using it in a course--I have added a forum and a glossary to a block called Support, so that they stand out better than having them stuck in a topic somewhere. And next to it is how it shows up on the forum index page.  There might be a better way than to add them to topic "100" but this works for me.
Attachment block.gif
In reply to Chardelle Busch

Re: Course "main menu" block

by James Robertson -

Thanks, I'll have to try it out.  Your Support block is exactly the kind of thing I was envisioning.  I hope I don't ever have a course with 100 weeks (or topics) in it dead.  Does Moodle create a set of empty topic/week structures from the final course week to week 99?

Jim.

In reply to James Robertson

Re: Course "main menu" block

by James Robertson -

Sorry I took so long to try it -- it looks good, seems intuitive to use, and I haven't run into any bugs.  I am also using the course menu block, and was surprised (but pleased) that topic 100 didn't show up in the menu block.  I suppose it wouldn't be very hard to suppress it in the various activity displays, though that would require mods to a few other files.  And it could be really awkward if any graded activities get included (you never know), so perhaps it's best left visible in these interfaces. 

Any other interest in or comments about this block? (let's not always see the same hands)

Thanks,

Jim.

In reply to James Robertson

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Glad you could use it James.  I haven't tried the course menu block, so didn't even think about that--and I didn't really have graded activities in mind either, mostly info/content type of activities/resources--so I don't know if those would even get added to the gradebook?
In reply to Chardelle Busch

Re: Course "main menu" block

by Ger Tielemans -

Normally I advise to use section zero for resources and activities that must be available during the runtime of a course.

Your block offers a new option: hide section zero and use your block (as the first block in a column) for the same purpose. Which solutions is more intuitiv?

Your solution becomes more and more interesting when more blocks become available in the module/activity screens.

 

In reply to Ger Tielemans

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
I hadn't thought of that either Ger--that might be interesting.  But, I just tried adding it to a quiz and it didn't worksad.  This really is just a hack (using topic 100), otherwise it would require coding to several files.

By the way, I saw your hack to have the activities placed horizontally in section 0--I really liked that--something I had wished I could do some times.
In reply to Chardelle Busch

Re: Course "main menu" block

by Ger Tielemans -
I did it ugly only in "view" mode, to show that it is possible...
..a real programmer can do it better:
he will add a switch on the settings page and then do it conditional in the same function smile
Now I have an odd effect in edit mode: the edit icons are separated from the items, but it is on a regular base, I can understand it smile

Reconstructing what I did, but compare your lib file with this zip:
  1. open course/lib.php
  2. copy and rename the function print_section into print_sectionZERO
  3. change print_sectionZERO:
    1. remove line 51 (echo '<tr><td class=" activity '.mod->modname,' ">'; )
    2. insert <td align="center"> before <img src=" '.$icon.' " '.  (line 92)
    3. insert <br/><font size=2> before <a title="'.$mod->modfullname (line 94)
    4. insert </td> after $instancename.'</a> but before the last '; (line 96)
    5. remove echo "</tr>";  (line 130)
  4. copy the format dirs for weeks and topics to new names weeksZERO and topicsZERO
  5. change in each new dir in format.php in the section zero part (ca. 10 lines under /// Print section 0 with general activities) the function name print_section into print_sectionZERO

I also remove the outline above section zero to make extra room:
/// Start main column
    echo '<td id="middle-column">';
 //   print_heading_block(get_string('weeklyoutline'), 'outline');
In reply to Ger Tielemans

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Thanks Ger,

I don't think it matters that the editing icons get goofy--it is still another nice option. And the course formats definitely need more options. I would really like to be able to add subpages to course pages that can have sections--one course page just isn't always enough! That's the reason I added this block--like we've agreed to here--I don't like my course home page to be too cluttered or disorganized.
In reply to Chardelle Busch

Re: Course "main menu" block

by Ger Tielemans -
Until 1.5 I kept the subsection modul alive: You could add subsections which could have subsections....
These sections got higher section numbers which you could hide.
I trimmed this subsection modul so it only showed the content of the section without the sidemenu's (to show that it is not part of the main level section overview)
When The blocks came up I gave up in favor of simplicity:
  1. make more use of the indent option in the section to show hierarchy and structure on the homepage
  2. use blocks for more global activities and resources. (especially I like the choice option between a fixed coded global block - visibible in all courses - and the course dependent and only their visible html block.)
In reply to Ger Tielemans

section zero 2

by Ger Tielemans -
Rework for 1.5.3:
  1. copy and rename the latest topic and week course formats
  2. remove  the header in the main column:
    /// Start main column
        echo '<td id="middle-column">';
     //   print_heading_block(get_string('weeklyoutline'), 'outline');
  3. call in each format print_sectionZERO instead of print_section
  4. open course/lib.php
  5. copy and rename function print_section into print_sectionZERO
  6. make these changes in print_sectionZERO

was 70:                           echo '<tr><td class="activity '.$mod->modname.'">';
now in 153:      if ($isediting) {echo '<tr><td class="activity '.$mod->modname.'">';}
was 140:                echo '                   <img src="'.$icon.'"'.
                             ' class="activityicon" alt="'.$mod->modfullname.'" />'.
                             '                    <a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
                             ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
                             $instancename.'</a>';
now:                //trimbegin
                    if ($isediting) {
                   
                        echo '                   <img src="'.$icon.'"'.
                             ' class="activityicon" alt="'.$mod->modfullname.'" />'.
                             '                    <a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
                             ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
                             $instancename.'</a>';
                    } else {
                        echo '<td align="center"><img src="'.$icon.'"'.
                             ' class="activityicon" alt="'.$mod->modfullname.'" />'.
                             ' <br /><font size=2><a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
                             ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
                             $instancename.'</a></td>';
                    }

was 205:                   echo "</tr>";
now:     if ($isediting ) {echo "</tr>";}

I made now only some small changes in the code of section zero. Now it looks like a normal week or topic course in edit mode, but shows as a horizontal line of modules in section zero in view modeYou can choose to do this for all sections, but then you loose the nice outline functionality of Moodle (I did it for a TeLeTOP makeover smile)I took latest 1.5.3  dec 21 2005 as starting pointI also decide to keep the doubling of the print_section function: so I can change LITTLE BY LITTLE the behavior of section zero smile.
In reply to Ger Tielemans

Re: section zero 2

by Ger Tielemans -
With 1.6 I gave up this trimming adventure: I now link the items form section zero to a sidebar block and then block the echo's/prints in course.format for section zero. I keep two formats:
  1. normal for editing section zero and making the links 
  2. the same format without section zero printing
In reply to Ger Tielemans

Re: Course "main menu" block

by James Robertson -

I had in mind using topic 0 for news items and introductory items.  I have also used topic 0 for resources that should be available throughout the course (books, reference sheets, help forum), but it always looked odd to me to have them sitting at the top of the course as if they were intended to be seen before beginning topic 1.  So I really like the idea of putting them in a side block where they are completely out of the visual sequence (still keeping news, overview & introductory items in topic 0)  -- to me this arrangement seems more intuitive.

Jim. 

P.S. I don't intend to use any graded activities in the course section block, I was just wondering what would happen if someone did.

In reply to James Robertson

Re: Course "main menu" block

by Dolly Miglani -

can we change the sorting order of main menu block to desc???/

In reply to Chardelle Busch

Re: Course "main menu" block

by Katja Leesemann -

Chardelle,

thanks for this nice hint. I followed your instructions (had to modify the section numer to "50"), but can not make it work. There is no block showing up or to choose from.

Any ideas?

Thanks

Katja

In reply to Chardelle Busch

Re: Course "main menu" block

by Katja Leesemann -

Chardelle, it works great! big grin

Unfortunately the block title is coursesectionblock and doesn't want to be changed. But I am working on it.

Thanks, I learned a lot.

Katja

In reply to Katja Leesemann

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Katja,

Glad you got it to work.  To give it a title, you need to add the title string to the lang/en/moodle.php file.  See #1 in my post above.  Let me know if you still have problems.
In reply to Chardelle Busch

Re: Course "main menu" block

by Katja Leesemann -

Hi Chardelle!

I tried some things with the extra block, followed all you instructions of the first posting, but unfortunately it works only on the first site. So I removed all the steps and sections. Now I get always this message:

Warning: Failed opening '/home/sites/home/web/moodle/blocks/course_section/block_course_section.php' for inclusion (include_path='') in /home/sites/home/web/moodle/lib/blocklib.php on line 115

Since I am not a programmer either (should have studied it instead of new media and education mixed  ) I guess it gives me this message because of the now "missing" new block, that is not longer existing.

Do you or anybody else know how to fix it?

Thanks, Katja


In reply to Katja Leesemann

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Katja,

To make sure a block is deleted, you can delete it from the blocks page, but you should also make sure the folder is deleted from the server--either through ftp or through cpanel, etc.
In reply to Chardelle Busch

Re: Course "main menu" block

by Bhupinder Singh -

Hi Chardelle Busch ,

Is the module capable of working in a WINDOWS environment???

Regards

Garry

In reply to Bhupinder Singh

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Garry,

First, to be clear, this is a block not a module. And, it should work wherever Moodle works since it is really just a clone of the Main Menu block from the front page. I've been using it to add simple activities to a block that don't really fit in any of the topics (or weeks) sections, or that I want to stand out from the topics sections in the course, for example a glossary or polls.

I'm not sure why Katja, above, had a problem with it on one site and not on the other.
In reply to Chardelle Busch

Re: Course "main menu" block

by Bhupinder Singh -

Thanks For the Reply.

It works Well.

Any idea how to add OVERLIB Functions into the Moodle Environment.

Garry

In reply to Chardelle Busch

Re: Course "main menu" block

by Anil Sharma -

Hi Helen

Your block is exactly what i need. However, i'm unable to install it. I've downloaded the zip file, unzipped it and uploaded the folder to the blocks folder. I've added the entry in moodle.php.  There is no sign of the block in the blocks menu inside any course ! I figured i might be using topic 100 but that doesnt seem so.  Anyways, i've even tried changing all the '100' values in your php file to '1000' but even that doesnt do anything

Also, the zip file only has one php file, is that all thats required ? I use 1.5.2+

TIA

In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
Chardelle-I've found two problems with this block. First of all, it doesn't show the little icons associated with activities and resources next to them. Secondly, if I add the block, and then try to move a resource to it, I get a message saying the course section does not exist. I can only move resources to it from elsewhere if I have already created something in it. It won't accept the movement of things into it when it is empty.

Anil-I didn't see the block at first but after I went to the admin page and the block configuration page it appeared.
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Thanks Nicole,

I must have uploaded my copy where I have gotten rid of all icons in blocks--oops. You will see several lines of code that begin with $this->content->icons[] that are commented out. To get the icons back, just delete the two slash marks in front of these lines //.

As for moving activities? I hadn't even tried that. Glad you figured it out, thanks.

And yes, Anil, the block folder only has the one file--I hope N's suggestions work for you.
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
Chardelle-I just discovered something potentially very useful about this block, although I'm not sure if you intended it to work this way. If I hide the block (but not its individual contents), I can link to resources/activities listed in that block from elsewhere within the course even though they can't be seen with the block.
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Well, I'll be dammed Nicole. I've always wanted to be able to do that and didn't even know I had created a way to do it.  Apparently this block section doesn't follow the same rules as hiding a section in the middle colum???

Thankscool
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
I wanted a way to do that too. I wanted to be able to track people's access to a file linked to from a web page resource in my main menu. So I created a web link resource in the course block and linked it to the file, and then hid the course block. Then I just added a link to the file resource in the web page resource, and voila, I am now able to track whenever someone accesses that file. You could use this trick to make multipage resources, or to make people go through certain activities to get to other ones, as long as you had a link to the second one somewhere in the first. However, it doesn't work if you hide the actual item in the block. So if you want to use this trick, you can't show the block at the same time, since only one such block is allowed per page.
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
If you want a second section block, maybe one that isn't hidden, you can do that. This just takes a "section" from the course and puts it in a block--and I've used section 100 for this one, so you should be able to add a new block with a new section.
Copy the folder and give it a new name, for example, course_section_two. Then also rename the file, so: block_course_section_two.php.
Then change the name also on line 3 of the php file:
class block_course_section_two extends block_list {

Then give it a new language string for the title, so, change line 5 in the php file to:
$this->title = get_string('coursesectionblocktwo');

Then add to your language moodle.php file the line for the title (for example): $string['coursesectionblocktwo'] = 'Forums';

Then, finally, give this block its own new section, so, change the "100" to "101" in the php file. This number appears in three places, lines 37, 38 and 125.

In reply to Chardelle Busch

Re: Course "main menu" block

by Anil Sharma -

Thanks for this wonderful block ! I wonder why no one thought of this before !

Just a small thing : I've added a lot of forums in the block. Is there a way to get these forums to show unread posts in the block itself ? I dont mind them spilling over to the next line !

In reply to Anil Sharma

Re: Course "main menu" block

by N Hansen -
I found a bug. When you create a chat, this block appears as one of the blocks you can to add to the chat. However, if you add it, you get the following message:


Fatal error: Call to undefined function: get_all_sections() in /home/mine/public_html/blocks/course_section/block_course_section.php on line 35

If the block doesn't work in chat, it shouldn't show up as an option. What's worse, once you get this error, there is no way to make it go away. You have to create an entirely new chat and discard the old one.
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Good catch Nicole.  Warning:  Don't use this block with other activities.

And Anil, as for forum tracking, I don't even know how to get the tracking to show up on my course page???  I'm not sure what's going on with it.
In reply to Chardelle Busch

Re: Course "main menu" block

by Anil Sharma -

Chardelle

To get forum tracking to work, two things are required to be 'on'.  In the settings of any forum "Read tracking for the forum" should be 'ON'.  Also, in the profile of a user 'Forum-tracking' should say 'Yes, highlight new posts for me'

With both these options on, you can track unread forum posts like this :

Forum unread posts image

When these same forum are put in your course section block, these 'unread posts' dissappear so I assume some code must be added somewhere. This is not very urgent..only if you have the time !

In reply to Anil Sharma

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Anil,

I just tried adding the code for forum tracking to this block, but haven't been able to get it to work.  I noticed, however, that the Main Menu block on the homepage (which this one is based on) does not show forum tracking either--so maybe there is some reason for that--I don't know.  I just tried doing a search and couldn't find anything on it.  I'm surprised no one has asked about this before. 
In reply to N Hansen

Re: Course "main menu" block

by John Papaioannou -
It's quite easy to not allow this block to be added to activities. Just a small code change: smile

function applicable_formats() {
    return array('all' => true, 'mod' => false);
}


In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
Chardelle-Is there a way to easily move an activity to your block from elsewhere (in my case I want to move a book from section 0 to the block)?
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
I just tried it and it worked fine.  I just clicked on the up/down arrows for an activity and then clicked on a little dashed box in the block and moved an activity from the 0 section to the block.  Have you tried it?
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
DUH! I'm being stupid. I noticed those right and left arrows for the first time this morning and was playing with them to see what they did and for some reason I got it in my head that I would need something facing right or left to move it. Never mind....
In reply to Chardelle Busch

Re: Course "main menu" block

by Marie Norman -

Hi Chardelle

I have come across your main menu block entry and feel it might be what I'm looking for, but having uploaded the file and making the script entry I cannot see how to use it.

I want to be able to create quizzes on my course that I can attach to a select menu box.  My problem is at present the quizzes appear on my topic box and if I try hiding them, they won't work when selected from my select box (I hope this makes sense).  So I thought if I used your block method I could put the quizzes on the block 100 area and they would not appear on the screen for the users but would still work when selected from my select box.

But I just don't seem to be able to find any block 100 anywhere.

Many thanks

In reply to Marie Norman

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Marie,

If the block installed fine, then you should see it listed in the dropdown to add a block to your page.  Be sure to add the string to your lang/your language/moodle.php file to give your block the name you want.  E.g.:  $string['coursesectionblock'] = 'Name of this Block';

I'm not sure whay you mean by "select box", but the quizzes you add to the block will be added to "Topic 100".  So, if you add quizzes to the block, then hide the block, perhaps they will then show up in your "select box".
In reply to Chardelle Busch

Re: Course "main menu" block

by Mark Little -
Hi,

Is there anyway we can add the little icons to this block. For example when you are linking to a HTML page you would get the HTML symbol....

Thanks
In reply to Mark Little

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Mark,

I answered this in a previous post above...my mistake

"I must have uploaded my copy where I have gotten rid of all icons in blocks--oops. You will see several lines of code that begin with $this->content->icons[] that are commented out. To get the icons back, just delete the two slash marks in front of these lines //.'" 

If you still have problems, let me know and I'll re-attach a new copy.

Ger,

I'll have to try this out--nice idea.
In reply to Chardelle Busch

Re: Course "main menu" block

by Mark Little -
Hi,

Thanks for that... All working now
In reply to Mark Little

Re: Course "main menu" block - To PJ...

by Ray Lawrence -
Would it be possible to create an equivalent of the "Main Menu" block for courses in Weekly/Topic format?
In reply to Ray Lawrence

Re: Course "main menu" block - To PJ...

by Chardelle Busch -
Picture of Core developers
Just to clarify, the Main Menu and Social Activities blocks put activities/resources into section 0 of those course formats. I chose Topic (section) 100 instead of section 0 so that this block could also be used in the front page and the social formats and not be confused with section 0 used in those blocks.

Since it appears that some of you are actually using this block, I've updated it some. I changed the name from course_section to just section since you can also add this block to your front page if you want a second "main menu" type block there, so it's not just a course block. You now can configure the title of the block with the edit icon. Some of you have also asked about having two instances of the block, so I have included a Section Block Two which puts activities into Topic 101.

If you already have an instance of the original block and want to use this new one (with the configurable title), you will see that all of the activities in your old one should appear (I didn't test this, so maybe backup those activities/resources first) in the new one too since they are not really in the block, but in Topic 100. Then you can safely delete the old block.
In reply to Chardelle Busch

SECTIONBLOCK PLACEMENT

by Bhupinder Singh -

Hi Chardelle,

THe section block is a great functionality.

Can you guide me where it is to be placed Reading the post left me a little confused and I solicit your assistance in understanding its placement in the Moodle installation.

Thanks

Garry

In reply to Bhupinder Singh

Re: SECTIONBLOCK PLACEMENT

by Chardelle Busch -
Picture of Core developers
Hi Garry,

All I've done is cleaned up the files a bit and added the option of editing the block title. To install a block:  Put the folder called "section" that is in the blocks folder in the zip into your moodle/blocks folder, then put the file called block_section.php from the lang folder into your moodle/lang/en folder and upload them. Then click on your Admin link from your Moodle front page to install the block. Then you should see a block in your Add Blocks dropdown list called Section Block. Choose it to add this block to a course, then click on the edit icon to give the block a title. If you want to have a second block, then upload the section2 block folder and you will see Section Block Two in your blocks drop down list.

If I confused you about using this with the original one--if you install this new Section Block into a course that has the old course_section block it will simply be a duplicate of the original one (with the activities/resources from Topic 100)--so, you can delete the old course_section block, or if you just want a second section block, only upload the section2 block folder.

Hope this answers your question
In reply to Chardelle Busch

WARNING!!!

by Chardelle Busch -
Picture of Core developers
Egads,

I just found a terrible bug with the course_section block that was originally posted at the top of this discussion.

If you have this block installed DO NOT delete it from the Administration/Blocks page.  For some reason, this screws up your course front page (the second zip posted here with the new blocks is okay).  All I can figure is it has something to do with the name of it???  If you want to delete this block from your installation, you will have to do it directly from your database.  So for example, if you have cpanel--go to phpMyAdmin and click on the mdl_block table.  Then from the Run sql query box, click on the name field and then click on go to see all of your blocks.  Then click on the red X in front of the course section block to delete it.  Then delete it from your blocks folder on your server so it won't re-install.

So sorry about this.


In reply to Chardelle Busch

Re: WARNING!!!

by Roger Spurgeon -
OK, I missed these instructions before I deleted the course_section block and now the front page of all of my courses are blank.  The activities are still there, but you can't see them.  Is this the error that you've described, and, how do I fix it?

Thanks.
In reply to Roger Spurgeon

Re: WARNING!!!

by Chardelle Busch -
Picture of Core developers
Try creating a new course, then moving all of the moodledata from the old course to the new one.  Then, everything should be restored.
In reply to Chardelle Busch

Re: WARNING!!!

by Roger Spurgeon -
Thanks for the idea.  I've discovered that after I removed the block, the data in the "course_sections" table was deleted, and thus all activities were "removed" from the course front page.  I was able to recreate the table from an older backup, so my teachers will not be thrilled with me, but at least I was able to restore most things!  Thanks for your response!
In reply to Chardelle Busch

Re: SECTIONBLOCK PLACEMENT

by Bhupinder Singh -

Hi Chardelle,

Thanks for the instructions It is clear now.

One small query: You had posted a warning on the course section Block.

Does the same issue exist with this or it is safe for a Production instance.

Regards

Garry

In reply to Bhupinder Singh

Re: SECTIONBLOCK

by Chardelle Busch -
Picture of Core developers
I tested deleting the section block and had no problems. In fact, I've been using the block for quite some time and have never had a problem.  I'm not sure why deleting the course_section block caused problems--some weird naming glitch that shouldn't happen--I'm depressed thinking that it might cause problems for someone.

(Thanks Eloy for deleting the original zip--I wouldn't want anyone else to install it)
In reply to Bhupinder Singh

Re: SECTIONBLOCK PLACEMENT

by Bhupinder Singh -

Thanks for the info.

You should not feel bad as this happens at times there is no fault of yours.

Suggest that you get it out of your system.wink

I was wondering if you could help me with a small problem that I have with the Login. At the time of login at the footer I get an Loaded with errors on page. How do I trace the source and try to remove the cause of the error?

Sorry for the bother.

Regards

Garry

In reply to Bhupinder Singh

Re: SECTIONBLOCK PLACEMENT

by Chardelle Busch -
Picture of Core developers
It's difficult to tell, maybe you could post this in the general problems forum with a screenshot or more details of what the errors are.

Also, I know you have been having problems with the certificate mod--I'll email you a zip of the one I am using--I'm having no problems with it in 1.5+--if you want to try it.
In reply to Chardelle Busch

Re: SECTIONBLOCK PLACEMENT

by Bhupinder Singh -

Thanks a lot .big grin

Receiving a clean copy shall  be great. The Certificate module has really got me going nuts.

The section block works great. Thanks for the same

Garry

In reply to Chardelle Busch

Re: Course "main menu" block

by Matt Edminster -
Chardelle,

This is a great addition! I'm wondering if it can be extended still further ...

I am managing a very large moodle course which is team taught by 8 professors. We have been using section #1 as a "Teacher's Section" hiding it as well as all of its contents so that it is accessible only to teachers. This block contains a wiki which we use to collaborate on test questions for the final exam.

I would prefer to designate a Teacher's Block which would again be accessible only to teachers. Is there a way to add this kind of functionality to your block? I've thought about trying to locate the string in the Administration block which dictates what is visible there according to a user's status in the course and then patching it into your code, but I really have no experience with coding and would be fumbling in the dark.

Does this seem possible?

Matt Edminster
In reply to Matt Edminster

Re: Course "main menu" block -- teacher's only

by Chardelle Busch -
Picture of Core developers
Hi Matt,

This is a really good idea.  So, I've created a teacher's version attached.  Only teacher's can see this block.  Keep in mind, though, that you will need to hide each individual activity to keep your students from seeing them from their respective index pages.  Test it out and see if it will work for you.
In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by Matt Edminster -
Wow! That was speedy! I'll plug this in and let you know how it works.

Matt
In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by Matt Edminster -
Well, I've hit a speedbump. What do you make of the following?

Fatal error
: Cannot redeclare class block_section in /home/edmin2/public_html/moodle/blocks/section_teacher/block_section_teacher.php on line 4

Any chance this block is conflicting with the previously installed section blocks 100 and 101?
In reply to Matt Edminster

Re: Course "main menu" block -- teacher's only

by Matt Edminster -
Well, that was the problem. I uninstalled the other section blocks and now the Teacher's block works just fine ... except for this ...

Activity icons are not showing up and this apparently has nothing to do with their being commented out in the coding.

And now another questions. Is it possible to place a link to the Teacher's Forum in the block as well? If I can get icons to show, then it would be great to have this actually coded into the block. If not, I can just link to the forum using that option in the resource list.
In reply to Matt Edminster

Re: Course "main menu" block -- teacher's only

by Chardelle Busch -
Picture of Core developers
Hi Matt,

Firstly, sorry about that.  I uploaded a wrong file.  This block can be used with the other two.  Here's another zip that contains all three blocks and one language file--you should replace everything you have with these files. 

As for the icons.  They show up fine for me.  It is probably a theme issue.  What theme are you using?  Try changing your theme to standard and see if you get icons. 

As for the teacher forum link.  It is hard coded in the admin block.  If you open the php file for that block, you will see it there, it looks like this:

 if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
                $this->content->items[]='<a href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$teacherforum->id.'">'.get_string('nameteacher', 'forum').'</a>';
                $this->content->icons[]='<img src="'.$CFG->modpixpath.'/forum/icon.gif" height="16" width="16" alt="" />';
            }

You can copy that code and place it into the block_section_teacher.php file, after this section of code:

 if ($ismoving) {
            $strmovehere = get_string('movehere');
            $strmovefull = strip_tags(get_string('movefull', '', "'$USER->activitycopyname'"));
            $strcancel= get_string('cancel');
            $stractivityclipboard = $USER->activitycopyname;
        }
In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by Matt Campbell -
One small bug - if I set up the section block and try to move a resource into it, I get the error message: This section doesn't exist.  When I hit continue, it kicks me out of the course and onto the main site page.

After adding anything through the dropdowns, I can then move resources onto it.  Are you defining the section when the block is added to the course, or when content is added to the block?

Thanks,
Matt
In reply to Matt Campbell

Re: Course "main menu" block -- teacher's only

by Chardelle Busch -
Picture of Core developers
Hi Matt,

That's a good question.  The sections are created when you set them in your course settings. The block is only a representation of topic 100 (or section 101 for sectionblock2). And, unless you have your course settings set to show 100 topics (which you can't really since the options only go to 52), it does not actually "exist" in your course page. When you add a resource/activity to this block it, in essence, just "tricks" the course into thinking it has a section 100wink.

It sounds like you've gotten it figured out though--thanks for posting about this.

In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by Chardelle Busch -
Picture of Core developers
Just in case anyone using this block would like to add a graded activity to it, Justin Filip has posted a fix to the gradebook here:
http://moodle.org/mod/forum/discuss.php?d=40764#200959

The original code for the gradebook would only pick up activities from the number of sections set in the course settings, rather that getting them from all sections.
In reply to Chardelle Busch

Course Section Block

by Mark Davies -

Hi Chardelle,

I was hoping you could help me, do you know if there is a version of the course_section block for Moodle 1.8?

I am upgrade from 1.7 and its not installing saying its not compatible..

Regards,

Mark

In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by N Hansen -
Chardelle-So it would still be possible to use the teacher's block as a place to hide resources that we want to link to from elsewhere? Up to now, the problem is if I want to see the resources that I am hiding in that block, I have to unhide it, so having a way that only teachers can see it would be helpful.
In reply to N Hansen

Re: Course "main menu" block -- teacher's only

by Chardelle Busch -
Picture of Core developers
Hi N,

Yes, the block is not visible to students, but still visible to you, so it should work well as a place to have resources hidden from view on the course homepage yet still accessible. It would be nice to have a Teacher's section in the course though that would do this sort of thing--or maybe more options when setting up resources and activities: This resource is available to teachers only, or Show on course homepage? Yes/No.

If you already have a bunch of resources set up in a section, Nicole, say section 1000, you can change that in the new block php file (three places) so you don't have to re-do them.
In reply to Chardelle Busch

Re: Course "main menu" block -- teacher's only

by Matt Edminster -
Chardelle,

The last set of code you sent works beautifully! Thank you very much!

I imagine that with some of the proposed improvements to the moodle system, more will be possible along the lines we're talking about here. I'm thinking specifically of the improved "groups" functionality which will allow for groups to both inheret activities and establish their own, and of the "roles" functionality which will allow for different definition of roles and rights for each course. Those two features alone would radically improve a discussion like this.

Matt
In reply to Matt Edminster

Re: Course "main menu" block -- teacher's only

by Randy Ahn -
Found this thread and installed the block. Thanks it is just what I needed.approve
In reply to Chardelle Busch

Re: Course "main menu" block

by Mr. Marc -

After reading this thread i'm I understanding this correctly that if I wanted the main menu block from the opening page block to follow every class should I just to follow these directions listed here?

thank you for your help

In reply to Mr. Marc

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Marc,

No, this does not duplicate a main menu block with activities from the main page (although that would be nice to have).  This just creates a new block in a course that you can add activities/resources too. 

And by the way, Oktech, a moodle partner, added the ability to choose the topic number in the block config rather than have it hard coded--and it can be found on the Moodle download page (called Side Bar block).  Although, I don't believe they have the option to hide it from students--which is what the teachers section block above does. 

I think the only way to accomplish what you want would be to add an html block to your courses and add links to it to your activities/resources from your site home page.
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
Has anyone tested this with 1.6 yet?

And why are the files for the latest version named entirely differently from previous versions? Can I upgrade or will I need to create an entirely new set of blocks on my site?
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Nicole,

If you are still using the original files, please read above about a problem when deleting the block from the admin page--DELETE IT MANUALLY.  My recommendation is that you use the sidebar block since I assume Mike will keep it up to date.  If you do upload the sidebar block, configure it to use Topic 100, then all of your activities should show up.
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
Actually Chardelle I am planning on using both. I like your block because I can hide activities from view but still make them accessible. I just figured out how to make a nice new course "format" by combining the use of both blocks, which I will post more on later.
In reply to N Hansen

Re: Course "main menu" block

by Chardelle Busch -
Picture of Core developers
Hi Nicole,

I guess what we really need is to have one block that can have more than one instance in a course by configuring the section number for each block.  I believe that Mike's block is almost identical to this one, so "hiding" should work the same.

I'd be interested in hearing more about how you are using it.
In reply to Chardelle Busch

Re: Course "main menu" block

by N Hansen -
The idea I had involved moving all course activities to your block and hiding it, and then using only one topic in the course and putting in that course resource pages corresponding to the course units, with the course blocks on the resource page (a new feature possible in 1.6). These resource pages were to contain links to the relevant activities for that unit hidden in your block. Basically, the idea was to create more of hierarchy, but since none of the activities in your block would be in the dropdown javascript menu in the upper right corner, I decided to abandon the idea, because navigation would become a hassle.
In reply to N Hansen

Re: Course "main menu" block

by Rohitha Heiyanthuduwage -

I developed simplehtml block given in block documentation. But it gave the following errors when I opend a course and the administration page. I wonder whether you can tell why was that?

When I open a course the following error came

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

http://127.0.0.1/moodle/course/view.php?id=5

 


Warning: block_load_class(C:\apachefriends\xampp\htdocs\moodle/blocks/simplehtml/block_simplehtml.php) [function.block-load-class]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\moodle\lib\blocklib.php on line 115

Warning: block_load_class() [function.include]: Failed opening 'C:\apachefriends\xampp\htdocs\moodle/blocks/simplehtml/block_simplehtml.php' for inclusion (include_path='.;c:\apachefriends\xampp\php\pear\') in C:\apachefriends\xampp\htdocs\moodle\lib\blocklib.php on line 115

 

 

 

When I open the blocks section in the admin page

 

http://127.0.0.1/moodle/admin/blocks.php

 

The following error came

Blocks


Warning: file(C:\apachefriends\xampp\htdocs\moodle/blocks/simplehtml/block_simplehtml.php) [function.file]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\moodle\lib\blocklib.php on line 21

Block simplehtml is not compatible with the current version of Mooodle and needs to be updated by a programmer.



 

In reply to Chardelle Busch

Re: Course "main menu" block

by Bruce Schmoetzer -
Chardelle,
Your "main menu" block has been a godsend!  It is exactly what I needed.  I hope that you and Mike can swap code to make a really nice side bar blocks that can be used in all courses including the main page, which was my need.
Again -- THANKS!

-Bruce
In reply to Chardelle Busch

Course "main menu" block and Guest Autologin

by Andrew Seears -
I've added a database to my Course Main Menu Block, but it does not let guests auto login to it.  Any ideas on why this is happening?

Andrew
In reply to Andrew Seears

Re: Course "main menu" block and Guest Autologin

by Dolly Miglani -

can we change the sorting order of main menu block to desc????????

In reply to Andrew Seears

Re: Course "main menu" block and Guest Autologin

by Dolly Miglani -

can we change the sorting order of main menu block to desc?????