Images not displayed in course contents display

  • John Feagans
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 5 months ago #1 by John Feagans
Moodle 1.9x Joomdle .82 Joomla 1.6

My courses all include an image along with the descriptions of the weekly topics. The course topics display shows them correctly in Joomla but the course contents display does not unless you are logged in to Moodle. Inspecting the elements in the display I see this for the url of the image:

Course topic
www.xxx.xxx/moodle/auth/joomdle/file_joomdle.php/3/help.h2.jpg

Course contents
www.xxx.xxx/moodle/file.php/3/help.h2.jpg

As you can see the course contents depends on the Moodle authorization and the course topics on the joomdle authorization. That is why if you are logged into Moodle, the display is correct.

I will attempt to debug this today and come up with a patch. Let me know your thoughts.

Please Log in or Create an account to join the conversation.

  • John Feagans
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 5 months ago - 13 years 5 months ago #2 by John Feagans
Replied by John Feagans on topic Images not displayed in course contents display
Problem in auth/joomdle/auth.php? Some, but not all functions replace instances of file.php with auth/joomdle/file_joomdle.php (and ../file.php).
Last edit: 13 years 5 months ago by John Feagans. Reason: more information to help others with same problem

Please Log in or Create an account to join the conversation.

  • John Feagans
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 5 months ago #3 by John Feagans
Replied by John Feagans on topic Images not displayed in course contents display
Here is the fix to auth.php: two lines at the end of this snippet. This replaces file.php with file_joomdle.php so the images can be correctly displayed.


function get_course_mods ($id, $username = '') {
global $CFG, $DB;

if ($username)
$user = get_complete_user_data ('username', $username);

$course = get_record("course", "id", $id);
$modinfo = get_fast_modinfo($course);

$sections = get_all_sections($id);

get_all_mods($id, $mods, $modnames, $modnamesplural, $modnamesused);

foreach ($sections as $section)
{
$sectionmods = explode(",", $section->sequence);
foreach ($sectionmods as $modnumber) {
if (empty($mods[$modnumber])) {
continue;
}
$mod = $mods[$modnumber];

if ($username)
{
$cm = get_coursemodule_from_id(false, $mod->id);
if (!coursemodule_visible_for_user ($cm, $user->id))
continue;
}

$e[$section->section] = $section->section;
$e[$section->section] = $section->summary;
$e[$section->section] = str_replace ('../file.php', $CFG->wwwroot . '/auth/joomdle/file_joomdle.php', $e[$section->section]);
$e[$section->section] = str_replace ('file.php', 'auth/joomdle/file_joomdle.php', $e[$section->section]);

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic Images not displayed in course contents display
I John.

Thanks for the info. I checked current code to add your fix, and it seems I already fixed it some time ago, and I did not remember :)
The fix will be included in next release.

Please Log in or Create an account to join the conversation.