- 現在との差分 を表示
- ソース を表示
- Moodle/Programming/html_writer へ行く。
1: 2021-07-29 (木) 14:07:33 iseki | |||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **html_writer [#w159312b] | ||
+ | *** Sample [#ub070ced] | ||
+ | function show_demo_set_header(&$table) | ||
+ | { | ||
+ | unset($table->head); | ||
+ | unset($table->align); | ||
+ | unset($table->size); | ||
+ | unset($table->wrap); | ||
+ | // Header | ||
+ | $table->head [] = '#'; | ||
+ | $table->align[] = 'right'; | ||
+ | $table->size [] = '20px'; | ||
+ | $table->wrap [] = 'nowrap'; | ||
+ | |||
+ | $table->head [] = 'Name'; | ||
+ | $table->align[] = 'center'; | ||
+ | $table->size [] = '80px'; | ||
+ | $table->wrap [] = 'nowrap'; | ||
+ | |||
+ | $table->head [] = 'Value'; | ||
+ | $table->align[] = 'left'; | ||
+ | $table->size [] = '100px'; | ||
+ | $table->wrap [] = 'nowrap'; | ||
+ | |||
+ | return; | ||
+ | } | ||
+ | |||
+ | |||
+ | function show_demo_disp_table() | ||
+ | { | ||
+ | global $CFG, $DB; | ||
+ | |||
+ | $table = new html_table(); | ||
+ | $datas = array(); | ||
+ | |||
+ | $datas[0]['num'] = 0; | ||
+ | $datas[0]['name'] = "AAA"; | ||
+ | $datas[0]['value'] = "VVV"; | ||
+ | |||
+ | $datas[1]['num'] = 1; | ||
+ | $datas[1]['name'] = "BBB"; | ||
+ | $datas[1]['value'] = "WWW"; | ||
+ | |||
+ | $i = 0; | ||
+ | foreach($datas as $data) { | ||
+ | $table->data[$i][] = $i + 1; | ||
+ | $table->data[$i][] = $data['name']; | ||
+ | $table->data[$i][] = $data['value']; | ||
+ | $i++; | ||
+ | } | ||
+ | |||
+ | show_demo_set_header($table); | ||
+ | echo '<div align="center">'; | ||
+ | echo html_writer::table($table); | ||
+ | echo '</div>'; | ||
+ | |||
+ | // | ||
+ | |||
+ | return; | ||
+ | } |
- Moodle/Programming/html_writer のバックアップ一覧
- Moodle/Programming/html_writer のバックアップ差分(No. All)
- 1: 2021-07-29 (木) 14:07:33 iseki
- 現: 2021-07-29 (木) 14:14:13 iseki