} } } ?> <section class="content"> <?php ErrorHandler::displayErrors(); ?> <div> <div class="notice">Note: Password is automatically set as the combination of user's first name and last four digits of their phone number, all lowercase.</div> <?php //error could be set elsewhere in the code, so we need retrieve it after the checks, if any //in this case, we are checking for the usernam, if it is already in the database $dataErrors = isset($validator) ? $validator->getErrors() : array(); $form = new FormHelper($data, $dataErrors); //id is important, they should be unique $form->create(array('class' => array('generic', 'addForm'), 'name' => 'addNewUserForm', 'method' => 'post', 'action' => BASE_DIR . '/admin/addUser.php')); $form->input(array('class' => 'formRow', 'input' => array('type' => 'select', 'selected' => $userType, 'id' => 'userGroup', 'options' => array('admin' => 'Administrator', 'rmhstaff' => 'RMH Staff Approver', 'socialworker' => 'Social Worker')), 'label' => array('value' => 'User Category'))); $form->input(array('class' => 'formRow', 'input' => array('id' => 'title'), 'label' => array('value' => 'Title'))); $form->input(array('input' => array('id' => 'fname'), 'label' => array('value' => 'First Name'))); $form->input(array('input' => array('id' => 'lname'), 'label' => array('value' => 'Last Name'))); $form->input(array('input' => array('id' => 'phone', 'type' => 'tel'), 'label' => array('value' => 'Phone'))); $form->input(array('input' => array('id' => 'username'), 'label' => array('value' => 'Username'))); $form->input(array('class' => 'formRow', 'input' => array('id' => 'email', 'type' => 'email'), 'label' => array('value' => 'Email'))); if (isset($userType) && $userType == 'socialworker') { $form->input(array('input' => array('id' => 'hospital'), 'label' => array('value' => 'Hospital Affiliation'))); $form->input(array('input' => array('id' => 'notify', 'selected' => 'yes', 'type' => 'radio', 'options' => array('yes' => 'Yes', 'no' => 'No')), 'label' => array('value' => 'Email Notification'))); } $form->button();