]> git.mjollnir.org Git - moodle.git/commitdiff
Some improvements in RSS:
authorstronk7 <stronk7>
Sun, 9 May 2004 18:34:33 +0000 (18:34 +0000)
committerstronk7 <stronk7>
Sun, 9 May 2004 18:34:33 +0000 (18:34 +0000)
- Article's author is showed if present.
- In forum posts feeds, show post->subject instead of discussion->name
- Description contents in every article are passed to format_text() to
  show contents like the rest of Moodle.

lang/en/moodle.php
mod/forum/rsslib.php
rss/rsslib.php

index aee09f2e314333776ecd770ff1b3f2f3c3cbac3f..d2f8bbf302c26f57f01f52e100d96686c20f744b 100644 (file)
@@ -108,6 +108,7 @@ $string['blocks'] = 'Blocks';
 $string['blocksetup'] = 'Setting up block tables';
 $string['blocksuccess'] = '$a tables have been set up correctly';
 $string['bycourseorder'] = 'By course order';
+$string['byname'] = 'by $a';
 $string['cancel'] = 'Cancel';
 $string['categories'] = 'Course categories';
 $string['category'] = 'Category';
index 3553aac86c11caa664e8bd5639d7ff6b5ef03f6f..fd4bc4b5a61ab6c7dbf4a641e0e81066bb20495c 100644 (file)
                                              u.firstname userfirstname,
                                              u.lastname userlastname,
                                              p.message postmessage,
-                                             p.created postcreated
+                                             p.created postcreated,
+                                             p.format postformat
                                       FROM {$CFG->prefix}forum_discussions d,
                                            {$CFG->prefix}forum_posts p,
                                            {$CFG->prefix}user u
                 $item->author = fullname($user);
                 $item->pubdate = $rec->postcreated;
                 $item->link = $CFG->wwwroot."/mod/forum/discuss.php?d=".$rec->discussionid;
-                $item->description = $rec->postmessage;
+                $item->description = format_text($rec->postmessage,$rec->postformat,NULL,$forum->course);
                 $items[] = $item;
                 $articlesleft--;
                 if ($articlesleft < 1) {
 
         if ($recs = get_records_sql ("SELECT p.id postid,
                                              d.id discussionid,
-                                             d.name discussionname,
                                              u.id userid,
                                              u.firstname userfirstname,
                                              u.lastname userlastname,
+                                             p.subject postsubject,
                                              p.message postmessage,
-                                             p.created postcreated
+                                             p.created postcreated,
+                                             p.format postformat
                                       FROM {$CFG->prefix}forum_discussions d,
                                            {$CFG->prefix}forum_posts p,
                                            {$CFG->prefix}user u
             foreach ($recs as $rec) {
                 unset($item);
                 unset($user);
-                $item->title = $rec->discussionname;
+                $item->title = $rec->postsubject;
                 $user->firstname = $rec->userfirstname;
                 $user->lastname = $rec->userlastname;
                 $item->author = fullname($user);
                 $item->pubdate = $rec->postcreated;
                 $item->link = $CFG->wwwroot."/mod/forum/discuss.php?d=".$rec->discussionid."&parent=".$rec->postid;
-                $item->description = $rec->postmessage;
+                $item->description = format_text($rec->postmessage,$rec->postformat,NULL,$forum->course);
                 $items[] = $item;
                 $articlesleft--;
                 if ($articlesleft < 1) {
index 094b8c0a0b7ccf8cd0b99e2cf29a6034516be77d..6e9d56da07e886fd042bbffdf708e447064ef32f 100644 (file)
@@ -181,7 +181,7 @@ function rss_standard_header($title = NULL, $link = NULL, $description = NULL) {
 
 //This function returns the rss XML code for every item passed in the array
 //item->title: The title of the item
-//item->author: The author of the item
+//item->author: The author of the item. Optional !!
 //item->pubdate: The pubdate of the item
 //item->link: The link url of the item
 //item->description: The content of the item
@@ -197,6 +197,10 @@ function rss_add_items($items) {
             $result .= rss_full_tag("title",3,false,$item->title);
             $result .= rss_full_tag("link",3,false,$item->link);
             $result .= rss_full_tag("pubDate",3,false,date("r",$item->pubdate));
+            //Include the author if exists 
+            if (isset($item->author)) {
+                $item->description = get_string("byname","",$item->author)."<p>".$item->description;
+            }
             $result .= rss_full_tag("description",3,false,$item->description);
             $result .= rss_end_tag("item",2,true);