|
|
|
|
@ -1764,8 +1764,32 @@ function get_work_user_list_from_documents( |
|
|
|
|
$select1 = " SELECT count(u.user_id) as count "; |
|
|
|
|
$select2 = " SELECT count(u.user_id) as count "; |
|
|
|
|
} else { |
|
|
|
|
$select1 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, w.title, w.parent_id, w.document_id document_id, w.id, qualification, qualificator_id"; |
|
|
|
|
$select2 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, d.title, w.parent_id, d.id document_id, 0, 0, 0"; |
|
|
|
|
$select1 = " SELECT DISTINCT |
|
|
|
|
u.firstname, |
|
|
|
|
u.lastname, |
|
|
|
|
u.user_id, |
|
|
|
|
w.title, |
|
|
|
|
w.parent_id, |
|
|
|
|
w.document_id document_id, |
|
|
|
|
w.id, qualification, |
|
|
|
|
qualificator_id, |
|
|
|
|
w.sent_date, |
|
|
|
|
w.contains_file, |
|
|
|
|
w.url |
|
|
|
|
"; |
|
|
|
|
$select2 = " SELECT DISTINCT |
|
|
|
|
u.firstname, u.lastname, |
|
|
|
|
u.user_id, |
|
|
|
|
d.title, |
|
|
|
|
w.parent_id, |
|
|
|
|
d.id document_id, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
w.sent_date, |
|
|
|
|
w.contains_file, |
|
|
|
|
w.url |
|
|
|
|
"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$documentTable = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
@ -1850,12 +1874,19 @@ function get_work_user_list_from_documents( |
|
|
|
|
$urlEdit = api_get_path(WEB_CODE_PATH).'work/edit.php?'.api_get_cidreq(); |
|
|
|
|
$urlDelete = api_get_path(WEB_CODE_PATH).'work/work_list.php?action=delete&'.api_get_cidreq(); |
|
|
|
|
$urlView = api_get_path(WEB_CODE_PATH).'work/view.php?'.api_get_cidreq(); |
|
|
|
|
$urlDownload = api_get_path(WEB_CODE_PATH).'work/download.php?'.api_get_cidreq(); |
|
|
|
|
|
|
|
|
|
$editIcon = Display::return_icon('edit.png', get_lang('Edit')); |
|
|
|
|
$addIcon = Display::return_icon('add.png', get_lang('Add')); |
|
|
|
|
$deleteIcon = Display::return_icon('delete.png', get_lang('Delete')); |
|
|
|
|
$viewIcon = Display::return_icon('rate_work.png', get_lang('CorrectAndRate')); |
|
|
|
|
$allowEdition = api_get_course_setting('student_delete_own_publication'); |
|
|
|
|
$viewIcon = Display::return_icon('default.png', get_lang('View')); |
|
|
|
|
$saveIcon = Display::return_icon( |
|
|
|
|
'save.png', |
|
|
|
|
get_lang('Save'), |
|
|
|
|
[], |
|
|
|
|
ICON_SIZE_SMALL |
|
|
|
|
); |
|
|
|
|
$allowEdition = api_get_course_setting('student_delete_own_publication') == 1; |
|
|
|
|
|
|
|
|
|
$workList = array(); |
|
|
|
|
while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
|
|
|
@ -1867,7 +1898,7 @@ function get_work_user_list_from_documents( |
|
|
|
|
if (empty($documentId)) { |
|
|
|
|
$url = $urlEdit.'&item_id='.$row['id'].'&id='.$workId; |
|
|
|
|
$editLink = Display::url($editIcon, $url); |
|
|
|
|
if ($allowEdition == false) { |
|
|
|
|
if ($allowEdition != 1) { |
|
|
|
|
$editLink = null; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
@ -1884,23 +1915,28 @@ function get_work_user_list_from_documents( |
|
|
|
|
$url = $urlEdit.'&item_id='.$newWorkId.'&id='.$workId; |
|
|
|
|
$editLink = Display::url($editIcon, $url); |
|
|
|
|
|
|
|
|
|
if ($allowEdition == false) { |
|
|
|
|
$editLink = null; |
|
|
|
|
if ($allowEdition != 1) { |
|
|
|
|
$editLink = ''; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($allowEdition && !empty($itemId)) { |
|
|
|
|
$deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId); |
|
|
|
|
} else { |
|
|
|
|
$deleteLink = null; |
|
|
|
|
$downloadLink = ''; |
|
|
|
|
// If URL is present then there's a file to download keep BC. |
|
|
|
|
if ($row['contains_file'] || !empty($row['url'])) { |
|
|
|
|
$downloadLink = Display::url($saveIcon, $urlDownload.'&id='.$row['id']).' '; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$viewLink = null; |
|
|
|
|
$viewLink = ''; |
|
|
|
|
if (!empty($itemId)) { |
|
|
|
|
$viewLink = Display::url($viewIcon, $urlView.'&id='.$itemId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$deleteLink = ''; |
|
|
|
|
if ($allowEdition == 1 && !empty($itemId)) { |
|
|
|
|
$deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$row['type'] = null; |
|
|
|
|
|
|
|
|
|
if ($qualificationExists) { |
|
|
|
|
@ -1917,11 +1953,11 @@ function get_work_user_list_from_documents( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($row['sent_date'])) { |
|
|
|
|
$row['sent_date'] = api_get_local_time($row['sent_date']); |
|
|
|
|
$row['sent_date'] = Display::dateToStringAgoAndLongDate($row['sent_date']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($userId == $currentUserId) { |
|
|
|
|
$row['actions'] = $viewLink.$editLink.$deleteLink; |
|
|
|
|
$row['actions'] = $downloadLink.$viewLink.$editLink.$deleteLink; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($addLinkShowed) { |
|
|
|
|
@ -1931,7 +1967,6 @@ function get_work_user_list_from_documents( |
|
|
|
|
|
|
|
|
|
$workList[] = $row; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $workList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -3648,12 +3683,17 @@ function getWorkDateValidationStatus($homework) |
|
|
|
|
*/ |
|
|
|
|
function setWorkUploadForm($form, $uploadFormType = 0) |
|
|
|
|
{ |
|
|
|
|
$form->addElement('header', get_lang('UploadADocument')); |
|
|
|
|
$form->addElement('hidden', 'contains_file', 0, array('id'=>'contains_file_id')); |
|
|
|
|
$form->addElement('hidden', 'active', 1); |
|
|
|
|
$form->addElement('hidden', 'accepted', 1); |
|
|
|
|
$form->addHeader(get_lang('UploadADocument')); |
|
|
|
|
$form->addHidden('contains_file', 0, array('id'=>'contains_file_id')); |
|
|
|
|
$form->addHidden('active', 1); |
|
|
|
|
$form->addHidden('accepted', 1); |
|
|
|
|
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload')); |
|
|
|
|
$form->addElement('text', 'extension', get_lang('FileExtension'), array('id' => 'file_extension', 'readonly' => 'readonly')); |
|
|
|
|
$form->addElement( |
|
|
|
|
'text', |
|
|
|
|
'extension', |
|
|
|
|
get_lang('FileExtension'), |
|
|
|
|
array('id' => 'file_extension', 'readonly' => 'readonly') |
|
|
|
|
); |
|
|
|
|
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
|
|
|
|
|
switch ($uploadFormType) { |
|
|
|
|
|