function wap_get_my_attention($offset, $perpage, $get_sql = '') { global $db; $limit = " LIMIT {$offset},{$perpage}"; $selectstr = " a.*,r.subsite_id,r.uid as ruid,r.fullname,r.display_name,r.sex_cn,r.sex,r.education_cn,r.experience_cn,r.intention_jobs,r.district_cn,r.wage_cn,r.trade_cn,r.nature_cn,r.major_cn,r.birthdate,r.refreshtime"; $result = $db->query("SELECT {$selectstr} FROM " . table('view_resume') . " as a {$get_sql} ORDER BY a.id DESC {$limit}"); while ($row = $db->fetch_array($result)) { $row['resume_url'] = wap_url_rewrite("resume-show", array('id' => $row['resumeid']), 1, $row['subsite_id']); if ($row['display_name'] == "3") { if ($row['sex'] == 1) { $row['fullname'] = cut_str($row['fullname'], 1, 0, "先生"); } elseif ($row['sex'] == 2) { $row['fullname'] = cut_str($row['fullname'], 1, 0, "女士"); } } elseif ($row['display_name'] == "2") { $row['fullname'] = "N" . str_pad($row['resumeid'], 7, "0", STR_PAD_LEFT); } //判断是否收藏过 if (check_favorites($row['resumeid'], $_SESSION['uid'])) { $row['is_favorites'] = 1; } $y = date("Y"); $row['age'] = $y - $row['birthdate']; $row['addtime'] = date('Y-m-d', $row['addtime']); /* 获取简历标记 */ $row_state = get_resume_state($_SESSION['uid'], $row['resumeid']); $row['resume_state'] = $row_state['resume_state']; $row['resume_state_cn'] = $row_state['resume_state_cn']; $row_arr[] = $row; } return $row_arr; }
function tpl_function_qishi_jobs_show($params, &$smarty) { global $db, $timestamp, $_CFG; $arr = explode(',', $params['set']); foreach ($arr as $str) { $a = explode(':', $str); switch ($a[0]) { case "职位ID": $aset['id'] = $a[1]; break; case "列表名": $aset['listname'] = $a[1]; break; case "描述长度": $aset['brieflylen'] = $a[1]; break; case "填补字符": $aset['dot'] = $a[1]; break; } } $aset = array_map("get_smarty_request", $aset); $aset['id'] = $aset['id'] ? intval($aset['id']) : 0; $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0; $aset['listname'] = $aset['listname'] ? $aset['listname'] : "list"; $wheresql = " WHERE id={$aset['id']} "; $sql = "select id,uid,setmeal_deadline,add_mode,amount,company_id,district_cn,contents,refreshtime,tag_cn,category,subclass,sdistrict,jobs_name,companyname,wage_cn,nature_cn,category_cn,sex_cn,age,education_cn,experience_cn,graduate from " . table('jobs') . $wheresql . " LIMIT 1"; $val = $db->getone($sql); if (empty($val)) { $sql_tmp = "select id,uid,setmeal_deadline,add_mode,amount,company_id,district_cn,contents,refreshtime,tag_cn,category,subclass,sdistrict,jobs_name,companyname,wage_cn,nature_cn,category_cn,sex_cn,age,education_cn,experience_cn from " . table('jobs_tmp') . $wheresql . " LIMIT 1"; $val = $db->getone($sql_tmp); if (empty($val)) { header("HTTP/1.1 404 Not Found"); $smarty->display("404.htm"); exit; } elseif ($val['deadline'] < time()) { $val['jobs_gq'] = 1; } else { $val['jobs_gq'] = 2; } $val['contents'] = htmlspecialchars_decode($val['contents'], ENT_QUOTES); } else { if (intval($_SESSION['uid']) > 0 && intval($_SESSION['utype']) == 2) { //检查该职位是否对此会员发起面试邀请,并且此会员没看 $check_int = check_interview(intval($_SESSION['uid']), $val['id']); if ($check_int) { update_interview(intval($_SESSION['uid']), $val['id']); } //检查该职位是否被此会员收藏过 $check_fav = check_favorites(intval($_SESSION['uid']), $val['id']); if ($check_fav) { $val['check_fav'] = 1; } } if ($val['setmeal_deadline'] < time() && $val['setmeal_deadline'] != "0" && $val['add_mode'] == "2") { $val['deadline'] = $val['setmeal_deadline']; } $val['amount'] = $val['amount'] == "0" ? '若干' : $val['amount']; $val['jobs_url'] = url_rewrite('QS_jobsshow', array('id' => $val['id'])); $profile = GetJobsCompanyProfile($val['company_id']); $val['company'] = $profile; $val['contact'] = GetJobsContact($val['id']); $district_cn = $val['district_cn']; $d_arr = explode("/", $district_cn); $val['district_ch'] = $d_arr[0]; $val['sdistrict_ch'] = $d_arr[1]; $val['expire'] = sub_day($val['deadline'], time()); $val['countresume'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('personal_jobs_apply') . " WHERE jobs_id= '{$val['id']}'"); if ($aset['brieflylen'] > 0) { $val['briefly'] = cut_str(strip_tags($val['contents']), $aset['brieflylen'], 0, $aset['dot']); } else { $val['briefly'] = strip_tags($val['contents']); } $val['contents'] = htmlspecialchars_decode($val['contents'], ENT_QUOTES); $val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300"); $val['company_url'] = url_rewrite('QS_companyshow', array('id' => $val['company_id'])); if ($val['company']['logo']) { $val['company']['logo'] = $_CFG['site_dir'] . "data/logo/" . $val['company']['logo']; } else { $val['company']['logo'] = $_CFG['site_dir'] . "data/logo/no_logo.gif"; } if ($val['company']['website']) { if (strstr($val['company']['website'], "http://") === false) { $val['company']['website'] = "http://" . $val['company']['website']; } } if (intval($_SESSION['utype']) == 2) { $interest_id = get_interest_jobs_id(intval($_SESSION['uid'])); } if ($val['tag_cn']) { $tag_cn = explode(',', $val['tag_cn']); $val['tag_cn'] = $tag_cn; } else { $val['tag_cn'] = array(); } } $user = get_jobs_username($val['uid']); $hashstr = substr(md5($user['username']), 8, 16); $smarty->assign('hashstr', $hashstr); $smarty->assign($aset['listname'], $val); }
function get_view_users($offset, $perpage, $get_sql = '') { global $db, $_CFG; $limit = " LIMIT {$offset},{$perpage}"; $result = $db->query("SELECT * FROM " . table('view_jobs') . " {$get_sql} ORDER BY `id` DESC {$limit}"); while ($row = $db->fetch_array($result)) { $personal_userinfo = $db->getone("select `username` from " . table('members') . " where `uid`=" . $row['uid']); $row['username'] = $personal_userinfo['username']; $jobsname = $db->getone("select `jobs_name`,`subsite_id` from " . table('jobs') . " where `id`=" . $row['jobsid']); if (empty($jobsname)) { $jobsname = $db->getone("select `jobs_name`,`subsite_id` from " . table('jobs_tmp') . " where `id`=" . $row['jobsid']); } $row['jobs_name'] = $jobsname['jobs_name']; $row['jobs_url'] = url_rewrite("QS_jobsshow", array('id' => $row['jobsid']), 1, $jobsname['subsite_id']); $resumes = $db->getall("select * from " . table('resume') . " where `uid`=" . $row['uid'] . $wheresql); if (empty($resumes)) { continue; } //将谁看过我的职位数据的id/addtime循环简历的时候要保存一份 $did = $row['id']; $addtime = date('Y-m-d', $row['addtime']); foreach ($resumes as $key1 => $value1) { $value1['resume_url'] = url_rewrite("QS_resumeshow", array('id' => $value1['id']), 1, $value1['subsite_id']); $value1["jobs_name"] = $row['jobs_name']; $value1["jobs_url"] = $row['jobs_url']; $value1["fullname"] = $value1['fullname']; if (intval($value1['birthdate']) == 0) { $value1['age'] = ''; } else { $value1["age"] = date('Y') - $value1['birthdate']; } //判断是否收藏过 if (check_favorites($value1['id'], $_SESSION['uid'])) { $value1['is_favorites'] = 1; } /* 教育经历 培训经历 */ $value1['resume_education_list'] = get_resume_education($value1['uid'], $value1['id']); $value1['resume_work_list'] = get_resume_work($value1['uid'], $value1['id']); $row = $value1; } $row["did"] = $did; $row["addtime"] = $addtime; $row_arr[] = $row; } return $row_arr; }
function add_favorites($id, $company_uid) { global $db, $_CFG; $timestamp = time(); $setmeal = get_user_setmeal($company_uid); $count = count_favorites($company_uid); if (strpos($id, "-")) { $id = explode("-", $id); } if (!is_array($id)) { $id = array($id); } $i = 0; foreach ($id as $v) { $v = intval($v); if ($_CFG['operation_mode'] == "2" || $_CFG['operation_mode'] == "3") { if ($count >= $setmeal['talent_pool']) { return "full"; } } if (!check_favorites($v, $company_uid)) { $db->query("INSERT INTO " . table('company_favorites') . " (resume_id,company_uid,favoritesa_ddtime) VALUES ('{$v}','{$company_uid}','{$timestamp}')"); write_memberslog($_SESSION['uid'], 1, 5001, $_SESSION['username'], "将简历({$v})添加至人才库"); $i++; } } write_memberslog($_SESSION['uid'], 1, 9002, $_SESSION['username'], "添加简历至人才库", 2, 1017, "添加人才库", $i, $count - $i); return $i; }
function add_favorites($id, $company_uid) { global $db, $_CFG; $timestamp = time(); $setmeal = get_user_setmeal($company_uid); $count = count_favorites($company_uid); if (strpos($id, "-")) { $id = explode("-", $id); } if (!is_array($id)) { $id = array($id); } $i = 0; foreach ($id as $v) { $v = intval($v); if ($_CFG['operation_mode'] == "2" || $_CFG['operation_mode'] == "3") { if ($count >= $setmeal['talent_pool']) { return "full"; } } if (!check_favorites($v, $company_uid)) { $setarr['resume_id'] = $v; $setarr['company_uid'] = $company_uid; $setarr['favoritesa_ddtime'] = $timestamp; $db->inserttable(table("company_favorites"), $setarr); write_memberslog($_SESSION['uid'], 1, 5001, $_SESSION['username'], "将简历({$v})添加至人才库"); $i++; } } write_memberslog($_SESSION['uid'], 1, 9002, $_SESSION['username'], "添加简历至人才库", 2, 1017, "添加人才库", $i, $count - $i); return $i; }
function tpl_function_qishi_jobs_show($params, &$smarty) { global $db, $timestamp, $_CFG; $arr = explode(',', $params['set']); foreach ($arr as $str) { $a = explode(':', $str); switch ($a[0]) { case "职位ID": $aset['id'] = $a[1]; break; case "列表名": $aset['listname'] = $a[1]; break; case "描述长度": $aset['brieflylen'] = $a[1]; break; case "填补字符": $aset['dot'] = $a[1]; break; } } $aset = array_map("get_smarty_request", $aset); $aset['id'] = $aset['id'] ? intval($aset['id']) : 0; $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0; $aset['listname'] = $aset['listname'] ? $aset['listname'] : "list"; $smarty->assign("is_reward", get_jobs_is_reward($_SESSION["uid"], $aset['id'])); $wheresql = " WHERE id={$aset['id']} "; $sql = "select id,uid,audit,display,setmeal_deadline,add_mode,amount,company_id,district_cn,contents,refreshtime,tag_cn,category,subclass,sdistrict,jobs_name,companyname,wage_cn,nature_cn,category_cn,sex_cn,age,education_cn,experience_cn,deadline,graduate from " . table('jobs') . $wheresql . " LIMIT 1"; $val = $db->getone($sql); if (empty($val)) { $sql_tmp = "select id,uid,audit,display,setmeal_deadline,add_mode,amount,company_id,district_cn,contents,refreshtime,tag_cn,category,subclass,sdistrict,jobs_name,companyname,wage_cn,nature_cn,category_cn,sex_cn,age,education_cn,deadline,experience_cn from " . table('jobs_tmp') . $wheresql . " LIMIT 1"; $val = $db->getone($sql_tmp); } if (empty($val)) { header("HTTP/1.1 404 Not Found"); $smarty->display("404.htm"); exit; } if ($val['deadline'] < time()) { $val['jobs_gq'] = 1; } elseif ($val['audit'] != '1' || $val['display'] != '1' || $val['setmeal_deadline'] != '0' && $val['setmeal_deadline'] < time()) { $val['jobs_gq'] = 2; } setcookie('QS[view_jobs_log][' . $val['id'] . ']', $val['id'], 0, $QS_cookiepath, $QS_cookiedomain); if (intval($_SESSION['uid']) > 0 && intval($_SESSION['utype']) == 2) { //检查是否看过该职位 $check = check_view_log(intval($_SESSION['uid']), $val['id']); if (!$check) { add_view_log(intval($_SESSION['uid']), $val['id']); } //检查该职位是否对此会员发起面试邀请,并且此会员没看 $check_int = check_interview(intval($_SESSION['uid']), $val['id']); if ($check_int) { update_interview(intval($_SESSION['uid']), $val['id']); } //检查该职位是否被此会员收藏过 $check_fav = check_favorites(intval($_SESSION['uid']), $val['id']); if ($check_fav) { $val['check_fav'] = 1; } } if ($val['setmeal_deadline'] < time() && $val['setmeal_deadline'] != "0" && $val['add_mode'] == "2") { $val['deadline'] = $val['setmeal_deadline']; } $val['amount'] = $val['amount'] == "0" ? '若干' : $val['amount']; $val['jobs_url'] = url_rewrite('QS_jobsshow', array('id' => $val['id'])); $profile = GetJobsCompanyProfile($val['company_id']); $val['company'] = $profile; $val['contact'] = GetJobsContact($val['id']); $district_cn = $val['district_cn']; $d_arr = explode("/", $district_cn); $val['district_ch'] = $d_arr[0]; $val['sdistrict_ch'] = $d_arr[1]; $val['expire'] = sub_day($val['deadline'], time()); $val['countresume'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('personal_jobs_apply') . " WHERE jobs_id= '{$val['id']}'"); if ($aset['brieflylen'] > 0) { $val['briefly'] = cut_str(strip_tags($val['contents']), $aset['brieflylen'], 0, $aset['dot']); } else { $val['briefly'] = strip_tags($val['contents']); } $val['contents'] = htmlspecialchars_decode($val['contents'], ENT_QUOTES); $val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300"); $val['company_url'] = url_rewrite('QS_companyshow', array('id' => $val['company_id'])); if ($val['company']['logo']) { $val['company']['logo'] = $_CFG['site_dir'] . "data/logo/" . $val['company']['logo']; } else { $val['company']['logo'] = $_CFG['site_dir'] . "data/logo/no_logo.gif"; } if ($val['company']['website']) { if (strstr($val['company']['website'], "http://") === false) { $val['company']['website'] = "http://" . $val['company']['website']; } } if (intval($_SESSION['utype']) == 2) { $view_log = get_view_log(intval($_SESSION['uid'])); foreach ($view_log as $key => $value) { $jobs_info = $db->getone("select id,company_id,jobs_name,companyname from " . table('jobs') . " where id=" . $value['jobsid']); $val['view_log'][$key]['jobsid'] = $jobs_info['id']; $val['view_log'][$key]['jobs_name'] = $jobs_info['jobs_name']; $val['view_log'][$key]['jobs_url'] = url_rewrite('QS_jobsshow', array('id' => $jobs_info['id'])); $val['view_log'][$key]['companyname'] = $jobs_info['companyname']; } $interest_id = get_interest_jobs_id(intval($_SESSION['uid'])); } if ($val['tag_cn']) { $tag_cn = explode(',', $val['tag_cn']); $val['tag_cn'] = $tag_cn; } else { $val['tag_cn'] = array(); } /* 薪酬统计 如果职位有三级分类 则根据职位的 subclass 如果职位没有有三级分类 则根据职位的 category */ if ($val['subclass']) { $salary_data = $db->getall("select c.c_name from " . table('jobs_search_wage') . " as j left join " . table('category') . " as c on c.c_id=j.wage where j.subclass=" . $val['subclass'] . " and j.sdistrict=" . $val['sdistrict']); } else { $salary_data = $db->getall("select c.c_name from " . table('jobs_search_wage') . " as j left join " . table('category') . " as c on c.c_id=j.wage where j.category=" . $val['category'] . " and j.sdistrict=" . $val['sdistrict']); } if ($salary_data) { $total = 0; $total_salary = 0; foreach ($salary_data as $key => $value) { $total_salary += intval($value['c_name']) + 500; $total++; } $val['salary']['value'] = intval($total_salary / $total); $val['salary']['px'] = $val['salary']['value'] / 12000 * 446 . "px"; } /* 薪酬统计 */ $user = get_jobs_username($val['uid']); $hashstr = substr(md5($user['username']), 8, 16); $smarty->assign('hashstr', $hashstr); $smarty->assign("is_reward", get_jobs_is_reward($aset['id'])); $smarty->assign($aset['listname'], $val); }