MDL-26464: remove 'add entry' link on setting block when it reachs the max number of records. Link removal does not apply to user who has data:manageentries capability (eg: teacher).

This commit is contained in:
Rossiani Wijaya
2011-03-11 10:03:14 +08:00
parent c09604234a
commit e4e9611570
3 changed files with 19 additions and 9 deletions
+2 -2
View File
@@ -190,7 +190,7 @@ if ($datarecord = data_submitted() and confirm_sesskey()) {
} else { /// Add some new records
if (!data_user_can_add_entry($data, $currentgroup, $groupmode)) {
if (!data_user_can_add_entry($data, $currentgroup, $groupmode, $context)) {
print_error('cannotadd', 'data');
}
@@ -317,7 +317,7 @@ echo '<div class="mdl-align"><input type="submit" name="saveandview" value="'.ge
if ($rid) {
echo '&nbsp;<input type="submit" name="cancel" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
} else {
if ( (!$data->maxentries) || (data_numentries($data)<($data->maxentries-1)) ) {
if ((!$data->maxentries) || has_capability('mod/data:manageentries', $context) || (data_numentries($data) < ($data->maxentries - 1))) {
echo '&nbsp;<input type="submit" value="'.get_string('saveandadd','data').'" />';
}
}