Fix for codeclimate

pull/2487/head
Polycapa 8 years ago
parent 6b3ac766aa
commit 73ba61f5f3
  1. 25
      main/admin/course_add.php
  2. 7
      main/admin/course_list.php
  3. 11
      main/admin/index.php
  4. 25
      main/admin/settings.lib.php
  5. 10
      main/admin/subscribe_user2course.php
  6. 62
      main/admin/user_add.php
  7. 12
      main/admin/user_list.php
  8. 7
      main/inc/lib/extra_field.lib.php

@ -42,10 +42,13 @@ $form = new FormValidator('update_course');
$form->addElement('header', $tool_name); $form->addElement('header', $tool_name);
// Title // Title
$form->addText('title', get_lang('Title'), true, $form->addText(
array( 'title',
'id' => 'title' get_lang('Title'),
)); true,
array(
'id' => 'title'
));
$form->applyFilter('title', 'html_filter'); $form->applyFilter('title', 'html_filter');
$form->applyFilter('title', 'trim'); $form->applyFilter('title', 'trim');
@ -96,12 +99,22 @@ $form->addElement(
); );
// Course department // Course department
$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60', 'id' => 'department_name')); $form->addText(
'department_name',
get_lang('CourseDepartment'),
false,
array('size' => '60', 'id' => 'department_name')
);
$form->applyFilter('department_name', 'html_filter'); $form->applyFilter('department_name', 'html_filter');
$form->applyFilter('department_name', 'trim'); $form->applyFilter('department_name', 'trim');
// Department URL // Department URL
$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60', 'id' => 'department_url')); $form->addText(
'department_url',
get_lang('CourseDepartmentURL'),
false,
array('size' => '60', 'id' => 'department_url')
);
$form->applyFilter('department_url', 'html_filter'); $form->applyFilter('department_url', 'html_filter');
// Course language. // Course language.

@ -351,7 +351,12 @@ if (isset ($_GET['search']) && $_GET['search'] === 'advanced') {
} }
// Create a search-box // Create a search-box
$form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE); $form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
$form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))); $form->addElement(
'text',
'keyword',
null,
array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))
);
$form->addButtonSearch(get_lang('SearchCourse')); $form->addButtonSearch(get_lang('SearchCourse'));
$advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>'; $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>';

@ -201,7 +201,10 @@ if (api_is_platform_admin()) {
$search_form = ' <form method="get" action="settings.php" class="form-inline"> $search_form = ' <form method="get" action="settings.php" class="form-inline">
<div class="form-group"> <div class="form-group">
<input class="form-control" type="text" name="search_field" value="" aria-label="'.get_lang('Search').'" > <input class="form-control"
type="text"
name="search_field" value=""
aria-label="'.get_lang('Search').'" >
<input type="hidden" value="search_setting" name="category"> <input type="hidden" value="search_setting" name="category">
<button class="btn btn-default" type="submit"> <button class="btn btn-default" type="submit">
<em class="fa fa-search"></em> ' . get_lang('Search').' <em class="fa fa-search"></em> ' . get_lang('Search').'
@ -282,7 +285,11 @@ $sessionPath = api_get_path(WEB_CODE_PATH).'session/';
$search_form = ' <form method="GET" class="form-inline" action="'.$sessionPath.'session_list.php"> $search_form = ' <form method="GET" class="form-inline" action="'.$sessionPath.'session_list.php">
<div class="form-group"> <div class="form-group">
<input class="form-control" type="text" name="keyword" value="" aria-label="'.get_lang('Search').'"> <input class="form-control"
type="text"
name="keyword"
value=""
aria-label="'.get_lang('Search').'">
<button class="btn btn-default" type="submit"> <button class="btn btn-default" type="submit">
<em class="fa fa-search"></em> ' . get_lang('Search').' <em class="fa fa-search"></em> ' . get_lang('Search').'
</button> </button>

@ -1370,7 +1370,13 @@ function generateSettingsForm($settings, $settings_by_access_list)
if (file_exists($file)) { if (file_exists($file)) {
$value = file_get_contents($file); $value = file_get_contents($file);
} }
$form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10', 'id' => $row['variable']), $hideme); $form->addElement(
'textarea',
$row['variable'],
array(get_lang($row['title']), get_lang($row['comment'])),
array('rows'=>'10', 'id' => $row['variable']),
$hideme
);
$default_values[$row['variable']] = $value; $default_values[$row['variable']] = $value;
} elseif ($row['variable'] == 'footer_extra_content') { } elseif ($row['variable'] == 'footer_extra_content') {
$file = api_get_home_path().'footer_extra_content.txt'; $file = api_get_home_path().'footer_extra_content.txt';
@ -1378,10 +1384,23 @@ function generateSettingsForm($settings, $settings_by_access_list)
if (file_exists($file)) { if (file_exists($file)) {
$value = file_get_contents($file); $value = file_get_contents($file);
} }
$form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10', 'id' => $row['variable']), $hideme); $form->addElement(
'textarea',
$row['variable'],
array(get_lang($row['title']), get_lang($row['comment'])),
array('rows'=>'10', 'id' => $row['variable']),
$hideme
);
$default_values[$row['variable']] = $value; $default_values[$row['variable']] = $value;
} else { } else {
$form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10', 'id' => $row['variable']), $hideme); $form->addElement(
'textarea',
$row['variable'],
array(get_lang($row['title']),
get_lang($row['comment'])),
array('rows'=>'10', 'id' => $row['variable']),
$hideme
);
$default_values[$row['variable']] = $row['selected_value']; $default_values[$row['variable']] = $row['selected_value'];
} }
break; break;

