We're having some issues putting it in contrib but it should eventually be available at contrib/block_side_bar from the main CVS repository. For now you can download the attached file.
Enjoy! Any feedback is appreciated.
From the Readme file:
This block allows you to create separate activities and resources in a course
that do not have to appear in course sections. The block can have multiple
instances of it within a course - each instance will have its own unique group
of activities and resources. Each instance can also have its own configured
title.
It functions by creating course sections for each instance, starting at a number
beyond what would normally be used by a course. This defaults to section 1000,
but is configurable at the global level.
All resources and activities within a block can be edited and moved around just
like normal activities when editing is turned on. Adding label resources allows
you to add text to the blocks as well.
In a sense, this block combined the main menu block functions and HTML block
functions into one block that can be used in a course.
I'm finding problems with using the side bar block as a sticky block.
1) WARNING: When the Side Bar block is added as a sticky course block, each time any course page is viewed (by admin, teacher, or student) a new section is created for each sticky side bar block. The generated section are over the 1000 section number defined for the first Side Bar block section. If you aren't careful this can create a LARGE number of these hidden section very quickly. Removing the sticky sidebar blocks does not remove the created sections.
2) Added content to a sticky side bar block is never displayed.
3) Content can be added to a sticky block from a course site. When it is the new content is attributied to that course site sections not the global site (course id = 1).
These bugs may have common root causes. I'm using Moodle 1.8 and your latest build of side bar block.
- Paul
The structure is:
/blocks/side_bar/lang/en/block_side_bar.php
/blocks/side_bar/block_side_bar.php
/blocks/side_bar/block_side_bar-README.txt
/blocks/side_bar/config_global.html
/blocks/side_bar/config_instance.html
This one can have as many instances added to a course as you like, and each one will contain its own activities in its own section. It automatically determines the sections for each block. Also, you can globally configure which section number to start with (each new course instance increments this section).
mike
You were probably using the code I first posted to the forum. That was fixed early on. But I have made another big improvement to the block code. Now it will delete any resources or activities that it creates, along with the course section, when you delete an instance of the block.
Use the code attached to this post (as should anyone using this block) and it should fix the problem you are having.
We want to make sure students login everyday, so we created an "Assignment" called Attendance. We want it to be in the Gradebook but not anywhere in the center block area. The Side Bar seems like the perfect option, except that all Assignments that are in the Side Bar only show up as "Uncategorized" and will not show up in the "Set Categories" tab so that we can actually categorize them. Once an assignment is taken out of the Side Bar and placed into the central area, it can be categorized. Otherwise, we constantly have to show this "Uncategorized" area in the grade book and can not weight it or anything. It's quite frustrating.
Is there a way around this? Any suggestions would be welcome.
~MC~
The issue is that when the gradebook is looking for course modules that can be assigned to a grade category it only looks through the defined number of sections in the course (as defined in the Course settings). As in, if you're using the Weeks course format and you define 10 weeks, it will only look through 10 sections.
From /grade/lib.php - grade_set_categories():
for ($i=0; $i<=$course->numsections; $i++) {
if (isset($sections[$i])) { // should always be true
$section = $sections[$i];
...
If you change it to:
foreach ($sections as $section) {
If will index the activities that were created using the Side Bar Block as they are outside the defined number of course sections.
Anyway, I attached a patch for the /grade/lib.php file that implements this change if you'd like to use it. I'm going to see if I can't get this change into the main distribution as it makes sense to go through any section that exists for the course.
There is another issue where the block is creating two new sections and only using the second one when you add a new instance. I'm still trying to fix that issue.
My problem now is that I have no idea how to apply a patch. Can you apply patches on a Windows server?
I tried to copy/paste the plus/minus lines manually and the result broke the gradebook. Though I'm a little nervous to implement a change to the gradebook -- for the sake of the sideblock-- I'd be willing to at least try it out, if you could help me figure out how to apply the patch.
Thanks!
~MC~
http://gnuwin32.sourceforge.net/downlinks/patch-bin-zip.php
And you would use it by changing to the /grade/ directory, copying the patch there, and running:
patch lib.php patch-grade_lib.php
If you wanted to reverse the patch (and restore lib.php to it's original state), run:
patch -R lib.php patch-grade_lib.php
Hope this helps!
a little bug came up when changing the title of the side bar (configuring side bar block). If there are any resources or activities included in side bar they will disappear after saving the new title. This is because a new row is inserted into mdl_course_sections table without the information about resources included in side bar.
We fixed this problem by adding a hidden field in side_bar/config_instance.html:
<input type="hidden" name="section" value="<?php echo $this->config->section; ?>" />
This way the data in mdl_course_sections table won't change.
- Laura
Add a Side Bar. Add some content. Then try moving a topic in the central column up or down. On our server it results in the content of the Side Bar being deleted!
The content is still there if you look in the MySQL database, it's just the Side Bar loses the link to it.
I've tried this on two seperate servers (1.6.1, both upgrades from 1.5.2) with the same behaviour. I haven't got access to a fresh 1.6.1+ install just yet, but I'll try it and report back as soon as possible.
sounds similar to what I have met when editing Side Bar (look Laura's message earlier in this thread)
Add Side Bar. Add content. Change Side Bar name in Configuring Side Bar Block. Result: all content deleted. Content can be found if I look Resources. It seems that editing brokes links between Side Bar and its resources.
This has happen several times both Moodle 1.5.3 and 1.6.1+
- Jani -
Change the field back to 1000 and the content of the block is restored.
Sounds like some auto-increment function in Moodle is going wonky (to use technical speak).
// Check for duplicates and fix order if needed.
// There is a very rare case that some sections in the same course have the same section id.
$sections = get_records_select('course_sections', "course = $course->id", 'section ASC');
$n = 0;
foreach ($sections as $section) {
if ($section->section != $n) {
if (!set_field('course_sections', 'section', $n, 'id', $section->id)) {
return false;
}
}
$n++;
}
Commenting this out prevents the bug I've talked about but will likely create problems of its own!
I fixed the problem you found. As the courselib.php code is automatically 're-numbering' course sections, I've stored the ID value of the course_sections database record in the block config also. I just do a check to verify that the section value stored in the block config (i.e. 1000) matches what the database says it is for that particular course record. This solves the problem. This update will also 'upgrade' existing blocks to store this new piece of information as well so that you don't need to replace all your existing instances of the block.
Here is the patch for it (I've also attached the new copy of block_side_bar.php if you don't know how to use patch and just want to drop the working file in). I'll post another comment here when the fix is in contrib CVS, too.
Index: block_side_bar.php
===================================================================
RCS file: /cvsroot/moodle/contrib/block_side_bar/blocks/side_bar/block_side_bar.php,v
retrieving revision 1.5
diff -u -r1.5 block_side_bar.php
--- block_side_bar.php 10 Mar 2006 01:23:15 -0000 1.5
+++ block_side_bar.php 13 Sep 2006 03:23:45 -0000
@@ -57,9 +57,10 @@
$section_start = $CFG->block_side_bar_section_start;
/// Create a new section for this block (if necessary).
- if (!isset($this->config->section) or empty($this->config->section)) {
- $sql = "SELECT MAX(section) as sectionid FROM `" . $CFG->prefix .
- "course_sections` WHERE course='" . $this->instance->pageid . "'";
+ if (empty($this->config->section)) {
+ $sql = "SELECT MAX(section) as sectionid
+ FROM `{$CFG->prefix}course_sections`
+ WHERE course='{$this->instance->pageid}'";
$rec = get_record_sql($sql);
$sectionnum = $rec->sectionid;
@@ -82,11 +83,31 @@
error('Could not add new section to course.');
}
- $this->config->section = $section->section;
+
+
+ /// Store the section number and ID of the DB record for that section.
+ $this->config->section = $section->section;
+ $this->config->section_id = $section->id;
parent::instance_config_commit();
} else {
- $section = get_record('course_sections', 'course', $this->instance->pageid,
- 'section', $this->config->section);
+
+ if (empty($this->config->section_id)) {
+ $section = get_record('course_sections', 'course', $this->instance->pageid,
+ 'section', $this->config->section);
+
+ $this->config->section_id = $section->id;
+ parent::instance_config_commit();
+ } else {
+ $section = get_record('course_sections', 'id', $this->config->section_id);
+ }
+
+ /// Double check that the section number hasn't been modified by something else.
+ /// Fixes problem found by Charlotte Owen when moving 'center column' course sections.
+ if ($section->section != $this->config->section) {
+ $section->section = $this->config->section;
+
+ update_record('course_sections', $section);
+ }
}
if (!empty($section) || $isediting) {
testing your patch. It fixes the bug, but when I backup and restore course, there are following unexpected results:
1) Backup/restore deleted all side bar content.
2) Side bar is hidden in normal view, shown only when editing on
3) If I try to add new activities or resources to side bar I cannot see them on side bar. I can access them via course resources/activities but not directy via side bar.
Backup and restore processing was mostly OK, but there were 2 or 3 times when error "Notice: Undefined variable: info in/opt/lampp/htdocs/ari/backup/restorelib.php on line 833
Error creating sections in the existing course.
An error has occurred and the restore could not be completed!"
Result: course with empty course sections.
We have found some similar problems with Nwiki in backup/restore. See this thread: http://moodle.org/mod/forum/discuss.php?d=51536
Our Moodle is 1.6.1+
- Jani -
When you said "Backup and restore processing was mostly OK" did you mean before the patch was applied or is this with the patch?
I'll examine the main backup/restore code to see if it's doing something unusual when it comes to handling courses and sections.
When you said "Backup and restore processing was mostly OK" did you mean before the patch was applied or is this with the patch?
- It was with the patch.
Laura Malmi notice later following: if rename side bar (in configuring side bar) after course restore, side bar content was shown again and side bar was not hidden anymore (in normal view).
- Jani -
I've fixed your bug. I added another configuration variable to each block instance the store the course ID of the course the block is in. It then checks to make sure that the course ID the block has saved is, in fact, the same as the course ID it is currently residing in (they would be different after a restore was done). If it's different, the block will store the new course ID value and also change the value its storing for the 'course_sections' record ID (as a new record is created for this section in the new course).
As with my fix for Charlotte's problem, this should 'upgrade' existing blocks. In fact, if you use the new code and just refresh a restored course (which isn't showing the blocks) they should appear right away for you.
I also found that resources/activities created by the block weren't being properly removed if an instance of the block was deleted so I added that fix in as well.
You can find this new code in my post at the bottom of this thread.
Thanks for letting me know about this issue.
- course sections created with an instance of the block won't be automatically renumbered by code elsewhere.
- course modules created by the block are properly removed when an instance of the block is deleted
- the block's sections and course modules will persist during the backup/restore process
Thanks for using it and letting me know about the bugs you're finding everyone!
The zip file attached to this post can just be unziped into your /blocks/ directory (and overwrite any existing /blocks/side_bar/ files).
Thanks for the contribution, but can you please not code in the forums? It gets old quickly and clogs up the server, plus people get confused about versions.
In general it's much better to host it on a web site or get it into cvs:/contrib and then link to it from an entry in the Moodle modules database. In your case, because it's in contrib already, the download link is always http://download.moodle.org/download.php/modules/block_side_bar.zip (archive updated daily)
we tested your new version in 1.6.1+ and 1.5.4. Everything was perfect in 1.6.1+, but in older Moodle version we have noticed that side bar seems to create several (like 10-15) extra course sections after backup and restore. This has happen couple of times with older side bar version, and only one time with this new version. Unfortunaly I cannot reproduce this bug and I'm not really sure if its side bar or something else?
In our Moodle 1.5.4+ (2005060240) we have following non-standard modules: dfwiki (2006020301) and new wiki (2006041201) and non-standard blocks: Skype contact (2005121300), Quote of the day (2005031300) and Live stats (2006150300).
- Jani -
Hi Justin
The sidebar block is very useful and would be more useful if it also appeared in the default moodle course. What we use SideBar for is to create activities in it, hide the entire block and Link those activites in the center column. This allows better design flexibilty.
The 'Main Menu' block on the default course, if hidden, also hides all the activites inside it. Therefore, it can't be used the same way as SideBar.
Can I request you to make the minor change so that Sidebar is also available in the default course ?
I just committed to CVS a change that will allow the block to be added to a site's main index page. I also tested the block myself by adding an activity, hiding the block and accessing it directly and it worked fine.
So if you update to the latest code in CVS you will have this feature.
Thanks for the request and sorry it took so long to implement.
I believe those comments were from the initial code release and we've fixed a lot since then and have been using it on client site's for quite some time now but I'll do another check to verify that it's all working still and maybe put some info about how it works into MoodleDocs.
I voted for this too. I need this one. I downloaded the version on the modules and plugins page and it doesn't work.
It says: Module "block_side_bar" is not readable - check permissions
Was this the latest version? I saw on Tracker that you said the latest version was here: contrib/plugins/blocks/side_bar but I don't know where this is.
Not sure if there is something wrong with the version or with the way I'm having to install modules and themes.
So far, I have tried to download 3 different modules. When I click on any download link, it takes me to my own computer files instead of the server files where Moodle is located.
I'm having to create empty folders on my server and then upload individual files into them. I have tried to upload actual folders from my computer, but I can't. The only things that have successfully worked with this method have been some themes.
I'm not sure what I need to do. I'm not a programmer and this is my first website also. Is there something I need to configure that I haven't? If so what and where do I find it?
Could you provide the answers to a few questions?
What operating system do you uses on your computer?
How are you uploading files to your server at he the moment e.g. cPanel, FTP program (which one?)?
Have you seen the installation instructions amongst the files you have downloaded? See below:
INSTALlATION:
To install and use, unzip this file into your Moodle root directory making sure
that you 'use folder names'. This will create the following files:
/blocks/side_bar/lang/en/block_side_bar.php
/blocks/side_bar/block_side_bar.php
/blocks/side_bar/block_side_bar-README.txt
/blocks/side_bar/config_global.html
/blocks/side_bar/config_instance.html
Visit your admin section to complete installation of the block.
So, at the moment, I can't figure out how to upload files to the server. This is where I'm stumped. The webhost provided this handsome little domain manager that also has a file manager on it. From there I downloaded Moodle as part of an Elephante pkg the host offered to the server. I have a File manage for the Moodle that allows me to upload 5 FILES at a time from my own computer. I don't see any instructions or options to access downloads from the internet.
In this domain manager control panel I do see 1 FTP "in use". I can't find anything called cPanel. So I am assuming I am using an FTP.
Does this look like a problem with my downloading method?
Does this sound right to you? This is my first website, so I am cluless.
It would be best to get the latest version of the side bar block from CVS. However, to make things simpler if you message me your email address I'll send you a zip file with these included.
You will need to upload this to your server to the "moodle" directory (folder). Nest you'll need to unzip / extract the contents of the zip file. You should see an option for this somehwhere in your domain admin file manager interface.
If you can't find where moodle is on your server, your webhost will be able to tell you.
When the file has been extracted you should see this:
/blocks/side_bar/lang/en/block_side_bar.php
/blocks/side_bar/block_side_bar.php
/blocks/side_bar/block_side_bar-README.txt
/blocks/side_bar/config_global.html
/blocks/side_bar/config_instance.html
Log in as admin on your site and you should see the update messages. You'll then be able to add this block to your courses.
We installed the Side Bar block on our 1.8.2 Moodle where it worked perfectly until we upgraded to 1.9.2.
Now, you can only add 1 side bar block to a course. If you add more than one, Moodle seems to treat them as one and the same. When you add links to Side Bar #2, they show up in Side Bar #1. And Side Bar #2 does not have jump menus for adding resources and activities. Side Bar #2 has a simple drop-down menu with a GO button for both Add a Resource and Add an Activity options. Weird!
And if you delete one of the Side Bars, all of them disappear!
What's up with the Houdini act?????

Is there a newer version for 1.9 some place, or in the works maybe? Is there a method for upgrading with the Side Bar block?
Any light that can be shed on the subject would be most appreciated.
A million thanks!
Sarah Ashley

這一討論區的貼文已經被移除
這一討論區的貼文已經被移除
WARNING - adding this as a sticky block can delete the site main menu, forums and resources from your front page!
If you add this as a sticky block and then delete it it can really make a mess of your moodle.Its because a sticky block that is being configured has a page id of 1.
I've added some code to the blocks instance_delete function to fix this:
function instance_delete() {
global $CFG;
if (empty($this->instance)) {
return true;
}
// GT Mod - Do not try to delete a sticky block's resources when viewed on sticky block config page
if (isset($this->instance->pinned) && $this->instance->pinned==true){
if (intval($this->instance->pageid)==1){
return true;
}
}
I've also attached the fixed version.
這一討論區的貼文已經被移除
這一討論區的貼文已經被移除
這一討論區的貼文已經被移除
Providing your site course has an id of 1, to get all your forums back just for the front page you can run the following sql SELECT statements on a backup version (you do have a backup, right?):
==========================================
forum table:
SELECT * FROM mdl_forum WHERE course=1
forum discussions table
SELECT fd.* FROM mdl_forum f LEFT JOIN mdl_forum_discussions fd ON f.id=fd.forum WHERE f.course=1
forum discussion table
SELECT fp.* FROM mdl_forum f LEFT JOIN mdl_forum_discussions fd ON f.id=fd.forum
LEFT JOIN mdl_forum_posts fp ON fd.id=fp.discussion WHERE f.course=1
==========================================
If you are using phpmyadmin you can export the results and then reimport them to your "damaged" moodle.
Also, note- any file attachments to forum posts will also need to be restored from a backup of your moodle data directory.
I couldn't restore the main menu - I just ended up recreating it.
Hope this helps.
Guy
這一討論區的貼文已經被移除
這一討論區的貼文已經被移除
這一討論區的貼文已經被移除
When hidden on the front page, the resources and activities are not accessible; just the way a normal block works. Is this because visitors are not logged in like a student? Any other ideas?
I am using Moodle 1.9.x and the latest download of the block.
Thanks
Hi Omer,
I use Side Bar all the time, too, which is one reason why I'm not upgrading my 1.9 site yet. Side Bar was not available for 2.0 last time I asked. It was originally contributed by Mike Churchwood (a Moodle Partner). I asked him about it last summer and he wasn't sure if they would be upgrading it. You could contact him again.
Alternatively, you could contact a Moodle contributor, Davo Smith. I have talked to him about upgrading Side Bar for 2.0 so he might be able to do it for you. His website is: http://davodev.co.uk/ where you can find contact information.
The Side Bar makes it possible to add CMS functionality to any Moodle course, which for my business clients, is a very important feature. Good luck and let me know what you find out! Penny
This is a work-around that always works (and also goes in the backup)
ONE: exception the course format SCORM, you must patch that one to make it possible there too:
THE WORKAROUND:
1. make your course one section bigger then you need: 20? >> 21
2. put all your sidebar activities and resources in that section
3. create a html block and link to these resources and activities
(add also an img in the link to imitate the sidebar-block-look)
4. when you are finished, do not hide the extra section, but lower the number of sections.
The only function you will loose is the open/close the eye in the sidebar
I hope that someday someone creates a good sidebar block for 2.0, I like the concept.
I, too, hope that "someone" creates sidebar for 2.0, because I LOVE it. I use it in all of the 1.9 sites/courses that I build. The workaround that you describe is one that many recommend, but it is an extra step and not as easy for non-tricky people to update.
In 2.0, the main menu block can be made "sticky" (which is accomplished by making it appear on every page, from within the block settings), but it is not the same block across courses...the content in that block is the same as in topic 0, so as is, that isn't much help. But it does work somewhat like Ger's workaround with the last topic. It would be nice if the main menu block in a course would either carry over the same content as the front page version OR be updatable the way the front page main menu and sidebar are.
I use the side_bar block extensively in my moodle site.
Updated 2 weeks ago to moodle 2.0.7 from 1.9.16 and all went well. Using the Moodle 2 version of side bar and it has worked great -until tonight.
It has now disappeared -well the contents of the blocks have disappeared, the empty blocks are there.
There are "orphaned sections" at the end of the course sections -ut not for all the blocks.
Any odeas how to fix (and prevent repeating) gratefully received.
Thanks
John
Hi Wen,
Perhaps 2-3 weeks ago I got an error message while trying to install the block Side Bar.
After your comment I tried it again. This time I successfully installed Side Bar (version 2.7.1; downloaded from HERE) in Moodle 2.7+ (Build: 20140703). I have no explanation why I couldn't install it previously, but was able to install it today. I can only encourage you to try it again.
With kind regards,
Hartmut
Hi Hartmut, thanks for your reply.
I was able to get it installed, but when I click on "+Add an activity or resource" in the Side Bar block, it simply does not do anything. I also tried to drag and drop activities that were already created in the center Topic X area to the Side Bar, it didn't work either. I'm testing this on the latest version of FireFox (v 31.0). Thanks!