This commit is contained in:
skodak 2007-10-19 08:51:52 +00:00
parent deb2988f39
commit d297269d79
13 changed files with 284 additions and 162 deletions

View file

@ -187,35 +187,9 @@ function get_grade_tree(&$gtree, $element, $current_itemid=null, $errors=null) {
}
}
$icon = '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="icon" alt=""/>' . "\n";
$icon = $gtree->get_element_icon($element);
$last = '';
$catcourseitem = false;
switch ($type) {
case 'item':
if ($object->itemtype == 'mod') {
$icon = '<img src="'.$CFG->modpixpath.'/'.$object->itemmodule.'/icon.gif" class="icon" alt="'
. get_string('modulename', $object->itemmodule).'"/>' . "\n";
} else if ($object->itemtype == 'manual') {
//TODO: add manual grading icon
if (empty($object->outcomeid)) {
$icon = '<img src="'.$CFG->pixpath.'/t/edit.gif" class="icon" alt="'
. get_string('manualgrade', 'grades').'"/>' . "\n"; // TODO: localize
} else {
$icon = '<img src="'.$CFG->pixpath.'/i/outcomes.gif" class="icon" alt="'
. get_string('outcome', 'grades').'"/>' . "\n";
}
}
break;
case 'courseitem':
case 'categoryitem':
$icon = '<img src="'.$CFG->pixpath.'/i/category_grade.gif" class="icon" alt="'.get_string('categorygrade').'"/>' . "\n"; // TODO: localize
$catcourseitem = true;
break;
case 'category':
$icon = '<img src="'.$CFG->pixpath.'/f/folder.gif" class="icon" alt="'.get_string('category').'"/>' . "\n";
break;
}
$catcourseitem = ($element['type'] == 'courseitem' or $element['type'] == 'categoryitem');
if ($type != 'category') {
$return_string .= '<li class="'.$type.'">'.$icon.$name.'</li>' . "\n";

View file

@ -42,7 +42,7 @@ class edit_category_form extends moodleform {
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'));
// visible elements
$mform->addElement('header', 'general', get_string('gradecategory', 'grades'));
$mform->addElement('header', 'gradecat', get_string('gradecategory', 'grades'));
$mform->addElement('text', 'fullname', get_string('categoryname', 'grades'));
if ($CFG->grade_aggregation == -1) {
@ -62,12 +62,14 @@ class edit_category_form extends moodleform {
$mform->addElement('static', 'aggregateonlygraded', get_string('aggregateonlygraded', 'grades'));
}
if (!empty($CFG->enableoutcomes) && $CFG->grade_aggregateoutcomes == -1) {
$mform->addElement('advcheckbox', 'aggregateoutcomes', get_string('aggregateoutcomes', 'grades'));
$mform->setHelpButton('aggregateoutcomes', array(false, get_string('aggregateoutcomes', 'grades'),
false, true, false, get_string('aggregateoutcomeshelp', 'grades')));
} else {
$mform->addElement('static', 'aggregateoutcomes', get_string('aggregateoutcomes', 'grades'));
if (!empty($CFG->enableoutcomes)) {
if($CFG->grade_aggregateoutcomes == -1) {
$mform->addElement('advcheckbox', 'aggregateoutcomes', get_string('aggregateoutcomes', 'grades'));
$mform->setHelpButton('aggregateoutcomes', array(false, get_string('aggregateoutcomes', 'grades'),
false, true, false, get_string('aggregateoutcomeshelp', 'grades')));
} else {
$mform->addElement('static', 'aggregateoutcomes', get_string('aggregateoutcomes', 'grades'));
}
}
if ($CFG->grade_aggregatesubcats == -1) {
@ -111,7 +113,7 @@ class edit_category_form extends moodleform {
}
// user preferences
$mform->addElement('header', 'general', get_string('userpreferences', 'grades'));
$mform->addElement('header', 'userpref', get_string('myreportpreferences', 'grades'));
$options = array(GRADE_REPORT_PREFERENCE_DEFAULT => get_string('default', 'grades'),
GRADE_REPORT_AGGREGATION_VIEW_FULL => get_string('fullmode', 'grades'),
GRADE_REPORT_AGGREGATION_VIEW_AGGREGATES_ONLY => get_string('aggregatesonly', 'grades'),
@ -158,9 +160,11 @@ class edit_category_form extends moodleform {
$agg_el->setValue($checkbox_values[$CFG->grade_aggregateonlygraded]);
}
if ($CFG->grade_aggregateoutcomes != -1) {
$agg_el =& $mform->getElement('aggregateoutcomes');
$agg_el->setValue($checkbox_values[$CFG->grade_aggregateoutcomes]);
if (!empty($CFG->enableoutcomes)) {
if ($CFG->grade_aggregateoutcomes != -1) {
$agg_el =& $mform->getElement('aggregateoutcomes');
$agg_el->setValue($checkbox_values[$CFG->grade_aggregateoutcomes]);
}
}
if ($CFG->grade_aggregatesubcats != -1) {

View file

@ -201,35 +201,9 @@ function print_grade_tree(&$gtree, $element, $moving, &$gpr, $switch, $switchedl
$actions .= $gtree->get_hiding_icon($element, $gpr);
/// prepare icon
$icon = '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="icon" alt=""/>';
$icon = $gtree->get_element_icon($element);
$last = '';
$catcourseitem = false;
switch ($element['type']) {
case 'item':
if ($object->itemtype == 'mod') {
$icon = '<img src="'.$CFG->modpixpath.'/'.$object->itemmodule.'/icon.gif" class="icon" alt="'
. get_string('modulename', $object->itemmodule).'"/>';
} else if ($object->itemtype == 'manual') {
//TODO: add manual grading icon
if (empty($object->outcomeid)) {
$icon = '<img src="'.$CFG->pixpath.'/t/edit.gif" class="icon" alt="'
. get_string('manualgrade', 'grades').'"/>'; // TODO: localize
} else {
$icon = '<img src="'.$CFG->pixpath.'/i/outcomes.gif" class="icon" alt="'
. get_string('outcome', 'grades').'"/>';
}
}
break;
case 'courseitem':
case 'categoryitem':
$icon = '<img src="'.$CFG->pixpath.'/i/category_grade.gif" class="icon" alt="'.get_string('categorygrade').'"/>'; // TODO: localize
$catcourseitem = true;
break;
case 'category':
$icon = '<img src="'.$CFG->pixpath.'/f/folder.gif" class="icon" alt="'.get_string('category').'"/>';
break;
}
$catcourseitem = ($element['type'] == 'courseitem' or $element['type'] == 'categoryitem');
/// prepare move target if needed
$moveto = '';