Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Rating API

From MoodleDocs
Revision as of 01:54, 25 January 2012 by Jason Fowler (talk | contribs) (Created page with "==Overview== ==File Locations== The primary functions for the RSS API is located in rating/lib.php Additional functions and usage examples can be found in the following files...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

File Locations

The primary functions for the RSS 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);

See also