From e77516ce435fa7dad905d0c5de7720f356eaa795 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 12 Jul 2017 09:29:16 -0500 Subject: [PATCH 01/12] Add Composer command to update basis css files Run `composer run-script update-css` in command line --- composer.json | 3 ++- .../CoreBundle/Composer/ScriptHandler.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5eeb32a48a..345091157b 100755 --- a/composer.json +++ b/composer.json @@ -132,7 +132,8 @@ ], "post-update-cmd": [ "Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles" - ] + ], + "update-css": "Chamilo\\CoreBundle\\Composer\\ScriptHandler::updateCss" }, "extra": { "symfony-app-dir": "app", diff --git a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php index 028b836a9b..71ef5f0078 100644 --- a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php +++ b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php @@ -253,4 +253,21 @@ class ScriptHandler return $res; } + + /** + * Update the basis css files. + * Avoid use the ScriptHandler::dumpCssFiles + */ + public static function updateCss() + { + $appCss = __DIR__.'/../../../../app/Resources/public/css/'; + $newPath = __DIR__.'/../../../../web/css/'; + $cssFiles = ['base.css', 'chat.css', 'editor.css', 'markdown.css', 'print.css', 'responsive.css', 'scorm.css']; + + $fs = new Filesystem(); + + foreach ($cssFiles as $file) { + $fs->copy($appCss.$file, $newPath.$file, true); + } + } } From 248c2cd957499912dfe557f5b66502474bd95406 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Wed, 12 Jul 2017 15:43:41 -0500 Subject: [PATCH 02/12] style css fix student views in survey - refs BT#12915 --- app/Resources/public/css/base.css | 8 ++--- main/survey/fillsurvey.php | 49 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 87c6aa5b98..cca8267554 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -3491,10 +3491,6 @@ i.size-32.icon-new-work{ margin-top: 4px; margin-bottom: 10px; } -.survey-block #question{ - background-color: #ececec; - text-align: center; -} .survey_question .title{ font-weight: bold; padding-bottom: 10px; @@ -3507,6 +3503,10 @@ i.size-32.icon-new-work{ color:#000; padding:5px;/*border: 1px solid #264269;*/ } +.survey_subtitle{ + margin-top: 20px; + margin-bottom: 20px; +} .survey_question .radio-inline input[type="radio"], .survey_question .checkbox-inline input[type="checkbox"]{ margin-top: 2px; diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index 8427f9ccec..0e939c5f52 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -502,16 +502,11 @@ Display :: display_header(get_lang('ToolSurvey')); // Displaying the survey title and subtitle (appears on every page) echo '
'; -echo '
'; -echo Display::return_icon( - 'statistics.png', - get_lang('CreateNewSurvey'), - array('style'=>'display:inline-block; margin-right:5px;'), - ICON_SIZE_SMALL -); -echo strip_tags($survey_data['survey_title']).'
'; +echo ''; if (!empty($survey_data['survey_subtitle'])) { - echo '
'.strip_tags($survey_data['survey_subtitle']).'
'; + echo '

'.strip_tags($survey_data['survey_subtitle']).'

