"; }else { } } } // Create an array to track employees by their email addresses $uniqueEmployees = []; // Iterate through the merged data and eliminate duplicates $filteredData = []; foreach ($merged_data as $employee) { $email = strtolower(trim($employee['email'])); // Check if this email has already been added to $uniqueEmployees if (!isset($uniqueEmployees[$email])) { // Update department names based on $customDepartmentNames $departments = array_map('trim', explode(',', $employee["department"])); // Split department names by comma and trim spaces foreach ($departments as &$department) { // Check if the department name needs updating if ($department === "Emergency Medicine" || $department === "Surgery" || $department === "Medicine" || $department === "Women's and Children's Health" || $department === "Biomedical Science" || $department === "Population Health & Social Medicine" || $department === "Clinical Neurosciences") { $department = "Department of " . $department; } } $employee["department"] = implode(', ', $departments); // Add the employee to the filtered data $filteredData[] = $employee; // Mark this email as added to avoid duplicates $uniqueEmployees[$email] = true; } } // Define custom department names $customDepartmentNames = [ "Emergency Medicine" => "Department of Emergency Medicine", "Surgery" => "Department of Surgery", "Medicine" => "Department of Medicine", "Women's and Children's Health" => "Department of Women's and Children's Health", "Biomedical Science" => "Department of Biomedical Science", "Population Health & Social Medicine" => "Department of Population Health & Social Medicine", "Clinical Neurosciences" => "Department of Clinical Neurosciences", ]; // Extract and organize unique department names $uniqueDepartments = []; foreach ($filteredData as $f) { $departments = array_map('trim', explode(',', $f["department"])); // Split department names by comma and trim spaces // Update department names based on $customDepartmentNames $departments = array_map(function ($department) use ($customDepartmentNames) { return isset($customDepartmentNames[$department]) ? $customDepartmentNames[$department] : $department; }, $departments); foreach ($departments as $department) { if (!in_array($department, $uniqueDepartments)) { $uniqueDepartments[] = $department; } } } // Extract "Office of the Dean" from $uniqueDepartments $officeOfTheDean = array_filter($uniqueDepartments, function ($department) { return $department === "Office of the Dean"; }); // Remove "Office of the Dean" from $uniqueDepartments $uniqueDepartments = array_filter($uniqueDepartments, function ($department) { return $department !== "Office of the Dean"; }); // Sort the remaining department names sort($uniqueDepartments); // Merge "Office of the Dean" back to the sorted list array_unshift($uniqueDepartments, reset($officeOfTheDean)); // Generate the select menu echo '
| Name | Title | Phone | ||
|---|---|---|---|---|
| '; if(isset($f["url"]) && !empty($f["url"]) && strpos($f["url"], 'https://www.fau.edu') !== false) { echo ''; }elseif (isset($f["url"]) && !empty($f["url"]) && strpos($f["url"], 'https://www.fau.edu') !== true) { echo ''; }else { } echo $name; echo CollegeDirectory_customCreds($f); if(isset($f["url"]) && !empty($f["url"]) && strpos($f["url"], 'https://www.fau.edu') !== false) { echo ' '; }elseif (isset($f["url"]) && !empty($f["url"]) && strpos($f["url"], 'https://www.fau.edu') !== true) { echo ' '; }else { } echo ' | '; echo ''. CollegeDirectory_customTitle($f) .' | '; echo ''; $phone = CollegeDirectory_customPhone($f); // Only display allowed phone numbers if(strpos($phone, "561-737") === 0 || strpos($phone, "561-799") === 0 || strpos($phone, "561-297") === 0 || strpos($phone, "561-566") === 0 || strpos($phone, "561-955") === 0 || strpos($phone, "561-733") === 0) {echo $phone;} echo ' | '; //echo ''. CollegeDirectory_customPhone($f) .' | '; echo ''; if(isset($f["email"]) && !empty($f["email"])) { echo ' '. CollegeDirectory_customEmail($f) .''; } echo ' | '; echo '