From 33e9b601c030d5e07d84c059e19f56ecddd0856f Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 30 Apr 2015 09:50:51 -0500 Subject: [PATCH] User FormValidator validate method - refs #7363 --- main/gradebook/search.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main/gradebook/search.php b/main/gradebook/search.php index 041d80e726..31a9bc3c7a 100644 --- a/main/gradebook/search.php +++ b/main/gradebook/search.php @@ -19,14 +19,19 @@ if (api_get_setting('allow_public_certificates') != 'true') { ); } -$firstname = isset($_POST['firstname']) ? trim($_POST['firstname']) : null; -$lastname = isset($_POST['lastname']) ? trim($_POST['lastname']) : null; - $userId = isset($_GET['id']) ? intval($_GET['id']) : 0; $userList = $userInfo = $courseList = $sessionList = []; -if (!empty($firstname) && !empty($lastname)) { +$searchForm = new FormValidator('search_form', 'post', null, null); +$searchForm->addText('firstname', get_lang('Firstname')); +$searchForm->addText('lastname', get_lang('Lastname')); +$searchForm->addButtonSearch(); + +if ($searchForm->validate()) { + $firstname = $searchForm->getSubmitValue('firstname'); + $lastname = $searchForm->getSubmitValue('lastname'); + $userList = UserManager::getUserByName($firstname, $lastname); if (empty($userList)) { @@ -53,11 +58,6 @@ if (!empty($firstname) && !empty($lastname)) { } } -$searchForm = new FormValidator('search_form', 'post', null, null); -$searchForm->addText('firstname', get_lang('Firstname')); -$searchForm->addText('lastname', get_lang('Lastname')); -$searchForm->addButtonSearch(); - $template = new Template(get_lang('SearchCertificates')); $template->assign('search_form', $searchForm->returnForm());