原始 :
修改後 :
修改moodle\mod\attendance\renderer.php裡的函式
protected function render_attendance_preferences_dat
head的部分
$table->head = array('#',
get_string('acronym', 'attendance'),
//get_string('description'), //拿掉描述
get_string('points', 'attendance'));
$table->align = array('center', 'center', 'center', 'center', 'center'); //by ail 20180928 拿掉一項if ($studentscanmark) {
$table->head[] = get_string('studentavailability', 'attendance'). $this->output->help_icon('studentavailability', 'attendance');
$table->align[] = 'center';
$table->head[] = get_string('setunmarked', 'attendance'). $this->output->help_icon('setunmarked', 'attendance');
$table->align[] = 'center';
}
//$table->head[] = get_string('action'); //拿掉動作head
新增一個新增input表格的函式
private function construct_text_input_hi($name, $size, $maxlength, $value='') {
$attributes = array(
'type' => 'text',
'name' => $name,
'size' => $size,
'maxlength' => $maxlength,
'value' => $value,
'disabled' => true, //鎖修改
'class' => 'form-control');
return html_writer::empty_tag('input', $attributes);
}
TABLE修改的地方
$cells = array();
$cells[] = $i;
$cells[] = $this->construct_text_input_hi('acronym['.$st->id.']', 2, 2, $st->acronym) . $emptyacronym; //改用不能編輯欄位的函示
//$cells[] = $this->construct_text_input_hi('description['.$st->id.']', 30, 30, $st->description) . $emptydescription; //刪除描述
$cells[] = $this->construct_text_input('grade['.$st->id.']', 4, 4, $st->grade);
if ($studentscanmark) {
$checked = '';
if ($st->setunmarked) {
$checked = ' checked ';
}
$cells[] = $this->construct_text_input('studentavailability['.$st->id.']', 4, 5, $st->studentavailability);
$cells[] = '<input type="radio" name="setunmarked" value="'.$st->id.'"'.$checked.'>';
}
// $cells[] = $this->construct_preferences_actions_icons($st, $prefdata); 改變狀態的動作選項
$table->data[$i] = new html_table_row($cells);
$table->data[$i]->id = "statusrow".$i;
$i++;
}
/* 新增一筆狀態到集合裡
$table->data[$i][] = '*';$table->data[$i][] = $this->construct_text_input('newacronym', 2, 2);
$table->data[$i][] = $this->construct_text_input('newdescription', 30, 30);
$table->data[$i][] = $this->construct_text_input('newgrade', 4, 4);
if ($studentscanmark) {
$table->data[$i][] = $this->construct_text_input('newstudentavailability', 4, 5);
}
$table->data[$i][] = $this->construct_preferences_button(get_string('add', 'attendance'),
mod_attendance_preferences_page_params::ACTION_ADD);
*/