diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index df897455a1..6e99115cc5 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -230,6 +230,11 @@ ul#navigation .report a { padding-top: 0px; background: none; } + +.work_correction_file_upload { + height: 40px; +} + .impress-content{ position: relative; width: 100%; @@ -354,24 +359,24 @@ ul#navigation .report a { display: inline-block; margin-left: 5px; padding: 5px; - background: #ffffff; - background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); - background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); - background: -o-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); - background: -ms-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); - background: linear-gradient(to bottom, #ffffff 0%,#e5e5e5 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); + background: #ffffff; + background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); + background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); + background: -o-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); + background: -ms-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); + background: linear-gradient(to bottom, #ffffff 0%,#e5e5e5 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); } .actions a:hover{ - background: #f4f4f4; - background: -moz-linear-gradient(top, #f4f4f4 0%, #dddddd 71%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f4f4), color-stop(71%,#dddddd)); - background: -webkit-linear-gradient(top, #f4f4f4 0%,#dddddd 71%); - background: -o-linear-gradient(top, #f4f4f4 0%,#dddddd 71%); + background: #f4f4f4; + background: -moz-linear-gradient(top, #f4f4f4 0%, #dddddd 71%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f4f4), color-stop(71%,#dddddd)); + background: -webkit-linear-gradient(top, #f4f4f4 0%,#dddddd 71%); + background: -o-linear-gradient(top, #f4f4f4 0%,#dddddd 71%); background: -ms-linear-gradient(top, #f4f4f4 0%,#dddddd 71%); background: linear-gradient(to bottom, #f4f4f4 0%,#dddddd 71%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#dddddd',GradientType=0 ); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#dddddd',GradientType=0 ); }*/ .actions .btn-toolbar { margin : 0px; @@ -3425,7 +3430,7 @@ div#no-data-view div.controls { padding-top: 1px; } -/* styles for the star rater +/* styles for the star rater .star-rating{ list-style:none; margin: 0px; @@ -4028,7 +4033,7 @@ a.forum_group_link { min-height: 50px; } .new_actions .nav > li > a { - + border-radius: 0 0 0 0; border-right: 1px solid #E5E5E5; margin: 0; @@ -6197,7 +6202,7 @@ div#chat-remote-video video { padding-top: 3px; padding-bottom: 5px; border-radius: 5px; - + } .hot-course-head{ padding-top: 10px; @@ -6459,7 +6464,7 @@ a.sessionView { { width: 70px; float: left; - margin-right: 5px; + margin-right: 5px; } #course-block .list-group .list-group-item .title, #session-block .list-group .list-group-item .title{ diff --git a/main/document/document.php b/main/document/document.php index ab5105dcb1..a031449f7d 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -34,7 +34,6 @@ $current_course_tool = TOOL_DOCUMENT; $this_section = SECTION_COURSES; $to_user_id = null; $parent_id = null; -$message = null; $lib_path = api_get_path(LIBRARY_PATH); @@ -50,16 +49,15 @@ if ( ) { unlink($_SESSION['temp_realpath_image']); } +$_user = api_get_user_info(); $courseInfo = api_get_course_info(); $course_dir = $courseInfo['directory'] . '/document'; $sys_course_path = api_get_path(SYS_COURSE_PATH); $base_work_dir = $sys_course_path . $course_dir; -$http_www = api_get_path(WEB_COURSE_PATH) . - $courseInfo['directory'] . '/document'; +$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'] . '/document'; $document_path = $base_work_dir; $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true'; -$courseInfo = api_get_course_info(); $course_dir = $courseInfo['directory'].'/document'; $sys_course_path = api_get_path(SYS_COURSE_PATH); $base_work_dir = $sys_course_path.$course_dir; @@ -68,7 +66,7 @@ $document_path = $base_work_dir; $currentUrl = api_get_self().'?'.api_get_cidreq(); -//Removing sessions +// Removing sessions unset($_SESSION['draw_dir']); unset($_SESSION['paint_dir']); unset($_SESSION['temp_audio_nanogong']); @@ -229,18 +227,20 @@ switch ($action) { if ($deleteDocument) { $certificateId = isset($_GET['delete_certificate_id']) ? $_GET['delete_certificate_id'] : null; - DocumentManager::remove_attach_certificate(api_get_course_id(), $certificateId); - $message = Display::return_message( + DocumentManager::remove_attach_certificate( + api_get_course_id(), + $certificateId + ); + Display::addFlash(Display::return_message( get_lang('DocDeleted') . ': ' . $documentInfo['title'], 'success' - ); + )); } else { - $message = Display::return_message(get_lang('DocDeleteError'), 'warning'); + Display::addFlash(Display::return_message(get_lang('DocDeleteError'), 'warning')); } } else { - $message = Display::return_message(get_lang('FileNotFound'), 'warning'); + Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); } - Session::write('message', $message); header("Location: $currentUrl"); exit; } @@ -390,27 +390,28 @@ switch ($action) { get_lang('Yes'). '

