Browse Source

Changes to recent current settings - refs #7538

Yannick Warnier 9 years ago
parent
commit
b990fc7965

+ 1 - 6
main/calendar/agenda_js.php

@@ -225,15 +225,11 @@ $form->addElement('label', get_lang('Date'), '<span id="start_date"></span><span
 $form->addElement('text', 'title', get_lang('Title'), array('id' => 'title'));
 $form->addElement('textarea', 'content', get_lang('Description'), array('id' => 'content'));
 
-$allowEventComment = api_get_configuration_value('allow_agenda_event_comment');
-
 if ($agenda->type == 'course') {
     $form->addElement('html', '<div id="add_as_announcement_div" style="display: none">');
     $form->addElement('checkbox', 'add_as_annonuncement', null, get_lang('AddAsAnnouncement'));
     $form->addElement('html', '</div>');
-    if ($allowEventComment) {
-        $form->addElement('textarea', 'comment', get_lang('Comment'), array('id' => 'comment'));
-    }
+    $form->addElement('textarea', 'comment', get_lang('Comment'), array('id' => 'comment'));
 }
 
 $tpl->assign('form_add', $form->return_form());
@@ -243,7 +239,6 @@ $content = $tpl->fetch('default/agenda/month.tpl');
 
 $message = Session::read('message');
 $tpl->assign('message', $message);
-$tpl->assign('allow_agenda_event_comment', $allowEventComment);
 
 Session::erase('message');
 

+ 0 - 4
main/cron/import_csv.php

@@ -841,10 +841,6 @@ class ImportCsv
 
                 $eventComment = $event['comment'];
 
-                // To use the event comment you need
-                // ALTER TABLE c_calendar_event ADD COLUMN comment TEXT;
-                // add in configuration.php allow_agenda_event_comment = true
-
                 if (empty($courseInfo)) {
                     $this->logger->addInfo(
                         "No course found for added: #".$event['course_id']." Skipping ..."

+ 6 - 28
main/inc/lib/agenda.lib.php

@@ -161,15 +161,10 @@ class Agenda
                     'end_date' => $end,
                     'all_day' => $allDay,
                     'session_id' => $this->getSessionId(),
-                    'c_id' => $this->course['real_id']
+                    'c_id' => $this->course['real_id'],
+                    'comment' => $eventComment,
                 );
 
-                $allow = api_get_configuration_value('allow_agenda_event_comment');
-
-                if ($allow) {
-                    $attributes['comment'] = $eventComment;
-                }
-
                 if (!empty($parentEventId)) {
                     $attributes['parent_event_id'] = $parentEventId;
                 }
@@ -606,15 +601,10 @@ class Agenda
                         'content' => $content,
                         'start_date' => $start,
                         'end_date' => $end,
-                        'all_day' => $allDay
+                        'all_day' => $allDay,
+                        'comment' => $comment,
                     );
 
-                    $allow = api_get_configuration_value('allow_agenda_event_comment');
-
-                    if ($allow) {
-                        $attributes['comment'] = $comment;
-                    }
-
                     Database::update(
                         $this->tbl_course_agenda,
                         $attributes,
@@ -1356,8 +1346,6 @@ class Agenda
 
         $sql .= $dateCondition;
 
-        $allowComments = api_get_configuration_value('allow_agenda_event_comment');
-
         $result = Database::query($sql);
         if (Database::num_rows($result)) {
             $events_added = array();
@@ -1462,12 +1450,7 @@ class Agenda
                 $event['allDay'] = isset($row['all_day']) && $row['all_day'] == 1 ? $row['all_day'] : 0;
                 $event['parent_event_id'] = $row['parent_event_id'];
                 $event['has_children'] = $this->hasChildren($row['id'], $course_id) ? 1 : 0;
-
-                if ($allowComments) {
-                    $event['comment'] = $row['comment'];
-                } else {
-                    $event['comment'] = null;
-                }
+                $event['comment'] = $row['comment'];
 
                 $this->events[] = $event;
             }
@@ -1864,12 +1847,7 @@ class Agenda
         );
 
         if ($this->type == 'course') {
-            $allow = api_get_configuration_value('allow_agenda_event_comment');
-
-            if ($allow) {
-                $form->addElement('textarea', 'comment', get_lang('Comment'));
-            }
-
+            $form->addElement('textarea', 'comment', get_lang('Comment'));
             $form->addElement('file', 'user_upload', get_lang('AddAnAttachment'));
             if ($showAttachmentForm) {
                 if (isset($params['attachment']) && !empty($params['attachment'])) {

+ 0 - 3
main/install/data.sql

@@ -334,7 +334,6 @@ VALUES
 ('add_gradebook_certificates_cron_task_enabled', NULL, 'radio', 'Tools', 'false', 'GradebookCronTaskGenerationTitle', 'GradebookCronTaskGenerationComment', NULL, NULL, 1),
 ('openbadges_backpack', NULL, 'textfield', 'Gradebook', 'https://backpack.openbadges.org/', 'OpenBadgesBackpackUrlTitle', 'OpenBadgesBackpackUrlComment', NULL, NULL, 1),
 ('cookie_warning', NULL, 'radio', 'Tools', 'false', 'CookieWarningTitle', 'CookieWarningComment', NULL, NULL, 1),
-('allow_agenda_event_comment', NULL, 'radio', 'Tools', 'false', 'AgendaEventCommentEnabledTitle', 'AgendaEventCommentEnabledComment', NULL, NULL, 1),
 ('prevent_session_admins_to_manage_all_users', NULL, 'radio', 'Session', 'false', 'PreventSessionAdminsToManageAllUsersTitle', 'PreventSessionAdminsToManageAllUsersComment', NULL, NULL, 1),
 ('hide_course_group_if_no_tools_available', NULL, 'radio', 'Tools', 'false', 'HideCourseGroupIfNoToolAvailableTitle', 'HideCourseGroupIfNoToolAvailableComment', NULL, NULL, 1),
 ('catalog_allow_session_auto_subscription', NULL, 'radio', 'Session', 'true', 'CatalogueAllowSessionAutoSubscriptionTitle', 'CatalogueAllowSessionAutoSubscriptionTitle', NULL, NULL, 1),
@@ -717,8 +716,6 @@ VALUES
 ('add_gradebook_certificates_cron_task_enabled', 'false', 'No'),
 ('cookie_warning', 'true', 'Yes'),
 ('cookie_warning', 'false', 'No'),
-('allow_agenda_event_comment', 'true', 'Yes'),
-('allow_agenda_event_comment', 'false', 'No'),
 ('prevent_session_admins_to_manage_all_users', 'true', 'Yes'),
 ('prevent_session_admins_to_manage_all_users', 'false', 'No'),
 ('hide_course_group_if_no_tools_available', 'true', 'Yes'),

+ 0 - 2
main/template/default/agenda/month.tpl

@@ -524,7 +524,6 @@ $(document).ready(function() {
                     <div id="simple_content"></div>
                 </div>
             </div>
-            {% if allow_agenda_event_comment %}
             <div class="control-group">
                 <label class="control-label">
                     <b>{{ "Comment" |get_lang}}</b>
@@ -533,7 +532,6 @@ $(document).ready(function() {
                     <div id="simple_comment"></div>
                 </div>
             </div>
-            {% endif %}
 
         </form>
     </div>

+ 22 - 39
src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150522222222.php

@@ -18,6 +18,8 @@ class Version20150522222222 extends AbstractMigrationChamilo
     public function up(Schema $schema)
     {
         $this->addSql('ALTER TABLE user ADD COLUMN last_login datetime DEFAULT NULL');
+        // calendar events comments
+        $this->addSql("ALTER TABLE c_calendar_event ADD COLUMN comment TEXT");
 
         // Move some settings from configuration.php to the database
         // Current settings categories are:
@@ -32,7 +34,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'true'),
             'AllowLearningPathReturnLinkTitle',
             'AllowLearningPathReturnLinkComment',
             null,
@@ -50,7 +52,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'HideScormExportLinkTitle',
             'HideScormExportLinkComment',
             null,
@@ -69,7 +71,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'HideScormCopyLinkTitle',
             'HideScormCopyLinkComment',
             null,
@@ -88,7 +90,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'HideScormPdfLinkTitle',
             'HideScormPdfLinkComment',
             null,
@@ -144,7 +146,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'PdfLogoHeaderTitle',
             'PdfLogoHeaderComment',
             null,
@@ -163,7 +165,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Platform',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'OrderUserListByOfficialCodeTitle',
             'OrderUserListByOfficialCodeComment',
             null,
@@ -181,8 +183,8 @@ class Version20150522222222 extends AbstractMigrationChamilo
             'email_alert_manager_on_new_quiz',
             '',
             'radio',
-            'Tools',
-            ($value?'true':'false'),
+            'Course',
+            ($value?$value:'true'),
             'AlertManagerOnNewQuizTitle',
             'AlertManagerOnNewQuizComment',
             null,
@@ -201,7 +203,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Tools',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'ShowOfficialCodeInExerciseResultListTitle',
             'ShowOfficialCodeInExerciseResultListComment',
             null,
@@ -221,7 +223,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Platform',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'HidePrivateCoursesFromCourseCatalogTitle',
             'HidePrivateCoursesFromCourseCatalogComment',
             null,
@@ -260,7 +262,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Platform',
-            ($value?'true':'false'),
+            ($value?$value:'true'),
             'AutoDetectLanguageCustomPagesTitle',
             'AutoDetectLanguageCustomPagesComment',
             null,
@@ -279,7 +281,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Tools',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'LearningPathShowReducedReportTitle',
             'LearningPathShowReducedReportComment',
             null,
@@ -298,7 +300,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Session',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'AllowSessionCourseCopyForTeachersTitle',
             'AllowSessionCourseCopyForTeachersComment',
             null,
@@ -316,8 +318,8 @@ class Version20150522222222 extends AbstractMigrationChamilo
             'hide_logout_button',
             '',
             'radio',
-            'Platform',
-            ($value?'true':'false'),
+            'Security',
+            ($value?$value:'false'),
             'HideLogoutButtonTitle',
             'HideLogoutButtonComment',
             null,
@@ -336,7 +338,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Platform',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'RedirectAdminToCoursesListTitle',
             'RedirectAdminToCoursesListComment',
             null,
@@ -355,7 +357,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Course',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'CourseImagesInCoursesListTitle',
             'CourseImagesInCoursesListComment',
             null,
@@ -393,7 +395,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
             '',
             'radio',
             'Gradebook',
-            ($value?'true':'false'),
+            ($value?$value:'false'),
             'FilterCertificateByOfficialCodeTitle',
             'FilterCertificateByOfficialCodeComment',
             null,
@@ -499,25 +501,6 @@ class Version20150522222222 extends AbstractMigrationChamilo
             [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
         );
 
-        // Allows a comment field in the course calendar events. Requires DB change
-        //$_configuration['allow_agenda_event_comment'] = false;
-        $value = api_get_configuration_value('allow_agenda_event_comment');
-        $this->addSettingCurrent(
-            'allow_agenda_event_comment',
-            '',
-            'radio',
-            'Tools',
-            ($value?$value:'false'),
-            'AgendaEventCommentEnabledTitle',
-            'AgendaEventCommentEnabledComment',
-            null,
-            '',
-            1,
-            true,
-            false,
-            [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
-        );
-
         // Filters administration users lists by the session admin who created them.
         // Change to true to restrict the visibility
         //$_configuration['prevent_session_admins_to_manage_all_users'] = false;
@@ -806,8 +789,8 @@ class Version20150522222222 extends AbstractMigrationChamilo
      */
     public function down(Schema $schema)
     {
-        $this->addSql("DELETE FROM settings_options WHERE variable IN ('session_course_ordering', 'force_sso_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'prevent_session_admins_to_manage_all_users', 'allow_agenda_event_comment', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
-        $this->addSql("DELETE FROM settings_current WHERE variable IN ('session_course_ordering', 'force_sso_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'prevent_session_admins_to_manage_all_users', 'allow_agenda_event_comment', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
+        $this->addSql("DELETE FROM settings_options WHERE variable IN ('session_course_ordering', 'force_sso_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'prevent_session_admins_to_manage_all_users', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
+        $this->addSql("DELETE FROM settings_current WHERE variable IN ('session_course_ordering', 'force_sso_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'prevent_session_admins_to_manage_all_users', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
 
         $this->addSql('ALTER TABLE user DROP COLUMN last_login');
         $this->addSql("