$table->width = "100%"; foreach ($lists as $list) { if ($cml = get_coursemodule_from_id('voiceshadow', $list->instance)) { if ($cml->course == $cm->course && $cml->instance == $cm->instance) { $name = "var" . $list->var . "text"; $userdata = $DB->get_record("user", array("id" => $list->userid)); $picture = $OUTPUT->user_picture($userdata, array('popup' => true)); $o = ""; $o .= html_writer::start_tag('div', array("style" => "text-align:left;margin:10px 0;")); $o .= html_writer::tag('span', $picture); $o .= html_writer::start_tag('span', array("style" => "margin: 8px;position: absolute;")); $o .= html_writer::link(new moodle_url('/user/view.php', array("id" => $userdata->id, "course" => $cml->course)), fullname($userdata)); $o .= html_writer::end_tag('span'); $o .= html_writer::end_tag('div'); $o .= html_writer::tag('div', $list->summary, array('style' => 'margin:10px 0;')); $o .= html_writer::tag('div', voiceshadow_player($list->id)); if (!empty($voiceshadow->{$name})) { $o .= html_writer::tag('div', "(" . $voiceshadow->{$name} . ")"); } $o .= html_writer::tag('div', html_writer::tag('small', date(get_string("timeformat1", "voiceshadow"), $list->time)), array("style" => "float:left;")); $cell1 = new html_table_cell($o); $cells = array($cell1); $row = new html_table_row($cells); $table->data[] = $row; } } } echo html_writer::table($table); echo $OUTPUT->box_end(); echo $OUTPUT->close_window_button(); echo $OUTPUT->footer();
//2-cell $table2 = new html_table(); $table2->head = array(get_string("table2::cell1::pronunciation", "voiceshadow"), get_string("table2::cell2::fluency", "voiceshadow"), get_string("table2::cell3::content", "voiceshadow"), get_string("table2::cell4::organization", "voiceshadow"), get_string("table2::cell5::eye", "voiceshadow")); //$table2->align = array ("center", "center", "center", "center", "center"); $table2->align = array("center" . get_string("table2::style", "voiceshadow"), "center" . get_string("table2::style", "voiceshadow"), "center" . get_string("table2::style", "voiceshadow"), "center" . get_string("table2::style", "voiceshadow"), "center" . get_string("table2::style", "voiceshadow")); $table2->width = "100%"; $table2->data[] = array(voiceshadow_set_rait($list->id, 1), voiceshadow_set_rait($list->id, 2), voiceshadow_set_rait($list->id, 3), voiceshadow_set_rait($list->id, 4), voiceshadow_set_rait($list->id, 5)); //----Comment Box-----/ //if ($list->userid == $USER->id){ $chtml = ""; if ($comments = $DB->get_records("voiceshadow_comments", array("fileid" => $list->id))) { foreach ($comments as $comment) { $chtml .= html_writer::start_tag('div', array("style" => "border:1px solid #333;margin:5px;text-align:left;padding:5px;")); $chtml .= html_writer::tag('div', $comment->summary, array('style' => 'margin:10px 0;')); if (!empty($comment->itemid)) { $chtml .= html_writer::tag('div', voiceshadow_player($comment->id, "voiceshadow_comments")); } $chtml .= html_writer::tag('div', html_writer::tag('small', date(get_string("timeformat1", "voiceshadow"), $comment->time)), array("style" => "float:left;")); if ($comment->userid == $USER->id || has_capability('mod/voiceshadow:teacher', $context)) { $student = $DB->get_record("user", array("id" => $comment->userid)); $studentlink = html_writer::link(new moodle_url('/user/view.php', array("id" => $student->id, "course" => $cml->course)), fullname($student)); $chtml .= html_writer::tag('div', html_writer::tag('small', $studentlink . " " . html_writer::link(new moodle_url('/mod/voiceshadow/view.php', array("id" => $list->instance, "act" => "deletecomment", "fileid" => $comment->id)), get_string("delete", "voiceshadow"), array("onclick" => "return confirm('" . get_string("confim", "voiceshadow") . "')")), array("style" => "margin: 2px 0 0 10px;"))); } $chtml .= html_writer::end_tag('div'); } } $addcommentlink = html_writer::tag('div', html_writer::link(new moodle_url('/mod/voiceshadow/view.php', array("id" => $list->instance, "a" => "add", "act" => "addcomment", "fileid" => $list->id)), get_string("addcomment", "voiceshadow"))); /* } else $addcomment = "";*/ //--------------------/