Skip to content

Commit

Permalink
MDL-11966 fixed typo in grader report causing fatal errors
Browse files Browse the repository at this point in the history
MDL-11993 refactored code for item headers and icons
  • Loading branch information
skodak committed Nov 1, 2007
1 parent 8082d19 commit 6cc3e35
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 369 deletions.
2 changes: 1 addition & 1 deletion grade/edit/tree/calculation.php
Expand Up @@ -187,7 +187,7 @@ function get_grade_tree(&$gtree, $element, $current_itemid=null, $errors=null) {
}
}

$icon = $gtree->get_element_icon($element);
$icon = $gtree->get_element_icon($element, true);
$last = '';
$catcourseitem = ($element['type'] == 'courseitem' or $element['type'] == 'categoryitem');

Expand Down
33 changes: 13 additions & 20 deletions grade/edit/tree/index.php
Expand Up @@ -174,8 +174,15 @@ function print_grade_tree(&$gtree, $element, $moving, &$gpr, $switch, $switchedl
$object = $element['object'];
$eid = $element['eid'];

$header = $gtree->get_element_header($element, true, true, true);

if ($object->is_hidden()) {
$header = '<span class="dimmed_text">'.$header.'</span>';
}

/// prepare actions
$actions = $gtree->get_edit_icon($element, $gpr);
$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='
Expand All @@ -186,26 +193,12 @@ function print_grade_tree(&$gtree, $element, $moving, &$gpr, $switch, $switchedl
. $strmove.'" title="'.$strmove.'"/></a>';
}

$actions .= $gtree->get_locking_icon($element, $gpr);

$name = $object->get_name();

//TODO: improve outcome visualisation
if ($element['type'] == 'item' and !empty($object->outcomeid)) {
$name = $name.' ('.get_string('outcome', 'grades').')';
}

if ($object->is_hidden()) {
$name = '<span class="dimmed_text">'.$name.'</span>';
}
$actions .= $gtree->get_hiding_icon($element, $gpr);
$actions .= $gtree->get_locking_icon($element, $gpr);

/// prepare icon
$icon = $gtree->get_element_icon($element);
/// prepare move target if needed
$last = '';
$catcourseitem = ($element['type'] == 'courseitem' or $element['type'] == 'categoryitem');

/// prepare move target if needed
$moveto = '';
if ($moving) {
$actions = ''; // no action icons when moving
Expand All @@ -217,21 +210,21 @@ function print_grade_tree(&$gtree, $element, $moving, &$gpr, $switch, $switchedl
/// print the list items now
if ($moving == $eid) {
// do not diplay children
echo '<li class="'.$element['type'].' moving">'.$icon.$name.'('.get_string('move').')</li>';
echo '<li class="'.$element['type'].' moving">'.$header.'('.get_string('move').')</li>';

} else if ($element['type'] != 'category') {
if ($catcourseitem and $switch) {
if ($switchedlast) {
echo '<li class="'.$element['type'].'">'.$icon.$name.$actions.'</li>';
echo '<li class="'.$element['type'].'">'.$header.$actions.'</li>';
} else {
echo $moveto;
}
} else {
echo '<li class="'.$element['type'].'">'.$icon.$name.$actions.'</li>'.$moveto;
echo '<li class="'.$element['type'].'">'.$header.$actions.'</li>'.$moveto;
}

} else {
echo '<li class="'.$element['type'].'">'.$icon.$name.$actions;
echo '<li class="'.$element['type'].'">'.$header.$actions;
echo '<ul class="catlevel'.$element['depth'].'">';
$last = null;
foreach($element['children'] as $child_el) {
Expand Down

0 comments on commit 6cc3e35

Please sign in to comment.