Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

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: 420 lines (17 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