User FormValidator validate method - refs #7363

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 3ceb77a84a
commit 33e9b601c0
  1. 18
      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; $userId = isset($_GET['id']) ? intval($_GET['id']) : 0;
$userList = $userInfo = $courseList = $sessionList = []; $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); $userList = UserManager::getUserByName($firstname, $lastname);
if (empty($userList)) { 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 = new Template(get_lang('SearchCertificates'));
$template->assign('search_form', $searchForm->returnForm()); $template->assign('search_form', $searchForm->returnForm());

Loading…
Cancel
Save