mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Adding 'get_coursemodule_info' to the standard available functions for assignment types. As a minimum, this allows assignment types to add their own icon (like resource does).
This commit is contained in:
parent
5d5ae618a8
commit
09ba8e56a9
1 changed files with 39 additions and 0 deletions
|
@ -1626,6 +1626,21 @@ class assignment_base {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a get_coursemodule_info function in case any assignment type wants to add 'extra' information
|
||||||
|
* for the course (see resource).
|
||||||
|
*
|
||||||
|
* Given a course_module object, this function returns any "extra" information that may be needed
|
||||||
|
* when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
|
||||||
|
*
|
||||||
|
* @param $coursemodule object The coursemodule object (record).
|
||||||
|
* @return object An object on information that the coures will know about (most noticeably, an icon).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function get_coursemodule_info($coursemodule) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} ////// End of the assignment_base class
|
} ////// End of the assignment_base class
|
||||||
|
|
||||||
|
|
||||||
|
@ -2399,6 +2414,30 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a get_coursemodule_info function in case any assignment type wants to add 'extra' information
|
||||||
|
* for the course (see resource).
|
||||||
|
*
|
||||||
|
* Given a course_module object, this function returns any "extra" information that may be needed
|
||||||
|
* when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
|
||||||
|
*
|
||||||
|
* @param $coursemodule object The coursemodule object (record).
|
||||||
|
* @return object An object on information that the coures will know about (most noticeably, an icon).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function assignment_get_coursemodule_info($coursemodule) {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
if (! $assignment = get_record('assignment', 'id', $coursemodule->instance)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once("$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php");
|
||||||
|
$assignmentclass = "assignment_$assignment->assignmenttype";
|
||||||
|
$ass = new $assignmentclass($coursemodule->id, $assignment);
|
||||||
|
|
||||||
|
return $ass->get_coursemodule_info($coursemodule);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue