Skip to content

Commit

Permalink
Use form->addSelectLanguage instead of custom code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Feb 10, 2017
1 parent ac8a66b commit 9c6abb2
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 22 deletions.
7 changes: 6 additions & 1 deletion main/admin/configure_inscription.php
Expand Up @@ -230,7 +230,12 @@

// LANGUAGE
if (api_get_setting('registration', 'language') == 'true') {
$form->addElement('select_language', 'language', get_lang('Language'), '', array('disabled' => 'disabled'));
$form->addSelectLanguage(
'language',
get_lang('Language'),
'',
array('disabled' => 'disabled')
);
}

// STUDENT/TEACHER
Expand Down
4 changes: 1 addition & 3 deletions main/admin/course_add.php
Expand Up @@ -106,14 +106,12 @@
// If there's only one language available, there's no point in asking
$form->addElement('hidden', 'course_language', $languages['folder'][0]);
} else {
$form->addElement(
'select_language',
$form->addSelectLanguage(
'course_language',
get_lang('Ln'),
array(),
array('style' => 'width:150px')
);
$form->applyFilter('select_language', 'html_filter');
}

if (api_get_setting('teacher_can_select_course_template') === 'true') {
Expand Down
3 changes: 1 addition & 2 deletions main/admin/course_edit.php
Expand Up @@ -197,8 +197,7 @@
$form->applyFilter('department_url', 'html_filter');
$form->applyFilter('department_url', 'trim');

$form->addElement('select_language', 'course_language', get_lang('CourseLanguage'));
$form->applyFilter('select_language', 'html_filter');
$form->addSelectLanguage('course_language', get_lang('CourseLanguage'));

$group = array();
$group[]= $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
Expand Down
2 changes: 1 addition & 1 deletion main/admin/course_list.php
Expand Up @@ -319,7 +319,7 @@ function get_course_visibility_icon($v) {
)
);

$el = $form->addElement('select_language', 'keyword_language', get_lang('CourseLanguage'));
$el = $form->addSelectLanguage('keyword_language', get_lang('CourseLanguage'));
$el->addOption(get_lang('All'), '%');
$form->addElement('radio', 'keyword_visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$form->addElement('radio', 'keyword_visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
Expand Down
3 changes: 1 addition & 2 deletions main/admin/course_request_edit.php
Expand Up @@ -84,8 +84,7 @@
$form->addRule('target_audience', get_lang('ThisFieldIsRequired'), 'required');

// Course language.
$form->addElement('select_language', 'course_language', get_lang('Ln'));
$form->applyFilter('select_language', 'html_filter');
$form->addSelectLanguage('course_language', get_lang('Ln'));

// Exemplary content checkbox.
$form->addElement('checkbox', 'exemplary_content', get_lang('FillWithExemplaryContent'));
Expand Down
2 changes: 1 addition & 1 deletion main/admin/legal_add.php
Expand Up @@ -137,7 +137,7 @@
$form->addElement('html', $buttons);

} else {
$form->addElement('select_language', 'language', get_lang('Language'),null,array());
$form->addSelectLanguage('language', get_lang('Language'), null, array());
$form->addButtonSearch(get_lang('Load'), 'send');

}
Expand Down
2 changes: 1 addition & 1 deletion main/admin/user_add.php
Expand Up @@ -265,7 +265,7 @@ function display_drh_list(){
$form->addElement('html', '</div>');
}

$form->addElement('select_language', 'language', get_lang('Language'), null);
$form->addSelectLanguage('language', get_lang('Language'), null);

// Send email
$group = array();
Expand Down
2 changes: 1 addition & 1 deletion main/admin/user_edit.php
Expand Up @@ -269,7 +269,7 @@ function confirmation(name) {
}

//Language
$form->addElement('select_language', 'language', get_lang('Language'));
$form->addSelectLanguage('language', get_lang('Language'));

// Send email
$group = array();
Expand Down
3 changes: 1 addition & 2 deletions main/auth/inscription.php
Expand Up @@ -205,8 +205,7 @@
// Language
if (in_array('language', $allowedFields)) {
if (api_get_setting('registration', 'language') == 'true') {
$form->addElement(
'select_language',
$form->addSelectLanguage(
'language',
get_lang('Language')
);
Expand Down
2 changes: 1 addition & 1 deletion main/auth/profile.php
Expand Up @@ -225,7 +225,7 @@ function show_icon_edit(element_html) {
}

// LANGUAGE
$form->addElement('select_language', 'language', get_lang('Language'));
$form->addSelectLanguage('language', get_lang('Language'));
if (api_get_setting('profile', 'language') !== 'true') {
$form->freeze('language');
}
Expand Down
5 changes: 4 additions & 1 deletion main/course_info/infocours.php
Expand Up @@ -140,7 +140,10 @@ function is_settings_editable()
$categories,
['style'=>'width:350px', 'id'=>'category_code']
);
$form->addElement('select_language', 'course_language', array(get_lang('Ln'), get_lang('TipLang')));
$form->addSelectLanguage(
'course_language',
array(get_lang('Ln'), get_lang('TipLang'))
);

$group = array(
$form->createElement('radio', 'show_course_in_user_language', null, get_lang('Yes'), 1),
Expand Down
4 changes: 1 addition & 3 deletions main/create_course/add_course.php
Expand Up @@ -147,14 +147,12 @@ function setFocus(){
// If there's only one language available, there's no point in asking
$form->addElement('hidden', 'course_language', $languages['folder'][0]);
} else {
$form->addElement(
'select_language',
$form->addSelectLanguage(
'course_language',
get_lang('Ln'),
array(),
array('style' => 'width:150px')
);
$form->applyFilter('select_language', 'html_filter');
}

// Exemplary content checkbox.
Expand Down
2 changes: 1 addition & 1 deletion main/exercise/exercise.class.php
Expand Up @@ -2276,7 +2276,7 @@ public function createForm($form, $type='full')
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';

$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
$form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
$form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage'));

$specific_fields = get_specific_field_list();

Expand Down
2 changes: 1 addition & 1 deletion main/survey/fillsurvey.php
Expand Up @@ -466,7 +466,7 @@

if (isset($list['language']) && $list['language'] == 1) {
// LANGUAGE
$form->addElement('select_language', 'language', get_lang('Language'));
$form->addSelectLanguage('language', get_lang('Language'));
if (api_get_setting('profile', 'language') !== 'true') {
$form->freeze('language');
}
Expand Down
2 changes: 1 addition & 1 deletion main/upload/upload_ppt.php
Expand Up @@ -85,7 +85,7 @@
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
$specific_fields = get_specific_field_list();
$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
$form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
$form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage'));
foreach ($specific_fields as $specific_field) {
$form->addElement('text', $specific_field['code'], $specific_field['name'].' : ');
}
Expand Down

0 comments on commit 9c6abb2

Please sign in to comment.