mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-10210 Added the grader report admin settings, and its correspondi…
…ng language strings. Few other minor edits.
- Loading branch information
nicolasconnault
committed
Jul 4, 2007
1 parent
28e2c55
commit 82b4da8
Showing
7 changed files
with
261 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php //$Id$ | ||
|
||
require_once '../../../config.php'; | ||
require_once $CFG->libdir.'/gradelib.php'; | ||
require_once 'edit_feedback_form.php'; | ||
|
||
$courseid = required_param('courseid', PARAM_INT); | ||
$id = optional_param('id', 0, PARAM_INT); | ||
|
||
if (!$course = get_record('course', 'id', $courseid)) { | ||
print_error('nocourseid'); | ||
} | ||
|
||
require_login($course); | ||
|
||
$context = get_context_instance(CONTEXT_COURSE, $course->id); | ||
//require_capability() here!! | ||
|
||
// default return url | ||
$returnurl = 'index.php?id='.$course->id; | ||
|
||
|
||
$mform = new edit_feedback_form(); | ||
if ($grade_text = get_record('grade_grades_text', 'gradeid', $id)) { | ||
$mform->set_data($grade_text); | ||
} else { | ||
$mform->set_data(array('courseid'=>$course->id)); | ||
} | ||
|
||
if ($mform->is_cancelled()) { | ||
redirect($returnurl); | ||
|
||
} else if ($data = $mform->get_data()) { | ||
$grade_text = new grade_grades_text(array('gradeid'=>$id)); | ||
grade_grades_text::set_properties($grade_text, $data); | ||
|
||
if (empty($grade_text->id)) { | ||
$grade_text->insert(); | ||
|
||
} else { | ||
$grade_text->update(); | ||
} | ||
|
||
redirect($returnurl); | ||
} | ||
|
||
// Get name of student and gradeitem name | ||
$query = "SELECT a.firstname, a.lastname, b.itemname, c.finalgrade, b.grademin, b.grademax | ||
FROM {$CFG->prefix}user AS a, | ||
{$CFG->prefix}grade_items AS b, | ||
{$CFG->prefix}grade_grades AS c | ||
WHERE c.id = $id | ||
AND b.id = c.itemid | ||
AND a.id = c.userid"; | ||
|
||
$extra_info = get_record_sql($query) ; | ||
$extra_info->grademin = round($extra_info->grademin); | ||
$extra_info->grademax = round($extra_info->grademax); | ||
$extra_info->finalgrade = round($extra_info->finalgrade); | ||
|
||
$stronascaleof = get_string('onascaleof', 'grades', $extra_info); | ||
$strgrades = get_string('grades'); | ||
$strgrade = get_string('grade'); | ||
$strgraderreport = get_string('graderreport', 'grades'); | ||
$strfeedbackedit = get_string('feedbackedit', 'grades'); | ||
$strstudent = get_string('student', 'grades'); | ||
$strgradeitem = get_string('gradeitem', 'grades'); | ||
|
||
$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'), | ||
array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&report=grader', 'type'=>'misc'), | ||
array('name'=>$strfeedbackedit, 'link'=>'', 'type'=>'misc')); | ||
|
||
$navigation = build_navigation($nav); | ||
|
||
|
||
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strfeedbackedit, $navigation, '', '', true, '', navmenu($course)); | ||
|
||
print_heading(get_string('feedbackedit', 'grades')); | ||
print_box_start('gradefeedbackbox generalbox'); | ||
echo "<p>$strstudent: " . fullname($extra_info) . "</p>"; | ||
echo "<p>$strgradeitem: " . $extra_info->itemname . "</p>"; | ||
if (!empty($extra_info->finalgrade)) { | ||
echo "<p>$strgrade: " . $extra_info->finalgrade . "$stronascaleof</p>"; | ||
} | ||
|
||
$mform->display(); | ||
|
||
print_box_end(); | ||
|
||
print_footer($course); | ||
die; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php //$Id$ | ||
|
||
require_once $CFG->libdir.'/formslib.php'; | ||
|
||
class edit_feedback_form extends moodleform { | ||
function definition() { | ||
global $CFG, $USER; | ||
$mform =& $this->_form; | ||
|
||
$feedbackformat = get_user_preferences('grade_report_feedbackformat', $CFG->grade_report_feedbackformat); | ||
|
||
// visible elements | ||
// User preference determines the format | ||
if ($CFG->htmleditor && $USER->htmleditor && $feedbackformat == GRADER_REPORT_FEEDBACK_FORMAT_HTML) { | ||
$mform->addElement('htmleditor', 'feedback', get_string('feedback', 'grades'), | ||
array('rows'=> '15', 'course' => optional_param('courseid', PARAM_INT), 'cols'=>'45')); | ||
} else { | ||
$mform->addElement('textarea', 'feedback', get_string('feedback', 'grades')); | ||
} | ||
|
||
//TODO: add other elements | ||
|
||
// hidden params | ||
$mform->addElement('hidden', 'gradeid', 0); | ||
$mform->setType('gradeid', PARAM_INT); | ||
|
||
$mform->addElement('hidden', 'courseid', 0); | ||
$mform->setType('courseid', PARAM_INT); | ||
|
||
//------------------------------------------------------------------------------- | ||
// buttons | ||
$this->add_action_buttons(); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
<?php // $Id$ | ||
|
||
/// Add settings for this module to the $settings object (it's already defined) | ||
|
||
$settings->add(new admin_setting_configcheckbox('gradereport_grader_enableajax', 'Enable AJAX in gradebook', 'This setting will enable the AJAX interface in the gradebooks, depending on the site setting and the individual user profile choice.', 1)); | ||
|
||
$settings->add(new admin_setting_configselect('grade_report_aggregationposition', get_string('aggregationposition', 'grades'), | ||
get_string('configaggregationposition', 'grades'), false, | ||
array( '0' => 'left', | ||
'1' => 'right'))); | ||
$settings->add(new admin_setting_configselect('grade_report_aggregationview', get_string('aggregationview', 'grades'), | ||
get_string('configaggregationview', 'grades'), false, | ||
array( '0' => 'full', | ||
'1' => 'compact'))); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_bulkcheckboxes', get_string('bulkcheckboxes', 'grades'), | ||
get_string('configbulkcheckboxes', 'grades'), 0)); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_enableajax', get_string('enableajax', 'grades'), | ||
get_string('configenableajax', 'grades'), 0)); | ||
$settings->add(new admin_setting_configselect('grade_report_gradedisplaytype', get_string('gradedisplaytype', 'grades'), | ||
get_string('configgradedisplaytype', 'grades'), false, | ||
array( '0' => 'raw', | ||
'1' => 'percentage'))); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_showeyecons', get_string('showeyecons', 'grades'), | ||
get_string('configshoweyecons', 'grades'), 0)); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_showgroups', get_string('showgroups', 'grades'), | ||
get_string('configshowgroups', 'grades'), 0)); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_showlocks', get_string('showlocks', 'grades'), | ||
get_string('configshowlocks', 'grades'), 0)); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_shownotes', get_string('shownotes', 'grades'), | ||
get_string('configshownotes', 'grades'), 0)); | ||
$settings->add(new admin_setting_configcheckbox('grade_report_showscales', get_string('showscales', 'grades'), | ||
get_string('configshowscales', 'grades'), 0)); | ||
$settings->add(new admin_setting_configtext('grade_report_studentsperpage', get_string('studentsperpage', 'grades'), | ||
get_string('configstudentsperpage', 'grades'), 20)); | ||
$settings->add(new admin_setting_configselect('grade_report_feedbackformat', get_string('feedbackformat', 'grades'), | ||
get_string('configfeedbackformat', 'grades'), false, | ||
array( '0' => 'text', | ||
'1' => 'html'))); | ||
$settings->add(new admin_setting_configselect('grade_report_decimalpoints', get_string('decimalpoints', 'grades'), | ||
get_string('configdecimalpoints', 'grades'), 2, | ||
array( '0' => '0', | ||
'1' => '1', | ||
'2' => '2', | ||
'3' => '3', | ||
'4' => '4', | ||
'5' => '5'))); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.