|
3 | 3 |
|
4 | 4 | use Chamilo\CoreBundle\Entity\Skill;
|
5 | 5 | use Skill as SkillManager;
|
| 6 | +use Symfony\Component\HttpFoundation\Request as HttpRequest; |
6 | 7 |
|
7 | 8 | /**
|
8 | 9 | * Page for assign skills to a user.
|
|
11 | 12 | */
|
12 | 13 | require_once __DIR__.'/../inc/global.inc.php';
|
13 | 14 |
|
14 |
| -$userId = isset($_REQUEST['user']) ? (int) $_REQUEST['user'] : 0; |
| 15 | +$httpRequest = HttpRequest::createFromGlobals(); |
| 16 | + |
| 17 | +$userId = $httpRequest->query->getInt( |
| 18 | + 'user', |
| 19 | + $httpRequest->request->getInt('user') |
| 20 | +); |
15 | 21 |
|
16 | 22 | if (empty($userId)) {
|
17 | 23 | api_not_allowed(true);
|
|
53 | 59 | $skillsOptions[$skill['data']['id']] = $skill['data']['name'];
|
54 | 60 | }
|
55 | 61 | }
|
56 |
| -$skillIdFromGet = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
57 |
| -$currentValue = isset($_REQUEST['current_value']) ? (int) $_REQUEST['current_value'] : 0; |
58 |
| -$currentLevel = isset($_REQUEST['current']) ? (int) str_replace('sub_skill_id_', '', $_REQUEST['current']) : 0; |
| 62 | +$skillIdFromGet = $httpRequest->query->getInt( |
| 63 | + 'id', |
| 64 | + $httpRequest->request->getInt('id') |
| 65 | +); |
| 66 | +$currentValue = $httpRequest->query->getInt( |
| 67 | + 'current_value', |
| 68 | + $httpRequest->request->getInt('current_value') |
| 69 | +); |
| 70 | +$currentLevel = $httpRequest->query->get( |
| 71 | + 'current', |
| 72 | + $httpRequest->request->get('current', '') |
| 73 | +); |
| 74 | +$currentLevel = (int) str_replace('sub_skill_id_', '', $currentLevel); |
59 | 75 |
|
60 |
| -$subSkillList = isset($_REQUEST['sub_skill_list']) ? explode(',', $_REQUEST['sub_skill_list']) : []; |
| 76 | +$subSkillList = $httpRequest->query->get( |
| 77 | + 'sub_skill_list', |
| 78 | + $httpRequest->request->get('sub_skill_list', '') |
| 79 | +); |
| 80 | +$subSkillList = explode(',', $subSkillList); |
61 | 81 | $subSkillList = array_unique($subSkillList);
|
62 | 82 |
|
63 | 83 | if (!empty($subSkillList)) {
|
|
94 | 114 | }
|
95 | 115 | }
|
96 | 116 |
|
97 |
| -$skillId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : key($skillsOptions); |
| 117 | +$skillId = $httpRequest->query->getInt( |
| 118 | + 'id', |
| 119 | + $httpRequest->request->getInt('id', key($skillsOptions)) |
| 120 | +); |
98 | 121 | $skill = $skillRepo->find($skillId);
|
99 | 122 | $profile = false;
|
100 | 123 | if ($skill) {
|
|
234 | 257 | //$form->addRule('acquired_level', get_lang('ThisFieldIsRequired'), 'required');
|
235 | 258 | }
|
236 | 259 |
|
237 |
| -$form->addTextarea('argumentation', get_lang('Argumentation'), ['rows' => 6]); |
238 |
| -$form->addRule('argumentation', get_lang('ThisFieldIsRequired'), 'required'); |
| 260 | +$form->addTextarea('argumentation', get_lang('Argumentation'), ['rows' => 6], true); |
239 | 261 | $form->addRule(
|
240 | 262 | 'argumentation',
|
241 | 263 | sprintf(get_lang('ThisTextShouldBeAtLeastXCharsLong'), 10),
|
242 | 264 | 'mintext',
|
243 | 265 | 10
|
244 | 266 | );
|
245 | 267 | $form->applyFilter('argumentation', 'trim');
|
| 268 | +$form->applyFilter('argumentation', 'html_filter'); |
246 | 269 | $form->addButtonSave(get_lang('Save'));
|
247 | 270 | $form->setDefaults($formDefaultValues);
|
248 | 271 |
|
|
0 commit comments