diff --git a/public/main/admin/configure_extensions.php b/public/main/admin/configure_extensions.php
index b12a38f015..503d3ce4bf 100644
--- a/public/main/admin/configure_extensions.php
+++ b/public/main/admin/configure_extensions.php
@@ -168,7 +168,7 @@ Display::display_header($nameTool);
$form->addElement('text', 'path_to_lzx', get_lang('Path to LZX files'));
//$form -> addElement('html','
');
$options = ChamiloApi::getDocumentConversionSizes();
- $form->addElement('select', 'size', get_lang('Size of the slides'), $options);
+ $form->addSelect('size', get_lang('Size of the slides'), $options);
$form->addElement('hidden', 'extension_code', 'ppt2lp');
$defaults = [];
diff --git a/public/main/admin/export_certificates.php b/public/main/admin/export_certificates.php
index 112bcc4349..2a97f88ac4 100644
--- a/public/main/admin/export_certificates.php
+++ b/public/main/admin/export_certificates.php
@@ -12,7 +12,7 @@ $options = [];
foreach ($courses as $course) {
$options[$course['id']] = $course['title'];
}
-$form->addElement('select', 'course', get_lang('Course'), $options);
+$form->addSelect('course', get_lang('Course'), $options);
$form->addElement('file', 'file', get_lang('File'));
$form->addButton('submit', get_lang('Submit'));
$form->display();
diff --git a/public/main/admin/extra_field_workflow.php b/public/main/admin/extra_field_workflow.php
index fba7cb09d0..59f14f1451 100644
--- a/public/main/admin/extra_field_workflow.php
+++ b/public/main/admin/extra_field_workflow.php
@@ -147,7 +147,7 @@ $options[STUDENT] = get_lang('Learner');
$options[COURSEMANAGER] = get_lang('Trainer');
ksort($options);
-$form->addElement('select', 'status', get_lang('Select role'), $options);
+$form->addSelect('status', get_lang('Select role'), $options);
$repo = $em->getRepository(ExtraFieldOptionRelFieldOption::class);
diff --git a/public/main/admin/ldap_users_list.php b/public/main/admin/ldap_users_list.php
index 4102206440..c6123e5c87 100644
--- a/public/main/admin/ldap_users_list.php
+++ b/public/main/admin/ldap_users_list.php
@@ -155,7 +155,7 @@ $type["all"] = get_lang('All');
$type["employee"] = get_lang('Trainer');
$type["student"] = get_lang('Learner');
-$form->addElement('select', 'keyword_type', get_lang('Status'), $type);
+$form->addSelect('keyword_type', get_lang('Status'), $type);
// Structure a rajouer ??
$form->addElement('submit', 'submit', get_lang('Validate'));
//$defaults['keyword_active'] = 1;
diff --git a/public/main/admin/skills_profile.php b/public/main/admin/skills_profile.php
index 9336c49a43..58c8b21683 100644
--- a/public/main/admin/skills_profile.php
+++ b/public/main/admin/skills_profile.php
@@ -24,7 +24,7 @@ $tpl = new Template(get_lang('Skills'));
$form = new FormValidator('profile_search');
$form->addElement('header', get_lang('Search skills'));
-$form->addElement('select', 'skills', null, null, ['id' => 'skills']);
+$form->addSelect('skills', null, null, ['id' => 'skills']);
$form->addButtonSearch(get_lang('Search'));
$profiles = $skill_profile->get_all();
diff --git a/public/main/admin/system_announcements.php b/public/main/admin/system_announcements.php
index 0e05ad9850..c7a24d0140 100644
--- a/public/main/admin/system_announcements.php
+++ b/public/main/admin/system_announcements.php
@@ -278,17 +278,6 @@ if ($action_todo) {
error_log($e);
}
- $group = [];
- foreach ($visibleList as $key => $name) {
- $group[] = $form->createElement(
- 'checkbox',
- $key,
- null,
- $name
- );
- }
-
- //$form->addGroup($group, null, get_lang('Visible'));
$form->addSelect('roles', get_lang('Visible'), $visibleList, ['multiple' => 'multiple']);
$form->addElement('hidden', 'id');
@@ -298,8 +287,7 @@ if ($action_todo) {
if (!empty($group_list)) {
$group_list = array_column($group_list, 'name', 'id');
$group_list[0] = get_lang('All');
- $form->addElement(
- 'select',
+ $form->addSelect(
'group',
get_lang('Announcement for a group'),
$group_list
@@ -307,17 +295,17 @@ if ($action_todo) {
}
$values['group'] = $values['group'] ?? '0';
- $form->addElement('checkbox', 'send_mail', null, get_lang('Send mail'));
+ $form->addCheckBox('send_mail', null, get_lang('Send mail'));
if ('add' === $action) {
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('Add to calendar'));
$text = get_lang('Add news');
$class = 'add';
- $form->addElement('hidden', 'action', 'add');
+ $form->addHidden('action', 'add');
} elseif ('edit' === $action) {
$text = get_lang('Edit News');
$class = 'save';
- $form->addElement('hidden', 'action', 'edit');
+ $form->addHidden('action', 'edit');
}
$form->addElement('checkbox', 'send_email_test', null, get_lang('Send an email to myself for testing purposes.'));
$form->addButtonSend($text, 'submit');
diff --git a/public/main/admin/user_export.php b/public/main/admin/user_export.php
index e92174f6b3..e318ca3cd1 100644
--- a/public/main/admin/user_export.php
+++ b/public/main/admin/user_export.php
@@ -59,8 +59,8 @@ $form->addCheckBox(
],
get_lang('Yes, add the headers')
);
-$form->addElement('select', 'course_code', get_lang('Only users from the course'), $courses);
-$form->addElement('select', 'course_session', get_lang('Only users from the courseSession'), $coursesSessions);
+$form->addSelect('course_code', get_lang('Only users from the course'), $courses);
+$form->addSelect('course_session', get_lang('Only users from the courseSession'), $coursesSessions);
$form->addButtonExport(get_lang('Export'));
$form->setDefaults(['file_type' => 'csv']);
diff --git a/public/main/admin/user_list.php b/public/main/admin/user_list.php
index 7dc0bf06cc..79184fd12b 100644
--- a/public/main/admin/user_list.php
+++ b/public/main/admin/user_list.php
@@ -1094,16 +1094,15 @@ $status_options[DRH] = get_lang('Human Resources Manager');
$status_options[SESSIONADMIN] = get_lang('Course sessionsAdmin');
$status_options[PLATFORM_ADMIN] = get_lang('Administrator');
-$form->addElement(
- 'select',
+$form->addSelect(
'keyword_status',
get_lang('Profile'),
$status_options
);
$active_group = [];
-$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('active'));
-$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('inactive'));
+$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active'));
+$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive'));
$form->addGroup($active_group, '', get_lang('activeAccount'), null, false);
$form->addElement('checkbox', 'check_easy_passwords', null, get_lang('Check passwords too easy to guess'));
$data = $extraField->addElements($form, 0, [], true, false, $variablesToShow);
diff --git a/public/main/announcements/announcements.php b/public/main/announcements/announcements.php
index c544d10c37..d9b4ccf654 100644
--- a/public/main/announcements/announcements.php
+++ b/public/main/announcements/announcements.php
@@ -186,7 +186,7 @@ switch ($action) {
}
}
$users = [];
- $searchForm->addElement('select', 'user_id', get_lang('Users'), $userList);
+ $searchForm->addSelect('user_id', get_lang('Users'), $userList);
$searchForm->addButtonSearch(get_lang('Search'));
$filterData = [];
diff --git a/public/main/attendance/index.php b/public/main/attendance/index.php
index c2b85d2b10..477727d951 100644
--- a/public/main/attendance/index.php
+++ b/public/main/attendance/index.php
@@ -557,7 +557,7 @@ switch ($action) {
'weekly' => get_lang('Weekly'),
'monthlyByDate' => get_lang('Monthly, by date'),
];
- $form->addElement('select', 'repeat_type', get_lang('Repeat type'), $a_repeat_type);
+ $form->addSelect('repeat_type', get_lang('Repeat type'), $a_repeat_type);
$form->addDatePicker(
'end_date_time',
diff --git a/public/main/coursecopy/copy_course.php b/public/main/coursecopy/copy_course.php
index 97852b7037..2c4cb233ab 100644
--- a/public/main/coursecopy/copy_course.php
+++ b/public/main/coursecopy/copy_course.php
@@ -108,7 +108,7 @@ if (Security::check_token('post') && (
'post',
api_get_path(WEB_CODE_PATH).'coursecopy/copy_course.php?'.api_get_cidreq()
);
- $form->addElement('select', 'destination_course', get_lang('Select target course'), $courses);
+ $form->addSelect('destination_course', get_lang('Select target course'), $courses);
$group = [];
$group[] = $form->createElement('radio', 'copy_option', null, get_lang('Full copy'), 'full_copy');
diff --git a/public/main/document/create_audio.php b/public/main/document/create_audio.php
index a5da9a20c6..27b1e12c78 100644
--- a/public/main/document/create_audio.php
+++ b/public/main/document/create_audio.php
@@ -227,7 +227,7 @@ if ('google' == $service) {
$form->addElement('hidden', 'text2voice_mode', 'google');
$form->addElement('hidden', 'id', $document_id);
$form->addElement('text', 'title', get_lang('Title'));
- $form->addElement('select', 'lang', get_lang('Language'), $options);
+ $form->addSelect('lang', get_lang('Language'), $options);
$form->addElement('textarea', 'text', get_lang('Enter the text you want to convert to an audio file'), ['id' => 'textarea_google']);
$form->addButtonSave(get_lang('Save mp3'));
$defaults = [];
diff --git a/public/main/dropbox/dropbox_functions.inc.php b/public/main/dropbox/dropbox_functions.inc.php
index 2eadfa8d8a..2035360154 100644
--- a/public/main/dropbox/dropbox_functions.inc.php
+++ b/public/main/dropbox/dropbox_functions.inc.php
@@ -209,7 +209,7 @@ function display_move_form(
foreach ($target as $category) {
$options[$category['cat_id']] = $category['cat_name'];
}
- $form->addElement('select', 'move_target', get_lang('Move file to'), $options);
+ $form->addSelect('move_target', get_lang('Move file to'), $options);
$form->addButtonMove(get_lang('Move the file'), 'do_move');
$form->display();
}
diff --git a/public/main/exercise/TestCategory.php b/public/main/exercise/TestCategory.php
index 86f280e576..4ba1b13a7f 100644
--- a/public/main/exercise/TestCategory.php
+++ b/public/main/exercise/TestCategory.php
@@ -938,7 +938,7 @@ class TestCategory
}
$form->addElement('html', $script);
- $form->addElement('select', 'parent_id', get_lang('Parent'), $category_parent_list, ['id' => 'parent_id']);
+ $form->addSelect('parent_id', get_lang('Parent'), $category_parent_list, ['id' => 'parent_id']);
$form->addElement('style_submit_button', 'SubmitNote', $submit, 'class="add"');
// setting the defaults
diff --git a/public/main/exercise/question.class.php b/public/main/exercise/question.class.php
index 9610e17807..7949fff1f6 100644
--- a/public/main/exercise/question.class.php
+++ b/public/main/exercise/question.class.php
@@ -1336,7 +1336,7 @@ abstract class Question
}
//Medias
//$course_medias = self::prepare_course_media_select(api_get_course_int_id());
- //$form->addElement('select', 'parent_id', get_lang('Attach to media'), $course_medias);
+ //$form->addSelect('parent_id', get_lang('Attach to media'), $course_medias);
}
$form->addElement('html', '');
diff --git a/public/main/exercise/question_create.php b/public/main/exercise/question_create.php
index 4f53969377..1f82905f26 100644
--- a/public/main/exercise/question_create.php
+++ b/public/main/exercise/question_create.php
@@ -56,7 +56,7 @@ $exercises['-'] = '-'.get_lang('Select exercise').'-';
while ($row = Database :: fetch_array($result)) {
$exercises[$row['iid']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
}
-$form->addElement('select', 'exercise', get_lang('Test'), $exercises);
+$form->addSelect('exercise', get_lang('Test'), $exercises);
// generate default content
$form->addElement(
diff --git a/public/main/extra/userInfo.php b/public/main/extra/userInfo.php
index 74a011b832..9e70491cb0 100644
--- a/public/main/extra/userInfo.php
+++ b/public/main/extra/userInfo.php
@@ -210,7 +210,7 @@ if ("viewDefEdit" == $displayMode) {
$possible_line_nrs[5] = '5 '.get_lang('lines');
$possible_line_nrs[10] = '10 '.get_lang('lines');
$possible_line_nrs[15] = '15 '.get_lang('lines');
- $edit_heading_form->addElement('select', 'nbline', get_lang('Line Number'), $possible_line_nrs);
+ $edit_heading_form->addSelect('nbline', get_lang('Line Number'), $possible_line_nrs);
$edit_heading_form->addElement('submit', 'submitDef', get_lang('Validate'));
$edit_heading_form->setDefaults($catToEdit);
$edit_heading_form->display();
diff --git a/public/main/forum/forumfunction.inc.php b/public/main/forum/forumfunction.inc.php
index 4451eec5f2..a5d494c91d 100644
--- a/public/main/forum/forumfunction.inc.php
+++ b/public/main/forum/forumfunction.inc.php
@@ -4231,7 +4231,7 @@ function move_post_form()
foreach ($threads as $thread) {
$threads_list[$thread->getIid()] = $thread->getThreadTitle();
}
- $form->addElement('select', 'thread', get_lang('Move toThread'), $threads_list);
+ $form->addSelect('thread', get_lang('Move toThread'), $threads_list);
$form->applyFilter('thread', 'html_filter');
// The OK button
diff --git a/public/main/group/group_creation.php b/public/main/group/group_creation.php
index 4133e35329..4f57327fa7 100644
--- a/public/main/group/group_creation.php
+++ b/public/main/group/group_creation.php
@@ -327,7 +327,7 @@ EOT;
$classForm->addHtml($description);
$classForm->addElement('hidden', 'action');
if ($allowGroupCategories) {
- $classForm->addElement('select', 'group_category', null, $categories);
+ $classForm->addSelect('group_category', null, $categories);
} else {
$classForm->addElement('hidden', 'group_category');
}
diff --git a/public/main/group/settings.php b/public/main/group/settings.php
index 1680b28cf8..93336cbe7b 100644
--- a/public/main/group/settings.php
+++ b/public/main/group/settings.php
@@ -60,7 +60,7 @@ if ('true' === api_get_setting('allow_group_categories')) {
foreach ($groupCategories as $category) {
$categoryList[$category['iid']] = $category['title'];
}
- $form->addElement('select', 'category_id', get_lang('Category'), $categoryList);
+ $form->addSelect('category_id', get_lang('Category'), $categoryList);
} else {
$form->addHidden('category_id', 0);
}
diff --git a/public/main/inc/lib/career.lib.php b/public/main/inc/lib/career.lib.php
index 75495e1f75..3f851d1aae 100644
--- a/public/main/inc/lib/career.lib.php
+++ b/public/main/inc/lib/career.lib.php
@@ -138,7 +138,7 @@ class Career extends Model
]
);
$status_list = $this->get_status_list();
- $form->addElement('select', 'status', get_lang('Status'), $status_list);
+ $form->addSelect('status', get_lang('Status'), $status_list);
if ('edit' === $action) {
$extraField = new ExtraField('career');
diff --git a/public/main/inc/lib/document.lib.php b/public/main/inc/lib/document.lib.php
index 8b78ab2b86..e3fbf08c27 100644
--- a/public/main/inc/lib/document.lib.php
+++ b/public/main/inc/lib/document.lib.php
@@ -5328,7 +5328,7 @@ This folder contains all sessions that have been opened in the chat. Although th
}
}
}
- $form->addElement('select', 'move_to', get_lang('Move to'), $options);
+ $form->addSelect('move_to', get_lang('Move to'), $options);
$form->addButtonNext(get_lang('Move element'), 'move_file_submit');
return $form->returnForm();
diff --git a/public/main/inc/lib/extra_field_option.lib.php b/public/main/inc/lib/extra_field_option.lib.php
index feee6e2715..a7695f8c93 100644
--- a/public/main/inc/lib/extra_field_option.lib.php
+++ b/public/main/inc/lib/extra_field_option.lib.php
@@ -770,7 +770,7 @@ class ExtraFieldOption extends Model
$form->addElement('text', 'option_value', get_lang('Value'));
$form->addElement('text', 'option_order', get_lang('Order'));
- $form->addElement('select', 'priority', get_lang('Priority'), $this->getPriorityOptions());
+ $form->addSelect('priority', get_lang('Priority'), $this->getPriorityOptions());
$form->addElement('textarea', 'priority_message', get_lang('Message type'));
$defaults = [];
diff --git a/public/main/inc/lib/grade_model.lib.php b/public/main/inc/lib/grade_model.lib.php
index 69fed3f80a..2aaf2b1b9d 100644
--- a/public/main/inc/lib/grade_model.lib.php
+++ b/public/main/inc/lib/grade_model.lib.php
@@ -282,7 +282,7 @@ class GradeModel extends Model
$grade_model_options[$item['id']] = $item['name'];
}
}
- $form->addElement('select', $name, get_lang('Grading model'), $grade_model_options);
+ $form->addSelect( $name, get_lang('Grading model'), $grade_model_options);
$default_platform_setting = api_get_setting('gradebook_default_grade_model_id');
$default = -1;
diff --git a/public/main/inc/lib/pear/HTML/QuickForm.php b/public/main/inc/lib/pear/HTML/QuickForm.php
index fa915b4ab7..1bbb8da0e8 100644
--- a/public/main/inc/lib/pear/HTML/QuickForm.php
+++ b/public/main/inc/lib/pear/HTML/QuickForm.php
@@ -219,13 +219,14 @@ class HTML_QuickForm extends HTML_Common
if (isset($attributes['id']) && !empty($attributes['id'])) {
$form_id = Security::remove_XSS($attributes['id']);
}
- $attributes = array(
+ $attributes = [
'action' => $action,
'method' => $method,
'name' => $formName,
'id' => $form_id,
- ) + $target;
+ ] + $target;
$this->updateAttributes($attributes);
+ //var_dump($_REQUEST);exit;
if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
$this->_submitValues = 'get' === $method ? $_GET : $_POST;
$this->_submitFiles = $_FILES;
@@ -830,21 +831,6 @@ class HTML_QuickForm extends HTML_Common
if (isset($this->_submitValues[$base])) {
$value = isset($this->_submitValues[$base][$cleanId]) ? $this->_submitValues[$base][$cleanId] : null;
}
-
- /*if ((is_array($value) || null === $value) && isset($this->_submitFiles[$base])) {
- $props = array('name', 'type', 'size', 'tmp_name', 'error');
- $code = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n" .
- " return null;\n" .
- "} else {\n" .
- " \$v = array();\n";
- foreach ($props as $prop) {
- $code .= " \$v = HTML_QuickForm::arrayMerge(\$v, \$this->_reindexFiles(\$this->_submitFiles['{$base}']['{$prop}']{$idx}, '{$prop}'));\n";
- }
- $fileValue = eval($code . " return \$v;\n}\n");
- if (null !== $fileValue) {
- $value = null === $value? $fileValue: HTML_QuickForm::arrayMerge($value, $fileValue);
- }
- }*/
}
// This is only supposed to work for groups with appendName = false
diff --git a/public/main/inc/lib/pear/HTML/QuickForm/select.php b/public/main/inc/lib/pear/HTML/QuickForm/select.php
index 45c853b70a..6aee3c8d86 100644
--- a/public/main/inc/lib/pear/HTML/QuickForm/select.php
+++ b/public/main/inc/lib/pear/HTML/QuickForm/select.php
@@ -25,8 +25,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Contains the select options
*
* @var array
- * @since 1.0
- * @access private
*/
protected $_options = [];
private $_optgroups = [];
@@ -35,8 +33,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Default values of the SELECT
*
* @var array
- * @since 1.0
- * @access private
*/
protected $_values = [];
@@ -54,37 +50,36 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
$elementName,
$elementLabel = '',
$options = null,
- $attributes = null
+ array $attributes = []
) {
$addBlank = '';
- if (is_array($attributes) || empty($attributes)) {
- if (empty($attributes)) {
- $attributes = [];
- }
- //selectpicker
+ $layout = $this->getLayout();
+ if (FormValidator::LAYOUT_HORIZONTAL === $layout) {
+ $attributes['class'] = 'form-control mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-indigo-500 sm:text-sm';
+ }
- $layout = $this->getLayout();
- if (FormValidator::LAYOUT_HORIZONTAL === $layout) {
- $attributes['class'] = 'form-control mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-indigo-500 sm:text-sm';
- }
- $attributes['data-live-search'] = 'true';
+ //$attributes['data-live-search'] = 'true';
+ if (isset($attributes['disable_js']) && $attributes['disable_js']) {
+ //$attributes['class'] = 'form-control';
+ //$attributes['data-live-search'] = '';
+ }
- if (isset($attributes['disable_js']) && $attributes['disable_js']) {
- $attributes['class'] = 'form-control';
- $attributes['data-live-search'] = '';
- }
+ if (isset($attributes['extra_class']) && $attributes['extra_class']) {
+ //$attributes['class'] .= ' '.$attributes['extra_class'];
+ //unset($attributes['extra_class']);
+ }
- if (isset($attributes['extra_class']) && $attributes['extra_class']) {
- $attributes['class'] .= ' '.$attributes['extra_class'];
- unset($attributes['extra_class']);
- }
+ if (isset($attributes['placeholder'])) {
+ $addBlank = $attributes['placeholder'];
+ }
- if (isset($attributes['placeholder'])) {
- $addBlank = $attributes['placeholder'];
- }
+ if (isset($attributes['multiple'])) {
+ $attributes['class'] = 'overflow-auto w-full border bg-white rounded px-3 py-2 outline-none text-gray-700';
}
- $columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
- $this->setColumnsSize($columnsSize);
+
+
+ //$columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
+ //$this->setColumnsSize($columnsSize);
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'select';
@@ -210,7 +205,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Returns the element name
*
* @since 1.0
- * @access public
* @return string
*/
public function getName()
@@ -222,7 +216,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Returns the element name (possibly with brackets appended)
*
* @since 1.0
- * @access public
* @return string
*/
public function getPrivateName()
@@ -239,7 +232,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
*
* @param mixed $values Array or comma delimited string of selected values
* @since 1.0
- * @access public
* @return void
*/
public function setValue($value)
@@ -251,7 +243,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Returns an array of the selected values
*
* @since 1.0
- * @access public
* @return array of selected values
*/
public function getValue()
@@ -264,7 +255,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
*
* @param int $size Size of select field
* @since 1.0
- * @access public
* @return void
*/
public function setSize($size)
@@ -276,7 +266,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Returns the select field size
*
* @since 1.0
- * @access public
* @return int
*/
public function getSize()
@@ -305,7 +294,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* Returns the select mutiple attribute
*
* @since 1.2
- * @access public
* @return bool true if multiple select, false otherwise
*/
public function getMultiple()
@@ -321,30 +309,29 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* @param mixed $attributes Either a typical HTML attribute string
* or an associative array
* @since 1.0
- * @access public
* @return void
*/
public function addOption($text, $value, $attributes = null, $return_array = false)
{
if (null === $attributes) {
- $attributes = array('value' => (string)$value);
+ $attributes = ['value' => (string) $value];
} else {
$attributes = $this->_parseAttributes($attributes);
if (isset($attributes['selected'])) {
// the 'selected' attribute will be set in toHtml()
$this->_removeAttr('selected', $attributes);
if (is_null($this->_values)) {
- $this->_values = array($value);
+ $this->_values = [$value];
} elseif (!in_array($value, $this->_values)) {
$this->_values[] = $value;
}
}
- $this->_updateAttrArray($attributes, array('value' => (string)$value));
+ $this->_updateAttrArray($attributes, ['value' => (string) $value]);
}
if ($return_array) {
- return array('text' => $text, 'attr' => $attributes);
+ return ['text' => $text, 'attr' => $attributes];
} else {
- $this->_options[] = array('text' => $text, 'attr' => $attributes);
+ $this->_options[] = ['text' => $text, 'attr' => $attributes];
}
}
@@ -356,7 +343,6 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* @param mixed $attributes Either a typical HTML attribute string
* or an associative array
* @since 1.0
- * @access public
* @return void
*/
public function addOptGroup($options, $label)
@@ -364,7 +350,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
foreach ($options as $option) {
$this->addOption($option['text'], $option['value'], $option, true);
}
- $this->_optgroups[] = array('label' => $label, 'options' => $options);
+ $this->_optgroups[] = ['label' => $label, 'options' => $options];
}
/**
@@ -385,7 +371,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
$attrString = $this->_getAttrString($this->_attributes);
} else {
$myName = $this->getName();
- $this->setName($myName . '[]');
+ $this->setName($myName.'[]');
$attrString = $this->_getAttrString($this->_attributes);
$this->setName($myName);
}
@@ -397,11 +383,12 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
$option['attr']['selected'] = 'selected';
}
- $strHtml .= $tabs . "";
+ $strHtml .=
+ $tabs."";
}
foreach ($this->_optgroups as $optgroup) {
- $strHtml .= $tabs . '