Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

This file adds support to rss feeds generation

Copyright: 2001 Eloy Lafuente (stronk7) http://contiento.com
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 418 lines (16 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 8 functions


Functions that are not part of a class:

forum_rss_get_feed($context, $args)   X-Ref
Returns the path to the cached rss feed contents. Creates/updates the cache if necessary.

param: stdClass $context the context
param: array    $args    the arguments received in the url
return: string the full path to the cached RSS feed directory. Null if there is a problem.

forum_rss_delete_file($forum)   X-Ref
Given a forum object, deletes all cached RSS files associated with it.

param: stdClass $forum

forum_rss_newstuff($forum, $cm, $time)   X-Ref
If there is new stuff in the forum since $time this returns true
Otherwise it returns false.

param: stdClass $forum the forum object
param: stdClass $cm    Course Module object
param: int      $time  check for items since this epoch timestamp
return: bool True for new items

forum_rss_get_sql($forum, $cm, $time=0)   X-Ref
Determines which type of SQL query is required, one for posts or one for discussions, and returns the appropriate query

param: stdClass $forum the forum object
param: stdClass $cm    Course Module object
param: int      $time  check for items since this epoch timestamp
return: string the SQL query to be used to get the Discussion/Post details from the forum table of the database

forum_rss_feed_discussions_sql($forum, $cm, $newsince=0)   X-Ref
Generates the SQL query used to get the Discussion details from the forum table of the database

param: stdClass $forum     the forum object
param: stdClass $cm        Course Module object
param: int      $newsince  check for items since this epoch timestamp
return: string the SQL query to be used to get the Discussion details from the forum table of the database

forum_rss_feed_posts_sql($forum, $cm, $newsince=0)   X-Ref
Generates the SQL query used to get the Post details from the forum table of the database

param: stdClass $forum     the forum object
param: stdClass $cm        Course Module object
param: int      $newsince  check for items since this epoch timestamp
return: string the SQL query to be used to get the Post details from the forum table of the database

forum_rss_get_group_sql($cm, $groupmode, $currentgroup, $modcontext=null)   X-Ref
Retrieve the correct SQL snippet for group-only forums

param: stdClass $cm           Course Module object
param: int      $groupmode    the mode in which the forum's groups are operating
param: bool     $currentgroup true if the user is from the a group enabled on the forum
param: stdClass $modcontext   The context instance of the forum module
return: string SQL Query for group details of the forum

forum_rss_feed_contents($forum, $sql, $params, $context)   X-Ref
This function return the XML rss contents about the forum
It returns false if something is wrong

param: stdClass $forum the forum object
param: string $sql the SQL used to retrieve the contents from the database
param: array $params the SQL parameters used
param: object $context the context this forum relates to
return: bool|string false if the contents is empty, otherwise the contents of the feed is returned