data MDL-23488 made database activity respect availability and visibility dates

AMOS BEGIN
 CPY [expired,mod_choice],[expired,mod_data]
 CPY [notopenyet,mod_choice],[notopenyet,mod_data]
AMOS END
This commit is contained in:
Andrew Davis 2010-07-29 03:26:02 +00:00
parent eb8d85c1d3
commit 2742ffe7c9
3 changed files with 17 additions and 0 deletions

View file

@ -173,6 +173,7 @@ $string['checkbox'] = 'Checkbox';
$string['chooseexportfields'] = 'Choose the fields you wish to export:'; $string['chooseexportfields'] = 'Choose the fields you wish to export:';
$string['chooseexportformat'] = 'Choose the format you wish to export to:'; $string['chooseexportformat'] = 'Choose the format you wish to export to:';
$string['chooseorupload'] = 'Choose file'; $string['chooseorupload'] = 'Choose file';
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
$string['importsuccess'] = 'The preset has been successfully applied.'; $string['importsuccess'] = 'The preset has been successfully applied.';
$string['insufficiententries'] = 'more entries needed to view this database'; $string['insufficiententries'] = 'more entries needed to view this database';
$string['intro'] = 'Introduction'; $string['intro'] = 'Introduction';
@ -242,6 +243,7 @@ $string['norecords'] = 'No entries in database';
$string['nosingletemplate'] = 'Single template is not yet defined'; $string['nosingletemplate'] = 'Single template is not yet defined';
$string['notapproved'] = 'Entry is not approved yet.'; $string['notapproved'] = 'Entry is not approved yet.';
$string['notinjectivemap'] = 'Not an injective map'; $string['notinjectivemap'] = 'Not an injective map';
$string['notopenyet'] = 'Sorry, this activity is not available until {$a}';
$string['number'] = 'Number'; $string['number'] = 'Number';
$string['numberrssarticles'] = 'RSS articles'; $string['numberrssarticles'] = 'RSS articles';
$string['numnotapproved'] = 'Pending'; $string['numnotapproved'] = 'Pending';

View file

@ -1946,6 +1946,12 @@ function data_user_can_add_entry($data, $currentgroup, $groupmode) {
return false; return false;
} }
//if in the view only time window
$now = time();
if ($now>$data->timeviewfrom && $now<$data->timeviewto) {
return false;
}
if (!$groupmode or has_capability('moodle/site:accessallgroups', $context)) { if (!$groupmode or has_capability('moodle/site:accessallgroups', $context)) {
return true; return true;
} }

View file

@ -368,6 +368,15 @@
} }
//if data activity closed dont let students in
if (!has_capability('mod/data:manageentries', $context)) {
$timenow = time();
if (!empty($data->timeavailablefrom) && $data->timeavailablefrom > $timenow) {
print_error('notopenyet', 'data', null, userdate($data->timeavailablefrom));
} else if (!empty($data->timeavailableto) && $timenow > $data->timeavailableto) {
print_error('expired', 'data', null, userdate($data->timeavailableto));
}
}
/// Print the tabs /// Print the tabs