Update from 1.11.x

pull/3768/head^2
Julio Montoya 5 years ago
parent c11c67a92a
commit cff435165c
  1. 6
      public/main/announcements/announcements.php
  2. 4
      public/main/exercise/exercise.php
  3. 8
      public/main/group/group_category.php
  4. 47
      public/main/inc/ajax/model.ajax.php
  5. 225
      public/main/work/pending.php
  6. 501
      public/main/work/work.lib.php

@ -26,6 +26,7 @@ $token = Security::get_existing_token();
$courseId = api_get_course_int_id();
$_course = api_get_course_info_by_id($courseId);
$group_id = api_get_group_id();
$sessionId = api_get_session_id();
$current_course_tool = TOOL_ANNOUNCEMENT;
$this_section = SECTION_COURSES;
$nameTools = get_lang('Announcements');
@ -33,11 +34,11 @@ $repo = Container::getAnnouncementRepository();
$allowToEdit = (
api_is_allowed_to_edit(false, true) ||
(api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())
(api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) ||
($sessionId && api_is_coach() && api_get_configuration_value('allow_coach_to_edit_announcements'))
);
$allowStudentInGroupToSend = false;
$sessionId = api_get_session_id();
$drhHasAccessToSessionContent = api_drh_can_access_all_session_content();
if (!empty($sessionId) && $drhHasAccessToSessionContent) {
$allowToEdit = $allowToEdit || api_is_drh();
@ -66,7 +67,6 @@ if (!empty($group_id)) {
if ($isTutor) {
$allowToEdit = true;
}
// Last chance ... students can send announcements
if (GroupManager::TOOL_PRIVATE_BETWEEN_USERS == $groupProperties['announcements_state']) {
$allowStudentInGroupToSend = true;

@ -396,10 +396,10 @@ if ($is_allowedToEdit && 'learnpath' !== $origin) {
$form->addText(
'keyword',
get_lang('Search'),
null,
false,
[
'aria-label' => get_lang('Search'),
'placeholder' => get_lang('Search'),
]
);
$form->addButtonSearch(get_lang('Search'));

@ -379,8 +379,8 @@ if ($form->validate()) {
$max_member = $values['max_member'];
}
$self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0;
$self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0;
$self_reg_allowed = $values['self_reg_allowed'] ?? 0;
$self_unreg_allowed = $values['self_unreg_allowed'] ?? 0;
switch ($values['action']) {
case 'update_settings':
@ -399,7 +399,7 @@ if ($form->validate()) {
$self_unreg_allowed,
$max_member,
$values['groups_per_user'],
isset($values['document_access']) ? $values['document_access'] : 0
$values['document_access'] ?? 0
);
Display::addFlash(Display::return_message(get_lang('Group settings have been modified')));
header('Location: '.$currentUrl.'&category='.$values['id']);
@ -419,7 +419,7 @@ if ($form->validate()) {
$self_unreg_allowed,
$max_member,
$values['groups_per_user'],
isset($values['document_access']) ? $values['document_access'] : 0
$values['document_access'] ?? 0
);
Display::addFlash(Display::return_message(get_lang('Category created')));
header('Location: '.$currentUrl);

@ -53,6 +53,7 @@ if (!in_array(
'get_work_user_list',
'get_work_user_list_others',
'get_work_user_list_all',
'get_work_pending_list',
'get_timelines',
'get_user_skill_ranking',
'get_usergroups',
@ -559,6 +560,20 @@ switch ($action) {
$work_id = $_REQUEST['work_id'];
$count = get_count_work($work_id);
break;
case 'get_work_pending_list':
$courseId = $_REQUEST['course'] ?? 0;
$status = $_REQUEST['status'] ?? 0;
$count = getAllWork(
null,
null,
null,
null,
$whereCondition,
true,
$courseId,
$status
);
break;
case 'get_work_user_list_others':
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$work_id = $_REQUEST['work_id'];
@ -1371,6 +1386,38 @@ switch ($action) {
$whereCondition
);
break;
case 'get_work_pending_list':
api_block_anonymous_users();
if (false === api_is_teacher()) {
exit;
}
$plagiarismColumns = [];
if (api_get_configuration_value('allow_compilatio_tool')) {
$plagiarismColumns = ['compilatio'];
}
$columns = [
'course',
'work_name',
'fullname',
'title',
'qualification',
'sent_date',
'qualificator_id',
'correction',
];
$columns = array_merge($columns, $plagiarismColumns);
$columns[] = 'actions';
$result = getAllWork(
$start,
$limit,
$sidx,
$sord,
$whereCondition,
false,
$courseId,
$status
);
break;
case 'get_work_user_list_others':
$plagiarismColumns = [];
if (api_get_configuration_value('allow_compilatio_tool')) {

@ -0,0 +1,225 @@
<?php
/* For licensing terms, see /license.txt */
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
// Only teachers.
if (false === api_is_teacher()) {
api_not_allowed(true);
}
require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$is_allowed_to_edit = api_is_allowed_to_edit() || api_is_coach();
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$htmlHeadXtra[] = api_get_jqgrid_js();
$userId = api_get_user_id();
/*$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'name' => get_lang('StudentPublications'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId,
'name' => $my_folder_data['title'],
];*/
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$itemId = isset($_REQUEST['item_id']) ? (int) $_REQUEST['item_id'] : null;
$htmlHeadXtra[] = api_get_jquery_libraries_js(['jquery-upload']);
$plagiarismListJqgridColumn = [];
$plagiarismListJqgridLine = [];
/*$allowAntiPlagiarism = api_get_configuration_value('allow_compilatio_tool');
if ($allowAntiPlagiarism) {
$plagiarismListJqgridColumn = ['Compilatio'];
$plagiarismListJqgridLine = [
[
'name' => 'compilatio',
'index' => 'compilatio',
'width' => '40',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
],
];
}*/
$orderName = api_is_western_name_order() ? 'firstname' : 'lastname';
$type = 'simple';
$columns = [
get_lang('Course'),
get_lang('WorkName'),
get_lang('FullUserName'),
get_lang('Title'),
get_lang('Score'),
get_lang('Date'),
get_lang('Status'),
get_lang('UploadCorrection'),
];
$columns = array_merge($columns, $plagiarismListJqgridColumn);
$columns[] = get_lang('Actions');
$column_model = [
[
'name' => 'course',
'index' => 'course',
'width' => '30',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
],
[
'name' => 'work_name',
'index' => 'work_name',
'width' => '30',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
],
[
'name' => 'fullname',
'index' => $orderName,
'width' => '30',
'align' => 'left',
'search' => 'true',
],
[
'name' => 'title',
'index' => 'title',
'width' => '25',
'align' => 'left',
'search' => 'false',
'wrap_cell' => 'true',
'sortable' => 'false',
],
[
'name' => 'qualification',
'index' => 'qualification',
'width' => '15',
'align' => 'center',
'search' => 'true',
],
[
'name' => 'sent_date',
'index' => 'sent_date',
'width' => '25',
'align' => 'left',
'search' => 'true',
'wrap_cell' => 'true',
],
[
'name' => 'qualificator_id',
'index' => 'qualificator_id',
'width' => '20',
'align' => 'left',
'search' => 'true',
],
[
'name' => 'correction',
'index' => 'correction',
'width' => '30',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
'title' => 'false',
],
];
$column_model = array_merge($column_model, $plagiarismListJqgridLine);
$column_model[] = [
'name' => 'actions',
'index' => 'actions',
'width' => '25',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
];
$extra_params = [
'autowidth' => 'true',
'height' => 'auto',
'sortname' => 'sent_date',
'sortorder' => 'desc',
'sortable' => 'false',
'multiselect' => 'false',
];
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_pending_list&type='.$type;
$deleteUrl = null;
/*$workUrl = api_get_path(WEB_AJAX_PATH).'work.ajax.php?';
$deleteUrl = $workUrl.'&a=delete_student_work';
$showUrl = $workUrl.'&a=show_student_work';
$hideUrl = $workUrl.'&a=hide_student_work';*/
/*if ($allowAntiPlagiarism) {
$extra_params['gridComplete'] = 'compilatioInit()';
}*/
$courses = CourseManager::get_courses_list_by_user_id($userId, false, false, false);
$content = '';
if (!empty($courses)) {
$form = new FormValidator('pending', 'GET');
$courses = array_column($courses, 'title', 'real_id');
$form->addSelect('course', get_lang('Course'), $courses, ['placeholder' => get_lang('All')]);
$status = [
1 => get_lang('All'),
2 => get_lang('NotRevised'),
3 => get_lang('Revised'),
];
$form->addSelect('status', get_lang('Status'), $status);
$form->addButtonSearch(get_lang('Search'));
$content .= $form->returnForm();
$tableWork = Display::grid_html('results');
$content .= Display::panel($tableWork);
if ($form->validate()) {
$values = $form->getSubmitValues();
$courseId = $values['course'] ?? 0;
if (!empty($courseId)) {
$url .= '&course='.(int) $courseId;
}
$status = $values['status'] ?? 0;
if (!empty($status)) {
$url .= '&status='.(int) $status;
}
}
} else {
$content .= Display::return_message(get_lang('NoCoursesForThisUser'), 'warning');
}
Display::display_header(get_lang('StudentPublications'));
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
$("#results").jqGrid(
"navGrid",
"#results_pager",
{ edit: false, add: false, search: false, del: false },
{ height:280, reloadAfterSubmit:false }, // edit options
{ height:280, reloadAfterSubmit:false }, // add options
{ reloadAfterSubmit:false, url: "<?php echo $deleteUrl; ?>" }, // del options
{ width:500 } // search options
);
});
</script>
<?php
/*$actionsLeft = null;
echo Display::toolbarAction('toolbar-worklist', [$actionsLeft]);*/
echo Display::page_header(get_lang('StudentPublicationToCorrect'));
echo Display::return_message(get_lang('StudentPublicationCorrectionWarning'), 'warning');
echo $content;
Display::display_footer();

@ -2552,6 +2552,507 @@ function get_work_user_list(
}
}
function getAllWork(
$start,
$limit,
$column,
$direction,
$whereCondition = '',
$getCount = false,
$courseId = 0,
$status = 0
) {
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$userId = api_get_user_id();
if (empty($userId)) {
return [];
}
$courses = CourseManager::get_courses_list_by_user_id($userId, false, false, false);
if (!empty($whereCondition)) {
$whereCondition = ' AND '.$whereCondition;
}
$whereCondition = Database::escape_string($whereCondition);
if (!in_array($direction, ['asc', 'desc'])) {
$direction = 'desc';
}
$column = !empty($column) ? Database::escape_string($column) : 'sent_date';
$start = (int) $start;
$limit = (int) $limit;
$courseQuery = [];
$courseList = [];
$withResults = 0;
foreach ($courses as $course) {
$courseIdItem = $course['real_id'];
if (!empty($courseId) && $courseIdItem != $courseId) {
continue;
}
$courseInfo = api_get_course_info_by_id($courseIdItem);
$session_id = isset($course['session_id']) ? $course['session_id'] : 0;
//$conditionSession = api_get_session_condition($session_id, true, false, 'w.session_id');
$conditionSession = '';
$parentCondition = '';
if ($withResults) {
$parentCondition = 'AND ww.parent_id is NOT NULL';
}
$courseQuery[] = " (work.c_id = $courseIdItem $conditionSession $parentCondition )";
$courseList[$courseIdItem] = $courseInfo;
}
$courseQueryToString = implode(' OR ', $courseQuery);
$compilation = null;
/*if (api_get_configuration_value('allow_compilatio_tool')) {
$compilation = new Compilatio();
}*/
$is_allowed_to_edit = api_is_allowed_to_edit() || api_is_coach();
if ($getCount) {
if (empty($courseQuery)) {
return 0;
}
$select = 'SELECT DISTINCT count(u.id) as count ';
} else {
$select = 'SELECT DISTINCT
u.id as user_id,
work.id as id,
title as title,
description,
url,
sent_date,
contains_file,
has_properties,
view_properties,
qualification,
weight,
allow_text_assignment,
u.firstname,
u.lastname,
u.username,
parent_id,
accepted,
qualificator_id,
url_correction,
title_correction,
work.c_id,
work.session_id ';
}
$statusCondition = '';
if (!empty($status)) {
switch ($status) {
case 2:
$statusCondition = ' AND (qualificator_id IS NULL OR qualificator_id = 0) ';
break;
case 3:
$statusCondition = ' AND (qualificator_id <> 0 AND qualificator_id IS NOT NULL) ';
break;
}
}
$sql = " $select
FROM $work_table work
INNER JOIN $user_table u
ON (work.user_id = u.id)
WHERE
work.parent_id <> 0 AND
work.active IN (1, 0)
$whereCondition AND
($courseQueryToString)
$statusCondition
AND u.status != ".INVITEE;
$sql .= " ORDER BY $column $direction ";
if (!empty($start) && !empty($limit)) {
$sql .= " LIMIT $start, $limit";
}
$result = Database::query($sql);
$works = [];
if ($getCount) {
$work = Database::fetch_array($result, 'ASSOC');
if ($work) {
return (int) $work['count'];
}
return 0;
}
$url = api_get_path(WEB_CODE_PATH).'work/';
$unoconv = api_get_configuration_value('unoconv.binaries');
$loadingText = addslashes(get_lang('Loading'));
$uploadedText = addslashes(get_lang('Uploaded'));
$failsUploadText = addslashes(get_lang('UplNoFileUploaded'));
$failsUploadIcon = Display::return_icon(
'closed-circle.png',
'',
[],
ICON_SIZE_TINY
);
$saveIcon = Display::return_icon(
'save.png',
get_lang('Save'),
[],
ICON_SIZE_SMALL
);
$correctionIcon = Display::return_icon(
'check-circle.png',
get_lang('Correction'),
null,
ICON_SIZE_SMALL
);
$correctionIconSmall = Display::return_icon(
'check-circle.png',
get_lang('Correction'),
null,
ICON_SIZE_TINY
);
$rateIcon = Display::return_icon(
'rate_work.png',
get_lang('CorrectAndRate'),
[],
ICON_SIZE_SMALL
);
$parentList = [];
$blockEdition = api_get_configuration_value('block_student_publication_edition');
$blockScoreEdition = api_get_configuration_value('block_student_publication_score_edition');
$loading = Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin');
$qualification_exists = true;
while ($work = Database::fetch_array($result, 'ASSOC')) {
$courseId = $work['c_id'];
$courseInfo = $courseList[$work['c_id']];
$sessionId = $work['session_id'];
$cidReq = 'cidReq='.$courseInfo['code'].'&id_session='.$sessionId;
$item_id = $work_id = $work['id'];
$dbTitle = $work['title'];
// Get the author ID for that document from the item_property table
$is_author = false;
$can_read = false;
$owner_id = $work['user_id'];
$visibility = api_get_item_visibility($courseInfo, 'work', $work['id'], $sessionId);
if ($visibility != 1) {
continue;
}
/*$locked = api_resource_is_locked_by_gradebook(
$item_id,
LINK_STUDENTPUBLICATION,
$courseInfo['code']
);*/
$locked = false;
/* Because a bug found when saving items using the api_item_property_update()
the field $item_property_data['insert_user_id'] is not reliable. */
if (!$is_allowed_to_edit && $owner_id == api_get_user_id()) {
$is_author = true;
}
/*if ($course_info['show_score'] == 0) {
$can_read = true;
}*/
$qualification_string = '';
if ($qualification_exists) {
if ($work['qualification'] == '') {
$qualification_string = Display::label('-');
} else {
$qualification_string = formatWorkScore($work['qualification'], $work['qualification']);
}
}
$work['qualification_score'] = $work['qualification'];
$add_string = '';
$time_expires = '';
if (!empty($work_assignment['expires_on'])) {
$time_expires = api_strtotime(
$work_assignment['expires_on'],
'UTC'
);
}
if (!empty($work_assignment['expires_on']) &&
!empty($time_expires) && ($time_expires < api_strtotime($work['sent_date'], 'UTC'))) {
$add_string = Display::label(get_lang('Expired'), 'important').' - ';
}
if (($can_read && $work['accepted'] == '1') ||
($is_author && in_array($work['accepted'], ['1', '0'])) ||
($is_allowed_to_edit || api_is_drh())
) {
// Firstname, lastname, username
$work['fullname'] = Display::div(
api_get_person_name($work['firstname'], $work['lastname']),
['class' => 'work-name']
);
// Title
$work['title_clean'] = $work['title'];
$work['title'] = Security::remove_XSS($work['title']);
if (strlen($work['title']) > 30) {
$short_title = substr($work['title'], 0, 27).'...';
$work['title'] = Display::span($short_title, ['class' => 'work-title', 'title' => $work['title']]);
} else {
$work['title'] = Display::div($work['title'], ['class' => 'work-title']);
}
// Type.
$work['type'] = DocumentManager::build_document_icon_tag('file', $work['url']);
// File name.
$linkToDownload = '';
// If URL is present then there's a file to download keep BC.
if ($work['contains_file'] || !empty($work['url'])) {
$linkToDownload = '<a href="'.$url.'download.php?id='.$item_id.'&'.$cidReq.'">'.$saveIcon.'</a> ';
}
$feedback = '';
$count = getWorkCommentCount($item_id, $courseInfo);
if (!is_null($count) && !empty($count)) {
if ($qualification_exists) {
$feedback .= ' ';
}
$feedback .= Display::url(
$count.' '.Display::returnFontAwesomeIcon('comments-o'),
$url.'view.php?'.$cidReq.'&id='.$item_id
);
}
$correction = '';
$hasCorrection = '';
if (!empty($work['url_correction'])) {
$hasCorrection = Display::url(
$correctionIcon,
api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.$cidReq.'&correction=1'
);
}
if ($qualification_exists) {
$work['qualification'] = $qualification_string.$feedback;
} else {
$work['qualification'] = $qualification_string.$feedback.$hasCorrection;
}
$work['qualification_only'] = $qualification_string;
// Date.
$work_date = api_get_local_time($work['sent_date']);
$date = date_to_str_ago($work['sent_date']).' '.$work_date;
$work['formatted_date'] = $work_date.' '.$add_string;
$work['expiry_note'] = $add_string;
$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = '<div class="work-date" title="'.$date.'">'.
$add_string.' '.Display::dateToStringAgoAndLongDate($work['sent_date']).'</div>';
$work['status'] = $hasCorrection;
$work['has_correction'] = $hasCorrection;
$work['course'] = $courseInfo['title'];
if (isset($parentList[$work['parent_id']])) {
$parent = $parentList[$work['parent_id']];
} else {
$parent = get_work_data_by_id($work['parent_id'], $courseId);
}
$work['work_name'] = $parent['title'];
// Actions.
$action = '';
if (api_is_allowed_to_edit()) {
if ($blockScoreEdition && !api_is_platform_admin() && !empty($work['qualification_score'])) {
$rateLink = '';
} else {
$rateLink = '<a href="'.$url.'view.php?'.$cidReq.'&id='.$item_id.'" title="'.get_lang('View').'">'.
$rateIcon.'</a> ';
}
$action .= $rateLink;
if ($unoconv && empty($work['contains_file'])) {
$action .= '<a
href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'"
title="'.get_lang('ExportToDoc').'" >'.
Display::return_icon('export_doc.png', get_lang('ExportToDoc'), [], ICON_SIZE_SMALL).'</a> ';
}
$alreadyUploaded = '';
if (!empty($work['url_correction'])) {
$alreadyUploaded = '<br />'.$work['title_correction'].' '.$correctionIconSmall;
}
$correction = '
<form
id="file_upload_'.$item_id.'"
class="work_correction_file_upload file_upload_small fileinput-button"
action="'.api_get_path(WEB_AJAX_PATH).'work.ajax.php?'.$cidReq.'&a=upload_correction_file&item_id='.$item_id.'"
method="POST"
enctype="multipart/form-data"
>
<div id="progress_'.$item_id.'" class="text-center button-load">
'.addslashes(get_lang('ClickOrDropOneFileHere')).'
'.Display::return_icon('upload_file.png', get_lang('Correction'), [], ICON_SIZE_TINY).'
'.$alreadyUploaded.'
</div>
<input id="file_'.$item_id.'" type="file" name="file" class="" multiple>
</form>
';
$correction .= "<script>
$(function() {
$('.work_correction_file_upload').each(function () {
$(this).fileupload({
dropZone: $(this)
});
});
$('#file_upload_".$item_id."').fileupload({
add: function (e, data) {
$('#progress_$item_id').html();
data.context = $('#progress_$item_id').html('$loadingText <br /> <em class=\"fa fa-spinner fa-pulse fa-fw\"></em>');
data.submit();
$(this).removeClass('hover');
},
dragover: function (e, data) {
$(this).addClass('hover');
},
done: function (e, data) {
if (data._response.result.name) {
$('#progress_$item_id').html('$uploadedText '+data._response.result.result+'<br />'+data._response.result.name);
} else {
$('#progress_$item_id').html('$failsUploadText $failsUploadIcon');
}
$(this).removeClass('hover');
}
});
$('#file_upload_".$item_id."').on('dragleave', function (e) {
// dragleave callback implementation
$(this).removeClass('hover');
});
});
</script>";
if ($locked) {
if ($qualification_exists) {
$action .= Display::return_icon(
'edit_na.png',
get_lang('CorrectAndRate'),
[],
ICON_SIZE_SMALL
);
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Comment'), [], ICON_SIZE_SMALL);
}
} else {
if ($blockEdition && !api_is_platform_admin()) {
$editLink = '';
} else {
$editIcon = Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL);
if ($qualification_exists) {
$editLink = '<a
href="'.$url.'edit.php?'.$cidReq.'&item_id='.$item_id.'&id='.$work['parent_id'].'"
title="'.get_lang('Edit').'" >'.
$editIcon.
'</a>';
} else {
$editLink = '<a
href="'.$url.'edit.php?'.$cidReq.'&item_id='.$item_id.'&id='.$work['parent_id'].'"
title="'.get_lang('Modify').'">'.
$editIcon.'</a>';
}
}
$action .= $editLink;
}
/*if ($work['contains_file']) {
if ($locked) {
$action .= Display::return_icon(
'move_na.png',
get_lang('Move'),
[],
ICON_SIZE_SMALL
);
} else {
$action .= '<a href="'.$url.'work.php?'.$cidReq.'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
Display::return_icon('move.png', get_lang('Move'), [], ICON_SIZE_SMALL).'</a>';
}
}*/
/*if ($work['accepted'] == '1') {
$action .= '<a href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
Display::return_icon('visible.png', get_lang('Invisible'), [], ICON_SIZE_SMALL).'</a>';
} else {
$action .= '<a href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
Display::return_icon('invisible.png', get_lang('Visible'), [], ICON_SIZE_SMALL).'</a> ';
}*/
/*if ($locked) {
$action .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
} else {
$action .= '<a href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}*/
} elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
$action .= '<a href="'.$url.'view.php?'.$cidReq.'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'), [], ICON_SIZE_SMALL).'</a>';
if (api_get_course_setting('student_delete_own_publication') == 1) {
if (api_is_allowed_to_session_edit(false, true)) {
$action .= '<a href="'.$url.'edit.php?'.$cidReq.'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Comment'), [], ICON_SIZE_SMALL).'</a>';
}
$action .= ' <a href="'.$url.'work_list.php?'.$cidReq.'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}
} else {
$action .= '<a href="'.$url.'view.php?'.$cidReq.'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'), [], ICON_SIZE_SMALL).'</a>';
}
// Status.
if (empty($work['qualificator_id'])) {
$qualificator_id = Display::label(get_lang('NotRevised'), 'warning');
} else {
$qualificator_id = Display::label(get_lang('Revised'), 'success');
}
$work['qualificator_id'] = $qualificator_id.' '.$hasCorrection;
$work['actions'] = '<div class="work-action">'.$linkToDownload.$action.'</div>';
$work['correction'] = $correction;
if (!empty($compilation) && $is_allowed_to_edit) {
$compilationId = $compilation->getCompilatioId($item_id, $courseId);
if ($compilationId) {
$actionCompilatio = "<div id='id_avancement".$item_id."' class='compilation_block'>
".$loading.'&nbsp;'.get_lang('CompilatioConnectionWithServer').'</div>';
} else {
$workDirectory = api_get_path(SYS_COURSE_PATH).$courseInfo['directory'];
if (!Compilatio::verifiFileType($dbTitle)) {
$actionCompilatio = get_lang('FileFormatNotSupported');
} elseif (filesize($workDirectory.'/'.$work['url']) > $compilation->getMaxFileSize()) {
$sizeFile = round(filesize($workDirectory.'/'.$work['url']) / 1000000);
$actionCompilatio = get_lang('UplFileTooBig').': '.format_file_size($sizeFile).'<br />';
} else {
$actionCompilatio = "<div id='id_avancement".$item_id."' class='compilation_block'>";
$actionCompilatio .= Display::url(
get_lang('CompilatioAnalysis'),
'javascript:void(0)',
[
'class' => 'getSingleCompilatio btn btn-primary btn-xs',
'onclick' => "getSingleCompilatio($item_id);",
]
);
$actionCompilatio .= get_lang('CompilatioWithCompilatio');
}
}
$work['compilatio'] = $actionCompilatio;
}
$works[] = $work;
}
}
return $works;
}
/**
* Send reminder to users who have not given the task.
*

Loading…
Cancel
Save