MDL-19797 Optimising output code for the Edit grades categories and items interface

This commit is contained in:
nicolasconnault
2009-08-25 07:31:13 +00:00
parent fbe52a393f
commit 54a007e8f6
5 changed files with 458 additions and 166 deletions
+12 -15
View File
@@ -133,8 +133,16 @@ $strcategoriesanditems = get_string('categoriesanditems', 'grades');
$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid));
$moving = false;
$movingeid = false;
$grade_edit_tree = new grade_edit_tree($gtree, $moving, $gpr);
if ($action == 'moveselect') {
if ($eid and confirm_sesskey()) {
$movingeid = $eid;
$moving=true;
}
}
$grade_edit_tree = new grade_edit_tree($gtree, $movingeid, $gpr);
switch ($action) {
case 'delete':
@@ -193,13 +201,6 @@ switch ($action) {
}
break;
case 'moveselect':
if ($eid and confirm_sesskey()) {
$grade_edit_tree->moving = $eid;
$moving=true;
}
break;
default:
break;
}
@@ -304,11 +305,7 @@ echo '<form id="gradetreeform" method="post" action="'.$returnurl.'">';
echo '<div>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
// Build up an array of categories for move drop-down (by reference)
$categories = array();
$level = 0;
$row_count = 0;
echo $grade_edit_tree->build_html_tree($gtree->top_element, true, array(), $categories, $level, $row_count);
echo $OUTPUT->table($grade_edit_tree->table);
echo '<div id="gradetreesubmit">';
if (!$moving) {
@@ -316,12 +313,12 @@ if (!$moving) {
}
// We don't print a bulk move menu if there are no other categories than course category
if (!$moving && count($categories) > 1) {
if (!$moving && count($grade_edit_tree->categories) > 1) {
echo '<br /><br />';
echo '<input type="hidden" name="bulkmove" value="0" id="bulkmoveinput" />';
echo get_string('moveselectedto', 'grades') . ' ';
$select = new html_select();
$select->options = $categories;
$select->options = $grade_edit_tree->categories;
$select->name = 'moveafter';
$select->disabled = true;
$select->id = 'menumoveafter';