]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11995 prevent deleting of grade items attached to external activities
authorskodak <skodak>
Thu, 1 Nov 2007 15:09:02 +0000 (15:09 +0000)
committerskodak <skodak>
Thu, 1 Nov 2007 15:09:02 +0000 (15:09 +0000)
grade/edit/tree/index.php

index 82988d9209636aca74e172c1f0d3ac3f45d67a7d..7bbfbf9d5a065b10b3314533bf72784790d0f70c 100644 (file)
@@ -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 .= '<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>';