Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
mod_feedback_structure Class Reference

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

Inheritance diagram for mod_feedback_structure:
mod_feedback_completion

Public Member Functions

 __construct ($feedback, $cm, $courseid=0, $templateid=null, $userid=0)
 Constructor.
 
 can_view_analysis ()
 Checks if current user is able to view feedback on this course.
 
 check_course_is_mapped ()
 Check whether the feedback is mapped to the given courseid.
 
 count_completed_responses ($groupid=0)
 Counts records from {feedback_completed} table for a given feedback.
 
 get_cm ()
 Current course module.
 
 get_completed_courses ()
 For the frontpage feedback returns the list of courses with at least one completed feedback.
 
 get_courseid ()
 Id of the current course (for site feedbacks only)
 
 get_feedback ()
 Current feedback.
 
 get_items ($hasvalueonly=false)
 Get all items in this feedback or this template.
 
 get_templateid ()
 Template id.
 
 is_already_submitted ($anycourseid=false)
 check for multiple_submit = false.
 
 is_anonymous ()
 Is this feedback anonymous?
 
 is_empty ()
 Is the items list empty?
 
 is_open ()
 Is this feedback open (check timeopen and timeclose)
 
 page_after_submit ()
 Returns the formatted text of the page after submit or null if it is not set.
 
 shuffle_anonym_responses ()
 If there are any new responses to the anonymous feedback, re-shuffle all responses and assign response number to each of them.
 

Protected Attributes

array $allcourses
 
array $allitems
 
cm_info $cm
 
int $courseid = 0
 course where the feedback is filled.
 
stdClass $feedback
 record from 'feedback' table.
 
int $templateid
 
int $userid
 

Detailed Description

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

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

mod_feedback_structure::__construct ( $feedback,
$cm,
$courseid = 0,
$templateid = null,
$userid = 0 )

Constructor.

Parameters
stdClass$feedbackfeedback object, in case of the template this is the current feedback the template is accessed from
stdClass | cm_info$cmcourse module object corresponding to the $feedback (at least one of $feedback or $cm is required)
int$courseidcurrent course (for site feedbacks only)
int$templateidtemplate id if this class represents the template structure
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).

Member Function Documentation

◆ can_view_analysis()

mod_feedback_structure::can_view_analysis ( )

Checks if current user is able to view feedback on this course.

Return values
bool

◆ count_completed_responses()

mod_feedback_structure::count_completed_responses ( $groupid = 0)

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

Parameters
int$groupid
Return values
mixedarray of found completeds otherwise false

◆ get_cm()

mod_feedback_structure::get_cm ( )

Current course module.

Return values
stdClass

◆ get_completed_courses()

mod_feedback_structure::get_completed_courses ( )

For the frontpage feedback returns the list of courses with at least one completed feedback.

Return values
arrayid=>name pairs of courses

◆ get_courseid()

mod_feedback_structure::get_courseid ( )

Id of the current course (for site feedbacks only)

Return values
stdClass

◆ get_feedback()

mod_feedback_structure::get_feedback ( )

Current feedback.

Return values
stdClass

◆ get_items()

mod_feedback_structure::get_items ( $hasvalueonly = false)

Get all items in this feedback or this template.

Parameters
bool$hasvalueonlyonly count items with a value.
Return values
arrayof objects from feedback_item with an additional attribute 'itemnr'

◆ get_templateid()

mod_feedback_structure::get_templateid ( )

Template id.

Return values
int

◆ is_already_submitted()

mod_feedback_structure::is_already_submitted ( $anycourseid = false)

check for multiple_submit = false.

if the feedback is global so the courseid must be given

Parameters
bool$anycourseidif true checks if this feedback was submitted in any course, otherwise checks $this->courseid . Applicable to frontpage feedbacks only
Return values
booltrue if the feedback already is submitted otherwise false

◆ is_anonymous()

mod_feedback_structure::is_anonymous ( )

Is this feedback anonymous?

Return values
bool

◆ is_empty()

mod_feedback_structure::is_empty ( )

Is the items list empty?

Return values
bool

◆ is_open()

mod_feedback_structure::is_open ( )

Is this feedback open (check timeopen and timeclose)

Return values
bool

◆ page_after_submit()

mod_feedback_structure::page_after_submit ( )

Returns the formatted text of the page after submit or null if it is not set.

Return values
string|null

Member Data Documentation

◆ $courseid

int mod_feedback_structure::$courseid = 0
protected

course where the feedback is filled.

For feedbacks that are NOT on the front page this is 0

◆ $feedback

stdClass mod_feedback_structure::$feedback
protected

record from 'feedback' table.

Reliably has fields: id, course, timeopen, timeclose, anonymous, completionsubmit. For full object or to access any other field use $this->get_feedback()


The documentation for this class was generated from the following file: