function test_retrieve_dbFamilyProfileByName($fname, $lname) { $families = retrieve_FamilyProfileByName($fname, $lname); if ($families == false) { echo "</br>" . "No families were found"; } else { echo "</br>" . "found records" . "</br>"; foreach ($families as $family) { display_family($family); } } }
$title = "Create a Reservation"; $helpPage = "SearchingFamilyProfile.php"; include '../header.php'; include ROOT_DIR . '/domain/Family.php'; include ROOT_DIR . '/database/dbFamilyProfile.php'; if (isset($_POST['form_token']) && validateTokenField($_POST) && (isset($_POST['firstName']) || isset($_POST['lastName']))) { $fn = isset($_POST['firstName']) ? sanitize($_POST['firstName']) : ""; //if firstName isset, sanitize it, else empty string if ($fn == "First Name") { $fn = ""; } $ln = isset($_POST['lastName']) ? sanitize($_POST['lastName']) : ""; if ($ln == "Last Name") { $ln = ""; } $families = retrieve_FamilyProfileByName($fn, $ln); //calls db receives an array of family objs if ($families) { echo ""; } else { echo "<div style='margin-left:260px; margin-top:30px;'><font color='red'><b>ERROR: Family not found, however, you may <a href='./newProfile.php'>create one.</a></b></font></div>"; } //DON'T DIE!! Messes up the layout!! if (is_array($families)) { //TODO: start table with tags $table = "\n<table cellpadding='20' style=\"margin-left:250px;\">\n<thead>\n<tr>\n"; $table .= "<th>Patient Name</th><th>Parent Name</th><th>Parent City</th><th>Patient Date Of Birth</th><th>Patient Notes</th>\n</tr></thead>"; $numFamilies = 1; //create an array, foreach ($families as $family) { $nextScript = BASE_DIR . "/referralForm.php?id=" . $family->get_familyProfileId();
$patientNote = ""; // this field is optional } if (isset($_POST['swNote']) && $_POST['swNote'] != "") { $profileActityNotes = $_POST['swNote']; } else { $profileActityNotes = ""; // this field is optional } // there were no input errors in the form, so proceed with database inserts if (empty($message)) { // the family profile id is 0, but a real one will be generated while doing the insert $temporaryFamilyProfile = new Family(0, "Pending", $parentFirstName, $parentLastName, $parentEmail, $phone1, $phone2, $address, $city, $state, $zip, $country, $patientFirstName, $patientLastName, $patientRelation, date($patientDateOfBirth), $patientFormPDF, $patientNote); if (insert_FamilyProfile($temporaryFamilyProfile)) { //Get generated familyProfileID from the familyProfile object. $results = retrieve_FamilyProfileByName($temporaryFamilyProfile->get_parentfname(), $temporaryFamilyProfile->get_parentlname()); } $resultsFamily = $results[0]; $temporaryFamilyProfileID = $resultsFamily->get_familyProfileId(); //create profile activity object $current_activity = new ProfileActivity(0, 0, $temporaryFamilyProfileID, $sw_id, 'NULL', $dateSubmit, 'NULL', $activityType, $profileActitivityStatus, $parentFirstName, $parentLastName, $parentEmail, $phone1, $phone2, $address, $city, $state, $zip, $country, $patientFirstName, $patientLastName, $patientRelation, $patientDateOfBirth, $patientFormPDF, $patientNote, $profileActityNotes); // check if insert function returns true, then insert profileactivity if (insert_ProfileActivity($current_activity)) { $taskFinished = TRUE; // //if profileActivity is inserted, send the email to rmh approver // $profileID = $current_activity->get_profileActivityId(); // NewFamilyProfile($profileID); } } } else { if (isset($_POST['form_token']) && !validateTokenField($_POST)) {