Skip to content

Commit

Permalink
MDL-24959 glossary_random - render images in picked entries properly
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Nov 15, 2010
1 parent 9dd4603 commit 32df07b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion blocks/glossary_random/block_glossary_random.php
Expand Up @@ -38,6 +38,12 @@ function specialization() {
$this->instance_config_commit();
}

// Get module and context, to be able to rewrite urls
if (! $cm = get_coursemodule_from_instance("glossary", $this->config->glossary, $this->course->id)) {
return false;
}
$glossaryctx = get_context_instance(CONTEXT_MODULE, $cm->id);

$limitfrom = 0;
$limitnum = 1;

Expand Down Expand Up @@ -69,7 +75,7 @@ function specialization() {
break;
}

if ($entry = $DB->get_records_sql("SELECT concept, definition, definitionformat, definitiontrust
if ($entry = $DB->get_records_sql("SELECT id, concept, definition, definitionformat, definitiontrust
FROM {glossary_entries}
WHERE glossaryid = ? AND approved = 1
ORDER BY timemodified $SORT", array($this->config->glossary), $limitfrom, $limitnum)) {
Expand All @@ -85,6 +91,7 @@ function specialization() {
$options = new stdClass();
$options->trusted = $entry->definitiontrust;
$options->overflowdiv = true;
$entry->definition = file_rewrite_pluginfile_urls($entry->definition, 'pluginfile.php', $glossaryctx->id, 'mod_glossary', 'entry', $entry->id);
$text .= format_text($entry->definition, $entry->definitionformat, $options);

$this->config->nexttime = usergetmidnight(time()) + DAYSECS * $this->config->refresh;
Expand Down

0 comments on commit 32df07b

Please sign in to comment.