} $candidate = array(); $candidate['joined_on'] = $joined_on; $candidate['updated_on'] = $joined_on; $candidate['added_by'] = $employee->getId(); $candidate['email_addr'] = $row[0]; $candidate['firstname'] = $row[1]; $candidate['lastname'] = $row[2]; $candidate['phone_num'] = $row[3]; $candidate['citizenship'] = strtoupper($row[4]); $candidate['total_work_years'] = sql_nullify($row[5]); $candidate['position_title'] = sql_nullify($row[6]); $candidate['work_from'] = sql_nullify($row[7]); $candidate['work_to'] = sql_nullify($row[8]); $candidate['employer'] = sql_nullify($row[9]); $candidate['employer_specialization'] = sql_nullify($row[10]); $candidates[] = $candidate; } } fclose($handle); @unlink("/tmp/" . basename($_FILES['members_csv_file']['tmp_name'])); } else { redirect_to('members.php?page=members&error=c1'); exit; } // 2. add candidates by creating passwords and send out email $failed_members = array(); $members = array(); foreach ($candidates as $candidate) { $member = new Member($candidate['email_addr']); $data = array();
$data = array(); $data['is_active_seeking_job'] = $_POST['is_seeking'] == '1'; $data['can_travel_relocate'] = $_POST['can_travel']; $data['seeking'] = $_POST['seeking']; $data['reason_for_leaving'] = $_POST['reason_leaving']; // $data['current_position'] = $_POST['current_position']; $data['notice_period'] = $_POST['notice_period']; $data['total_work_years'] = $_POST['total_years']; $data['expected_salary_currency'] = $_POST['expected_currency']; $data['expected_salary'] = $_POST['expected_salary']; $data['expected_total_annual_package'] = $_POST['expected_total_annual_package']; $data['current_salary_currency'] = $_POST['current_currency']; $data['current_salary'] = $_POST['current_salary']; $data['current_total_annual_package'] = $_POST['current_total_annual_package']; $data['preferred_job_location_1'] = sql_nullify($_POST['pref_job_loc_1']); $data['preferred_job_location_2'] = sql_nullify($_POST['pref_job_loc_2']); $data['updated_on'] = date('Y-m-d'); $member = new Member($_POST['id']); if ($member->update($data) === false) { echo 'ko'; exit; } echo 'ok'; exit; } if ($_POST['action'] == 'save_job_profile') { $data = array(); // $data['specialization'] = $_POST['specialization']; $data['position_title'] = $_POST['position_title']; $data['position_superior_title'] = $_POST['superior_title']; $data['organization_size'] = $_POST['organization_size'];
break; case 'employer_industry': // match to YE industry $query = "SELECT industries.id \n FROM industries \n LEFT JOIN linkedin_industry_map ON industries.industry = linkedin_industry_map.ye_industry\n WHERE linkedin_industry_map.linkedin_industry = '" . $child->nodeValue . "' \n LIMIT 1"; $industry_results = $mysqli->query($query); if (is_null($industry_results) || empty($industry_results)) { $data['employer_specialization'] = 'NULL'; } else { $data['employer_specialization'] = $industry_results[0]['id']; } break; case 'summary': $data['summary'] = sql_nullify($child->nodeValue); break; case 'work_from': $data['work_from'] = sql_nullify($child->nodeValue); break; case 'work_to': $data['work_to'] = sql_nullify($child->nodeValue); break; } } // print_r($data); if ($member->addJobProfile($data) === false) { echo 'ko'; exit; } } echo 'ok'; exit; }