Procházet zdrojové kódy

Add config announcements_hide_send_to_hrm_users see BT#11557

jmontoyaa před 8 roky
rodič
revize
082b7c9c19

+ 9 - 11
main/announcements/announcements.php

@@ -164,8 +164,6 @@ switch ($action) {
             $userIdToSearch = $filterData['user_id'];
         }
 
-        //$searchFormToString = $searchForm->returnForm();
-
         // jqgrid will use this URL to do the selects
         $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_course_announcements&'.api_get_cidreq().'&title_to_search='.$keyword.'&user_id_to_search='.$userIdToSearch;
         $deleteUrl = api_get_path(WEB_AJAX_PATH).'announcement.ajax.php?a=delete_item&'.api_get_cidreq();
@@ -312,7 +310,6 @@ switch ($action) {
                 if (!api_is_course_coach() ||
                     api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $_GET['id'])
                 ) {
-
                     AnnouncementManager::change_visibility_announcement(
                         $_course,
                         $_GET['id']
@@ -320,7 +317,6 @@ switch ($action) {
                     Display::addFlash(Display::return_message(get_lang('VisibilityChanged')));
                     header('Location: '.$homeUrl);
                     exit;
-
                 }
             }
         }
@@ -364,7 +360,7 @@ switch ($action) {
                     get_lang('RemindInactiveLearnersMailSubject'),
                     api_get_setting('siteName')
                 );
-            } elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] == 'true') {
+            } elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] === 'true') {
                 // we want to remind inactive users. The $_GET['since'] parameter
                 // determines which users have to be warned (i.e the users who have been inactive for x days or more
                 $since = isset($_GET['since']) ? intval($_GET['since']) : 6;
@@ -419,11 +415,10 @@ switch ($action) {
             );
         } else {
             if (!isset($announcement_to_modify)) {
-                $announcement_to_modify = "";
+                $announcement_to_modify = '';
             }
             $element = CourseManager::addGroupMultiSelect($form, $group_id, array());
             $form->setRequired($element);
-
             $form->addElement(
                 'checkbox',
                 'email_ann',
@@ -459,9 +454,7 @@ switch ($action) {
             $htmlTags .= "<b>".$tag."</b><br />";
         }
 
-        $form->addHtml(
-            "<div class='form-group'><div class='col-sm-2'></div><div class='col-sm-8'><div class='alert alert-info'>".$htmlTags."</div></div></div>"
-        );
+        $form->addLabel('', "<div class='alert alert-info'>".$htmlTags."</div>");
         $form->addHtmlEditor(
             'content',
             get_lang('Description'),
@@ -478,7 +471,12 @@ switch ($action) {
             $form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions'));
         }
 
-        $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));
+        $config = api_get_configuration_value('announcements_hide_send_to_hrm_users');
+
+        if ($config === false) {
+            $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));
+        }
+
         $form->addButtonSave(get_lang('ButtonPublishAnnouncement'));
         $form->setDefaults($defaults);
 

+ 3 - 1
main/install/configuration.dist.php

@@ -248,4 +248,6 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
 // be reflected on the https://version.chamilo.org/stats page in the future.
 //$_configuration['packager'] = 'chamilo';
 // List of driver to plugin in ckeditor
-//$_configuration['editor_driver_list'] = ['PersonalDriver', 'CourseDriver'];
+//$_configuration['editor_driver_list'] = ['PersonalDriver', 'CourseDriver'];
+// Hide send to hrm users options in announcements
+//$_configuration['announcements_hide_send_to_hrm_users'] = true;