api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('Group area').' '.$group_properties['name'],
];
} else {
if (!(api_is_allowed_to_edit() || api_is_coach())) {
api_not_allowed(true);
}
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
case 'export_to_pdf':
exportAllWork($studentId, $courseInfo, 'pdf');
exit;
break;
case 'download':
if (api_is_allowed_to_edit()) {
downloadAllFilesPerUser($studentId, $courseInfo);
}
break;
case 'delete_all':
if (api_is_allowed_to_edit()) {
$deletedItems = deleteAllWorkPerUser($studentId, $courseInfo);
if (!empty($deletedItems)) {
$message = get_lang('File deleted').'
';
foreach ($deletedItems as $item) {
$message .= $item['title'].'
';
}
$message = Display::return_message($message, 'info', false);
Display::addFlash($message);
}
header('Location: '.api_get_self().'?studentId='.$studentId.'&'.api_get_cidreq());
exit;
}
break;
}
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'name' => get_lang('Assignments'),
];
$interbreadcrumb[] = [
'url' => '#',
'name' => $userInfo['complete_name'],
];
Display :: display_header(null);
$workPerUser = getWorkPerUser($studentId);
echo '
';
echo '
'.
Display::return_icon('back.png', get_lang('Back to Assignments list'), '', ICON_SIZE_MEDIUM).'';
if (api_is_allowed_to_edit()) {
echo '
'.
Display::return_icon('pdf.png', get_lang('Export to PDF'), '', ICON_SIZE_MEDIUM).'';
echo '
'.
Display::return_icon('save.png', get_lang('Download'), '', ICON_SIZE_MEDIUM).'';
echo '
'.
Display::return_icon('delete.png', get_lang('Delete all papers'), '', ICON_SIZE_MEDIUM).'';
}
echo '
';
$table = new HTML_Table(['class' => 'data_table']);
$column = 0;
$row = 0;
$headers = [
get_lang('Title'),
get_lang('Time of reception'),
get_lang('Deadline'),
get_lang('Feedback'),
get_lang('Detail'),
];
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$row++;
$column = 0;
$url = api_get_path(WEB_CODE_PATH).'work/';
foreach ($workPerUser as $work) {
$work = $work['work'];
$scoreWeight = intval($work->qualification) == 0 ? null : $work->qualification;
$workId = $work->id;
$workExtraData = get_work_assignment_by_id($workId);
foreach ($work->user_results as $userResult) {
$itemId = $userResult['id'];
$table->setCellContents($row, $column, $work->title.' ['.trim(strip_tags($userResult['title'])).']');
$table->setCellAttributes($row, $column, ['width' => '300px']);
$column++;
$table->setCellContents($row, $column, $userResult['sent_date']);
$column++;
$dateQualification = !empty($workExtraData['expires_on']) ? api_get_local_time($workExtraData['expires_on']) : '-';
$table->setCellContents($row, $column, $dateQualification);
$column++;
$score = null;
$score = $userResult['qualification'];
$table->setCellContents($row, $column, $score);
$column++;
// Detail
$links = null;
// is a text
$url = api_get_path(WEB_CODE_PATH).'work/view.php?'.api_get_cidreq().'&id='.$itemId;
$links .= Display::url(Display::return_icon('default.png', get_lang('View')), $url);
if (!empty($userResult['url'])) {
$url = api_get_path(WEB_CODE_PATH).'work/download.php?'.api_get_cidreq().'&id='.$itemId;
$links .= Display::url(Display::return_icon('save.png', get_lang('Download')), $url);
}
if (api_is_allowed_to_edit()) {
$url = api_get_path(WEB_CODE_PATH).'work/edit.php?'.api_get_cidreq().'&item_id='.$itemId.'&id='.$workId.'&parent_id='.$workId;
$links .= Display::url(
Display::return_icon('edit.png', get_lang('Comment')),
$url
);
}
$table->setCellContents($row, $column, $links);
$row++;
$column = 0;
}
}
echo Display::page_subheader($userInfo['complete_name']);
echo $table->toHtml();
Display :: display_footer();