From: nicolasconnault Date: Wed, 19 Sep 2007 14:12:34 +0000 (+0000) Subject: MDL-11340 Finished! X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=109bf12cdaf66ea8c95fc9da49f73d4395644a9b;p=moodle.git MDL-11340 Finished! --- diff --git a/grade/edit/gradedisplay/gradedisplay_form.php b/grade/edit/gradedisplay/gradedisplay_form.php index abbce701c2..e2f02d8a76 100644 --- a/grade/edit/gradedisplay/gradedisplay_form.php +++ b/grade/edit/gradedisplay/gradedisplay_form.php @@ -20,7 +20,7 @@ class edit_grade_display_form extends moodleform { GRADE_REPORT_GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades')); $mform->addElement('select', 'gradedisplaytype', get_string('coursegradedisplaytype', 'grades'), $gradedisplaytypes); $mform->setHelpButton('gradedisplaytype', array(false, get_string('coursegradedisplaytype', 'grades'), - false, true, false, get_string('coursegradedisplaytypehelp', 'grades'))); + false, true, false, get_string('configcoursegradedisplaytype', 'grades'))); $mform->setDefault('gradedisplaytype', $coursegradedisplaytype); $mform->setType($coursegradedisplaytype, PARAM_INT); @@ -84,7 +84,8 @@ class edit_grade_display_form extends moodleform { $mform->disabledIf($gradeboundaryname, 'override'); } - $mform->addElement('submit', 'action', get_string('addelement', 'grades')); + $mform->addElement('submit', 'addgradeletter', get_string('addgradeletter', 'grades')); + $mform->disabledIf('addgradeletter', 'override'); } // hidden params diff --git a/grade/edit/gradedisplay/index.php b/grade/edit/gradedisplay/index.php index aa67506b62..22d035403d 100644 --- a/grade/edit/gradedisplay/index.php +++ b/grade/edit/gradedisplay/index.php @@ -7,8 +7,8 @@ require_once $CFG->libdir.'/gradelib.php'; require_once $CFG->dirroot.'/grade/report/lib.php'; require_once 'gradedisplay_form.php'; -$courseid = optional_param('id', 0, PARAM_INT); -$action = optional_param('action', '', PARAM_ALPHA); +$courseid = optional_param('id', 0, PARAM_INT); +$addgradeletter = optional_param('addgradeletter', null, PARAM_ALPHANUM); /// Make sure they can even access this course if ($courseid) { @@ -23,18 +23,13 @@ if ($courseid) { admin_externalpage_setup('scales'); } -$straddelement = get_string('addelement', 'grades'); -switch ($action) { - case $straddelement: - // Insert a record in the grade_letters table, with 0 as lower boundary and ' - ' as letter - $record = new stdClass(); - $record->contextid = $context->id; - $record->letter = '-'; - $record->lowerboundary = 0; - insert_record('grade_letters', $record); - break; - default: - break; +if (!empty($addgradeletter)) { + // Insert a record in the grade_letters table, with 0 as lower boundary and ' - ' as letter + $record = new stdClass(); + $record->contextid = $context->id; + $record->letter = 'A'; + $record->lowerboundary = 0; + insert_record('grade_letters', $record); } $course_has_letters = get_field('grade_letters', 'contextid', 'contextid', $context->id); @@ -43,7 +38,7 @@ $course_has_letters = get_field('grade_letters', 'contextid', 'contextid', $cont $gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'gradedisplay', 'courseid'=>$courseid)); $returnurl = $gpr->get_return_url($CFG->wwwroot.'/grade/edit/gradedisplay/index.php?id='.$course->id); -$mform = new edit_grade_display_form(null, array('gpr'=>$gpr, 'course_has_letters' => $course_has_letters, 'action' => $action)); +$mform = new edit_grade_display_form(null, array('gpr'=>$gpr, 'course_has_letters' => $course_has_letters)); if ($mform->is_cancelled()) { redirect($returnurl); @@ -96,15 +91,14 @@ if ($mform->is_cancelled()) { } } } - } else { - } - - redirect($returnurl, get_string('coursegradedisplayupdated', 'grades')); + if (!isset($data->addgradeletter)) { + redirect($returnurl, get_string('coursegradedisplayupdated', 'grades')); + } } $strgrades = get_string('grades'); -$pagename = get_string('gradedisplay'); +$pagename = get_string('gradedisplay', 'grades'); $navigation = grade_build_nav(__FILE__, $pagename, array('courseid' => $courseid)); @@ -114,31 +108,6 @@ $stredit = get_string('edit'); $strused = get_string('used'); $stredit = get_string('edit'); -switch ($action) { - case 'delete': - if (!confirm_sesskey()) { - break; - } - $scaleid = required_param('scaleid', PARAM_INT); - if (!$scale = grade_scale::fetch(array('id'=>$scaleid))) { - break; - } - - if (empty($scale->courseid)) { - require_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM)); - } else if ($scale->courseid != $courseid) { - error('Incorrect courseid!'); - } - - if (!$scale->can_delete()) { - break; - } - - //TODO: add confirmation - $scale->delete(); - break; -} - if ($courseid) { /// Print header print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course)); diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index 44cf567c90..6f053664ce 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -7,6 +7,7 @@ $string['addcategory'] = 'Add Category'; $string['addcategoryerror'] = 'Could not add category.'; $string['addexceptionerror'] = 'Error occurred while adding exception for userid:gradeitem'; $string['addfeedback'] = 'Add Feedback'; +$string['addgradeletter'] = 'Add a grade letter'; $string['addidnumbers'] = 'Add id numbers'; $string['additem'] = 'Add Grade Item'; $string['addoutcomeitem'] = 'Add Outcome Item'; @@ -62,6 +63,7 @@ $string['configaggregationview'] = 'Each category can be displayed in three ways $string['configaveragesdecimalpoints'] = 'The number of decimal points to display for each average (group or whole), below a column of grades. This can be overriden per grading item.'; $string['configaveragesdisplaytype'] = 'Specifies how to display the averages for each column in the grader report. The default and recommended value is Inherit, which first checks the display type of each column, and if such is not set explicitly, defaults to the more general Grade Display Type. If other display types are selected, they ignore the individual settings for each column, and use exclusively the selected type.'; $string['configbulkcheckboxes'] = 'Checkboxes near each grade for Bulk grade operations.'; +$string['configcoursegradedisplaytype'] = 'Select the default display type of grades for this course. You can also select the site default value. Grades can be shown as real grades, as percentages (in reference to the minimum and maximum grades) or as letters (A, B, C etc..). Selecting Letters will allow you to define your own grade letters and boundaries.'; $string['configdecimalpoints'] = 'The number of decimal points to display for each grade. This can be overriden per grading item.'; $string['configenableajax'] = 'Adds a layer of AJAX functionality to the grader report, simplifying and speeding up common operations. Depends on Javascript being switched on at the user\'s browser level.'; $string['configenableoutcomes'] = 'Support for Outcomes (also known as Competencies, Goals, Standards or Criteria) means that we can grade things using one or more scales that are tied to outcome statements. Enabling outcomes makes such special grading possible throughout the site.'; @@ -89,8 +91,10 @@ $string['configstudentsperpage'] = 'The number of students to display per page i $string['configstudentsperpagedefault'] = 'The number of students to display per page in the grader report. Leave this field empty to use the site default (currently $a).'; $string['contract'] = 'Contract Category'; $string['coursegradecategory'] = 'Course grade category'; +$string['coursegradedisplaytype'] = 'Course grade display type'; $string['coursegradedisplayupdated'] = 'The course grade display type has been updated.'; $string['coursename'] = 'Course name'; +$string['coursesettings'] = 'Course settings'; $string['coursetotal'] = 'Course total'; $string['createcategory'] = 'Create Category'; $string['createcategoryerror'] = 'Could not create a new category'; @@ -175,6 +179,7 @@ $string['gradeitemnonmembers'] = 'Included in Grading'; $string['gradeitemremovemembers'] = 'Include in Grading'; $string['gradeitems'] = 'Grade items'; $string['gradeletter'] = 'Grade Letter'; +$string['gradeletters'] = 'Grade Letters'; $string['gradeletterhelp'] = 'Grade Letter Help'; $string['gradeletternote'] = 'To delete a grade letter just empty any of the
three text areas for that letter and click submit.'; $string['grademax'] = 'Maximum grade';