Browse files

ForumNG: Change intro handling, also theme styling #1106

  • Loading branch information...
1 parent a53a02e commit 4d6532eb1f935322f405d535ae9698f989b4c790 @sammarshallou sammarshallou committed Oct 25, 2011
Showing with 23 additions and 8 deletions.
  1. +7 −0 mod_forumng.php
  2. +15 −3 renderer.php
  3. +0 −4 styles.css
  4. +1 −1 view.php
View
7 mod_forumng.php
@@ -653,6 +653,13 @@ public function get_intro($abbreviated=false) {
}
}
+ /**
+ * @return int FORMAT_xx constant for intro format
+ */
+ public function get_intro_format() {
+ return $this->forumfields->introformat;
+ }
+
/** @return int GRADING_xx constant */
public function get_grading() {
return $this->forumfields->grading;
View
18 renderer.php
@@ -470,13 +470,25 @@ public function render_flagged_list_end() {
* @return string Intro HTML or '' if none
*/
public function render_intro($forum) {
+ // Don't output anything if no text, so we don't get styling around
+ // something blank
$text = $forum->get_intro();
if (trim($text) === '') {
return '';
}
- $options = (object)array('trusttext'=>true);
- return '<div class="forumng-intro">' . format_text($text, FORMAT_HTML,
- $options, $forum->get_course_id()) . '</div>';
+
+ // Make fake activity object in required format, and use to format
+ // intro for module with standard function (which handles images etc.)
+ $activity = (object)array('intro' => $forum->get_intro(),
+ 'introformat' => $forum->get_intro_format());
+ $intro = format_module_intro(
+ 'forumng', $activity, $forum->get_course_module_id(true));
+
+ // Box styling appears to be consistent with some other modules
+ $intro = html_writer::tag('div', $intro, array('class' => 'generalbox box',
+ 'id' => 'intro'));
+
+ return $intro;
}
/**
View
4 styles.css
@@ -124,10 +124,6 @@ a.forumng-iconlink:hover {
margin-right:12px;
}
-.forumng-intro {
- margin: 1em 0;
-}
-
form.forumng-paste-buttons {
margin-left: 0.85em;
padding: 0.7em 0.5em;
View
2 view.php
@@ -88,7 +88,7 @@
print $out->container_start('forumng-main');
print $out->render_switch_link($forum);
-print skip_main_destination();
+print $out->skip_link_target();
// Get forum type to display main part of page
$forum->get_type()->print_view_page($forum, $groupid);

0 comments on commit 4d6532e

Please sign in to comment.