소스 검색

Rename download work file name adding send date + username see BT#12100

jmontoyaa 8 년 전
부모
커밋
4116edc8a7
2개의 변경된 파일19개의 추가작업 그리고 11개의 파일을 삭제
  1. 0 1
      main/work/downloadfolder.inc.php
  2. 19 10
      main/work/work.lib.php

+ 0 - 1
main/work/downloadfolder.inc.php

@@ -141,7 +141,6 @@ $query = Database::query($sql);
 
 //add tem to the zip file
 while ($not_deleted_file = Database::fetch_assoc($query)) {
-
     $user_info = api_get_user_info($not_deleted_file['insert_user_id']);
     $insert_date = api_get_local_time($not_deleted_file['insert_date']);
     $insert_date = str_replace(array(':', '-', ' '), '_', $insert_date);

+ 19 - 10
main/work/work.lib.php

@@ -2091,14 +2091,13 @@ function get_work_user_list(
                 $correction = '';
                 $action = '';
                 $hasCorrection = '';
+                if (!empty($work['url_correction'])) {
+                    $hasCorrection = Display::url(
+                        Display::return_icon('check-circle.png', get_lang('Correction'), null, ICON_SIZE_SMALL),
+                        api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.api_get_cidreq().'&correction=1'
+                    );
+                }
                 if (api_is_allowed_to_edit()) {
-                    if (!empty($work['url_correction'])) {
-                        $hasCorrection = Display::url(
-                            Display::return_icon('check-circle.png', get_lang('Correction'), null, ICON_SIZE_SMALL),
-                            api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.api_get_cidreq().'&correction=1'
-                        );
-                    }
-
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
                         Display::return_icon('rate_work.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL).'</a> ';
 
@@ -2207,7 +2206,7 @@ function get_work_user_list(
                 } else {
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
                         Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
-                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
+                    //$action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
                 }
 
                 // Status.
@@ -2219,7 +2218,6 @@ function get_work_user_list(
                 $work['qualificator_id'] = $qualificator_id.' '.$hasCorrection;
                 $work['actions'] = '<div class="work-action">'.$send_to.$link_to_download.$action.'</div>';
                 $work['correction'] = $correction;
-
                 $works[] = $work;
             }
         }
@@ -4875,7 +4873,7 @@ function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
             */
 
             $work_is_visible = $item_info['visibility'] == 1 && $row['accepted'] == 1;
-            $doc_visible_for_all = ($course_info['show_score'] == 1);
+            $doc_visible_for_all = $course_info['show_score'] == 1;
 
             $is_editor = api_is_allowed_to_edit(true, true, true);
             $student_is_owner_of_work = user_is_author($row['id'], $row['user_id']);
@@ -4893,7 +4891,18 @@ function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
                 }
 
                 $title = str_replace(' ', '_', $title);
+
+                if ($correction == false) {
+                    $userInfo = api_get_user_info($row['user_id']);
+                    if ($userInfo) {
+                        $date = api_get_local_time($row['sent_date']);
+                        $date = str_replace(array(':', '-', ' '), '_', $date);
+                        $title = $date.'_'.$userInfo['username'].'_'.$title;
+                    }
+                }
+
                 Event::event_download($title);
+
                 if (Security::check_abs_path(
                     $full_file_name,
                     api_get_path(SYS_COURSE_PATH).api_get_course_path().'/')