'; } // Displaying the survey introduction @@ -522,7 +517,7 @@ if (!isset($_GET['show'])) { $paged_questions_sec = array(); if (!empty($survey_data['survey_introduction'])) { - echo '
'.$survey_data['survey_introduction'].'
'; + echo '
'.$survey_data['survey_introduction'].'
'; } $limit = 0; } @@ -1195,7 +1190,7 @@ $p_l = isset($_POST['language']) ? Security::remove_XSS($_POST['language']) : '' $add_parameters = isset($_GET['user_id']) ? 'user_id='.intval($_GET['user_id']).'&' : ''; $url = api_get_self().'?'.api_get_cidreq().'&'.$add_parameters.'course='.$g_c.'&invitationcode='.$g_ic.'&show='.$show; -$form = new FormValidator('question', 'post', $url); +$form = new FormValidator('question', 'post', $url, null, null, FormValidator::LAYOUT_INLINE); $form->addHidden('language', $p_l); if (isset($questions) && is_array($questions)) { @@ -1203,25 +1198,28 @@ if (isset($questions) && is_array($questions)) { $ch_type = 'ch_'.$question['type']; $display = new $ch_type; // @todo move this in a function. - $form->addHtml('
'); - $form->addHtml($question['survey_question']); + $form->addHtml('
'); + //$form->addHtml('
'); + $form->addHtml('
'.$question['question_id'].'. '.strip_tags($question['survey_question']).'
'); + //$form->addHtml($question['survey_question']); $display->render($form, $question); - $form->addHtml('
'); + $form->addHtml('
'); } } +$form->addHtml('
'); if ($survey_data['survey_type'] === '0') { if ($survey_data['show_form_profile'] == 0) { // The normal survey as always if (($show < $numberofpages) || !$_GET['show']) { if ($show == 0) { - $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); + $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success'); } else { - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); } } if ($show >= $numberofpages && $_GET['show']) { - $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); + $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success'); } } else { // The normal survey as always but with the form profile @@ -1229,14 +1227,14 @@ if ($survey_data['survey_type'] === '0') { $numberofpages = count($paged_questions); if (($show < $numberofpages) || !$_GET['show']) { //$show = $_GET['show'] + 1 if ($show == 0) { - $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); + $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success'); } else { - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); } } if ($show >= $numberofpages && $_GET['show']) { - $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); + $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success'); } } } @@ -1255,7 +1253,7 @@ if ($survey_data['survey_type'] === '0') { if ($personality == 0) { if (($show <= $numberofpages) || !$_GET['show']) { - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); if ($survey_data['one_question_per_page'] == 0) { if ($personality >= 0) { $form->addHidden('personality', $personality); @@ -1277,10 +1275,10 @@ if ($survey_data['survey_type'] === '0') { } elseif ($personality > 0) { if ($survey_data['one_question_per_page'] == 1) { if ($show >= $numberofpages) { - $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); + $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success'); } else { $form->addHidden('personality', $personality); - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); } } else { // if the personality test hidden input was set. @@ -1289,12 +1287,13 @@ if ($survey_data['survey_type'] === '0') { } } elseif ($survey_data['form_fields'] == '') { // This is the case when the show_profile_form is true but there are not form_fields - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); } elseif (!is_array($user_data)) { // If the user is not registered in the platform we do not show the form to update his information - $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right'); + $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success'); } } +$form->addHtml('
'); $form->display(); // Footer From a5e7b6e5366109e3347981955165daa4d3cd0841 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 12 Jul 2017 16:06:40 -0500 Subject: [PATCH 03/12] Add button to go to course homepage when finishing survey - refs BT#12915 --- main/survey/preview.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main/survey/preview.php b/main/survey/preview.php index bf8d6e811a..c9d604dbb5 100755 --- a/main/survey/preview.php +++ b/main/survey/preview.php @@ -22,6 +22,7 @@ $table_user = Database::get_main_table(TABLE_MAIN_USER); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); $course_id = api_get_course_int_id(); +$courseInfo = $course_id ? api_get_course_info_by_id($course_id) : []; $userId = api_get_user_id(); $surveyId = intval($_GET['survey_id']); $userInvited = 0; @@ -206,7 +207,7 @@ if (api_is_course_admin() || $url = api_get_self().'?survey_id='.$survey_id.'&show='.$show; $form = new FormValidator('question-survey', 'post', $url, null, null, FormValidator::LAYOUT_INLINE); - + if (is_array($questions) && count($questions) > 0) { foreach ($questions as $key => & $question) { $ch_type = 'ch_'.$question['type']; @@ -251,6 +252,14 @@ if (api_is_course_admin() || } $form->addHtml('
'); $form->display(); + + if ($courseInfo) { + echo Display::toolbarButton( + get_lang('ReturnToCourseHomepage'), + api_get_course_url($courseInfo['code']), + 'home' + ); + } } else { echo Display::return_message(get_lang('NotAllowed'), 'error', false); } From fe261d62ad8e9e91c11a05d1a1ed565d0a82ba51 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 12 Jul 2017 17:00:25 -0500 Subject: [PATCH 04/12] Update language terms --- main/lang/english/trad4all.inc.php | 7 +++++++ main/lang/french/trad4all.inc.php | 7 +++++++ main/lang/spanish/trad4all.inc.php | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 74a795b12d..4473c047b0 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -8021,4 +8021,11 @@ $IsMandatory = "Mandatory?"; $StudentXHasBeenAssignedNewWorkInCourseY = "%s got a new assignment in course %s"; $AsHRMYouReceiveThisMailToAlertThatXHasNewWorkInCourseY = "As his/her human resources manager, you are receiving this e-mail to let you know that %s just got a new assignment in course %s"; $DearXComma = "Dear %s,"; +$UserLinkingRequests = "User linking requests"; +$NewHomeworkEmailAlertToHrmEnable = "Send e-mail to students and their HRM on assignments creation"; +$UserLinkingRequestAccepted = "User linking request accepted"; +$UserLinkingTo = "Linked to student"; +$RequestLinkingToUser = "Request linking to student"; +$LinkingRequestsAdded = "Linking request added"; +$HrmList = "Human Resource Managers list"; ?> \ No newline at end of file diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 80ec927fd4..36d454fba0 100644 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -7963,4 +7963,11 @@ $IsMandatory = "Obligatoire?"; $StudentXHasBeenAssignedNewWorkInCourseY = "Une nouvelle tâche a été assignée à %s dans le cours %s"; $AsHRMYouReceiveThisMailToAlertThatXHasNewWorkInCourseY = "En tant que son responsable RH, vous recevez cet e-mail pour vous avertir qu'une nouvelle tâche vient d'être assignée à %s dans le cours %s."; $DearXComma = "Cher/Chère %s,"; +$UserLinkingRequests = "Demandes de liaisons à utilisateurs"; +$NewHomeworkEmailAlertToHrmEnable = "Envoyer un e-mail aux apprenants et à leurs directeurs de ressources humaines lors de la création d'un travail"; +$UserLinkingRequestAccepted = "Demande de liaison acceptée"; +$UserLinkingTo = "Lié à l'apprenant"; +$RequestLinkingToUser = "Solliciter lien à apprenant"; +$LinkingRequestsAdded = "Demande de liaison enregistrée"; +$HrmList = "Liste des directeurs de ressources humaines"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index c50378824f..70709ca03b 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -8052,4 +8052,11 @@ $IsMandatory = "Obligatorio/a?"; $StudentXHasBeenAssignedNewWorkInCourseY = "Nueva tarea asignada a %s en el curso %s"; $AsHRMYouReceiveThisMailToAlertThatXHasNewWorkInCourseY = "Como su responsable RH, está recibiendo este correo para avisarle que una nueva tarea acaba de ser asignada a %s en el curso %s."; $DearXComma = "Estimado/a %s,"; +$UserLinkingRequests = "Solicitudes de vinculación a estudiantes"; +$NewHomeworkEmailAlertToHrmEnable = "Enviar un correo a los estudiantes y sus responsables de recursos humanos a la creación de una tarea"; +$UserLinkingRequestAccepted = "Solicitud de vinculación a estudiante aceptada"; +$UserLinkingTo = "Vinculado al estudiante"; +$RequestLinkingToUser = "Solicitar vinculación a estudiante"; +$LinkingRequestsAdded = "Solicitud de vinculación añadida"; +$HrmList = "Lista de responsables de recursos humanos"; ?> \ No newline at end of file From 241e2950d2bd1a1cfe142717cf038bda94a3dc65 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 12 Jul 2017 17:01:34 -0500 Subject: [PATCH 05/12] Update vinculation term to linking --- main/admin/index.php | 2 +- ...vinculation_requests.php => user_linking_requests.php} | 8 ++++---- main/inc/lib/userportal.lib.php | 4 ++-- ...uire_user_vinculation.php => require_user_linking.php} | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename main/admin/{user_vinculation_requests.php => user_linking_requests.php} (90%) rename main/social/{require_user_vinculation.php => require_user_linking.php} (93%) diff --git a/main/admin/index.php b/main/admin/index.php index d337049253..ee002272f2 100644 --- a/main/admin/index.php +++ b/main/admin/index.php @@ -109,7 +109,7 @@ if (api_is_platform_admin()) { } $items[] = array('url' => 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields')); $items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes')); - $items[] = ['url' => 'user_vinculation_requests.php', 'label' => get_lang('UserVinculationRequests')]; + $items[] = ['url' => 'user_linking_requests.php', 'label' => get_lang('UserLinkingRequests')]; } elseif (api_is_session_admin() && api_get_configuration_value('limit_session_admin_role')) { $items = array( array('url' => 'user_list.php', 'label' => get_lang('UserList')), diff --git a/main/admin/user_vinculation_requests.php b/main/admin/user_linking_requests.php similarity index 90% rename from main/admin/user_vinculation_requests.php rename to main/admin/user_linking_requests.php index b0c00a3373..7a28b795d6 100644 --- a/main/admin/user_vinculation_requests.php +++ b/main/admin/user_linking_requests.php @@ -32,7 +32,7 @@ if ($action === 'accept' && $hrm && $assinedId) { $em->flush(); Display::addFlash( - Display::return_message(get_lang('UserVinculationRequestAccepted'), 'success') + Display::return_message(get_lang('UserLinkingRequestAccepted'), 'success') ); } @@ -75,7 +75,7 @@ function getData(User $hrm) return $result; } -$form = new FormValidator('user_vinculation_requests', 'get'); +$form = new FormValidator('user_linking_requests', 'get'); $form->addSelectAjax( 'hrm', get_lang('DRH'), @@ -91,7 +91,7 @@ if ($hrm) { if ($requests) { $content .= Display::table( - [get_lang('UserVinculationTo'), get_lang('Actions')], + [get_lang('UserLinkingTo'), get_lang('Actions')], $requests ); } else { @@ -101,7 +101,7 @@ if ($hrm) { $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')]; -$toolName = get_lang('UserVinculationRequests'); +$toolName = get_lang('UserLinkingRequests'); $view = new Template($toolName); $view->assign('header', $toolName); diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 21d4ed4433..a01d56012e 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -977,12 +977,12 @@ class IndexManager .get_lang('EditProfile').''; if (api_get_configuration_value('show_link_request_hrm_user') && api_is_drh()) { - $label = get_lang('RequireVinculationWithUser'); + $label = get_lang('RequestLinkingToUser'); $icon = Display::return_icon('new_group.png', $label); $profile_content .= '
  • ' .Display::url( $icon.$label, - api_get_path(WEB_CODE_PATH).'social/require_user_vinculation.php' + api_get_path(WEB_CODE_PATH).'social/require_user_linking.php' ) .'
  • '; } diff --git a/main/social/require_user_vinculation.php b/main/social/require_user_linking.php similarity index 93% rename from main/social/require_user_vinculation.php rename to main/social/require_user_linking.php index 5491efac51..2d88b420e3 100644 --- a/main/social/require_user_vinculation.php +++ b/main/social/require_user_linking.php @@ -40,7 +40,7 @@ foreach ($usersRequested as $userRequested) { $requestOptions[$userInfo['user_id']] = $userInfo['complete_name']; } -$form = new FormValidator('require_user_vinculation'); +$form = new FormValidator('require_user_linking'); $form->addUserAvatar('hrm', get_lang('DRH'), 'medium'); $form->addSelectAjax( 'users', @@ -65,7 +65,7 @@ if ($form->validate()) { UserManager::requestUsersToHRManager($hrm->getId(), $usersId, false); Display::addFlash( - Display::return_message(get_lang('RequestsVinculationAdded'), 'success') + Display::return_message(get_lang('LinkingRequestsAdded'), 'success') ); header('Location: '.api_get_self()); @@ -102,7 +102,7 @@ foreach ($usersAssigned as $userAssigned) { $content .= '
    '; -$toolName = get_lang('RequireVinculationWithUser'); +$toolName = get_lang('RequestLinkingToUser'); $view = new Template($toolName); $view->assign('header', $toolName); From 303b764902a35d4dee8bdbee5f583c7d3fae1bea Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 12 Jul 2017 17:23:32 -0500 Subject: [PATCH 06/12] Update language terms --- main/course_info/infocours.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index 94152642fc..046d9b7a0e 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -311,14 +311,14 @@ $form->addGroup($group, '', array(get_lang("NewUserEmailAlert"))); $group = array(); $group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', get_lang('NewHomeworkEmailAlert'), get_lang('NewHomeworkEmailAlertEnable'), 1); -$group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertToDrhEnable'), 2); +$group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertToHrmEnable'), 2); $group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertDisable'), 0); $form->addGroup($group, '', array(get_lang("NewHomeworkEmailAlert"))); $group = array(); +$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForTeachers'), 3); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForStudents'), 2); -$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0); $form->addGroup($group, '', array(get_lang("WorkEmailAlert"))); From 50333afd409b822ea45db225496878628756e2e9 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 12 Jul 2017 17:24:07 -0500 Subject: [PATCH 07/12] Add column to show when survey is mandatory or not - refs BT#12915 --- main/survey/surveyUtil.class.php | 70 ++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 39bbd8f326..faa6f58d3c 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -2511,9 +2511,18 @@ class SurveyUtil $table->set_header(6, get_lang('AvailableUntil')); $table->set_header(7, get_lang('Invite')); $table->set_header(8, get_lang('Anonymous')); - $table->set_header(9, get_lang('Modify'), false, 'width="150"'); + + if (api_get_configuration_value('allow_mandatory_survey')) { + $table->set_header(9, get_lang('IsMandatory')); + $table->set_header(10, get_lang('Modify'), false, 'width="150"'); + $table->set_column_filter(9, 'anonymous_filter'); + $table->set_column_filter(10, 'modify_filter_drh'); + } else { + $table->set_header(9, get_lang('Modify'), false, 'width="150"'); + $table->set_column_filter(9, 'modify_filter_drh'); + } + $table->set_column_filter(8, 'anonymous_filter'); - $table->set_column_filter(9, 'modify_filter_drh'); $table->display(); } @@ -2554,9 +2563,18 @@ class SurveyUtil $table->set_header(6, get_lang('AvailableUntil')); $table->set_header(7, get_lang('Invite')); $table->set_header(8, get_lang('Anonymous')); - $table->set_header(9, get_lang('Modify'), false, 'width="150"'); + + if (api_get_configuration_value('allow_mandatory_survey')) { + $table->set_header(9, get_lang('IsMandatory')); + $table->set_header(10, get_lang('Modify'), false, 'width="150"'); + $table->set_column_filter(9, 'anonymous_filter'); + $table->set_column_filter(10, 'modify_filter'); + } else { + $table->set_header(9, get_lang('Modify'), false, 'width="150"'); + $table->set_column_filter(9, 'modify_filter'); + } + $table->set_column_filter(8, 'anonymous_filter'); - $table->set_column_filter(9, 'modify_filter'); $table->set_form_actions(array('delete' => get_lang('DeleteSurvey'))); $table->display(); } @@ -2593,9 +2611,18 @@ class SurveyUtil $table->set_header(6, get_lang('AvailableUntil')); $table->set_header(7, get_lang('Invite')); $table->set_header(8, get_lang('Anonymous')); - $table->set_header(9, get_lang('Modify'), false, 'width="130"'); + + if (api_get_configuration_value('allow_mandatory_survey')) { + $table->set_header(9, get_lang('Modify'), false, 'width="130"'); + $table->set_header(10, get_lang('Modify'), false, 'width="130"'); + $table->set_column_filter(9, 'anonymous_filter'); + $table->set_column_filter(10, 'modify_filter_for_coach'); + } else { + $table->set_header(9, get_lang('Modify'), false, 'width="130"'); + $table->set_column_filter(9, 'modify_filter_for_coach'); + } + $table->set_column_filter(8, 'anonymous_filter'); - $table->set_column_filter(9, 'modify_filter_for_coach'); $table->display(); } @@ -2766,6 +2793,7 @@ class SurveyUtil $table_survey = Database::get_course_table(TABLE_SURVEY); $table_user = Database::get_main_table(TABLE_MAIN_USER); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); + $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey'); $_user = api_get_user_info(); // Searching @@ -2814,6 +2842,8 @@ class SurveyUtil $res = Database::query($sql); $surveys = array(); $array = array(); + $efv = new ExtraFieldValue('survey'); + while ($survey = Database::fetch_array($res)) { $array[0] = $survey[0]; $array[1] = Display::url( @@ -2839,7 +2869,15 @@ class SurveyUtil ); $array[8] = $survey[8]; - $array[9] = $survey[9]; + + if ($mandatoryAllowed) { + $efvMandatory = $efv->get_values_by_handler_and_field_variable($survey[9], 'is_mandatory'); + + $array[9] = $efvMandatory ? $efvMandatory['value'] : 0; + $array[10] = $survey[9]; + } else { + $array[9] = $survey[9]; + } if ($isDrh) { $array[1] = $survey[1]; @@ -2860,6 +2898,7 @@ class SurveyUtil */ public static function get_survey_data_for_coach($from, $number_of_items, $column, $direction) { + $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey'); $survey_tree = new SurveyTree(); //$last_version_surveys = $survey_tree->get_last_children_from_branch($survey_tree->surveylist); $last_version_surveys = $survey_tree->surveylist; @@ -2884,6 +2923,7 @@ class SurveyUtil $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); $table_user = Database::get_main_table(TABLE_MAIN_USER); $course_id = api_get_course_int_id(); + $efv = new ExtraFieldValue('survey'); $sql = "SELECT survey.survey_id AS col0, @@ -2908,6 +2948,11 @@ class SurveyUtil $res = Database::query($sql); $surveys = array(); while ($survey = Database::fetch_array($res)) { + if ($mandatoryAllowed) { + $survey['col10'] = $survey['col9']; + $efvMandatory = $efv->get_values_by_handler_and_field_variable($survey['col9'], 'is_mandatory'); + $survey['col9'] = $efvMandatory['value']; + } $surveys[] = $survey; } @@ -2928,6 +2973,7 @@ class SurveyUtil $course_id = $_course['real_id']; $user_id = intval($user_id); $sessionId = api_get_session_id(); + $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey'); // Database table definitions $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); @@ -2949,6 +2995,9 @@ class SurveyUtil echo ''; echo ' '.get_lang('SurveyName').''; echo ' '.get_lang('Anonymous').''; + if ($mandatoryAllowed) { + echo ''.get_lang('IsMandatory').''; + } echo ''; echo ''; echo ''; @@ -2972,6 +3021,8 @@ class SurveyUtil "; $result = Database::query($sql); + $efv = new ExtraFieldValue('survey'); + while ($row = Database::fetch_array($result, 'ASSOC')) { echo ''; if ($row['answered'] == 0) { @@ -2999,6 +3050,11 @@ class SurveyUtil echo ''; echo ($row['anonymous'] == 1) ? get_lang('Yes') : get_lang('No'); echo ''; + if ($mandatoryAllowed) { + $efvMandatory = $efv->get_values_by_handler_and_field_variable($row['survey_id'], 'is_mandatory'); + echo ''.($efvMandatory['value'] ? get_lang('Yes') : get_lang('No')).''; + } + echo ''; } echo ''; From d27f1c81df9906ff01f8f42d9649191d167f1a9a Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 12 Jul 2017 17:42:41 -0500 Subject: [PATCH 08/12] Boost: Add simple caching rules for woff font files to avoid loading OpenSans at each request --- .htaccess | 8 ++++++++ documentation/installation_guide.html | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index ad2bcce53d..ec1b9be77e 100644 --- a/.htaccess +++ b/.htaccess @@ -61,3 +61,11 @@ RewriteRule ^([^/.]+)/?$ user.php?$1 [L] # Deny access RewriteRule ^(tests|.git) - [F,L,NC] + +# Add caching of woff font files to avoid loading 2*15KB each time with Chamilo +# default OpenSans font +AddType application/font-woff .woff .woff2 + + ExpiresActive On + ExpiresByType application/font-woff "access plus 1 month" + diff --git a/documentation/installation_guide.html b/documentation/installation_guide.html index ee044ff075..d92b8fe282 100755 --- a/documentation/installation_guide.html +++ b/documentation/installation_guide.html @@ -736,6 +736,12 @@ If you have issues with files taking a long time to download, make sure you reco RewriteRule ^([^/.]+)/?$ user.php?$1 [L] RewriteRule ^(tests|.git) - [F,L,NC] </Directory> + + AddType application/font-woff .woff .woff2 + <IfModule mod_expires.c> + ExpiresActive On + ExpiresByType application/font-woff "access plus 1 month" + </IfModule>

    Nginx

    Nginx doesn't support .htaccess rules, so you have no other option than to apply the following rules (note that your PHP backend configuration may vary). @@ -791,8 +797,8 @@ If you have issues with files taking a long time to download, make sure you reco } # Serve static files directly - location ~* \.(png|jpe?g|gif|ico|js|css|mp3|swf|flv|mp4|ogg)$ { - expires 1y; + location ~* \.(png|jpe?g|gif|ico|js|css|mp3|swf|flv|mp4|ogg|woff|woff2)$ { + expires 30d; access_log off; rewrite ^/courses/([^/]+)/course-pic85x85.png$ /app/courses/$1/course-pic85x85.png last; rewrite ^/courses/([^/]+)/course-pic.png$ /app/courses/$1/course-pic.png last; From 2ad4d45320b63bdb3567230f75d5ef4749aa0b9e Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 12 Jul 2017 18:11:49 -0500 Subject: [PATCH 09/12] Fix number of question in survey - refs BT#12915 --- main/survey/fillsurvey.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index 0e939c5f52..d65a1d5b54 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -721,6 +721,7 @@ if (isset($_GET['show']) || isset($_POST['personality'])) { $questions[$row['sort']]['type'] = $row['type']; $questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text']; $questions[$row['sort']]['maximum_score'] = $row['max_value']; + $questions[$row['sort']]['sort'] = $row['sort']; } else { // If the type is a pagebreak we are finished loading the questions for this page break; @@ -1024,6 +1025,7 @@ if (isset($_GET['show']) || isset($_POST['personality'])) { $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1']; $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2']; $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri']; + $questions[$row['sort']]['sort'] = $row['sort']; } else { // If the type is a pagebreak we are finished loading the questions for this page break; @@ -1145,12 +1147,14 @@ if (isset($_GET['show']) || isset($_POST['personality'])) { $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1']; $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2']; $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri']; + $questions[$row['sort']]['sort'] = $row['sort']; } else { // If the type is a page break we are finished loading the questions for this page break; } $counter++; } + var_Dump($questions); } } } else { // In case it's another type than 0 or 1 @@ -1200,7 +1204,7 @@ if (isset($questions) && is_array($questions)) { // @todo move this in a function. $form->addHtml('
    '); //$form->addHtml('
    '); - $form->addHtml('
    '.$question['question_id'].'. '.strip_tags($question['survey_question']).'
    '); + $form->addHtml('
    '.$question['sort'].'. '.strip_tags($question['survey_question']).'
    '); //$form->addHtml($question['survey_question']); $display->render($form, $question); $form->addHtml('
    '); From 0cebc2bffb579608d9575ed557176ae145c3e1b7 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Wed, 12 Jul 2017 18:11:53 -0500 Subject: [PATCH 10/12] fix styles --- app/Resources/public/css/base.css | 12 +++--------- app/Resources/public/css/themes/chamilo/default.css | 5 +---- main/template/default/announcement/slider.tpl | 4 +++- main/template/default/announcement/view.tpl | 4 +++- main/template/default/layout/hot_courses.tpl | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index cca8267554..ad305dfcab 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -204,10 +204,8 @@ header { margin: 25px auto; text-align: center; } -#notice_block p, #notice-block p{ - color: #666; - font-size: 12px; - line-height: 20px; +#notice_block h5{ + font-weight: bold; } .carousel-indicators{ bottom: 0px !important; @@ -1607,7 +1605,7 @@ div.admin_section h4 { right: 0; } .view-options{ - padding-top: 2px; + padding-top: 3px; padding-right: 10px; } #course_settings h3 img { @@ -3861,10 +3859,6 @@ i.size-32.icon-new-work{ color: #666; } /* Items menus sidebar */ -.sidebar .nav li a{ - padding: 2px; - font-size: 12px; -} .sidebar .nav li a img{ vertical-align: middle; margin-right: 5px; diff --git a/app/Resources/public/css/themes/chamilo/default.css b/app/Resources/public/css/themes/chamilo/default.css index 1904aa9f20..11fa9c003e 100755 --- a/app/Resources/public/css/themes/chamilo/default.css +++ b/app/Resources/public/css/themes/chamilo/default.css @@ -148,7 +148,4 @@ a:focus { } .bgfooter a{ color: #ffffff; -} -.page-header{ - margin: 10px 0 10px; -} +} \ No newline at end of file diff --git a/main/template/default/announcement/slider.tpl b/main/template/default/announcement/slider.tpl index 16f6241b83..a9b4ed06c5 100644 --- a/main/template/default/announcement/slider.tpl +++ b/main/template/default/announcement/slider.tpl @@ -1,4 +1,6 @@ - +