@ -293,8 +293,9 @@ if (is_array($extra_field_list)) {
<b><?php echo get_lang('UserList'); ?></b> <b><?php echo get_lang('UserList'); ?></b>
<br/><br/> <br/><br/>
<?php echo get_lang('FirstLetterUser'); ?> : <?php echo get_lang('FirstLetterUser'); ?> :
<select name="firstLetterUser" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();" <select name="firstLetterUser"
aria-label="<?php echo get_lang('FirstLetterUser'); ?>"> onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"
aria-label="<?php echo get_lang('FirstLetterUser'); ?>">
<option value="">--</option> <option value="">--</option>
<?php <?php
echo Display :: get_alphabet_options($first_letter_user); echo Display :: get_alphabet_options($first_letter_user);
@ -306,8 +307,9 @@ if (is_array($extra_field_list)) {
<b><?php echo get_lang('CourseList'); ?> :</b> <b><?php echo get_lang('CourseList'); ?> :</b>
<br/><br/> <br/><br/>
<?php echo get_lang('FirstLetterCourse'); ?> : <?php echo get_lang('FirstLetterCourse'); ?> :
<select name="firstLetterCourse" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();" <select name="firstLetterCourse"
aria-label="<?php echo get_lang('FirstLetterCourse'); ?>"> onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"
aria-label="<?php echo get_lang('FirstLetterCourse'); ?>">
<option value="">--</option> <option value="">--</option>
<?php <?php
echo Display :: get_alphabet_options($first_letter_course); echo Display :: get_alphabet_options($first_letter_course);

@ -102,45 +102,65 @@ $form = new FormValidator('user_add');
$form->addElement('header', '', $tool_name); $form->addElement('header', '', $tool_name);
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
// Firstname // Firstname
$form->addElement('text', 'firstname', get_lang('FirstName'), $form->addElement(
array( 'text',
'id' => 'firstname' 'firstname',
)); get_lang('FirstName'),
array(
'id' => 'firstname'
)
);
$form->applyFilter('firstname', 'html_filter'); $form->applyFilter('firstname', 'html_filter');
$form->applyFilter('firstname', 'trim'); $form->applyFilter('firstname', 'trim');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
// Lastname // Lastname
$form->addElement('text', 'lastname', get_lang('LastName'), $form->addElement(
array( 'text',
'id' => 'lastname' 'lastname',
)); get_lang('LastName'),
array(
'id' => 'lastname'
)
);
$form->applyFilter('lastname', 'html_filter'); $form->applyFilter('lastname', 'html_filter');
$form->applyFilter('lastname', 'trim'); $form->applyFilter('lastname', 'trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
} else { } else {
// Lastname // Lastname
$form->addElement('text', 'lastname', get_lang('LastName'), $form->addElement(
array( 'text',
'id' => 'lastname' 'lastname',
)); get_lang('LastName'),
array(
'id' => 'lastname'
)
);
$form->applyFilter('lastname', 'html_filter'); $form->applyFilter('lastname', 'html_filter');
$form->applyFilter('lastname', 'trim'); $form->applyFilter('lastname', 'trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
// Firstname // Firstname
$form->addElement('text', 'firstname', get_lang('FirstName'), $form->addElement(
array( 'text',
'id' => 'firstname' 'firstname',
)); get_lang('FirstName'),
array(
'id' => 'firstname'
)
);
$form->applyFilter('firstname', 'html_filter'); $form->applyFilter('firstname', 'html_filter');
$form->applyFilter('firstname', 'trim'); $form->applyFilter('firstname', 'trim');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
} }
// Official code // Official code
$form->addElement('text', 'official_code', get_lang('OfficialCode'), $form->addElement(
array( 'text',
'size' => '40', 'official_code',
'id' => 'official_code' get_lang('OfficialCode'),
)); array(
'size' => '40',
'id' => 'official_code'
)
);
$form->applyFilter('official_code', 'html_filter'); $form->applyFilter('official_code', 'html_filter');
$form->applyFilter('official_code', 'trim'); $form->applyFilter('official_code', 'trim');
// Email // Email

@ -816,10 +816,14 @@ if (!empty($action)) {
// Create a search-box // Create a search-box
$form = new FormValidator('search_simple', 'get', null, null, null, 'inline'); $form = new FormValidator('search_simple', 'get', null, null, null, 'inline');
$form->addText('keyword', get_lang('Search'), false, $form->addText(
array( 'keyword',
'aria-label' => get_lang("SearchUsers") get_lang('Search'),
)); false,
array(
'aria-label' => get_lang("SearchUsers")
)
);
$form->addButtonSearch(get_lang('Search')); $form->addButtonSearch(get_lang('Search'));
$searchAdvanced = ' $searchAdvanced = '

@ -911,7 +911,12 @@ class ExtraField extends Model
$field_details['display_text'], $field_details['display_text'],
false, false,
false, false,
array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130', 'id' => 'extra_'.$field_details['variable']) array(
'ToolbarSet' => 'Profile',
'Width' => '100%',
'Height' => '130',
'id' => 'extra_'.$field_details['variable']
)
); );
$form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
$form->applyFilter('extra_'.$field_details['variable'], 'trim'); $form->applyFilter('extra_'.$field_details['variable'], 'trim');

Loading…
Cancel
Save