From: skodak Date: Thu, 1 Nov 2007 15:09:02 +0000 (+0000) Subject: MDL-11995 prevent deleting of grade items attached to external activities X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=61a5ee1647846b05728759d2d89b91ffae7d63c4;p=moodle.git MDL-11995 prevent deleting of grade items attached to external activities --- diff --git a/grade/edit/tree/index.php b/grade/edit/tree/index.php index 82988d9209..7bbfbf9d5a 100644 --- a/grade/edit/tree/index.php +++ b/grade/edit/tree/index.php @@ -77,6 +77,10 @@ $moving = false; 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()) { @@ -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 .= ''
-                 . $strdelete.''; + if (!($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item())) { + $actions .= ''
+                     . $strdelete.''; + } $actions .= ''
                  . $strmove.'';