Standardising the printing of content and summaries to use format_text()

This commit is contained in:
moodler 2004-08-09 14:49:16 +00:00
parent 7dd826818e
commit 43cbfc1999
5 changed files with 17 additions and 13 deletions

View file

@ -72,12 +72,12 @@
if (!$resource->visible) { // Show dimmed if the mod is hidden if (!$resource->visible) { // Show dimmed if the mod is hidden
$table->data[] = array ($printsection, $table->data[] = array ($printsection,
"<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>", "<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>",
text_to_html($resource->summary) ); format_text($resource->summary) );
} else { //Show normal if the mod is visible } else { //Show normal if the mod is visible
$table->data[] = array ($printsection, $table->data[] = array ($printsection,
"<a $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>", "<a $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>",
text_to_html($resource->summary) ); format_text($resource->summary) );
} }
} }

View file

@ -71,7 +71,8 @@ function display() {
} }
if (trim(strip_tags($this->resource->summary))) { if (trim(strip_tags($this->resource->summary))) {
print_simple_box(text_to_html($this->resource->summary), "center"); $formatoptions->noclean = true;
print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center");
print_spacer(10,10); print_spacer(10,10);
} }

View file

@ -291,7 +291,8 @@ function display() {
echo '</script>'; echo '</script>';
if (trim(strip_tags($this->resource->summary))) { if (trim(strip_tags($this->resource->summary))) {
print_simple_box(text_to_html($this->resource->summary), "center"); $formatoptions->noclean = true;
print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center");
} }
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>"; $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>";
@ -415,7 +416,8 @@ function display() {
} }
if (trim($this->resource->summary)) { if (trim($this->resource->summary)) {
print_simple_box(format_text($this->resource->summary), 'center'); $formatoptions->noclean = true;
print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center");
} }
if ($inpopup) { if ($inpopup) {

View file

@ -79,14 +79,15 @@ function display() {
} }
$pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
$formatoptions->noclean = true;
$inpopup = !empty($_GET["inpopup"]); $inpopup = !empty($_GET["inpopup"]);
if ($this->resource->popup) { if ($this->resource->popup) {
if ($inpopup) { /// Popup only if ($inpopup) { /// Popup only
add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id);
print_header(); print_header();
print_simple_box(format_text($this->resource->alltext, FORMAT_HTML), "center", "", "$THEME->cellcontent", "20"); print_simple_box(format_text($this->resource->alltext, FORMAT_HTML, $formatoptions),
"center", "", "$THEME->cellcontent", "20");
} else { /// Make a page and a pop-up window } else { /// Make a page and a pop-up window
print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}",
@ -100,7 +101,7 @@ function display() {
echo '</script>'; echo '</script>';
if (trim(strip_tags($this->resource->summary))) { if (trim(strip_tags($this->resource->summary))) {
print_simple_box(format_text($this->resource->summary, FORMAT_HTML), "center"); print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center");
} }
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>"; $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>";
@ -121,7 +122,7 @@ function display() {
"", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource),
navmenu($this->course, $this->cm)); navmenu($this->course, $this->cm));
print_simple_box(format_text($this->resource->alltext, FORMAT_HTML), "center", "", "$THEME->cellcontent", "20"); print_simple_box(format_text($this->resource->alltext, FORMAT_HTML, $formatoptions), "center", "", "$THEME->cellcontent", "20");
echo "<center><p><font size=1>$strlastmodified: ".userdate($this->resource->timemodified)."</p></center>"; echo "<center><p><font size=1>$strlastmodified: ".userdate($this->resource->timemodified)."</p></center>";

View file

@ -76,7 +76,7 @@ function display() {
$navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->"; } $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->"; }
$pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
$formatoptions->noclean = true;
$inpopup = !empty($_GET["inpopup"]); $inpopup = !empty($_GET["inpopup"]);
if ($this->resource->popup) { if ($this->resource->popup) {
@ -84,7 +84,7 @@ function display() {
add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}",
$this->resource->id, $this->cm->id); $this->resource->id, $this->cm->id);
print_header(); print_header();
print_simple_box(format_text($this->resource->alltext, $this->resource->options), print_simple_box(format_text($this->resource->alltext, $this->resource->options, $formatoptions),
"center", "", "$THEME->cellcontent", "20"); "center", "", "$THEME->cellcontent", "20");
} else { /// Make a page and a pop-up window } else { /// Make a page and a pop-up window
@ -99,7 +99,7 @@ function display() {
echo '</script>'; echo '</script>';
if (trim(strip_tags($this->resource->summary))) { if (trim(strip_tags($this->resource->summary))) {
print_simple_box(format_text($this->resource->summary, FORMAT_HTML), "center"); print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center");
} }
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>"; $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}</a>";
@ -120,7 +120,7 @@ function display() {
"", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource),
navmenu($this->course, $this->cm)); navmenu($this->course, $this->cm));
print_simple_box(format_text($this->resource->alltext, $this->resource->options), print_simple_box(format_text($this->resource->alltext, $this->resource->options, $formatoptions),
"center", "", "$THEME->cellcontent", "20"); "center", "", "$THEME->cellcontent", "20");
echo "<center><p><font size=1>$strlastmodified: ".userdate($this->resource->timemodified)."</p></center>"; echo "<center><p><font size=1>$strlastmodified: ".userdate($this->resource->timemodified)."</p></center>";