function updateFamilyProfile(Family $familyProfile) { error_log("in updateFamilyProfile will do the actual insert to the database"); $activityType = "Edit"; //retrieves the sw, and gets id, firstname and lastname $currentUser = getUserProfileID(); $swID = ""; $swFirstName = ""; $swLastName = ""; $rmhStaffProfileId = ""; $rmhStaffFirstName = ""; $rmhStaffLastName = ""; $dateSWSubmit = 'NULL'; $dateRMHApproved = 'NULL'; // if the person doing the edit is a social worker, add their name and id to the reservation // activity record if (getUserAccessLevel() == 1) { $rmhStaffProfileId = 'NULL'; $sw = retrieve_UserProfile_SW($currentUser); $swObject = current($sw); // there is only one record in the returned array, so get it // consider changing this code $swID = $swObject->get_swProfileId(); // $swFirstName = $swObject->get_swFirstName(); // $swLastName=$swObject->get_swLastName(); $status = "Unconfirmed"; $dateSWSubmit = date("Y-m-d H:i:s"); } else { if (getUserAccessLevel() == 2) { $rmhStaff = retrieve_UserProfile_RMHApprover_OBJ($currentUser); $rmhStaffProfileId = $rmhStaff->get_rmhStaffProfileId(); // $rmhStaffFirstName = $rmhStaff->get_rmhStaffFirstName(); // $rmhStaffLastName = $rmhStaff->get_rmhStaffLastName(); $status = "Confirmed"; $dateRMHApproved = date("Y-m-d H:i:s"); } } // only if this is an RMH staff approval // insert_FamilyProfile($familyProfile); error_log('in updateFamilyProfile, familyProfileId is ' . $familyProfile->get_familyProfileId()); // only insert an activity record - will insert change into FamilyProfile table only if // approved $currentProfileActivity = new ProfileActivity(0, 0, $familyProfile->get_familyProfileId(), $swID, $rmhStaffProfileId, $dateSWSubmit, $dateRMHApproved, $activityType, $status, $familyProfile->get_parentfname(), $familyProfile->get_parentlname(), $familyProfile->get_parentemail(), $familyProfile->get_parentphone1(), $familyProfile->get_parentphone2(), $familyProfile->get_parentaddress(), $familyProfile->get_parentcity(), $familyProfile->get_parentstate(), $familyProfile->get_parentzip(), $familyProfile->get_parentcountry(), $familyProfile->get_patientfname(), $familyProfile->get_patientlname(), $familyProfile->get_patientrelation(), $familyProfile->get_patientdob(), $familyProfile->get_patientformpdf(), $familyProfile->get_patientnotes(), $familyProfile->get_patientnotes()); $retval = insert_ProfileActivity($currentProfileActivity); return $retval; }
function cancelReservation(Reservation $informationroom) { error_log("will do the actual insert to the database"); //retrieves the sw, and gets id, firstname and lastname $currentUser = getUserProfileID(); // if the person doing the edit is a social worker, add their name and id to the reservation // activity record if (getUserAccessLevel() == 1) { $sw = retrieve_UserProfile_SW($currentUser); $swObject = current($sw); // there is only one record in the returned array, so get it // consider changing this code $informationroom->set_socialWorkerProfileId($swObject->get_swProfileId()); $informationroom->set_swFirstName($swObject->get_swFirstName()); $informationroom->set_swLastName($swObject->get_swLastName()); $informationroom->set_swDateStatusSubmitted(date("Y-m-d H:i:s")); $informationroom->set_status("Unconfirmed"); } else { if (getUserAccessLevel() == 2) { $rmhStaff = retrieve_UserProfile_RMHApprover_OBJ($currentUser); $informationroom->set_rmhStaffProfileId($rmhStaff->get_rmhStaffProfileId()); $informationroom->set_rmhStaffFirstName($rmhStaff->get_rmhStaffFirstName()); $informationroom->set_rmhStaffLastName($rmhStaff->get_rmhStaffLastName()); $informationroom->set_rmhDateStatusSubmitted(date("Y-m-d H:i:s")); $informationroom->set_status("Confirmed"); } } $informationroom->set_activityType("Cancel"); // insert a new activity record with a Cancel status // because we keep track of all changes, never update // the current activity record. instead, insert a new one // with the same request id but new activity id $retval = insert_RoomReservationActivity($informationroom); return $retval; }
include_once ROOT_DIR . '/database/dbUserProfile.php'; $errors = array(); $messages = array(); $statuses = array('approve' => 'Confirm', 'deny' => 'Deny'); //Status info that is stored in the database if (isset($_POST['form_token']) && validateTokenField($_POST)) { //the security validation was successful, perform required operation here below. $requestId = sanitize($_POST['requestID']); //The request id that was submitted $requestType = sanitize($_POST['activityType']); //the activity type, whether it was a profile change, or reservation $status = sanitize($_POST['status']); //whether the status was approved or denied error_log("in activity handler, status is {$status}"); //since the activity tables uses RMH Staff profile ID, the current RMH profile needs to be retrieved. Maybe this kind of information can be stored in the SESSION? $rmhProfile = retrieve_UserProfile_RMHApprover_OBJ(getUserProfileID()); $rmhStaffProfileId = $rmhProfile->get_rmhStaffProfileId(); if ($requestType == 'profile') { //$profileActivity = retrieve_ProfileActivity_byFamilyProfileID($familyProfileID); $profileActivity = retrieve_ProfileActivity_byRequestId($requestId); $profileActivity->set_rmhStaffProfileId($rmhStaffProfileId); $profileActivity->set_rmhDateStatusSubm(date("Y-m-d H:i:s")); $profileActivity->set_profileActivityStatus($statuses[$status]); $updateProfileActivity = update_status_ProfileActivity($profileActivity); if ($updateProfileActivity) { $messages['profile_activity_updated'] = 'Profile activity status set to ' . $profileActivity->get_profileActivityStatus(); //if it is approved, it needs to be copied over to the family profile table if (array_search($profileActivity->get_profileActivityStatus(), $statuses) == 'approve') { $alterFamilyProfile = update_FamilyProfile_On_ProfileActivity($profileActivity); if ($alterFamilyProfile) { $messages['profile_updated'] = "Family Profile has been updated with the approved changes";
<input type="text" name="Admin_Email" value="<?php echo $u_email; ?> " size="25"/><?php ?> <form method="post" action="<?php adminUpdate(); ?> "><input name="Update" type="submit" value="Update" /> </form> <?php } else { $errors['invalid_profile'] = "Could not retrieve profile information"; } break; case 'RMH Staff Approver': $profileObj = retrieve_UserProfile_RMHApprover_OBJ($user_profile_id); if ($profileObj) { $u_Id = $profileObj->get_usernameId(); $u_cat = $profileObj->get_userCategory(); $staff_title = $profileObj->get_rmhStaffTitle(); $staff_fname = $profileObj->get_rmhStaffFirstName(); $staff_lname = $profileObj->get_rmhStaffLastName(); $staff_phone = $profileObj->get_rmhStaffPhone(); $u_email = $profileObj->get_userEmail(); echo 'Username: '******'<br>';
function retrieveCurrentUserProfile() { //since access level is stored in the session, use that to find the user category //1 is for social worker //2 is for staff approver //3 is for admin //if there is a db function available for this, this function is not needed $accessLevel = getUserAccessLevel(); $userProfileId = getUserProfileID(); switch ($accessLevel) { case 1: return retrieve_UserProfile_SW_OBJ($userProfileId); break; case 2: return retrieve_UserProfile_RMHApprover_OBJ($userProfileId); break; case 3: $userProfile = retrieve_UserProfile_RMHAdmin($userProfileId); return is_array($userProfile) ? current($userProfile) : false; break; default: return false; break; } }