Rating API
From MoodleDocs
Overview
File Locations
The primary functions for the Rating API is located in rating/lib.php
Additional functions and usage examples can be found in the following files:
- rating/rate.php
- rating/rate_ajax.php
Examples
Below you will find examples on how to use the RSS functions within your own modules.
Creating an RSS feed
This example shows how you can create the content of an RSS Feed. (Example taken from blog/rsslib.php)
$cm = $modinfo->instances['forum'][$forum->id];
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$forum = forum_get_course_forum($this->page->course->id, 'news');
$userid = (!isloggedin()) ? 0 : $USER->id;
$tooltiptext = get_string('rsssubscriberssposts','forum');
echo rss_get_link($context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);