diff --git a/main/work/add_document.php b/main/work/add_document.php index 069b9c878d..3e3ca92613 100755 --- a/main/work/add_document.php +++ b/main/work/add_document.php @@ -31,8 +31,14 @@ if (!api_is_allowed_to_edit()) { $courseInfo = api_get_course_info(); -$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); -$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), +); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, + 'name' => $my_folder_data['title'], +); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddDocument')); $error_message = null; diff --git a/main/work/edit.php b/main/work/edit.php index ccc8386d3d..87b1db3b65 100755 --- a/main/work/edit.php +++ b/main/work/edit.php @@ -77,8 +77,8 @@ if (!empty($my_folder_data)) { if (!empty($homework['expires_on']) && !empty($homework['expires_on']) ) { - $time_expires = api_strtotime($homework['expires_on'], 'UTC'); - $difference = $time_expires - $time_now; + $time_expires = api_strtotime($homework['expires_on'], 'UTC'); + $difference = $time_expires - $time_now; if ($difference < 0) { $has_expired = true; } @@ -89,8 +89,8 @@ if (!empty($my_folder_data)) { } if (!empty($homework['ends_on'])) { - $time_ends = api_strtotime($homework['ends_on'], 'UTC'); - $difference2 = $time_ends - $time_now; + $time_ends = api_strtotime($homework['ends_on'], 'UTC'); + $difference2 = $time_ends - $time_now; if ($difference2 < 0) { $has_ended = true; } @@ -159,7 +159,7 @@ if ($is_allowed_to_edit && !empty($item_id)) { $form->addLabel( get_lang('Download'), ''. - Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_MEDIUM).' + Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_MEDIUM).' ' ); } @@ -335,7 +335,7 @@ if (!empty($work_id)) { $content .= Display::return_message(get_lang('ActionNotAllowed'), 'error'); } } elseif ($student_can_edit_in_session && $has_ended == false) { - $content .= $form->return_form(); + $content .= $form->returnForm(); } else { $content .= Display::return_message(get_lang('ActionNotAllowed'), 'error'); } diff --git a/main/work/student_work.php b/main/work/student_work.php index 2d62e4f245..1b1aea2f38 100755 --- a/main/work/student_work.php +++ b/main/work/student_work.php @@ -48,11 +48,11 @@ if (!empty($group_id)) { } $interbreadcrumb[] = array( - 'url' => '../group/group.php', + 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups') ); $interbreadcrumb[] = array( - 'url' => '../group/group_space.php?gidReq='.$group_id, + 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name'] ); } else { diff --git a/main/work/upload.php b/main/work/upload.php index 44a5bf12f5..e94ddc08a7 100755 --- a/main/work/upload.php +++ b/main/work/upload.php @@ -1,8 +1,6 @@ api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); -$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$workId, 'name' => $workInfo['title']); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), +); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$workId, + 'name' => $workInfo['title'], +); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadCorrections')); $form = new FormValidator( @@ -62,13 +68,11 @@ $succeed = false; if ($form->validate()) { $values = $form->getSubmitValues(); - $upload = process_uploaded_file($_FILES['file'], false); if ($upload) { $zip = new PclZip($_FILES['file']['tmp_name']); - // Check the zip content (real size and file extension) $zipFileList = (array)$zip->listContent(); @@ -126,6 +130,9 @@ if ($form->validate()) { $finder = new Finder(); $finder->files()->in($destinationDir); + + $table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); + /** @var SplFileInfo $file */ foreach ($finder as $file) { $fileName = $file->getBasename(); @@ -143,13 +150,9 @@ if ($form->validate()) { if (!empty($workStudent['url'])) { $correctionFilePath = $coursePath.$workStudent['url'].'_correction'; $correctionTitle = $fileName; - } else { - //$correctionFilePath = $workDir.api_get_unique_id().'_correction'; } } - $table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); - if (!empty($correctionFilePath)) { $result = copy( diff --git a/main/work/upload_from_template.php b/main/work/upload_from_template.php index 5486ca1d8c..0453eab403 100755 --- a/main/work/upload_from_template.php +++ b/main/work/upload_from_template.php @@ -53,8 +53,14 @@ $student_can_edit_in_session = api_is_allowed_to_session_edit(false, true); $homework = get_work_assignment_by_id($workInfo['id']); $validationStatus = getWorkDateValidationStatus($homework); -$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); -$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$work_id, 'name' => $workInfo['title']); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), +); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$work_id, + 'name' => $workInfo['title'], +); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadFromTemplate')); $form = new FormValidator( diff --git a/main/work/view.php b/main/work/view.php index 26d60ee00b..ac0be47c37 100755 --- a/main/work/view.php +++ b/main/work/view.php @@ -21,7 +21,10 @@ if ($work['active'] != 1) { $work['title'] = isset($work['title']) ? Security::remove_XSS($work['title']) : ''; $work['description'] = isset($work['description']) ? Security::remove_XSS($work['description']) : ''; -$interbreadcrumb[] = array ('url' => 'work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); +$interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), +); $my_folder_data = get_work_data_by_id($work['parent_id']); $courseInfo = api_get_course_info(); @@ -41,9 +44,9 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i ) ) { if ((api_is_allowed_to_edit() || api_is_coach()) || api_is_drh()) { - $url_dir = 'work_list_all.php?id='.$my_folder_data['id'].'&'.api_get_cidreq(); + $url_dir = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?id='.$my_folder_data['id'].'&'.api_get_cidreq(); } else { - $url_dir = 'work_list.php?id='.$my_folder_data['id'].'&'.api_get_cidreq(); + $url_dir = api_get_path(WEB_CODE_PATH).'work/work_list.php?id='.$my_folder_data['id'].'&'.api_get_cidreq(); } $userInfo = api_get_user_info($work['user_id']); diff --git a/main/work/work.php b/main/work/work.php index 2233b39aae..14683d2b18 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -53,48 +53,63 @@ if ($action == 'upload_form') { } /* Header */ -if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { - $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); - $gradebook = $_SESSION['gradebook']; -} elseif (empty($_GET['gradebook'])) { - unset($_SESSION['gradebook']); - $gradebook = ''; -} - -if (!empty($gradebook) && $gradebook == 'view') { - $interbreadcrumb[] = array ('url' => '../gradebook/' . $_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); +if (api_is_in_gradebook()) { + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(), + 'name' => get_lang('ToolGradebook'), + ); } if (!empty($group_id)) { api_protect_course_group(GroupManager::GROUP_TOOL_WORK); - $group_properties = GroupManager::get_group_properties($group_id); - $interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); - $interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']); - $interbreadcrumb[] = array('url' =>'work.php?'.api_get_cidreq(),'name' => get_lang('StudentPublications')); - $url_dir = 'work.php?&id=' . $work_id.'&'.api_get_cidreq(); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), + 'name' => get_lang('Groups'), + ); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), + 'name' => get_lang('GroupSpace').' '.$group_properties['name'], + ); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), + ); + $url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?&id=' . $work_id.'&'.api_get_cidreq(); if (!empty($my_folder_data)) { $interbreadcrumb[] = array('url' => $url_dir, 'name' => $my_folder_data['title']); } if ($action == 'upload_form') { - $interbreadcrumb[] = array('url' => 'work.php?'.api_get_cidreq(),'name' => get_lang('UploadADocument')); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('UploadADocument'), + ); } if ($action == 'create_dir') { - $interbreadcrumb[] = array('url' => 'work.php?'.api_get_cidreq(),'name' => get_lang('CreateAssignment')); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('CreateAssignment'), + ); } } else { if ($origin != 'learnpath') { if (isset($_GET['id']) && !empty($_GET['id']) || $display_upload_form || $action == 'settings' || $action == 'create_dir') { - $interbreadcrumb[] = array('url' => 'work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), + 'name' => get_lang('StudentPublications'), + ); } else { $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('StudentPublications')); } if (!empty($my_folder_data)) { - $interbreadcrumb[] = array('url' => 'work.php?id=' . $work_id.'&'.api_get_cidreq(), 'name' => $my_folder_data['title']); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?id='.$work_id.'&'.api_get_cidreq(), + 'name' => $my_folder_data['title'], + ); } if ($action == 'upload_form') { @@ -322,7 +337,7 @@ switch ($action) { } if (api_is_allowed_to_edit() || api_is_coach()) { // Work list - + $content .= '