diff --git a/app/Migrations/Schema/V110/Version20150522222222.php b/app/Migrations/Schema/V110/Version20150522222222.php index 4cf535cc59..6c213004db 100644 --- a/app/Migrations/Schema/V110/Version20150522222222.php +++ b/app/Migrations/Schema/V110/Version20150522222222.php @@ -707,7 +707,7 @@ class Version20150522222222 extends AbstractMigrationChamilo '', 'radio', 'Tools', - ($value?$value:'false'), + ($value ? $value : 'false'), 'DropboxHideCourseCoachTitle', 'DropboxHideCourseCoachComment', null, @@ -718,6 +718,23 @@ class Version20150522222222 extends AbstractMigrationChamilo [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] ); + $value = api_get_configuration_value('dropbox_hide_general_coach'); + $this->addSettingCurrent( + 'dropbox_hide_general_coach', + '', + 'radio', + 'Tools', + ($value ? $value : 'false'), + 'DropboxHideGeneralCoachTitle', + 'DropboxHideGeneralCoachComment', + null, + '', + 1, + true, + false, + [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] + ); + // If SSO is used, the redirection to the master server is forced. //$_configuration['force_sso_redirect'] = false; $value = api_get_configuration_value('force_sso_redirect'); diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index e33e415c5c..10979326e3 100755 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -570,16 +570,34 @@ function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategor ); } - $hideCoach = api_get_setting('dropbox_hide_course_coach'); + $complete_user_list2 = CourseManager::get_coach_list_from_course_code( + $course_info['code'], + api_get_session_id() + ); - if ($hideCoach !== 'true') { - $complete_user_list2 = CourseManager::get_coach_list_from_course_code( - $course_info['code'], - api_get_session_id() + $generalCoachList = array(); + $courseCoachList = array(); + foreach ($complete_user_list2 as $coach) { + if ($coach['type'] == 'general_coach') { + $generalCoachList[] = $coach; + } else { + $courseCoachList[] = $coach; + } + } + + $hideCourseCoach = api_get_setting('dropbox_hide_course_coach'); + if ($hideCourseCoach == 'false') { + $complete_user_list_for_dropbox = array_merge( + $complete_user_list_for_dropbox, + $courseCoachList ); + } + $hideGeneralCoach = api_get_setting('dropbox_hide_general_coach'); + + if ($hideGeneralCoach == 'false') { $complete_user_list_for_dropbox = array_merge( $complete_user_list_for_dropbox, - $complete_user_list2 + $generalCoachList ); } } else { diff --git a/main/install/data.sql b/main/install/data.sql index f697f3916c..c6d3ef372c 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -1707,6 +1707,7 @@ VALUES ('hide_certificate_export_link_students', NULL, 'radio', 'Gradebook', 'false', 'CertificateHideExportLinkStudentTitle', 'CertificateHideExportLinkStudentComment', NULL, NULL, 1), ('hide_certificate_export_link', NULL, 'radio', 'Gradebook', 'false', 'CertificateHideExportLinkTitle', 'CertificateHideExportLinkComment', NULL, NULL, 1), ('dropbox_hide_course_coach', NULL, 'radio', 'Tools', 'false', 'DropboxHideCourseCoachTitle', 'DropboxHideCourseCoachComment', NULL, NULL, 1), +('dropbox_hide_general_coach', NULL, 'radio', 'Tools', 'false', 'DropboxHideGeneralCoachTitle', 'DropboxHideGeneralCoachComment', NULL, NULL, 1), ('sso_force_redirect', NULL, 'radio', 'Security', 'false', 'SSOForceRedirectTitle', 'SSOForceRedirectComment', NULL, NULL, 1), ('session_course_ordering', NULL, 'radio', 'Session', 'false', 'SessionCourseOrderingTitle', 'SessionCourseOrderingComment', NULL, NULL, 1), ('gamification_mode', NULL, 'radio', 'Platform', '0', 'GamificationModeTitle', 'GamificationModeComment', NULL, NULL, 1), @@ -1786,6 +1787,8 @@ VALUES ('hide_certificate_export_link', 'false', 'No'), ('dropbox_hide_course_coach', 'true', 'Yes'), ('dropbox_hide_course_coach', 'false', 'No'), +('dropbox_hide_general_coach', 'true', 'Yes'), +('dropbox_hide_general_coach', 'false', 'No'), ('sso_force_redirect', 'true', 'Yes'), ('sso_force_redirect', 'false', 'No'), ('session_course_ordering', 'true', 'Yes'),