Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Contains class mod_feedback_structure

Copyright: 2016 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 367 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: mod_feedback_structure  - X-Ref

Stores and manipulates the structure of the feedback or template (items, pages, etc.)

__construct($feedback, $cm, $courseid = 0, $templateid = null, $userid = 0)   X-Ref
Constructor

param: stdClass $feedback feedback object, in case of the template
param: stdClass|cm_info $cm course module object corresponding to the $feedback
param: int $courseid current course (for site feedbacks only)
param: int $templateid template id if this class represents the template structure
param: int $userid User id to use for all capability checks, etc. Set to 0 for current user (default).

get_feedback()   X-Ref
Current feedback

return: stdClass

get_cm()   X-Ref
Current course module

return: stdClass

get_courseid()   X-Ref
Id of the current course (for site feedbacks only)

return: stdClass

get_templateid()   X-Ref
Template id

return: int

is_open()   X-Ref
Is this feedback open (check timeopen and timeclose)

return: bool

get_items($hasvalueonly = false)   X-Ref
Get all items in this feedback or this template

param: bool $hasvalueonly only count items with a value.
return: array of objects from feedback_item with an additional attribute 'itemnr'

is_empty()   X-Ref
Is the items list empty?

return: bool

is_anonymous()   X-Ref
Is this feedback anonymous?

return: bool

page_after_submit()   X-Ref
Returns the formatted text of the page after submit or null if it is not set

return: string|null

can_view_analysis()   X-Ref
Checks if current user is able to view feedback on this course.

return: bool

is_already_submitted($anycourseid = false)   X-Ref
check for multiple_submit = false.
if the feedback is global so the courseid must be given

param: bool $anycourseid if true checks if this feedback was submitted in any course, otherwise checks $this->courseid .
return: bool true if the feedback already is submitted otherwise false

check_course_is_mapped()   X-Ref
Check whether the feedback is mapped to the given courseid.


shuffle_anonym_responses()   X-Ref
If there are any new responses to the anonymous feedback, re-shuffle all
responses and assign response number to each of them.


count_completed_responses($groupid = 0)   X-Ref
Counts records from {feedback_completed} table for a given feedback

If $groupid or $this->courseid is set, the records are filtered by the group/course

param: int $groupid
return: mixed array of found completeds otherwise false

get_completed_courses()   X-Ref
For the frontpage feedback returns the list of courses with at least one completed feedback

return: array id=>name pairs of courses