MDL-15498: Completion: added support for basic completion-on-view and on grade (where applicable) to assignment, choice, data, glossary, lesson, and resource.
This commit is contained in:
+11
-1
@@ -3180,5 +3180,15 @@ class assignment_portfolio_caller extends portfolio_module_caller_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function assignment_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
$assignmentclass = "assignment_$assignment->assignmenttype";
|
||||
$assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
|
||||
|
||||
$assignmentinstance->view(); // Actually display the assignment!
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$assignmentinstance->view(); // Actually display the assignment!
|
||||
?>
|
||||
|
||||
@@ -749,4 +749,14 @@ function chice_get_extra_capabilities() {
|
||||
return array('moodle/site:accessallgroups');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function choice_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
+3
-1
@@ -166,5 +166,7 @@
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
?>
|
||||
|
||||
@@ -2270,4 +2270,15 @@ function data_get_extra_capabilities() {
|
||||
return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function data_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -661,4 +661,8 @@
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
?>
|
||||
|
||||
@@ -2306,4 +2306,16 @@ function glossary_get_extra_capabilities() {
|
||||
return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/site:trustcontent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function glossary_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -518,7 +518,9 @@
|
||||
glossary_print_tabbed_table_end();
|
||||
|
||||
/// Finish the page
|
||||
|
||||
print_footer($course);
|
||||
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
?>
|
||||
|
||||
@@ -705,4 +705,16 @@ function lesson_get_extra_capabilities() {
|
||||
return array('moodle/site:accessallgroups');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function lesson_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1031,4 +1031,7 @@
|
||||
/// Finish the page
|
||||
print_footer($course);
|
||||
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
?>
|
||||
|
||||
@@ -752,4 +752,15 @@ class resource_portfolio_caller extends portfolio_module_caller_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $feature FEATURE_xx constant for requested feature
|
||||
* @return mixed True if module supports feature, null if doesn't know
|
||||
*/
|
||||
function resource_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
$resourceclass = 'resource_'.$resource->type;
|
||||
$resourceinstance = new $resourceclass($cm->id);
|
||||
|
||||
$resourceinstance->display();
|
||||
// Mark activity viewed before we display it because some resource types
|
||||
// do not return from display()
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$resourceinstance->display();
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user