'; if (!isset($_GET['copy'])) { - $message = Display::return_message($message, 'warning', false); + Display::addFlash(Display::return_message($message, 'warning', false)); } if (Security::remove_XSS($_GET['copy']) == 'yes') { if (!copy($file, $copyfile)) { - $message = Display::return_message(get_lang('CopyFailed'), 'error'); + Display::addFlash(Display::return_message(get_lang('CopyFailed'), 'error')); } else { - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('OverwritenFile').' '.$file_link, 'confirmation', false - ); + )); } } } else { if (!copy($file, $copyfile)) { - $message = Display::return_message(get_lang('CopyFailed'), 'error'); + Display::addFlash(Display::return_message(get_lang('CopyFailed'), 'error')); } else { - $message = Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false); + Display::addFlash( + Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false) + ); } } - Session::write('message', $message); } break; case 'convertToPdf': @@ -432,10 +433,10 @@ switch ($action) { '/document' . $document_info['path']; $fileInfo = pathinfo($file); if ($fileInfo['extension'] == $formatTarget) { - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('ErrorSameFormat'), 'warning' - ); + )); } elseif ( !( in_array( @@ -455,10 +456,10 @@ switch ($action) { ) ) ) { - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('FormatNotSupported'), 'warning' - ); + )); } else { $convertedFile = $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '_from_' . $fileInfo['extension'] . @@ -466,10 +467,10 @@ switch ($action) { $convertedTitle = $document_info['title']; $obj = new OpenofficePresentation(true); if (file_exists($convertedFile)) { - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('FileExists'), 'error' - ); + )); } else { $result = $obj->convertCopyDocument( $file, @@ -477,10 +478,10 @@ switch ($action) { $convertedTitle ); if (empty($result)) { - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('CopyFailed'), 'error' - ); + )); } else { $cidReq = Security::remove_XSS($_GET['cidReq']); $id_session = api_get_session_id(); @@ -492,11 +493,11 @@ switch ($action) { '&id_session=' . $id_session . '&' . 'gidReq=' . $gidReq . '&id=' . current($result) ); - $message = Display::return_message( + Display::addFlash(Display::return_message( get_lang('CopyMade') . ' ' . $file_link, 'confirmation', false - ); + )); } } } @@ -1059,7 +1060,7 @@ if ($is_allowed_to_edit || null, $sessionId ); - $message = Display::return_message(get_lang('DirMv'), 'confirmation'); + Display::addFlash(Display::return_message(get_lang('DirMv'), 'confirmation')); } elseif (is_file($real_path_target)) { api_item_property_update( $courseInfo, @@ -1073,7 +1074,7 @@ if ($is_allowed_to_edit || null, $sessionId ); - $message = Display::return_message(get_lang('DocMv'), 'confirmation'); + Display::addFlash(Display::return_message(get_lang('DocMv'), 'confirmation')); } // Set the current path @@ -1086,14 +1087,14 @@ if ($is_allowed_to_edit || } elseif (is_file($real_path_target)) { $message = Display::return_message(get_lang('FileExists'), 'v'); } + Display::addFlash($message); } else { - $message = Display::return_message(get_lang('Impossible'), 'error'); + Display::addFlash(Display::return_message(get_lang('Impossible'), 'error')); } } } else { - $message = Display::return_message(get_lang('Impossible'), 'error'); + Display::addFlash(Display::return_message(get_lang('Impossible'), 'error')); } - Session::write('message', $message); } } @@ -1210,8 +1211,7 @@ if ($is_allowed_to_edit || } } } // endforeach - - Session::write('message', $messages); + Display::addFlash($messages); } } @@ -1284,7 +1284,7 @@ if ($is_allowed_to_edit || } } - Session::write('message', $message); + Display::addFlash($message); } // Show them the form for the directory name @@ -1372,9 +1372,7 @@ if ($is_allowed_to_edit || } elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) { $document_id_for_template = intval($_GET['add_as_template']); - $title = Security::remove_XSS($_POST['template_title']); - //$description = Security::remove_XSS($_POST['template_description']); $user_id = api_get_user_id(); // Create the template_thumbnails folder in the upload folder (if needed) @@ -1425,8 +1423,9 @@ if ($is_allowed_to_edit || $user_id, $new_file_name ); - $message = Display::return_message(get_lang('DocumentSetAsTemplate'), 'confirmation'); - Session::write('message', $message); + Display::addFlash( + Display::return_message(get_lang('DocumentSetAsTemplate'), 'confirmation') + ); } if (isset($_GET['remove_as_template'])) { @@ -1437,8 +1436,10 @@ if ($is_allowed_to_edit || $course_code, $user_id ); - $message = Display::return_message(get_lang('DocumentUnsetAsTemplate'), 'confirmation'); - Session::write('message', $message); + + Display::addFlash( + Display::return_message(get_lang('DocumentUnsetAsTemplate'), 'confirmation') + ); } } @@ -1454,7 +1455,9 @@ if (isset($_GET['curdirpath']) && $document_id = Security::remove_XSS($_GET['set_certificate']); // document id DocumentManager::attach_gradebook_certificate($course_id, $document_id); $message = Display::return_message(get_lang('IsDefaultCertificate'), 'normal'); - Session::write('message', $message); + Display::addFlash( + $message + ); } } /* GET ALL DOCUMENT DATA FOR CURDIRPATH */ @@ -1502,17 +1505,16 @@ if ($groupId != 0) { if (!isset($folders) || $folders === false) { $folders = array(); } -$btngroup= array('class' => 'btn btn-default'); +$btngroup = array('class' => 'btn btn-default'); /* GO TO PARENT DIRECTORY */ +$actionsLeft = ''; if ($curdirpath != '/' && $curdirpath != $group_properties['directory'] && !$is_certificate_mode) { - $actionsLeft = ''; $actionsLeft .= Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM); $actionsLeft .= ''; - } if ($is_certificate_mode && $curdirpath != '/certificates') { @@ -1530,9 +1532,7 @@ if ($is_allowed_to_edit || ) { // TODO:check enable more options for shared folders /* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */ - // Create new document - if (!$is_certificate_mode) { $actionsLeft .= Display::url( Display::return_icon('new_document.png', get_lang('CreateDoc'), '', ICON_SIZE_MEDIUM), @@ -1647,11 +1647,10 @@ if (api_is_allowed_to_edit(null, true)) { Display::return_icon('percentage.png', get_lang('DocumentQuota'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'document/document_quota.php?'.api_get_cidreq() ); -} - +} +$actionsRight = ''; if (!$is_certificate_mode) { /* BUILD SEARCH FORM */ - $form = new FormValidator( 'search_document', 'get', @@ -1741,7 +1740,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) { $count++; } - // Validacion when belongs to a session + // Validation when belongs to a session $session_img = api_get_session_image($document_data['session_id'], $_user['status']); // Document title with link @@ -1843,8 +1842,6 @@ if (!is_null($documentAndFolders)) { } } - - if (!empty($moveTo)) { $document_id = DocumentManager::get_document_id($courseInfo, $moveTo); } @@ -1966,7 +1963,10 @@ if (!empty($groupId)) { } else { Display::display_introduction_section(TOOL_DOCUMENT); } -$toolbar = Display::toolbarAction('toolbar-document',array(0 => $actionsLeft, 1 => $actionsRight)); +$toolbar = Display::toolbarAction( + 'toolbar-document', + array(0 => $actionsLeft, 1 => $actionsRight) +); echo $toolbar; echo $templateForm; diff --git a/main/document/downloadfolder.inc.php b/main/document/downloadfolder.inc.php index 3bb7497f37..b9815e6cd3 100755 --- a/main/document/downloadfolder.inc.php +++ b/main/document/downloadfolder.inc.php @@ -58,9 +58,6 @@ if (($path == '/shared_folder' || exit; } -// Zip library for creation of the zip file. -require api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; - // Creating a ZIP file. $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; @@ -94,10 +91,16 @@ function fixDocumentNameCallback($p_event, &$p_header) ); // Changes file.phps to file.php + $basename = basename($documentNameFixed); $basenamePHPFixed = str_replace('.phps', '.php', $basename); - $documentNameFixed = str_replace($basename, $basenamePHPFixed, $basenamePHPFixed); + $documentNameFixed = str_replace( + $basename, + $basenamePHPFixed, + $documentNameFixed + ); + $documentNameFixed = str_replace($remove_dir, '', $documentNameFixed); $p_header['stored_filename'] = $documentNameFixed; return 1; @@ -161,7 +164,8 @@ if (api_is_allowed_to_edit()) { } } } - + //error_log($sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path']); + //error_log($sysCoursePath.$courseInfo['path'].'/document'.$remove_dir); $zip->add( $sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path'], PCLZIP_OPT_REMOVE_PATH, @@ -230,12 +234,12 @@ if (api_is_allowed_to_edit()) { docs.id = props.ref AND docs.c_id = props.c_id WHERE - docs.c_id = $courseId AND - props.tool = '".TOOL_DOCUMENT."' AND - docs.path LIKE '".$querypath."/%' AND - props.visibility <> '1' AND + docs.c_id = $courseId AND + props.tool = '".TOOL_DOCUMENT."' AND + docs.path LIKE '".$querypath."/%' AND + props.visibility <> '1' AND (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND - docs.filetype = 'folder'"; + docs.filetype = 'folder'"; $query2 = Database::query($sql); // If we get invisible folders, we have to filter out these results from all visible files we found @@ -255,9 +259,9 @@ if (api_is_allowed_to_edit()) { docs.c_id = $courseId AND props.tool ='".TOOL_DOCUMENT."' AND docs.path LIKE '".$invisible_folders['path']."/%' AND - docs.filetype ='file' AND + docs.filetype = 'file' AND (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND - props.visibility ='1'"; + props.visibility ='1'"; $query3 = Database::query($sql); // Add tem to an array while ($files_in_invisible_folder = Database::fetch_assoc($query3)) { @@ -294,7 +298,9 @@ if (api_is_allowed_to_edit()) { } // Launch event -Event::event_download(($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)'); +Event::event_download( + ($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)' +); // Start download of created file $name = ($path == '/') ? 'documents.zip' : $documentInfo['title'].'.zip'; diff --git a/main/exercice/exercise.php b/main/exercice/exercise.php index de12f6ed3a..7f8df3a486 100644 --- a/main/exercice/exercise.php +++ b/main/exercice/exercise.php @@ -118,7 +118,6 @@ $nameTools = get_lang('Exercises'); $errorXmlExport = null; if ($is_allowedToEdit && !empty($choice) && $choice == 'exportqti2') { require_once api_get_path(SYS_CODE_PATH).'exercice/export/qti2/qti2_export.php'; - require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; $export = export_exercise_to_qti($exerciseId, true); $archive_path = api_get_path(SYS_ARCHIVE_PATH); diff --git a/main/exercice/hotpotatoes.php b/main/exercice/hotpotatoes.php index acb43c755f..f2929a61eb 100755 --- a/main/exercice/hotpotatoes.php +++ b/main/exercice/hotpotatoes.php @@ -8,8 +8,6 @@ require_once '../inc/global.inc.php'; -// Including additional libraries. -require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; require_once 'hotpotatoes.lib.php'; // Section (for the tabs). diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 18df3893d5..99bf1a441d 100755 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -1509,7 +1509,7 @@ switch ($action) { $class = 'btn btn-danger'; $text = get_lang('Remove'); } else { - $url = 'class.php?action=add_class_to_course&id='.$group['id'].'&'.api_get_cidreq(); + $url = 'class.php?action=add_class_to_course&id='.$group['id'].'&'.api_get_cidreq().'&type=not_registered'; $class = 'btn btn-primary'; //$icon = Display::return_icon('add.png', get_lang('Add')); $text = get_lang('Add'); diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index 6bbd5d582a..e8fb94c110 100755 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -1444,8 +1444,6 @@ class AddCourse */ public static function readPropertiesInArchive($archive, $is_compressed = true) { - include api_get_path(LIBRARY_PATH) . 'pclzip/pclzip.lib.php'; - debug::printVar(dirname($archive), 'Zip : '); $uid = api_get_user_id(); /* string tempnam (string dir, string prefix) diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 38e8ce0333..4e807c55dd 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -3314,13 +3314,13 @@ function api_not_allowed($print_headers = false, $message = null) global $this_section; - if (empty($user_id)) { + if (CustomPages::enabled() && !isset($user_id)) { - // Why the CustomPages::enabled() need to be to set the request_uri - $_SESSION['request_uri'] = $_SERVER['REQUEST_URI']; - } + if (empty($user_id)) { + // Why the CustomPages::enabled() need to be to set the request_uri + $_SESSION['request_uri'] = $_SERVER['REQUEST_URI']; + } - if (CustomPages::enabled() && !isset($user_id)) { CustomPages::display(CustomPages::INDEX_UNLOGGED); } @@ -3330,7 +3330,11 @@ function api_not_allowed($print_headers = false, $message = null) if (isset($message)) { $msg = $message; } else { - $msg = Display::return_message(get_lang('NotAllowedClickBack').'

'.get_lang('ReturnToCourseHomepage').'', 'error', false); + $msg = Display::return_message( + get_lang('NotAllowedClickBack').'

'.get_lang('ReturnToCourseHomepage').'', + 'error', + false + ); } $msg = Display::div($msg, array('align'=>'center')); @@ -3342,11 +3346,13 @@ function api_not_allowed($print_headers = false, $message = null) } $tpl = new Template(null, $show_headers, $show_headers); - $tpl->assign('hide_login_link', 1); - $tpl->assign('content', $msg); - if (($user_id!=0 && !api_is_anonymous()) && (!isset($course) || $course == -1) && empty($_GET['cidReq'])) { + + if (($user_id != 0 && !api_is_anonymous()) && + (!isset($course) || $course == -1) && + empty($_GET['cidReq']) + ) { // if the access is not authorized and there is some login information // but the cidReq is not found, assume we are missing course data and send the user // to the user_portal @@ -3360,29 +3366,41 @@ function api_not_allowed($print_headers = false, $message = null) $this_section == SECTION_PLATFORM_ADMIN ) ) { - - //only display form and return to the previous URL if there was a course ID included + $courseCode = api_get_course_id(); + // Only display form and return to the previous URL if there was a course ID included if ($user_id != 0 && !api_is_anonymous()) { //if there is a user ID, then the user is not allowed but the session is still there. Say so and exit $tpl->assign('content', $msg); $tpl->display_one_col_template(); exit; } - if (!is_null(api_get_course_id())) { - api_set_firstpage_parameter(api_get_course_id()); + + if (!is_null($courseCode)) { + api_set_firstpage_parameter($courseCode); } // If the user has no user ID, then his session has expired $action = api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']); $action = str_replace('&', '&', $action); - $form = new FormValidator('formLogin', 'post', $action, null, array(), FormValidator::LAYOUT_BOX_NO_LABEL); + $form = new FormValidator( + 'formLogin', + 'post', + $action, + null, + array(), + FormValidator::LAYOUT_BOX_NO_LABEL + ); $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'autocapitalize_off')); $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password'))); $form->addButton('submitAuth', get_lang('LoginEnter'), '', 'primary'); // see same text in auth/gotocourse.php and main_api.lib.php function api_not_allowed (above) $content = Display::return_message(get_lang('NotAllowed'), 'error', false); - $content .= '

'.get_lang('LoginToGoToThisCourse').'

'; + + if (!empty($courseCode)) { + $content .= '

'.get_lang('LoginToGoToThisCourse').'

'; + } + if (api_is_cas_activated()) { $content .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false); $content .= Display::div("
".sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution"))."

", array('align'=>'center')); @@ -3396,7 +3414,15 @@ function api_not_allowed($print_headers = false, $message = null) if (api_is_cas_activated()) { $content .= ""; } - $content .= '

'.get_lang('ReturnToCourseHomepage').'

'; + + if (!empty($courseCode)) { + $content .= '

'. + get_lang('ReturnToCourseHomepage').'

'; + } else { + $content .= '

'. + get_lang('CampusHomepage').'

'; + } + $tpl->setLoginBodyClass(); $tpl->assign('content', $content); $tpl->display_one_col_template(); diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 3b5d719e74..f173d72bb6 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1893,9 +1893,9 @@ class Display foreach ($items as $item) { $html .= '
'; $html .= '
- - '.$item['title'].' - + + '.$item['title'].' +
'; $html .= '
'; @@ -1906,6 +1906,7 @@ class Display } $html .= '
'; } + return $html; } @@ -1915,8 +1916,10 @@ class Display public static function group_button($title, $elements) { $html = '
- -
'; $html .= '
'; + return $html; } } diff --git a/main/inc/lib/formvalidator/Element/DatePicker.php b/main/inc/lib/formvalidator/Element/DatePicker.php index b0ec459efd..45459968b3 100755 --- a/main/inc/lib/formvalidator/Element/DatePicker.php +++ b/main/inc/lib/formvalidator/Element/DatePicker.php @@ -92,7 +92,8 @@ class DatePicker extends HTML_QuickForm_text buttonImageOnly: true, buttonText: '" . get_lang('SelectDate') . "', changeMonth: true, - changeYear: true + changeYear: true, + yearRange: 'c-60y:c+5y' }); }); "; diff --git a/main/inc/lib/login.lib.php b/main/inc/lib/login.lib.php index 57d3ec7310..ea5f6efe3a 100755 --- a/main/inc/lib/login.lib.php +++ b/main/inc/lib/login.lib.php @@ -333,18 +333,6 @@ class Login UserManager::update_extra_field_value($_user['user_id'], 'already_logged_in', 'true'); Session::write('is_platformAdmin', $is_platformAdmin); Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); - -// -// -// // If request_uri is setted we have to go further to have course permissions -// if (empty($_SESSION['request_uri']) || !isset($_SESSION['request_uri'])) { -// if (isset($_SESSION['noredirection'])) { -// //If we just want to reset info without redirecting user -// unset($_SESSION['noredirection']); -// } else { -// LoginRedirection::redirect(); -// } -// } } else { header('location:' . api_get_path(WEB_PATH)); //exit("WARNING UNDEFINED UID !! "); diff --git a/main/inc/lib/pear/HTML/QuickForm/select.php b/main/inc/lib/pear/HTML/QuickForm/select.php index 68a6af101f..331a7e87b9 100755 --- a/main/inc/lib/pear/HTML/QuickForm/select.php +++ b/main/inc/lib/pear/HTML/QuickForm/select.php @@ -550,7 +550,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element $this->setName($myName); } - $strHtml .= $tabs . '\n"; $strValues = is_array($this->_values)? array_map('strval', $this->_values): array(); diff --git a/main/newscorm/aicc.class.php b/main/newscorm/aicc.class.php index d436ac3252..d2a7227022 100755 --- a/main/newscorm/aicc.class.php +++ b/main/newscorm/aicc.class.php @@ -668,7 +668,6 @@ class aicc extends learnpath //error_log('New LP - in export_zip()', 0); // Zip everything that is in the corresponding scorm dir. // Write the zip file somewhere (might be too big to return). - require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; require_once 'learnpath_functions.inc.php'; $course_id = api_get_course_int_id(); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN); diff --git a/main/template/default/work/view.tpl b/main/template/default/work/view.tpl index e71622e824..cbfc4ce41a 100755 --- a/main/template/default/work/view.tpl +++ b/main/template/default/work/view.tpl @@ -1,31 +1,22 @@ -{% if work.url_correction %} -

{{ "Correction" |get_lang }}

-

- - {{ "Download" |get_lang }} - -

-
-{% endif %} - {% if work.description %} +

+ {{ 'Description' | get_lang }} +

{{ work.description }}

{% endif %} {% if work.contains_file and work.show_content %} +

+ {{ 'Content' | get_lang }} +

{{ work.show_content }}

diff --git a/main/user/class.php b/main/user/class.php index ef26723775..42cf2b9715 100755 --- a/main/user/class.php +++ b/main/user/class.php @@ -37,16 +37,16 @@ $(document).ready( function() { }); '; -Display :: display_header($tool_name, "User"); +$actions = ''; $usergroup = new UserGroup(); if (api_is_allowed_to_edit()) { - echo '
'; + $actions .= '
'; if ($type == 'registered') { - echo ''. + $actions .= ''. Display::return_icon('add.png', get_lang("AddClassesToACourse"), array(), ICON_SIZE_MEDIUM).''; } else { - echo ''. - Display::return_icon('empty_evaluation.png', get_lang("Classes"), array(), ICON_SIZE_MEDIUM).''; + $actions .= ''. + Display::return_icon('back.png', get_lang("Classes"), array(), ICON_SIZE_MEDIUM).''; $form = new FormValidator('groups', 'post', api_get_self(), '', '', FormValidator::LAYOUT_INLINE); $options = [ @@ -56,13 +56,11 @@ if (api_is_allowed_to_edit()) { ]; $form->addSelect('group_filter', get_lang('Groups'), $options, ['id' => 'group_filter']); $form->setDefaults(['group_filter' => $groupFilter]); - $form->display(); + $actions .= $form->returnForm(); } - echo '
'; + $actions .= '
'; } -echo UserManager::getUserSubscriptionTab(4); - if (api_is_allowed_to_edit()) { $action = isset($_GET['action']) ? $_GET['action'] : null; switch ($action) { @@ -74,6 +72,7 @@ if (api_is_allowed_to_edit()) { array(api_get_course_int_id()), false ); + Display::addFlash(Display::return_message(get_lang('Added'))); } break; case 'remove_class_from_course': @@ -83,6 +82,7 @@ if (api_is_allowed_to_edit()) { $id, array(api_get_course_int_id()) ); + Display::addFlash(Display::return_message(get_lang('Deleted'))); } break; } @@ -101,8 +101,8 @@ $columns = array( get_lang('Actions'), ); -//Column config -$column_model = array( +// Column config +$columnModel = array( array('name'=>'name', 'index' => 'name', 'width' => '35', @@ -135,26 +135,25 @@ $column_model = array( ), ); // Autowidth -$extra_params['autowidth'] = 'true'; +$extraParams['autowidth'] = 'true'; // height auto -$extra_params['height'] = 'auto'; - -// With this function we can add actions to the jgrid -$action_links = 'function action_formatter (cellvalue, options, rowObject) { - return \'' - .' ' - .' \'; -}'; +$extraParams['height'] = 'auto'; + +Display :: display_header($tool_name, "User"); + ?> display_teacher_view(); Display :: display_footer(); diff --git a/main/work/add_user.php b/main/work/add_user.php index c1b350e6f5..ae2decf4b3 100755 --- a/main/work/add_user.php +++ b/main/work/add_user.php @@ -6,7 +6,7 @@ require_once '../inc/global.inc.php'; // Including necessary files require_once 'work.lib.php'; -$current_course_tool = TOOL_STUDENTPUBLICATION; +$current_course_tool = TOOL_STUDENTPUBLICATION; $workId = isset($_GET['id']) ? intval($_GET['id']) : null; $userId = isset($_GET['user_id']) ? intval($_GET['user_id']) : null; @@ -30,8 +30,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('AddUsers')); $error_message = null; diff --git a/main/work/downloadfolder.inc.php b/main/work/downloadfolder.inc.php index 02dfed1706..fbb75d1263 100755 --- a/main/work/downloadfolder.inc.php +++ b/main/work/downloadfolder.inc.php @@ -35,9 +35,6 @@ if (empty($_course) || empty($_course['path'])) { $sys_course_path = api_get_path(SYS_COURSE_PATH); -//zip library for creation of the zipfile -require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; - // Creating a ZIP file $temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; diff --git a/main/work/view.php b/main/work/view.php index c2a75d911d..c2ae38c56e 100755 --- a/main/work/view.php +++ b/main/work/view.php @@ -42,9 +42,11 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i $url_dir = 'work_list.php?id='.$my_folder_data['id']; } + $userInfo = api_get_user_info($work['user_id']); $interbreadcrumb[] = array('url' => $url_dir, 'name' => $my_folder_data['title']); + $interbreadcrumb[] = array('url' => '#', 'name' => $userInfo['complete_name']); $interbreadcrumb[] = array('url' => '#','name' => $work['title']); - //|| api_is_drh() + if (($courseInfo['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1 @@ -99,6 +101,35 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i $tpl = new Template(); $tpl->assign('work', $work); $tpl->assign('comments', $comments); + + $actions = ''; + if (isset($work['contains_file'])) { + if (isset($work['download_url'])) { + $actions .= Display::url( + Display::return_icon( + 'save.png', + get_lang('Download'), + null, + ICON_SIZE_MEDIUM + ), + $work['download_url'] + ); + + if (isset($work['url_correction'])) { + $actions .= Display::url( + Display::return_icon( + 'check.png', + get_lang('Correction'), + null, + ICON_SIZE_MEDIUM + ), + $work['download_url'].'&correction=1' + ); + } + } + } + + $tpl->assign('actions', $actions); if (api_is_allowed_to_session_edit()) { $tpl->assign('form', $commentForm); } diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 4c58c9cf49..53555b2bf5 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -50,7 +50,7 @@ function display_action_links($id, $cur_dir_path, $action) $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'),'',ICON_SIZE_MEDIUM).''; } $display_output .= '' . Display::return_icon('listwork.png', get_lang('viewStudents'),'',ICON_SIZE_MEDIUM) . ''; - + } if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) { @@ -1564,6 +1564,11 @@ function getWorkListTeacher( api_get_path(WEB_CODE_PATH).'work/edit_work.php?id='.$workId.'&'.api_get_cidreq() ); + $correctionLink = Display::url( + Display::return_icon('upload_file.png', get_lang('UploadCorrections'), '', ICON_SIZE_SMALL), + api_get_path(WEB_CODE_PATH).'work/upload_corrections.php?'.api_get_cidreq().'&id='.$workId + ); + if ($countUniqueAttempts > 0) { $downloadLink = Display::url( Display::return_icon( @@ -1598,7 +1603,7 @@ function getWorkListTeacher( $deleteLink = null; $editLink = null; } - $work['actions'] = $visibilityLink.$downloadLink.$editLink.$deleteLink; + $work['actions'] = $visibilityLink.$correctionLink.$downloadLink.$editLink.$deleteLink; $works[] = $work; } } @@ -1895,7 +1900,9 @@ function get_work_user_list( u.username, parent_id, accepted, - qualificator_id'; + qualificator_id, + url_correction + '; if ($getCount) { $select = "SELECT DISTINCT count(u.user_id) as count "; } @@ -2055,8 +2062,15 @@ function get_work_user_list( $action = ''; if (api_is_allowed_to_edit()) { + if (!empty($work['url_correction'])) { + $action .= Display::url( + Display::return_icon('check.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 .= ''. - Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).' '; + Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).' '; if ($unoconv && empty($work['contains_file'])) { $action .= ''. @@ -2169,6 +2183,7 @@ function get_work_user_list( $work['qualificator_id'] = $qualificator_id; $work['actions'] = $send_to.$link_to_download.$action; $work['correction'] = $correction; + $works[] = $work; } } @@ -2422,48 +2437,50 @@ function user_is_author($itemId, $userId = null, $courseId = null, $sessionId = */ function get_list_users_without_publication($task_id, $studentId = null) { - $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); - $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); - $table_user = Database::get_main_table(TABLE_MAIN_USER); + $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); + $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); + $table_user = Database::get_main_table(TABLE_MAIN_USER); $session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); - //condition for the session - $session_id = api_get_session_id(); - $course_id = api_get_course_int_id(); + $users = getAllUserToWork($task_id, api_get_course_int_id()); + $users = array_column($users, 'user_id'); + // Condition for the session + $session_id = api_get_session_id(); + $course_id = api_get_course_int_id(); $task_id = intval($task_id); if ($session_id == 0) { $sql = "SELECT user_id as id FROM $work_table WHERE c_id = $course_id AND - parent_id='$task_id' AND + parent_id = '$task_id' AND active IN (0, 1)"; } else { $sql = "SELECT user_id as id FROM $work_table WHERE c_id = $course_id AND - parent_id='$task_id' AND - session_id='".$session_id."' AND + parent_id = '$task_id' AND + session_id = '".$session_id."' AND active IN (0, 1)"; } $result = Database::query($sql); $users_with_tasks = array(); - while($row = Database::fetch_array($result)) { + while ($row = Database::fetch_array($result)) { $users_with_tasks[] = $row['id']; } if ($session_id == 0) { $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u - WHERE u.status != 1 and cu.c_id='".api_get_course_int_id()."' AND u.user_id = cu.user_id"; + WHERE u.status != 1 and cu.c_id='".$course_id."' AND u.user_id = cu.user_id"; } else { $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $session_course_rel_user AS cu, $table_user AS u WHERE u.status != 1 AND - cu.c_id='".api_get_course_int_id()."' AND + cu.c_id='".$course_id."' AND u.user_id = cu.user_id AND cu.session_id = '".$session_id."'"; } @@ -2487,22 +2504,30 @@ function get_list_users_without_publication($task_id, $studentId = null) $result_users = Database::query($sql_users); $users_without_tasks = array(); - while ($row_users = Database::fetch_row($result_users)) { - - if (in_array($row_users[0], $users_with_tasks)) { + while ($rowUsers = Database::fetch_array($result_users)) { + $userId = $rowUsers['user_id']; + if (in_array($userId, $users_with_tasks)) { continue; } - if ($group_id && !in_array($row_users[0], $new_group_user_list)) { + if ($group_id && !in_array($userId, $new_group_user_list)) { continue; } - $userId = $row_users[0]; - $row_users[0] = $row_users[1]; - $row_users[1] = $row_users[2]; - $row_users[2] = Display::encrypted_mailto_link($row_users[3]); + + if (!empty($users)) { + if (!in_array($userId, $users)) { + continue; + } + } + + $row_users = []; + $row_users[0] = $rowUsers['lastname']; + $row_users[1] = $rowUsers['firstname']; + $row_users[2] = Display::encrypted_mailto_link($rowUsers['email']); $row_users[3] = $userId; $users_without_tasks[] = $row_users; } + return $users_without_tasks; } @@ -2529,9 +2554,6 @@ function display_list_users_without_publication($task_id, $studentId = null) $paging_options = array(); $my_params = array(); - if (isset($_GET['curdirpath'])) { - $my_params['curdirpath'] = Security::remove_XSS($_GET['curdirpath']); - } if (isset($_GET['edit_dir'])) { $my_params['edit_dir'] = Security::remove_XSS($_GET['edit_dir']); } @@ -4873,7 +4895,6 @@ function downloadAllFilesPerUser($userId, $courseInfo) return false; } - require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/'; diff --git a/main/work/work_missing.php b/main/work/work_missing.php index 4560f11abf..e832269551 100755 --- a/main/work/work_missing.php +++ b/main/work/work_missing.php @@ -1,8 +1,6 @@ api_get_path(WEB_CODE_PATH).'group/group.php', 'name' => get_lang('Groups')); - $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']); + $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?gidReq='.$group_id, + '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')); -$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'] +); if (isset($_GET['list']) && $_GET['list'] == 'with') { - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UsersWithTask')); + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UsersWithTask')); } else { - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UsersWithoutTask')); + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UsersWithoutTask')); } -Display :: display_header(null); +Display::display_header(null); echo '
'; -echo ''.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).''; - +echo ''. + Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).''; +$output = ''; if (!empty($workId)) { if (empty($_GET['list']) or Security::remove_XSS($_GET['list']) == 'with') { - $display_output .= ''. + $output .= ''. Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'),'',ICON_SIZE_MEDIUM).""; } else { if (!isset($_GET['action']) || (isset($_GET['action']) && $_GET['action'] != 'send_mail')) { - $display_output .= ''. + $output .= ''. Display::return_icon('mail_send.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM).""; } else { - $display_output .= Display::return_icon('mail_send_na.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM); + $output .= Display::return_icon('mail_send_na.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM); } } } -echo $display_output; +echo $output; echo '
'; -$error_message = Session::read('error_message'); -if (!empty($error_message)) { - echo $error_message; - Session::erase('error_message'); -} display_list_users_without_publication($workId);