*/
$string['aggregatetype'] = 'Aggregate type';
+$string['aggregateavg'] = 'Average of ratings';
+$string['aggregatecount'] = 'Count of ratings';
+$string['aggregatemax'] = 'Maximum rating';
+$string['aggregatemin'] = 'Minimum rating';
+$string['aggregatenone'] = 'No ratings';
+$string['aggregatesum'] = 'Sum of ratings';
$string['aggregatetype_help'] = 'The aggregate type defines how ratings are combined to form the final grade in the gradebook.
* Average of ratings - The mean of all ratings
If "No ratings" is selected, then the activity will not appear in the gradebook.';
$string['allowratings'] = 'Allow items to be rated?';
$string['capabilitychecknotavailable'] = 'Capability check not available until activity is saved';
+$string['couldnotdeleteratings'] = 'Sorry, that cannot be deleted as people have already rated it';
$string['norate'] = 'Rating of items not allowed!';
-$string['noviewanyrate'] = 'You can only look at results for posts that you made';
-$string['noviewrate'] = 'You do not have the capability to view post ratings';
+$string['noviewanyrate'] = 'You can only look at results for items that you made';
+$string['noviewrate'] = 'You do not have the capability to view item ratings';
$string['rate'] = 'Rate';
$string['ratepermissiondenied'] = 'You do not have permission to rate this item';
$string['rating'] = 'Rating';
$aggregatelabel = '';
switch ($rating->settings->aggregationmethod) {
case RATING_AGGREGATE_AVERAGE :
- $aggregatelabel .= get_string("aggregateavg", "forum");
+ $aggregatelabel .= get_string("aggregateavg", "rating");
break;
case RATING_AGGREGATE_COUNT :
- $aggregatelabel .= get_string("aggregatecount", "forum");
+ $aggregatelabel .= get_string("aggregatecount", "rating");
break;
case RATING_AGGREGATE_MAXIMUM :
- $aggregatelabel .= get_string("aggregatemax", "forum");
+ $aggregatelabel .= get_string("aggregatemax", "rating");
break;
case RATING_AGGREGATE_MINIMUM :
- $aggregatelabel .= get_string("aggregatemin", "forum");
+ $aggregatelabel .= get_string("aggregatemin", "rating");
break;
case RATING_AGGREGATE_SUM :
- $aggregatelabel .= get_string("aggregatesum", "forum");
+ $aggregatelabel .= get_string("aggregatesum", "rating");
break;
}
$string['addentries'] = 'Add entries';
$string['addtemplate'] = 'Add template';
$string['advancedsearch'] = 'Advanced search';
-$string['allowratings'] = 'Allow posts to be rated?';
$string['alttext'] = 'Alternative text';
$string['approve'] = 'Approve';
$string['approved'] = 'Approved';
$string['cannotaccesspresentsother'] = 'You are not allowed to access presets from other users';
$string['cannotadd'] = 'Can not add entries!';
$string['cannotdeletepreset'] = 'Error deleting a preset!';
-$string['cannotrate'] = 'Rating of items not allowed!';
$string['cannotunziptopreset'] = 'Cannot unzip to the preset directory';
$string['columns'] = 'columns';
$string['comment'] = 'Comment';
$string['fromfile'] = 'Import from zip file';
$string['fromfile_help'] = 'The import from zip file feature allows you to browse for and upload a preset zip of templates and fields.';
$string['generateerror'] = 'Not all files generated!';
-$string['guestrate'] = 'Guests are not allowed to rate entries.';
$string['header'] = 'Header';
$string['headeraddtemplate'] = 'Defines the interface when editing entries';
$string['headerasearchtemplate'] = 'Defines the interface for Advanced Searches';
$string['invalidfieldtype'] = 'Field Type is incorrect';
$string['invalidid'] = 'Incorrect data ID';
$string['invalidpreset'] = '{$a} is not a preset.';
-$string['invalidrate'] = 'Invalid database rate ({$a})';
-$string['invalidratedata'] = 'Incorrect submitted ratings data';
$string['invalidrecord'] = 'Incorrect record';
$string['invalidurl'] = 'The URL you just entered is not valid';
$string['jstemplate'] = 'Javascript template';
$string['nolisttemplate'] = 'List template is not yet defined';
$string['nomatch'] = 'No matching entries found!';
$string['nomaximum'] = 'No maximum';
-$string['norating'] = 'This activity does not use ratings';
$string['norecords'] = 'No entries in database';
$string['nosingletemplate'] = 'Single template is not yet defined';
$string['notapproved'] = 'Entry is not approved yet.';
$string['presetinfo'] = 'Saving as a preset will publish this template. Other users may be able to use it in their databases.';
$string['presets'] = 'Presets';
$string['radiobutton'] = 'Radio buttons';
-$string['rate'] = 'Rate';
-$string['rating'] = 'Rating';
-$string['ratingeveryone'] = 'Everyone can rate posts';
-$string['ratingno'] = 'No ratings';
-$string['ratingonlyteachers'] = 'Only {$a} can rate posts';
-$string['ratingpublic'] = '{$a} can see everyone\'s ratings';
-$string['ratingpublicnot'] = '{$a} can only see their own ratings';
-$string['ratings'] = 'Ratings';
-$string['ratingssaved'] = 'Ratings saved';
$string['recordapproved'] = 'Entry approved';
$string['recorddeleted'] = 'Entry deleted';
$string['recordsnotsaved'] = 'No entry was saved. Please check the format of the uploaded file.';
$string['savetemplate'] = 'Save template';
$string['search'] = 'Search';
$string['selectedrequired'] = 'All selected required';
-$string['sendinratings'] = 'Send in my latest ratings';
$string['showall'] = 'Show all entries';
$string['single'] = 'View single';
$string['singletemplate'] = 'Single template';
* @return void Output echo'd
*/
function data_print_ratings($data, $record) {
- /*global $USER, $DB, $OUTPUT;
-
- $cm = get_coursemodule_from_instance('data', $data->id);
- $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
- if ($data->assessed and isloggedin() and (has_capability('mod/data:rate', $context) or has_capability('mod/data:viewrating', $context) or data_isowner($record->id))) {
- if ($ratingsscale = make_grades_menu($data->scale)) {
- $ratingsmenuused = false;
-
- echo '<div class="ratings" style="text-align:center">';
- echo '<form id="form" method="post" action="rate.php">';
- echo '<input type="hidden" name="dataid" value="'.$data->id.'" />';
-
- if (has_capability('mod/data:rate', $context) and !data_isowner($record->id)) {
- data_print_ratings_mean($record->id, $ratingsscale, has_capability('mod/data:viewrating', $context));
- echo ' ';
- data_print_rating_menu($record->id, $USER->id, $ratingsscale);
- $ratingsmenuused = true;
-
- } else {
- data_print_ratings_mean($record->id, $ratingsscale, true);
- }
-
- if ($data->scale < 0) {
- if ($scale = $DB->get_record('scale', array('id'=>abs($data->scale)))) {
- echo $OUTPUT->help_icon_scale($data->course, $scale);
- }
- }
-
- if ($ratingsmenuused) {
- echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
- echo '<input type="submit" value="'.get_string('sendinratings', 'data').'" />';
- }
- echo '</form>';
- echo '</div>';
- }
- }*/
global $OUTPUT;
if( !empty($record->rating) ){
echo $OUTPUT->render($record->rating);
$string['addanewquestion'] = 'Add a new question';
$string['addanewtopic'] = 'Add a new topic';
$string['advancedsearch'] = 'Advanced search';
-$string['aggregateavg'] = 'Average of ratings';
-$string['aggregatecount'] = 'Count of ratings';
-$string['aggregatecountformat'] = '{$a->count} (grade: {$a->grade})';
-$string['aggregatemax'] = 'Maximum rating';
-$string['aggregatemin'] = 'Minimum rating';
-$string['aggregatenone'] = 'No ratings';
-$string['aggregatesum'] = 'Sum of ratings';
-$string['ajaxrating'] = 'Enable AJAX rating';
$string['allforums'] = 'All forums';
$string['allowdiscussions'] = 'Can a {$a} post to this forum?';
-$string['allowratings'] = 'Allow posts to be rated?';
$string['allowsallsubscribe'] = 'This forum allows everyone to choose whether to subscribe or not';
$string['allowsdiscussions'] = 'This forum allows each person to start one discussion topic.';
$string['allsubscribe'] = 'Subscribe to all forums';
$string['completionreplies'] = 'Student must post replies:';
$string['completionrepliesgroup'] = 'Require replies';
$string['completionreplieshelp'] = 'requiring replies to complete';
-$string['configajaxrating'] = 'AJAX rating is a forum rating usability improvement. If enabled, users can rate forum posts almost instantly without needing to scroll to the bottom of the page and click the \'Send in my latest ratings\' button. This setting also requires AJAX to be enabled for the site and in user profiles.';
$string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.';
$string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.';
$string['configenablerssfeeds'] = 'This switch will enable the possibility of RSS feeds for all forums. You will still need to turn feeds on manually in the settings for each forum.';
$string['configtrackreadposts'] = 'Set to \'yes\' if you want to track read/unread for each user.';
$string['configusermarksread'] = 'If \'yes\', the user must manually mark a post as read. If \'no\', when the post is viewed it is marked as read.';
$string['couldnotadd'] = 'Could not add your post due to an unknown error';
-$string['couldnotdeleteratings'] = 'Sorry, that cannot be deleted as people have already rated it';
$string['couldnotdeletereplies'] = 'Sorry, that cannot be deleted as people have already responded to it';
$string['couldnotupdate'] = 'Could not update your post due to an unknown error';
$string['delete'] = 'Delete';
$string['invalidforumid'] = 'Forum ID was incorrect';
$string['invalidparentpostid'] = 'Parent post ID was incorrect';
$string['invalidpostid'] = 'Invalid Post ID - {$a}';
-$string['invalidrate'] = 'Invalid rate ({$a})';
$string['lastpost'] = 'Last post';
$string['learningforums'] = 'Learning forums';
$string['logblocked'] = 'Log blocked emails';
$string['nodiscussions'] = 'There are no discussion topics yet in this forum';
$string['nodiscussionsstartedby'] = 'No discussions started by this user';
$string['noguestpost'] = 'Sorry, guests are not allowed to post.';
-$string['noguestrate'] = 'Guests are not allowed to rate entries.';
$string['noguestsubscribe'] = 'Sorry, guests are not allowed to subscribe to receive forum postings by email.';
$string['noguesttracking'] = 'Sorry, guests are not allowed to set tracking options.';
$string['nomorepostscontaining'] = 'No more posts containing \'{$a}\' were found';
$string['noposts'] = 'No posts';
$string['nopostscontaining'] = 'No posts containing \'{$a}\' were found';
$string['noquestions'] = 'There are no questions yet in this forum';
-$string['norate'] = 'Rating of items not allowed!';
-$string['noratinggiven'] = 'No rating given';
-$string['noresult'] = 'No ratings for this post: {$a}';
$string['nosubscribers'] = 'There are no subscribers yet for this forum';
$string['notexists'] = 'Discussion no longer exists';
$string['nothingnew'] = 'Nothing new for {$a}';
$string['notinstalled'] = 'The forum module is not installed';
$string['notpartofdiscussion'] = 'This post is not part of a discussion!';
$string['notrackforum'] = 'Don\'t track unread posts';
-$string['noviewanyrate'] = 'You can only look at results for posts that you made';
$string['noviewdiscussionspermission'] = 'You do not have the permission to view discussions in this forum';
-$string['noviewrate'] = 'You do not have the capability to view post ratings';
$string['nowallsubscribed'] = 'All forums in {$a} are subscribed.';
$string['nowallunsubscribed'] = 'All forums in {$a} are not subscribed.';
$string['nownotsubscribed'] = '{$a->name} will NOT receive copies of \'{$a->forum}\' by email.';
$string['pruneheading'] = 'Split the discussion and move this post to a new discussion';
$string['qandaforum'] = 'Q and A forum';
$string['qandanotify'] = 'This is a Question and Answer forum. In order to see other responses to these Questions, you must first post your Answer';
-$string['rate'] = 'Rate';
-$string['rating'] = 'Rating';
-$string['ratingeveryone'] = 'Everyone can rate posts';
-$string['ratingno'] = 'No ratings';
-$string['ratingonlyteachers'] = 'Only {$a} can rate posts';
-$string['ratingpublic'] = '{$a} can see everyone\'s ratings';
-$string['ratingpublicnot'] = '{$a} can only see their own ratings';
-$string['ratings'] = 'Ratings';
-$string['ratingssaved'] = 'Ratings saved';
$string['re'] = 'Re:';
$string['readtherest'] = 'Read the rest of this topic';
$string['replies'] = 'Replies';
$string['searchwhichforums'] = 'Choose which forums to search';
$string['searchwords'] = 'These words can appear anywhere in the post';
$string['seeallposts'] = 'See all posts made by this user';
-$string['sendinratings'] = 'Send in my latest ratings';
$string['shortpost'] = 'Short post';
$string['showsubscribers'] = 'Show/edit current subscribers';
$string['singleforum'] = 'A single simple discussion';
$string['viewalldiscussions'] = 'View all discussions';
$string['warnafter'] = 'Post threshold for warning';
$string['warnafter_help'] = 'Students can be warned as they approach the maximum number of posts allowed in a given period. This setting specifies after how many posts they are warned. Users with the capability mod/forum:postwithoutthrottling are exempt from post limits.';
-$string['youratedthis'] = 'You rated this';
$string['yournewquestion'] = 'Your new question';
$string['yournewtopic'] = 'Your new discussion topic';
$string['yourreply'] = 'Your reply';
if (!empty($confirm) && confirm_sesskey()) { // User has confirmed the delete
if ($post->totalscore) {
- notice(get_string("couldnotdeleteratings", "forum"),
+ notice(get_string('couldnotdeleteratings', 'rating'),
forum_go_back_to("discuss.php?d=$post->discussion"));
} else if ($replycount && !has_capability('mod/forum:deleteanypost', $modcontext)) {
$settings->add(new admin_setting_configcheckbox('forum_logblocked', get_string('logblocked', 'forum'),
get_string('configlogblocked', 'forum'), 1));
-
- //no using the central ajax setting for ratings. MDL-21657
- //$settings->add(new admin_setting_configcheckbox('forum_ajaxrating', get_string('ajaxrating', 'forum'),
- // get_string('configajaxrating', 'forum'), 0));
}
$string['allowduplicatedentries_help'] = 'If enabled, multiple entries can have the same concept name.';
$string['allowprintview'] = 'Allow print view';
$string['allowprintview_help'] = 'If enabled, students are provided with a link to a printer-friendly version of the glossary. The link is always available to teachers.';
-$string['allowratings'] = 'Allow entries to be rated?';
$string['answer'] = 'Answer';
$string['approve'] = 'Approve';
$string['areyousuredelete'] = 'Are you sure you want to delete this entry?';
$string['importentries'] = 'Import entries';
$string['importentriesfromxml'] = 'Import entries from XML file';
$string['includegroupbreaks'] = 'Include group breaks';
-$string['invalidrate'] = 'Invalid glossary rate ({$a})';
$string['isglobal'] = 'Is this glossary global?';
$string['isglobal_help'] = 'A global glossary has entries which are linked to from throughout the site, rather than only in the course that the glossary is in. Only administrators can set a glossary as global.';
$string['letter'] = 'letter';
$string['printerfriendly'] = 'Printer-friendly version';
$string['printviewnotallowed'] = 'Print view isn\'t allowed';
$string['question'] = 'Question';
-$string['rate'] = 'Rate';
-$string['rating'] = 'Rating';
-$string['ratingeveryone'] = 'Everyone can rate entries';
-$string['ratingno'] = 'No ratings';
-$string['ratingonlyteachers'] = 'Only {$a} can rate entries';
-$string['ratingonlywithpermissions'] = 'Only people with permission to rate entries';
-$string['ratings'] = 'Ratings';
-$string['ratingssaved'] = 'Ratings saved';
-$string['ratingtime'] = 'Restrict ratings to entries with dates in this range:';
$string['rejectedentries'] = 'Rejected entries';
$string['rejectionrpt'] = 'Rejection Report';
$string['resetglossaries'] = 'Delete entries from';
$string['rsstype_help'] = 'To enable the RSS feed for this activity, select either concepts with author or concepts without author to be included in the feed.';
$string['searchindefinition'] = 'Search full text';
$string['secondaryglossary'] = 'Secondary glossary';
-$string['sendinratings'] = 'Send in my latest ratings';
$string['showall'] = 'Show \'ALL\' link';
$string['showall_help'] = 'If enabled, participants can browse all entries at once.';
$string['showalphabet'] = 'Show alphabet';
echo "<th class=\"header\" scope=\"col\"><a href=\"index.php?$sortargs&sort=time\">$strtime</a></th>";
echo "</tr>";
+ $maxrating = count($scalemenu);
foreach ($ratings as $rating) {
//Undo the aliasing of the user id column from user_picture::fields()
//we could clone the rating object or preserve the rating id if we needed it again
echo $OUTPUT->user_picture($rating);
}
echo '</td><td>'.fullname($rating).'</td>';
+
+ //if they've switched to rating out of 5 but there were ratings submitted out of 10 for example
+ //Not doing this within $rm->get_all_ratings_for_item to allow access to the raw data
+ if ($rating->rating > $maxrating) {
+ $rating->rating = $maxrating;
+ }
echo '<td style="white-space:nowrap" align="center" class="rating">'.$scalemenu[$rating->rating]."</td>";
echo '<td style="white-space:nowrap" align="center" class="time">'.userdate($rating->timemodified)."</td>";
echo "</tr>\n";
* @return array
*/
public function get_aggregate_types() {
- return array (RATING_AGGREGATE_NONE => get_string('aggregatenone', 'forum'),
- RATING_AGGREGATE_AVERAGE => get_string('aggregateavg', 'forum'),
- RATING_AGGREGATE_COUNT => get_string('aggregatecount', 'forum'),
- RATING_AGGREGATE_MAXIMUM => get_string('aggregatemax', 'forum'),
- RATING_AGGREGATE_MINIMUM => get_string('aggregatemin', 'forum'),
- RATING_AGGREGATE_SUM => get_string('aggregatesum', 'forum'));
+ return array (RATING_AGGREGATE_NONE => get_string('aggregatenone', 'rating'),
+ RATING_AGGREGATE_AVERAGE => get_string('aggregateavg', 'rating'),
+ RATING_AGGREGATE_COUNT => get_string('aggregatecount', 'rating'),
+ RATING_AGGREGATE_MAXIMUM => get_string('aggregatemax', 'rating'),
+ RATING_AGGREGATE_MINIMUM => get_string('aggregatemin', 'rating'),
+ RATING_AGGREGATE_SUM => get_string('aggregatesum', 'rating'));
}
/**
$scaleid = required_param('scaleid', PARAM_INT);
$userrating = required_param('rating', PARAM_INT);
$rateduserid = required_param('rateduserid', PARAM_INT);//which user is being rated. Required to update their grade
-$aggregationmethod = optional_param('aggregation', PARAM_INT);//we're going to calculate the aggregate and return it to the client
+$aggregationmethod = optional_param('aggregation', RATING_AGGREGATE_NONE, PARAM_INT);//we're going to calculate the aggregate and return it to the client
$result = new stdClass;