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 * from " . table('jobs') . $wheresql . " LIMIT 1";
    $val = $db->getone($sql);
    if (empty($val)) {
        $sql_tmp = "select * from " . table('jobs_tmp') . $wheresql . " LIMIT 1";
        $val_tmp = $db->getone($sql_tmp);
        if ((intval($_SESSION['admin_id']) > 0 || intval($_SESSION['uid']) == $val_tmp['uid']) && !empty($val_tmp)) {
            $val = $val_tmp;
        }
    }
    if (empty($val)) {
        header("HTTP/1.1 404 Not Found");
        $smarty->display("404.htm");
        exit;
    } 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']);
            }
        }
        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']), false);
        $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());
        $wheresql = " WHERE company_uid='{$row['uid']}' AND jobs_id= '{$row['id']}'";
        $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, $val['dot']);
        } else {
            $val['briefly'] = strip_tags($val['contents']);
        }
        $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['main_domain'] . "data/logo/" . $val['company']['logo'];
        } else {
            $val['company']['logo'] = $_CFG['main_domain'] . "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']) {
            $tag = explode('|', $val['tag']);
            $taglist = array();
            if (!empty($tag) && is_array($tag)) {
                foreach ($tag as $t) {
                    $tli = explode(',', $t);
                    $taglist[] = array($tli[0], $tli[1]);
                }
            }
            $val['tag'] = $taglist;
        } else {
            $val['tag'] = array();
        }
    }
    $smarty->assign($aset['listname'], $val);
}
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);
}
Example #3
0
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);
}