@ -372,18 +372,24 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$row = new html_table_row();
$row = new html_table_row();
$row->cells[] = $i;
$row->cells[] = $i;
$fullname = html_writer::link($takedata->url_view(array('studentid' => $user->id)), fullname($user));
$fullname = html_writer::link($takedata->url_view(array('studentid' => $user->id)), fullname($user));
$row->cells[] = $this->output->user_picture($user).$fullname;
$fullname = $this->output->user_picture($user).$fullname;
$celldata = $this->construct_take_user_controls($takedata, $user);
$ucdata = $this->construct_take_user_controls($takedata, $user);
if (array_key_exists('colspan', $celldata)) {
if (array_key_exists('warning', $ucdata)) {
$cell = new html_table_cell($celldata['text']);
$fullname .= html_writer::empty_tag('br');
$cell->colspan = $celldata['colspan'];
$fullname .= $ucdata['warning'];
}
$row->cells[] = $fullname;
if (array_key_exists('colspan', $ucdata)) {
$cell = new html_table_cell($ucdata['text']);
$cell->colspan = $ucdata['colspan'];
$row->cells[] = $cell;
$row->cells[] = $cell;
}
}
else
else
$row->cells = array_merge($row->cells, $celldata['text']);
$row->cells = array_merge($row->cells, $u cdata['text']);
if (array_key_exists('class', $celldata)) $row->attributes['class'] = $celldata['class'];
if (array_key_exists('class', $u cdata)) $row->attributes['class'] = $u cdata['class'];
$table->data[] = $row;
$table->data[] = $row;
}
}
@ -413,11 +419,15 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$fullname = html_writer::link($takedata->url_view(array('studentid' => $user->id)), fullname($user));
$fullname = html_writer::link($takedata->url_view(array('studentid' => $user->id)), fullname($user));
$celltext .= html_writer::tag('span', $fullname, array('class' => 'fullname'));
$celltext .= html_writer::tag('span', $fullname, array('class' => 'fullname'));
$celltext .= html_writer::empty_tag('br');
$celltext .= html_writer::empty_tag('br');
$celldata = $this->construct_take_user_controls($takedata, $user);
$ucdata = $this->construct_take_user_controls($takedata, $user);
$celltext .= is_array($celldata['text']) ? implode('', $celldata['text']) : $celldata['text'];
$celltext .= is_array($ucdata['text']) ? implode('', $ucdata['text']) : $ucdata['text'];
if (array_key_exists('warning', $ucdata)) {
$celltext .= html_writer::empty_tag('br');
$celltext .= $ucdata['warning'];
}
$cell = new html_table_cell($celltext);
$cell = new html_table_cell($celltext);
if (array_key_exists('class', $celldata)) $cell->attributes['class'] = $celldata['class'];
if (array_key_exists('class', $u cdata)) $cell->attributes['class'] = $u cdata['class'];
$row->cells[] = $cell;
$row->cells[] = $cell;
$i++;
$i++;
@ -455,12 +465,7 @@ class mod_attforblock_renderer extends plugin_renderer_base {
private function construct_take_user_controls(attforblock_take_data $takedata, $user) {
private function construct_take_user_controls(attforblock_take_data $takedata, $user) {
$celldata = array();
$celldata = array();
if ($user->enrolmentstart > $takedata->sessioninfo->sessdate) {
if ($user->enrolmentend and $user->enrolmentend < $takedata->sessioninfo->sessdate) {
$celldata['text'] = get_string('enrolmentstart', 'attforblock', userdate($user->enrolmentstart, '%d.%m.%Y'));
$celldata['colspan'] = count($takedata->statuses) + 1;
$celldata['class'] = 'userwithoutenrol';
}
elseif ($user->enrolmentend and $user->enrolmentend < $takedata->sessioninfo->sessdate) {
$celldata['text'] = get_string('enrolmentend', 'attforblock', userdate($user->enrolmentend, '%d.%m.%Y'));
$celldata['text'] = get_string('enrolmentend', 'attforblock', userdate($user->enrolmentend, '%d.%m.%Y'));
$celldata['colspan'] = count($takedata->statuses) + 1;
$celldata['colspan'] = count($takedata->statuses) + 1;
$celldata['class'] = 'userwithoutenrol';
$celldata['class'] = 'userwithoutenrol';
@ -486,11 +491,11 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$params['checked'] = '';
$params['checked'] = '';
$input = html_writer::empty_tag('input', $params);
$input = html_writer::empty_tag('input', $params);
if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_LIST)
$celldata['text'][] = $input;
if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_GRID)
else {
$input = html_writer::tag('nobr', $input . $st->acronym);
$celldata['text'][] = html_writer::tag('nobr', $input . $st->acronym);
}
$celldata['text'][] = $input;
}
}
$params = array(
$params = array(
'type' => 'text',
'type' => 'text',
@ -498,6 +503,11 @@ class mod_attforblock_renderer extends plugin_renderer_base {
if (array_key_exists($user->id, $takedata->sessionlog))
if (array_key_exists($user->id, $takedata->sessionlog))
$params['value'] = $takedata->sessionlog[$user->id]->remarks;
$params['value'] = $takedata->sessionlog[$user->id]->remarks;
$celldata['text'][] = html_writer::empty_tag('input', $params);
$celldata['text'][] = html_writer::empty_tag('input', $params);
if ($user->enrolmentstart > $takedata->sessioninfo->sessdate + $takedata->sessioninfo->duration) {
$celldata['warning'] = get_string('enrolmentstart', 'attforblock', userdate($user->enrolmentstart, '%H:%M %d.%m.%Y'));
$celldata['class'] = 'userwithoutenrol';
}
}
}
return $celldata;
return $celldata;