Skip to content

Commit

Permalink
MFC: MDL-11995 prevent deleting of grade items attached to external a…
Browse files Browse the repository at this point in the history
…ctivities
  • Loading branch information
skodak committed Nov 1, 2007
1 parent 915e268 commit 0a48ba0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions grade/edit/tree/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
switch ($action) {
case 'delete':
if ($eid) {
if ($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item()) {
// no deleting of external activities!
break;
}
$confirm = optional_param('confirm', 0, PARAM_BOOL);

if ($confirm and confirm_sesskey()) {
Expand Down Expand Up @@ -185,9 +189,11 @@ function print_grade_tree(&$gtree, $element, $moving, &$gpr, $switch, $switchedl
$actions .= $gtree->get_calculation_icon($element, $gpr);

if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
$actions .= '<a href="index.php?id='.$COURSE->id.'&amp;action=delete&amp;eid='
. $eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'
. $strdelete.'" title="'.$strdelete.'"/></a>';
if (!($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item())) {
$actions .= '<a href="index.php?id='.$COURSE->id.'&amp;action=delete&amp;eid='
. $eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'
. $strdelete.'" title="'.$strdelete.'"/></a>';
}
$actions .= '<a href="index.php?id='.$COURSE->id.'&amp;action=moveselect&amp;eid='
. $eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/move.gif" class="iconsmall" alt="'
. $strmove.'" title="'.$strmove.'"/></a>';
Expand Down

0 comments on commit 0a48ba0

Please sign in to comment.