Moodle

HTML resource page views are not logged when blocks are showing

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.9.2
  • Component/s: Resource
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

Currently mod/resource/type/html/resource.class.php display() does not log resource page views if blocks are showing:-

/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') { parent::display_course_blocks_start(); // logging missing here echo format_text($this->resource->alltext, FORMAT_HTML, $formatoptions, $this->course->id); parent::display_course_blocks_end(); } else {

/// Set up generic stuff first, including checking for access
parent::display();

/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;

$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
$inpopup = optional_param('inpopup', '', PARAM_BOOL);

// fix for MDL-9021, thanks Etienne Roz
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); // OK here

Easily resolved, but is there any reason not to make this correction?

Issue Links

Activity

Hide
David Mudrak added a comment -

Fixed in both HEAD (rev 1.42) and MOODLE_19_STABLE (rev 1.40.2.2). As in MDL-9021, I moved add_to_log() out of any if { } statements. Thanks for the spotting!

Show
David Mudrak added a comment - Fixed in both HEAD (rev 1.42) and MOODLE_19_STABLE (rev 1.40.2.2). As in MDL-9021, I moved add_to_log() out of any if { } statements. Thanks for the spotting!
Hide
John Beedell added a comment -

Thanks for the fix David, but I don't think you can use the shorthand variables (e.g. $course) without setting them up. Perhaps its easiest to just use the object reference ($this->course->id). Sorry.

Show
John Beedell added a comment - Thanks for the fix David, but I don't think you can use the shorthand variables (e.g. $course) without setting them up. Perhaps its easiest to just use the object reference ($this->course->id). Sorry.
Hide
Petr Škoda (skodak) added a comment -

fixed, thanks everybody

Show
Petr Škoda (skodak) added a comment - fixed, thanks everybody
Hide
David Mudrak added a comment -

What a stupid mistake of mine :-/ Sorry and thanks for the re-fix

Show
David Mudrak added a comment - What a stupid mistake of mine :-/ Sorry and thanks for the re-fix

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: