diff --git a/assets/css/base.css b/assets/css/base.css index d6f5883841..35ab1a7952 100644 --- a/assets/css/base.css +++ b/assets/css/base.css @@ -1373,54 +1373,6 @@ a.unread { text-align: right; } -/* BIG TOOLS COURSE */ -.title-tools { - font-weight: bold; -} - -#course_tools .big_icon { - padding: 10px; - text-align: center; -} - -#course_tools .content { - text-align: center; - margin-bottom: 20px; - margin-top: 10px; - width: 100%; - height: 50px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} - -#course_tools .content:hover { - width: auto; - white-space: initial; - overflow: visible; - cursor: pointer; -} - -.course-tool .make_visible_and_invisible img { - margin-top: -3px; - margin-right: 5px; -} - -.big_icon img { - padding: 5px; - border-radius: 10px; - box-shadow: 0 4px 8px #C8C8C8; - border: 1px solid #e6e6e6; -} - -.big_icon img:hover { - box-shadow: 0 4px 18px #C8C8C8; -} - -.courseadminview .big_icon a { - font-size: 12px; -} - /* Fixes the administration block section */ .admin_section div { margin: 5px 0 14px 25px; @@ -5960,271 +5912,7 @@ div#chat-remote-video video { display: inline-block; width: 100%; } -/* -.grid-courses .items .course-student-info { - background-color: #d9edf7; - border: 1px solid #bce8f1; - padding: 5px; - border-radius: 5px; -} - -.grid-courses .items .code-title { - font-size: 10px; - font-weight: bold; - padding-top: 8px; - color: #666; -} - -.grid-courses .items { - vertical-align: top; - white-space: normal; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); - text-align: left; - background-color: #fff; - border: 1px solid #DFDFDF; - border-radius: 5px; - margin: auto auto 20px; -} - -.grid-courses .items.my-courses { - box-shadow: 2px 4px 15px 0 rgba(46, 61, 73, .1); - transition: box-shadow .3s ease, border .3s ease; -} - -.grid-courses .items.my-courses .course-student-info { - font-size: 10px; - text-align: center; - background: none; - border: none; - padding: 0; -} - -.grid-courses .items.my-courses .title { - font-size: 14px; -} - -.grid-courses .items.items-courses { - padding-bottom: 10px; - box-shadow: 2px 4px 15px 0 rgba(46, 61, 73, .1); - transition: box-shadow .3s ease, border .3s ease; -} - -.grid-courses .items.items-sessions { -} - -.grid-courses .items.items-courses:hover, -.grid-courses .items.my-courses:hover, -.grid-courses .items.items-hotcourse:hover { - box-shadow: 4px 5px 20px 0 rgba(46, 61, 73, .15); - transition: box-shadow .3s ease, border .3s ease; -} - -.grid-courses .items.items-hotcourse { - box-shadow: 2px 4px 15px 0 rgba(46, 61, 73, .1); - transition: box-shadow .3s ease, border .3s ease; -} - -.grid-courses .items .block-title { - margin: 10px 0; -} - -.grid-courses .items .title { - line-height: 1.4; - padding: 0; - font-weight: bold; - margin: 0; - font-size: 14px; -} - -.grid-courses .items .toolbar > div { - text-align: center; -} - -.grid-courses .items .image .black-shadow { - top: 0; - left: 0; - width: 100%; - height: 100%; - opacity: 0; - box-sizing: border-box; - position: absolute; - background: rgba(0, 0, 0, 0.7) none repeat scroll 0 0; - padding: 40px 10px 10px; -} - -.grid-courses .items .image .hovered-course { - opacity: 1; - transition: all 0.3s ease 0s; -} - -.grid-courses .items .toolbar .info { - float: left; - font-size: 12px; -} - -.grid-courses .session-date, -.grid-courses .session-info { - font-size: 12px; - padding: 5px 10px; -} - -.grid-courses .items .block-info { - font-size: 12px; -} - -.grid-courses .items .block-date { - padding: 5px 0; - font-size: 11px; - line-height: 18px; -} - -.grid-courses .items .block-info .list-inline { - margin: 0; - padding: 0; -} - -.grid-courses .items .image { - position: relative; -} - -.grid-courses .items .image .img-responsive { - min-width: 100%; -} - -.grid-courses .items .image .pin { - position: absolute; - top: -10px; - right: -10px; - z-index: 2; -} - -.grid-courses .items .ranking { - font-size: 10px; - margin: 0 0 10px; -} - -.grid-courses .items .notifications { - text-align: center; -} - -.grid-courses .items .admin-actions, -.grid-courses .items .user-actions { - position: absolute; - bottom: 0; - left: 0; -} - -.grid-courses .items .admin-actions .btn-sm, -.grid-courses .items .user-actions .btn-sm { - border-radius: 0; - border: none; -} - -.grid-courses .items .admin-actions .registered { - background-color: #17AA1C; - color: #FFF; -} - -.grid-courses .items .category { - position: absolute; - bottom: 0; - right: -10px; - background-color: #fd6600; - color: #fff; - padding: 5px 10px; - font-size: 10px; - text-transform: uppercase; - z-index: 2; - font-weight: bold; - height: 32px; - line-height: 23px; - max-width: 80%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.grid-courses .items .cribbon { - width: 0; - height: 0; - border-top: 10px solid #333333; - border-right: 10px solid transparent; - position: absolute; - bottom: -10px; - right: -10px; -} - -.grid-courses .items .description { - padding: 5px 10px 5px; - min-height: 125px; -} - -.grid-courses .items .description .text { - font-size: 12px; -} - -.grid-courses .items .author-card { - display: flex; - margin-top: 5px; - margin-left: 5px; -} - -.grid-courses .items .author-card img { - border: 2px solid #fff; -} - -.grid-courses .items .author-card .teachers-details { - display: flex; - flex-direction: column; - justify-content: center; -} - -.grid-courses .items .author-card .teachers-details h5 { - font-size: 10px; - font-weight: bold; - margin: 0 10px; -} -.grid-courses .items .author-card .teachers-details h5 a { - color: #fff; -} - -.grid-courses .items .block-author { - display: flex; - margin: 5px 0 5px; -} - -.grid-courses .items .block-author img { - border: 2px solid #fff; -} - -.grid-courses .items .block-author .teachers-details { - display: flex; - flex-direction: column; - justify-content: center; -} - -.grid-courses .items .block-author .teachers-details p { - font-size: 10px; - margin: 0 10px 0 10px; - padding: 0; -} - -.grid-courses .items .block-author .teachers-details h5 { - font-size: 10px; - font-weight: bold; - margin: 0 10px; -} - -.grid-courses .items .block-author .teachers-details h5 a { - color: #666; -} - -.grid-courses { - margin-top: 15px; - margin-bottom: 15px; -} -*/ .title-session, .title-courses { text-align: center; diff --git a/assets/css/scss/_base.scss b/assets/css/scss/_base.scss index 066d24d307..638c76950b 100644 --- a/assets/css/scss/_base.scss +++ b/assets/css/scss/_base.scss @@ -343,3 +343,49 @@ footer { } } +.course-accordion{ + .card-header{ + padding: 0; + background-color: $default-white; + .btn-link{ + display: inline-block; + width: 100%; + } + } + .card-body{ + .tools{ + width: 160px; + height: 160px; + display: block; + float: left; + text-align: center; + cursor: pointer; + position: relative; + background-color: transparent; + .big_icon{ + position: absolute; + width: 84px; + height: 84px; + top: 40%; + margin-top: -50px; + left: 40%; + margin-left: -32px; + text-align: center; + border: 1px solid rgba(0, 0, 0, 0.125) ; + border-radius: 50%; + a{ + display: block; + padding-top: 10px; + overflow: hidden; + } + } + .content{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + z-index: 999; + } + } + } +} \ No newline at end of file diff --git a/config/packages/graphql.yaml b/config/packages/graphql.yaml index 48d018c5b4..5313f035d4 100644 --- a/config/packages/graphql.yaml +++ b/config/packages/graphql.yaml @@ -25,15 +25,15 @@ parameters: services: chamilo_api.graphql.resolver.user: class: Chamilo\ApiBundle\GraphQL\Resolver\UserResolver - arguments: [ '@service_container' ] + arguments: ['@service_container'] chamilo_api.graphql.resolver.course: class: Chamilo\ApiBundle\GraphQL\Resolver\CourseResolver - arguments: [ '@service_container' ] + arguments: ['@service_container'] chamilo_api.graphql.resolver.session: class: Chamilo\ApiBundle\GraphQL\Resolver\SessionResolver - arguments: [ '@service_container' ] + arguments: ['@service_container'] Chamilo\ApiBundle\GraphQL\Map\: resource: "../../src/ApiBundle/GraphQL/Map/*" diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php index 2a371da855..e6ccc7e404 100755 --- a/main/announcements/announcements.php +++ b/main/announcements/announcements.php @@ -156,8 +156,8 @@ switch ($action) { break; case 'view': $interbreadcrumb[] = [ - "url" => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(), - "name" => $nameTools, + 'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(), + 'name' => $nameTools, ]; $nameTools = get_lang('View'); @@ -309,8 +309,16 @@ switch ($action) { if ($sessionId != 0 && api_is_allowed_to_session_edit(false, true) == false) { api_not_allowed(); } + $delete = false; + if (api_is_platform_admin()) { + $delete = true; + } if (!api_is_session_general_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) { + $delete = true; + } + + if ($delete) { AnnouncementManager::delete_announcement($_course, $id); Display::addFlash(Display::return_message(get_lang('AnnouncementDeleted'))); } @@ -382,7 +390,7 @@ switch ($action) { $url = api_get_self().'?action='.$action.'&id='.$id.'&'.api_get_cidreq(); $form = new FormValidator( - 'f1', + 'announcement', 'post', $url, null, @@ -472,9 +480,23 @@ switch ($action) { $announcement_to_modify = ''; } - $announcementInfo = AnnouncementManager::get_by_id($courseId, $id); - if (isset($announcementInfo) && !empty($announcementInfo)) { - $to = AnnouncementManager::load_edit_users('announcement', $id); + $announcementInfo = []; + if (!empty($id)) { + $announcementInfo = AnnouncementManager::get_by_id($courseId, $id); + } + + $showSubmitButton = true; + if (!empty($announcementInfo)) { + $to = AnnouncementManager::loadEditUsers('announcement', $id); + + if (!empty($group_id)) { + $separated = CourseManager::separateUsersGroups($to); + if (isset($separated['groups']) && count($separated['groups']) > 1) { + $form->freeze(); + Display::addFlash(Display::return_message(get_lang('LockByTeacher'))); + $showSubmitButton = false; + } + } $defaults = [ 'title' => $announcementInfo['title'], @@ -489,10 +511,47 @@ switch ($action) { } } + $ajaxUrl = api_get_path(WEB_AJAX_PATH).'announcement.ajax.php?'.api_get_cidreq().'&a=preview'; + + $form->addHtml(" + + "); + if (isset($defaults['users'])) { foreach ($defaults['users'] as $value) { $parts = explode(':', $value); - if (!isset($parts[1]) || empty($parts[1])) { continue; } @@ -543,12 +602,29 @@ switch ($action) { $config = api_get_configuration_value('announcement.hide_send_to_hrm_users'); if ($config === false) { - $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH')); + $form->addCheckBox( + 'send_to_hrm_users', + null, + get_lang('SendAnnouncementCopyToDRH'), + ['id' => 'send_to_hrm_users'] + ); } $form->addCheckBox('send_me_a_copy_by_email', null, get_lang('SendAnnouncementCopyToMyself')); $defaults['send_me_a_copy_by_email'] = true; - $form->addButtonSave(get_lang('ButtonPublishAnnouncement')); + + if ($showSubmitButton) { + $form->addLabel('', + Display::url( + get_lang('Preview'), + 'javascript:void(0)', + ['class' => 'btn btn-default', 'id' => 'announcement_preview'] + ).'
' + ); + $form->addHtml(' '); + } $form->setDefaults($defaults); if ($form->validate()) { @@ -619,7 +695,7 @@ switch ($action) { $sendToUsersInSession ); } else { - $insert_id = AnnouncementManager::add_group_announcement( + $insert_id = AnnouncementManager::addGroupAnnouncement( $data['title'], $data['content'], $group_id, diff --git a/main/badge/assign.php b/main/badge/assign.php index 8b32d2d90b..92099ed6f2 100644 --- a/main/badge/assign.php +++ b/main/badge/assign.php @@ -294,7 +294,7 @@ if ($form->validate()) { $skillUser->setSkill($skill); if ($showLevels) { - $level = $skillLevelRepo->find(intval($values['acquired_level'])); + $level = $skillLevelRepo->find($values['acquired_level']); $skillUser->setAcquiredLevel($level); } diff --git a/main/badge/issued.php b/main/badge/issued.php index a19793fc18..3e9ad60610 100644 --- a/main/badge/issued.php +++ b/main/badge/issued.php @@ -184,7 +184,7 @@ if ($showLevels && $allowToEdit) { if ($formAcquiredLevel->validate() && $allowComment) { $values = $formAcquiredLevel->exportValues(); - $level = $skillLevelRepo->find(intval($values['acquired_level'])); + $level = $skillLevelRepo->find($values['acquired_level']); $skillIssue->setAcquiredLevel($level); $entityManager->persist($skillIssue); diff --git a/main/course_info/about.php b/main/course_info/about.php index 42519afa04..2316a5612f 100644 --- a/main/course_info/about.php +++ b/main/course_info/about.php @@ -125,6 +125,10 @@ $topics = [ $subscriptionUser = CourseManager::is_user_subscribed_in_course($userId, $course->getCode()); +$allowSubscribe = false; +if ($course->getSubscribe() == true || api_is_platform_admin()) { + $allowSubscribe = true; +} $plugin = BuyCoursesPlugin::create(); $checker = $plugin->isEnabled(); $courseIsPremium = null; @@ -165,6 +169,7 @@ $template->assign('course', $courseItem); $essence = new Essence\Essence(); $template->assign('essence', $essence); $template->assign('is_premium', $courseIsPremium); +$template->assign('allow_subscribe', $allowSubscribe); $template->assign('token', $token); $template->assign('url', $urlCourse); $layout = $template->get_template('course_home/about.tpl'); diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index 8820ccebd5..979694e2ce 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -22,28 +22,16 @@ $nameTools = get_lang('ModifInfo'); api_protect_course_script(true); api_block_anonymous_users(); $_course = api_get_course_info(); - -/* Constants and variables */ -define('MODULE_HELP_NAME', 'Settings'); -define('COURSE_CHANGE_PROPERTIES', 'COURSE_CHANGE_PROPERTIES'); - $currentCourseRepository = $_course['path']; -$is_allowedToEdit = api_is_course_admin() || api_is_platform_admin(); +$isAllowToEdit = api_is_course_admin() || api_is_platform_admin(); $course_code = api_get_course_id(); $courseId = api_get_course_int_id(); +$isEditable = true; -function is_settings_editable() -{ - return isset($GLOBALS['course_info_is_editable']) && $GLOBALS['course_info_is_editable']; -} - -/* MAIN CODE */ -if (!$is_allowedToEdit) { +if (!$isAllowToEdit) { api_not_allowed(true); } -//$htmlHeadXtra[] = api_get_css_asset('cropper/dist/cropper.min.css'); -//$htmlHeadXtra[] = api_get_asset('cropper/dist/cropper.min.js'); $show_delete_watermark_text_message = false; if (api_get_setting('pdf_export_watermark_by_course') == 'true') { if (isset($_GET['delete_watermark'])) { @@ -695,11 +683,11 @@ if ($exerciseInvisible === 'true' && $form->addGroup($group, '', [get_lang('ExerciseInvisibleInSession')]); } -if (is_settings_editable()) { +if ($isEditable) { $form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); } else { // Is it allowed to edit the course settings? - if (!is_settings_editable()) { + if (!$isEditable) { $disabled_output = "disabled"; } $form->freeze(); @@ -753,11 +741,11 @@ if (api_get_configuration_value('allow_exercise_auto_launch')) { $group[] = $form->createElement('radio', 'enable_exercise_auto_launch', null, get_lang('Deactivate'), 0); $form->addGroup($group, '', [get_lang('ExerciseAutoLaunch')]); - if (is_settings_editable()) { + if ($isEditable) { $form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); } else { // Is it allowed to edit the course settings? - if (!is_settings_editable()) { + if (!$isEditable) { $disabled_output = "disabled"; } $form->freeze(); @@ -920,7 +908,7 @@ if (!isset($values['student_delete_own_publication'])) { $form->setDefaults($values); // Validate form -if ($form->validate() && is_settings_editable()) { +if ($form->validate() && $isEditable) { $updateValues = $form->getSubmitValues(); // update course picture @@ -1031,10 +1019,8 @@ if ($show_delete_watermark_text_message) { ); } -/* Header */ -Display::display_header($nameTools, MODULE_HELP_NAME); +Display::display_header($nameTools, 'Settings'); -// Display the form echo ''.$user_info['official_code'].'