diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 0c0e1e0829..b58abab0a9 100644 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -489,10 +489,6 @@ switch ($action) { $item['language_id'] = $language_info['english_name']; $item['actions'] = Display::url(Display::return_icon('edit.png', get_lang('Edit')), api_get_path(WEB_CODE_PATH).'admin/event_type.php?action=edit&event_type_name='.$item['event_type_name']); $item['actions'] .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_path(WEB_CODE_PATH).'admin/event_controller.php?action=delete&id='.$item['id']); - - /*if (!$item['status']) { - $item['name'] = ''.$item['subject'].''; - }*/ $new_result[] = $item; } $result = $new_result; @@ -514,7 +510,7 @@ switch ($action) { break; case 'get_promotions': $columns = array('name', 'career', 'description', 'actions'); - if(!in_array($sidx, $columns)) { + if (!in_array($sidx, $columns)) { $sidx = 'name'; } diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 6f53a46fef..1496346744 100644 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -1671,8 +1671,8 @@ function get_work_user_list_from_documents( if ($getCount) { $select = " SELECT count() as count "; } else { - $select1 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, w.title, w.document_id document_id, w.id"; - $select2 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, d.title, d.id document_id, 0"; + $select1 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, w.title, w.document_id document_id, w.id, qualification, qualificator_id"; + $select2 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, d.title, d.id document_id, 0, 0, 0"; } $documentTable = Database::get_course_table(TABLE_DOCUMENT); @@ -1734,6 +1734,13 @@ function get_work_user_list_from_documents( $currentUserId = api_get_user_id(); + $work_data = get_work_data_by_id($workId); + + $qualificationExists = false; + if (!empty($work_data['qualification']) && intval($work_data['qualification']) > 0) { + $qualificationExists = true; + } + if ($getCount) { $result = Database::fetch_array($result); return $result['count']; @@ -1756,6 +1763,8 @@ function get_work_user_list_from_documents( $documentId = $row['document_id']; $itemId = $row['id']; + $addLinkShowed = false; + if (empty($documentId)) { $url = $urlEdit.'&item_id='.$row['id'].'&id='.$workId; $editLink = Display::url($editIcon, $url); @@ -1767,6 +1776,7 @@ function get_work_user_list_from_documents( if (empty($documentToWork)) { $url = $urlAdd.'&document_id='.$documentId.'&id='.$workId; $editLink = Display::url($addIcon, $url); + $addLinkShowed = true; } else { $row['title'] = $documentToWork['title']; @@ -1794,6 +1804,19 @@ function get_work_user_list_from_documents( $row['type'] = build_document_icon_tag('file', $row['file']); + if ($qualificationExists) { + if (empty($row['qualificator_id'])) { + $status = Display::label(get_lang('NotRevised'), 'warning'); + } else { + $status = Display::label(get_lang('Revised'), 'success'); + } + $row['qualificator_id'] = $status; + } + + if (!empty($row['qualification'])) { + $row['qualification'] = Display::label($row['qualification'], 'info'); + } + if (!empty($row['sent_date'])) { $row['sent_date'] = api_get_local_time($row['sent_date']); } @@ -1802,6 +1825,11 @@ function get_work_user_list_from_documents( $row['actions'] = $viewLink.$editLink.$deleteLink; } + if ($addLinkShowed) { + $row['qualification'] = ''; + $row['qualificator_id'] = ''; + } + $workList[] = $row; } } diff --git a/main/work/work_list.php b/main/work/work_list.php index ef29765c33..4fca382df3 100644 --- a/main/work/work_list.php +++ b/main/work/work_list.php @@ -98,7 +98,6 @@ $check_qualification = intval($my_folder_data['qualification']); if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) { $type = 'simple'; - $columns = array( get_lang('Type'), get_lang('FirstName'), @@ -111,14 +110,14 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) ); $column_model = array ( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), + array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false'), array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), - array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'20', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), - array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array('name'=>'qualification', 'index'=>'qualification', 'width'=>'10', 'align'=>'left', 'search' => 'true'), + array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), + array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'), + array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') ); } else { $type = 'complex'; @@ -133,7 +132,7 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) ); $column_model = array ( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), + array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false'), array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), diff --git a/main/work/work_list_others.php b/main/work/work_list_others.php index d9fd0b90af..847d93864e 100644 --- a/main/work/work_list_others.php +++ b/main/work/work_list_others.php @@ -75,9 +75,16 @@ $check_qualification = intval($my_folder_data['qualification']); if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) { $type = 'simple'; $columns = array( - get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions') + get_lang('Type'), + get_lang('FirstName'), + get_lang('LastName'), + get_lang('Title'), + get_lang('Qualification'), + get_lang('Date'), + get_lang('Status'), + get_lang('Actions') ); - $column_model = array( + $column_model = array( array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), @@ -92,7 +99,7 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) $columns = array( get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions') ); - $column_model = array ( + $column_model = array ( array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),