diff --git a/backup/backuplib.php b/backup/backuplib.php index eab3b96..0365af5 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1089,6 +1089,21 @@ $context = get_context_instance(CONTEXT_MODULE, $tok); //Gets course_module data from db $course_module = get_records ("course_modules","id",$tok); + //check to see if timed mods should be hidden + // if (isset($preferences->hidetimedmods) && $preferences->hidetimedmods) { + require_once($CFG->dirroot.'/mod/'.$moduletype.'/backuplib.php'); + $testmodtimed = $moduletype.'_backup_timed_mod'; + if (function_exists($testmodtimed)) { + if (!$testmodtimed($course_module[$tok])) { + //don't back this module up yet. + $tok = strtok(","); + continue; + + } + + } + // } + //If it's the first, pring MODS tag if ($first_record) { fwrite ($bf,start_tag("MODS",4,true)); diff --git a/mod/choice/backuplib.php b/mod/choice/backuplib.php index bbbb63a..ed07b80 100644 --- a/mod/choice/backuplib.php +++ b/mod/choice/backuplib.php @@ -52,6 +52,14 @@ $choice = get_record('choice','id',$choice); } + //check to see if timed mods should be hidden + if (isset($preferences->hidetimedmods) && $preferences->hidetimedmods) { + if (!choice_backup_timed_mod($course_module->instance)) { + return false; + } + } + } + $status = true; //Start mod @@ -246,4 +254,18 @@ FROM {$CFG->prefix}choice_answers s WHERE s.choiceid = $instanceid"); } + //returns whether this choice is available yet, so it can be excluded from the backups. + function choice_backup_timed_mod($instance) { + + $choice = get_record('choice','id',$instance->instance); + + $timenow = time(); + if ($choice->timeclose !=0) { + if ($choice->timeopen > $timenow ) { + return false; + } + } + return true; + + } ?>