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:
sam_marshall
2008-07-29 17:22:47 +00:00
parent 96fa52a47c
commit 18a2a0cb3a
12 changed files with 89 additions and 5 deletions
+11 -1
View File
@@ -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;
}
}
?>
+4 -1
View File
@@ -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!
?>
+10
View File
@@ -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
View File
@@ -166,5 +166,7 @@
print_footer($course);
/// Mark as viewed
$completion=new completion_info($course);
$completion->set_module_viewed($cm);
?>
+11
View File
@@ -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;
}
}
?>
+4
View File
@@ -661,4 +661,8 @@
}
print_footer($course);
/// Mark as viewed
$completion=new completion_info($course);
$completion->set_module_viewed($cm);
?>
+12
View File
@@ -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;
}
}
?>
+3 -1
View File
@@ -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);
?>
+12
View File
@@ -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;
}
}
?>
+3
View File
@@ -1031,4 +1031,7 @@
/// Finish the page
print_footer($course);
/// Mark as viewed
$completion=new completion_info($course);
$completion->set_module_viewed($cm);
?>
+11
View File
@@ -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;
}
}
?>
+5 -1
View File
@@ -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();
?>