MacroViz原創文章,轉貼請註明出處,並請留下訊息,謝謝。
本文重點:如何修改moodle使之可以支援「批改學生作業時可按照學號排序」功能,適用於moodle1.61版
一般來說,學校教務選課系統多以學生學號為帳號,匯入到moodle時,大部分也是會以相同的帳號跟密碼匯入。然而moodle所提供的繳交作業模組,並不支援帳號排序,造成老師們批改作業時的小小困擾,因此本文就針對如何修改出該功能作一說明。
用Dreamweaver MX 2004 或 8 開啟 \moodle\mod\assignment\lib.php, 大概在1011行~1028行處,發現如下程式碼:
$tablecolumns = array(‘picture’, ‘fullname’, ‘grade’, ‘comment’, ‘timemodified’, ‘timemarked’, ‘status’);
$tableheaders = array(", get_string(‘fullname’), get_string(‘grade’), get_string(‘comment’, ‘assignment’), get_string(‘lastmodified’).’ (‘.$course->student.’)', get_string(‘lastmodified’).’ (‘.$course->teacher.’)', get_string(‘status’));
require_once($CFG->libdir.’/tablelib.php’);
$table = new flexible_table(‘mod-assignment-submissions’);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot.’/mod/assignment/submissions.php?id=’.$this->cm->id.’&currentgroup=’.$currentgroup);
$table->sortable(true, ‘lastname’);//sorted by lastname by default
$table->collapsible(true);
$table->initialbars(true);
$table->column_suppress(‘picture’);
$table->column_suppress(‘fullname’);
$table->column_class(‘picture’, ‘picture’);
將 picture 改成 username,就可以讓moodle在批改作業時,按照該班選課同學之學號排序了:
$tablecolumns = array(‘username‘, ‘fullname’, ‘grade’, ‘comment’, ‘timemodified’, ‘timemarked’, ‘status’, ‘status’);
$tableheaders = array(get_string(‘username’),get_string(‘fullname’), get_string(‘grade’), get_string(‘comment’, ‘assignment’), get_string(‘lastmodified’).’ (‘.$course->student.’)', get_string(‘lastmodified’).’ (‘.$course->teacher.’)', get_string(‘status’));
require_once($CFG->libdir.’/tablelib.php’);
$table = new flexible_table(‘mod-assignment-submissions’);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot.’/mod/assignment/submissions.php?id=’.$this->cm->id.’&currentgroup=’.$currentgroup);
$table->sortable(true, ‘username‘);//sorted by lastname by default
$table->collapsible(true);
$table->initialbars(true);
$table->column_suppress(‘username‘);
$table->column_suppress(‘fullname’);
$table->column_class(‘username‘, ‘username‘);
PS.
- 因為Dreamweaver MX 2004 之後版本,避開了Unicode BOM的問題,因此可放心在Windows環境下編輯Unicode編碼的PHP,如果是使用Fedora Linux的人,直接用gEdit編輯就可以了。
- 要求學生繳交作業時可以以學號.DOC,學號.PPT等方繳交,可以讓後續處理更方便。
版主您好
想請教您,我依文章設定後還是只看到圖片,
但是,欄頭已改成帳號並且可排序,我版本是1.97
是否因版本的關係,可否請您抽空指教
感謝您
不敢當,最近比較少去動 moodle 了。