Image in Course Display for each course

Re: Image in Course Display for each course

by W Page -
Number of replies: 5

Hi!

TO:   Jon Bolton

Check out the updated script which is in another post of   Alvaro's as "changes-2.txt".  I think this takes care of that problem. 

Also, which version of MOODLE are you using v1.1.1 or developmental v1.2?  I cannot get the images to visualized.  I am wondering if this has something to do with the version I am using.

WP1

In reply to W Page

Re: Image in Course Display for each course

by Bryan Williams -

WP,

What would happen if you created an images directory in the webroot, rather than within Moodle, making sure chmod is set to something like 777.  Alvaro's script is forgiving enough that your image calls are being ignored, rather than sending you an error message.  Jon's earlier problem was probably something in the path of the two images not appearing that needed fixing (did not look at changes-2.txt).  It does not appear that on your site the images are even trying to load.  thoughtful

In reply to W Page

Re: Image in Course Display for each course

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Thanks, I'd noticed Alvaro's post and had already made the changes.

I'm using both versions of Moodle … 1.1.1 in a live enviroment and 1.2 in a test environment. The images work well in both - see http://learningcentre.baillie.org.uk/course/category.php?id=1

I'm not sure why you're having the problems - the only thing that I did noticed in your step-by-step post of what you had done, there was no mention of making changes to /course/edit.php. You need to insert

$form->image = image;

at line 111. This change allows to put the name of the selected image in the DB.

In reply to Jon Bolton

Re: Image in Course Display for each course

by W Page -

Hi!

Thanks for responding.

I just checked.  "$form->image = image;" is at line 111 in "course/edit.php".  Also, all the images are in the proper place (in the field "image" in the "course" table). 

I will just start all over and go step by step again.  Hopefully I can figure this out since I really want to utilize this feature.

WP1

In reply to W Page

Re: Image in Course Display for each course

by W Page -

Hi Everyone!

Well I just had to keep fiddling with it.  I was able to get only one image to display for only one course.  I was able to get this one to display by  not keeping the script (noted just below this paragraph) at line 1152 in "course/lib.php" but by moving it after the requested teacher information in the course block area which was line 1227 in "course/lib.php".

echo "<br><img src=\"/images/$course->image\" alt=\"$course->alternate\" title=\"$course->alternate\"><br><br>";

Please check the following link,
http://s94988317.onlinehome.us/moodle/

Anyone have any suggestions as to how I can correct this problem?

Thanks again in advance for any help anyone can give me with this.

WP1

Below is the code block area I am referring to and where I inserted the above line, 
===========================================

print_simple_box_start("center", "$width", $THEME->cellcontent, 5, "coursebox");

$linkcss = $course->visible ? "" : " class=\"dimmed\" ";

echo "<table width=\"100%\">";
echo "<tr valign=top>";
echo "<td valign=top width=\"50%\" class=\"courseboxinfo\">";
echo "<p><font size=3><b><a title=\"".get_string("entercourse")."\"
$linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a></b></font></p>";
if ($teachers = get_course_teachers($course->id)) {
echo "<p><font size=\"1\">\n";
foreach ($teachers as $teacher) {
if ($teacher->authority > 0) {
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
$fullname = fullname($teacher, isteacher($course->id)); // is the USER a teacher of that course
echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$fullname</a><br />";
echo "<br><img src=\"./images/$course->image\" alt=\"$course->alternate\" title=\"$course->alternate\"><br><br>";
}
}
echo "</font></p>";
}

In reply to W Page

Re: Image in Course Display for each course

by W Page -
Hello All!

OK I am still "fiddling" with this particular script.

As I pointed out in the previous post. Before I moved the script line no image would display even if a teacher was assigned to a course.  After I moved the script line which is in "course/lib.php" only one image displayed for one course. None of the other images displayed for any of the other courses.  I had also previously added a teacher to that particular course before moving the script line. I could not see any relationship between adding the teacher and seeing the image at the time.

Later this evening I added a teacher to two other courses . All of a sudden the images displayed. But, only if the course had a teacher added.

Any course I have not added a teacher to still does not have an image displayed although I added an image in the "Edit course settings" page.

The image should display even if a teacher is not assigned to the course.

Can anyone explain why this is happening??

WP1