]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12496, MDL-11889 allow deleting of activities with disabled grading from gradeboo...
authorskodak <skodak>
Tue, 18 Dec 2007 17:38:22 +0000 (17:38 +0000)
committerskodak <skodak>
Tue, 18 Dec 2007 17:38:22 +0000 (17:38 +0000)
grade/edit/tree/index.php

index 7bbfbf9d5a065b10b3314533bf72784790d0f70c..a19bd48ff771db7802a9833892c8f987167a4de6 100644 (file)
@@ -77,8 +77,9 @@ $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!
+            if ($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item() and $object->gradetype != GRADE_TYPE_NONE) {
+                // no deleting of external activities - they would be recreated anyway!
+                // exception is activity without grading
                 break;
             }
             $confirm = optional_param('confirm', 0, PARAM_BOOL);
@@ -189,7 +190,7 @@ 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)) {
-        if (!($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item())) {
+        if (!($element['type'] == 'item' and $object->is_external_item() and !$object->is_outcome_item() and $object->gradetype != GRADE_TYPE_NONE)) {
             $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>';