function tpl_function_qishi_curriculum_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,subsite_id,uid,setmeal_deadline,add_mode,train_id,contents,refreshtime,teacher_id,teacher_cn,trainname,course_name,addtime,click,favour_expenses,train_expenses,classhour,category_cn,starttime,classtype_cn,district_cn,train_object,train_certificate from " . table('course') . $wheresql . " LIMIT 1";
    $val = $db->getone($sql);
    if (empty($val)) {
        header("HTTP/1.1 404 Not Found");
        $smarty->display("404.htm");
        exit;
    } else {
        check_url($val['subsite_id'], $smarty, $_CFG['train_url']);
        if ($val['setmeal_deadline'] < time() && $val['setmeal_deadline'] != "0" && $val['add_mode'] == "2") {
            $val['deadline'] = $val['setmeal_deadline'];
        }
        $val['course_url'] = url_rewrite('QS_courseshow', array('id' => $val['id']), 1, $val['subsite_id']);
        $profile = GetTainProfile($val['train_id']);
        $val['train'] = $profile;
        $val['expire'] = sub_day($val['deadline'], time());
        $val['countapply'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('personal_course_apply') . " WHERE course_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['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
        $val['train_url'] = url_rewrite('QS_train_agencyshow', array('id' => $val['train_id']));
        $val['teacher_url'] = url_rewrite('QS_train_lecturershow', array('id' => $val['teacher_id']));
        if ($val['train']['logo']) {
            $val['train']['logo'] = $_CFG['site_dir'] . "data/train_logo/" . $val['train']['logo'];
        } else {
            $val['train']['logo'] = $_CFG['site_dir'] . "data/train_logo/no_logo.gif";
        }
    }
    $smarty->assign($aset['listname'], $val);
}
function tpl_function_qishi_train_lecturer_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,train_id,contents,birthdate,refreshtime,photo,photo_img,teachername,education_cn,graduated_school,speciality,work_unit,positionaltitles,district_cn,achievements from " . table('train_teachers') . $wheresql . " LIMIT 1";
    $val = $db->getone($sql);
    if (empty($val)) {
        header("HTTP/1.1 404 Not Found");
        $smarty->display("404.htm");
        exit;
    } else {
        $profile = GetTainProfile($val['train_id']);
        $val['train'] = $profile;
        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['age'] = date('Y') + 1 - $val['birthdate'];
        $val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
        $val['train_url'] = url_rewrite('QS_train_agencyshow', array('id' => $val['train_id']));
        $val['teacher_url'] = url_rewrite('QS_train_lecturer', array('id' => $val['id']));
        if ($val['photo'] == "1") {
            $val['photosrc'] = $_CFG['teacher_photo_dir'] . $val['photo_img'];
        } else {
            $val['photosrc'] = $_CFG['teacher_photo_dir'] . "no_photo.gif";
        }
    }
    $smarty->assign($aset['listname'], $val);
}
Esempio n. 3
0
function tpl_function_qishi_resume_show($params, &$smarty)
{
    global $db, $_CFG, $QS_cookiepath, $QS_cookiedomain;
    $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;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
    $aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
    $wheresql = " WHERE  id=" . $aset['id'] . "";
    $val = $db->getone("select id,uid,display,display_name,fullname,sex,sex_cn,major_cn,birthdate,photo,photo_img,photo_display,tag_cn,refreshtime,height,marriage_cn,education_cn,experience_cn,householdaddress,residence,talent,wage_cn,nature_cn,district_cn,trade_cn,intention_jobs,current_cn,specialty,title,telephone,email,addtime,resume_from_pc from " . table('resume') . $wheresql . " LIMIT  1");
    if (intval($_SESSION['utype']) == 1) {
        $company_profile = $db->getone("select companyname from " . table('company_profile') . " where uid=" . intval($_SESSION['uid']));
    }
    if ($val) {
        setcookie('QS[view_resume_log][' . $val['id'] . ']', $val['id'], 0, $QS_cookiepath, $QS_cookiedomain);
        if (intval($_SESSION['uid']) > 0 && intval($_SESSION['utype']) == 1) {
            //检查企业是否被个人屏蔽过
            $company_profile = $db->getone("select companyname from " . table('company_profile') . " where uid=" . intval($_SESSION['uid']));
            $shield_company = $db->getall("select comkeyword from " . table('personal_shield_company') . " where pid=" . $val['id'] . " and uid=" . $val['uid']);
            foreach ($shield_company as $key => $value) {
                if (!empty($value['comkeyword']) && stristr($company_profile['companyname'], $value['comkeyword'])) {
                    header("HTTP/1.1 404 Not Found");
                    $smarty->display("404.htm");
                    exit;
                }
            }
            //检查是否查看过
            $check = check_view_log(intval($_SESSION['uid']), $val['id']);
            if (!$check) {
                add_view_log(intval($_SESSION['uid']), $val['id']);
                $sql = "select did from " . table("personal_jobs_apply") . " where resume_id={$val['id']} and company_uid=" . intval($_SESSION['uid']) . " ";
                if ($db->getone($sql)) {
                    $db->query("update " . table("personal_jobs_apply") . " set personal_look=2 where  resume_id={$val['id']} and company_uid=" . intval($_SESSION['uid']) . "");
                }
            } else {
                $db->query("update " . table("personal_jobs_apply") . " set personal_look=2 where  resume_id={$val['id']} and company_uid=" . intval($_SESSION['uid']) . "");
            }
            // 简历处理率
            $resume_applyed = $db->getone("select count(*) num from " . table("personal_jobs_apply") . " where  company_uid=" . intval($_SESSION['uid']) . " and resume_id={$val['id']} ");
            if (!empty($resume_applyed)) {
                $apply_see = $db->getone("select count(*) num from " . table("personal_jobs_apply") . " where  company_uid=" . intval($_SESSION['uid']) . " and  personal_look=2 ");
                $apply_all = $db->getone("select count(*) num from " . table("personal_jobs_apply") . " where  company_uid=" . intval($_SESSION['uid']) . " ");
                $company_info['resume_processing'] = $apply_see['num'] / $apply_all['num'] * 100;
                $db->updatetable(table("company_profile"), $company_info, array("uid" => $_SESSION['uid']));
            }
            //查看是否已经下载过简历
            $download = $db->getone("select did from " . table("company_down_resume") . " where resume_id={$val['id']} and company_uid=" . intval($_SESSION['uid']) . " ");
            if ($download) {
                if ($val['display_name'] == "2") {
                    $val['fullname'] = "N" . str_pad($val['id'], 7, "0", STR_PAD_LEFT);
                    $val['fullname_'] = $val['fullname'];
                } elseif ($val['display_name'] == "3") {
                    if ($val['sex'] == 1) {
                        $val['fullname'] = cut_str($val['fullname'], 1, 0, "先生");
                    } elseif ($val['sex'] == 2) {
                        $val['fullname'] = cut_str($val['fullname'], 1, 0, "女士");
                    }
                } else {
                    $val['fullname_'] = $val['fullname'];
                    $val['fullname'] = $val['fullname'];
                }
            }
            //提示信息
            $mes_apply = $db->getone("select jobs_name,apply_addtime from " . table('personal_jobs_apply') . " where `resume_id`=" . $val['id'] . " and  `company_uid`=" . intval($_SESSION['uid']) . " limit 1 ");
            if ($mes_apply) {
                $val['message'] = "应聘职位:" . $mes_apply['jobs_name'] . " 投递时间:" . date('Y-m-d', $mes_apply['apply_addtime']);
            } else {
                $val['message'] = "";
            }
        } else {
            if ($val['display_name'] == "2") {
                $val['fullname'] = "N" . str_pad($val['id'], 7, "0", STR_PAD_LEFT);
                $val['fullname_'] = $val['fullname'];
            } elseif ($val['display_name'] == "3") {
                if ($val['sex'] == 1) {
                    $val['fullname'] = cut_str($val['fullname'], 1, 0, "先生");
                } elseif ($val['sex'] == 2) {
                    $val['fullname'] = cut_str($val['fullname'], 1, 0, "女士");
                }
            } else {
                $val['fullname_'] = $val['fullname'];
                $val['fullname'] = $val['fullname'];
            }
        }
        $val['education_list'] = get_this_education($val['uid'], $val['id']);
        $val['work_list'] = get_this_work($val['uid'], $val['id']);
        $val['training_list'] = get_this_training($val['uid'], $val['id']);
        $val['language_list'] = get_this_language($val['uid'], $val['id']);
        $val['credent_list'] = get_this_credent($val['uid'], $val['id']);
        $val['img_list'] = get_this_img($val['uid'], $val['id']);
        $val['age'] = date("Y") - $val['birthdate'];
        if ($val['photo'] == "1") {
            $download = $db->getone("select did from " . table("company_down_resume") . " where resume_id={$val['id']} and company_uid=" . intval($_SESSION['uid']) . " ");
            if (empty($download)) {
                if ($val['photo_display'] == "1") {
                    $val['photosrc'] = $_CFG['resume_photo_dir'] . $val['photo_img'];
                } else {
                    $val['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo_display.gif";
                }
            } else {
                $val['photosrc'] = $_CFG['resume_photo_dir'] . $val['photo_img'];
            }
        } else {
            $val['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo.gif";
        }
        if ($val['tag_cn']) {
            $tag_cn = explode(',', $val['tag_cn']);
            $val['tag_cn'] = $tag_cn;
        } else {
            $val['tag_cn'] = array();
        }
        $apply = $db->getone("select * from " . table('personal_jobs_apply') . " where `resume_id`=" . $val['id']);
        $val['jobs_name'] = $apply['jobs_name'];
        $val['apply_addtime'] = $apply['apply_addtime'];
        $val['jobs_url'] = url_rewrite('QS_jobsshow', array('id' => $apply['jobs_id']));
        if ($val['jobs_name']) {
            $val['apply'] = 1;
        } else {
            $val['apply'] = 0;
        }
        /* 简历活跃度  更新时间 主动申请职位数  浏览职位数 */
        $vitality = 0;
        $val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
        $timestr = time() - $val['refreshtime'];
        $day = intval($timestr / 86400);
        if ($day < 3) {
            $vitality += 2;
        } else {
            $vitality += 1;
        }
        $time = time() - 15 * 86400;
        $val['apply_jobs'] = $db->get_total("select count(*) num from " . table("personal_jobs_apply") . " where resume_id={$val['id']} and apply_addtime>{$time} and is_apply=1 ");
        if ($val['apply_jobs'] > 0 && $val['apply_jobs'] < 10) {
            $vitality += 1;
        } elseif ($val['apply_jobs'] >= 10) {
            $vitality += 2;
        }
        $val['view_jobs'] = $db->get_total("select count(*) num from " . table("view_jobs") . " where uid={$val['uid']} and addtime>{$time} ");
        if ($val['view_jobs'] >= 10) {
            $vitality += 1;
        }
        $val['vitality'] = $vitality;
        /*企业关注度 start */
        $attention = 0;
        $val['com_down'] = $db->get_total("select count(*) num from " . table("company_down_resume") . " where resume_id={$val['id']} and down_addtime>{$time} ");
        if ($val['com_down'] >= 0 && $val['com_down'] < 10) {
            $attention += 1;
        } elseif ($val['com_down'] >= 10) {
            $attention += 2;
        }
        $val['com_invite'] = $db->get_total("select count(*) num from " . table("company_interview") . " where resume_id={$val['id']} and interview_addtime>{$time} ");
        if ($val['com_invite'] > 0 && $val['com_invite'] < 10) {
            $attention += 1;
        } elseif ($val['com_invite'] >= 10) {
            $attention += 2;
        }
        $val['com_view'] = $db->get_total("select count(*) num from " . table("view_resume") . " where resumeid={$val['id']} and addtime>{$time} ");
        if ($val['com_view'] >= 10) {
            $attention += 1;
        }
        $val['attention'] = $attention;
        /*企业关注度 end */
        //判断手机、微信、邮箱是否验证
        $is_audit_phone = $db->getone("SELECT mobile_audit,email_audit,weixin_openid FROM " . table('members') . " WHERE uid={$val['uid']}  LIMIT 1 ");
        $val['is_audit_mobile'] = $is_audit_phone['mobile_audit'];
        $val['is_audit_email'] = $is_audit_phone['email_audit'];
        $val['is_audit_weixin'] = $is_audit_phone['weixin_openid'];
        //个人自己预览
        if ($_SESSION['utype'] == '2' && $_SESSION['uid'] == $val['uid']) {
            $val['isminesee'] = '1';
        }
    } else {
        header("HTTP/1.1 404 Not Found");
        $smarty->display("404.htm");
        exit;
    }
    $smarty->assign($aset['listname'], $val);
}
function tpl_function_qishi_companyjobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "显示职位":
                $aset['jobsrow'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "紧急招聘":
                $aset['emergency'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "职位分类":
                $aset['jobscategory'] = $a[1];
                break;
            case "统计职位":
                $aset['countjobs'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = isset($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['jobsrow'] = isset($aset['jobsrow']) ? intval($aset['jobsrow']) : 3;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 16;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : null;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_jobsshow';
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_rtime');
        } elseif ($arr[0] == "stickrtime") {
            $orderbysql = " ORDER BY stick {$arr[1]} , refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_stickrtime');
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
            $jobstable = table('jobs_search_hot');
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]},refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_scale');
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY wage {$arr[1]},refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_wage');
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_rtime');
        }
    } else {
        $orderbysql = " ORDER BY refreshtime desc ";
        $jobstable = table('jobs_search_rtime');
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['recommend'])) {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['emergency'])) {
        $wheresql .= " AND emergency=" . intval($aset['emergency']);
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['trade'])) {
        $wheresql .= " AND trade=" . intval($aset['trade']);
    }
    if (isset($aset['district']) && $aset['district'] != '') {
        if (strpos($aset['district'], "-")) {
            $or = $orsql = "";
            $arr = explode("-", $aset['district']);
            foreach ($arr as $sid) {
                $orsql .= $or . " district=" . intval($sid);
                $or = " OR ";
            }
            $wheresql .= " AND  (" . $orsql . ") ";
        } else {
            $wheresql .= " AND district=" . intval($aset['district']) . " ";
        }
    }
    //楼层 职位
    if (isset($aset['jobscategory']) && $aset['jobscategory'] != '') {
        $jobscategory = trim($aset['jobscategory']);
        $jobscategory = str_replace("_", ",", $jobscategory);
        $wheresql .= " AND category in (" . $jobscategory . ") ";
    }
    $limit = " LIMIT {$aset['start']},{$aset['row']}";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    $uidlimit = " LIMIT {$aset['start']}," . $aset['row'] * 15;
    $sql1 = "SELECT id,uid FROM " . $jobstable . $wheresql . $orderbysql . $uidlimit;
    //echo $sql1;
    $result1 = $db->query($sql1);
    $uidarr = array();
    while ($row = $db->fetch_array($result1)) {
        if (count($uidarr) >= $aset['row']) {
            break;
        }
        $uidarr[$row['uid']] = $row['uid'];
    }
    if (!empty($uidarr)) {
        $uidarr = implode(",", $uidarr);
        $wheresql = $wheresql ? $wheresql . " AND uid IN ({$uidarr}) " : " WHERE uid IN ({$uidarr}) ";
        $sql2 = "SELECT subsite_id,company_id,companyname,nature_cn,wage_cn,amount,sex_cn,district_cn,education_cn,experience_cn,contents,company_addtime,refreshtime,id,jobs_name,addtime,uid,click,highlight,highlight,setmeal_id,setmeal_name FROM " . table('jobs') . $wheresql . $orderbysql;
        //echo $sql2;
        $result2 = $db->query($sql2);
        $countuid = array();
        while ($row = $db->fetch_array($result2)) {
            $countuid[$row['uid']][] = $row['uid'];
            if (count($countuid[$row['uid']]) > $aset['jobsrow']) {
                continue;
            }
            $companyarray[$row['uid']]['companyname_'] = $row['companyname'];
            $companyarray[$row['uid']]['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
            $companyarray[$row['uid']]['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
            $companyarray[$row['uid']]['company_addtime'] = $row['company_addtime'];
            $companyarray[$row['uid']]['company_id'] = $row['company_id'];
            $companyarray[$row['uid']]['nature_cn'] = $row['nature_cn'];
            $companyarray[$row['uid']]['wage_cn'] = $row['wage_cn'];
            $companyarray[$row['uid']]['sex_cn'] = $row['sex_cn'];
            $companyarray[$row['uid']]['amount'] = $row['amount'];
            $companyarray[$row['uid']]['district_cn'] = $row['district_cn'];
            $companyarray[$row['uid']]['education_cn'] = $row['education_cn'];
            $companyarray[$row['uid']]['experience_cn'] = $row['experience_cn'];
            $companyarray[$row['uid']]['briefly'] = strip_tags($row['contents']);
            $companyarray[$row['uid']]['refreshtime'] = $companyarray[$row['uid']]['refreshtime'] > $row['refreshtime'] ? $companyarray[$row['uid']]['refreshtime'] : $row['refreshtime'];
            $companyarray[$row['uid']]['refreshtime_cn'] = daterange(time(), $companyarray[$row['uid']]['refreshtime'], 'm-d', "#FF3300");
            $companyarray[$row['uid']]['setmeal_id'] = $row['setmeal_id'];
            $companyarray[$row['uid']]['setmeal_name'] = $row['setmeal_name'];
            $companyarray[$row['uid']]['uid'] = $row['uid'];
            $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_addtime'] = $row['addtime'];
            $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_refreshtime'] = $row['refreshtime'];
            $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_click'] = $row['click'];
            $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
            if (!empty($row['highlight'])) {
                $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_name'] = "<span style=\"color:{$row['highlight']}\">{$companyarray[$row['uid']]['jobs'][$row['id']]['jobs_name']}</span>";
            }
            $companyarray[$row['uid']]['jobs'][$row['id']]['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id']), 1, $row['subsite_id']);
            $companyarray[$row['uid']]['jobs'][$row['id']]['id'] = $row['id'];
            if (intval($aset['countjobs']) == 1) {
                if (intval($_CFG['subsite_id']) > 0) {
                    $count_wheresql = ' and subsite_id=' . intval($_CFG['subsite_id']) . ' ';
                } else {
                    $count_wheresql = '';
                }
                $companyarray[$row['uid']]['jobs_num'] = $db->get_total("SELECT count(*) as num from " . table("jobs") . " where uid={$row['uid']} " . $count_wheresql);
            }
        }
    }
    $smarty->assign($aset['listname'], $companyarray);
}
Esempio n. 5
0
function interest_jobs($topclass, $category, $subclass, $id)
{
    global $db;
    $wheresql = " WHERE id !=" . intval($id);
    if (intval($subclass) != 0) {
        $wheresql .= " and subclass =" . $subclass;
    } elseif (intval($category) != 0) {
        $wheresql .= " and  category =" . $category;
    } elseif (intval($topclass) != 0) {
        $wheresql .= " and  topclass =" . $topclass;
    }
    $list = array();
    $orderbysql = " ORDER BY  refreshtime  desc ";
    $limit = " LIMIT 5 ";
    $result = $db->query("SELECT id,subsite_id,jobs_name,companyname,wage_cn,district_cn,refreshtime FROM " . table('jobs') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        //刷新时间
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['url'] = wap_url_rewrite("jobs-show", array("id" => $row['id']), 1, $row['subsite_id']);
        $list[] = $row;
    }
    return $list;
}
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 tpl_function_qishi_simple_resume_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "姓名长度":
                $aset['unamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "页面":
                $aset['simpleresumeshow'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = isset($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['unamelen'] = isset($aset['unamelen']) ? intval($aset['unamelen']) : 8;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['simpleresumeshow'] = isset($aset['simpleresumeshow']) ? $aset['simpleresumeshow'] : 'QS_simpleresumeshow';
    if (isset($aset['displayorder'])) {
        if (strpos($aset['displayorder'], '>')) {
            $arr = explode('>', $aset['displayorder']);
            // 排序字段
            if ($arr[0] == 'refreshtime') {
                $arr[0] = "refreshtime";
            } elseif ($arr[0] == "id") {
                $arr[0] = "id";
            } elseif ($arr[0] == "click") {
                $arr[0] == "click";
            } else {
                $arr[0] = "";
            }
            // 排序方式
            if ($arr[1] == 'desc') {
                $arr[1] = "desc";
            } elseif ($arr[1] == "asc") {
                $arr[1] = "asc";
            } else {
                $arr[1] = "";
            }
            if ($arr[0] && $arr[1]) {
                $orderbysql = " ORDER BY  `is_hot`  {$arr[1]} , {$arr[0]} {$arr[1]}";
            }
        }
    } else {
        $orderbysql = " ORDER BY   `is_hot`  DESC";
    }
    $wheresql = " AND audit=1 ";
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $aset['key'] = help::addslashes_deep(trim($aset['key']));
        if ($aset['keytype'] == "1" || $aset['keytype'] == "") {
            $wheresql .= " AND  likekey like '%{$aset['key']}%'";
            $orderbysql = "";
        } elseif ($aset['keytype'] == "2") {
            $wheresql .= " AND  MATCH (`key`) AGAINST ('" . fulltextpad($aset['key']) . "') ";
            $orderbysql = "";
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('simple_resume') . $wheresql;
        //echo $total_sql;
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => 'QS_simpleresumelist', 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = ($currenpage - 1) * $aset['row'];
        $smarty->assign('page', $page->show(3));
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT " . abs($aset['start']) . ',' . $aset['row'];
    $result = $db->query("SELECT id,subsite_id,uname,detailed,refreshtime,category,is_hot,sex,age,experience_cn,deadline,district_cn,sdistrict_cn FROM " . table('simple_resume') . " " . $wheresql . $orderbysql . $limit);
    $list = array();
    //echo "SELECT * FROM ".table('jobs')." ".$wheresql.$orderbysql.$limit;
    while ($row = $db->fetch_array($result)) {
        $row['uname_'] = $row['uname'];
        $row['uname'] = cut_str($row['uname'], $aset['unamelen'], 0, $aset['dot']);
        $row['detailed_'] = strip_tags($row['detailed']);
        if ($aset['brieflylen'] > 0) {
            $row['detailed'] = cut_str($row['detailed_'], $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['detailed'] = $row['detailed_'];
        }
        if (strlen($row['detailed_']) > $aset['brieflylen'] * 2) {
            $row['show_detail'] = true;
        } else {
            $row['show_detail'] = false;
        }
        // $row['comname_']=$row['comname'];
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        // $row['comname']=cut_str($row['comname'],$aset['companynamelen'],0,$aset['dot']);
        $row['simple_url'] = url_rewrite($aset['simpleresumeshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['intention_jobs'] = $row['category'];
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 8
0
<?php

/*
 * 74cms WAP
 * ============================================================================
 * 版权所有: 骑士网络,并保留所有权利。
 * 网站地址: http://www.74cms.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once dirname(__FILE__) . '/../include/common.inc.php';
require_once QISHI_ROOT_PATH . 'include/fun_wap.php';
require_once QISHI_ROOT_PATH . 'include/mysql.class.php';
$smarty->cache = false;
$db = new mysql($dbhost, $dbuser, $dbpass, $dbname);
require_once dirname(__FILE__) . '/weixin_share.php';
$show = news_one($_GET['id']);
if ($show) {
    $show['addtime'] = daterange(time(), $show['addtime'], 'Y-m-d', "#FF3300");
    $show['bimg'] = $_CFG['upfiles_dir'] . $show['Small_img'];
    $type_cn = $db->getone(" SELECT * FROM " . table('article_category') . " WHERE id=" . $show['type_id']);
    $show['type_cn'] = $type_cn['categoryname'];
    $smarty->assign('show', $show);
}
$smarty->assign('goback', $_SERVER["HTTP_REFERER"]);
$smarty->display("m/news-show.html");
Esempio n. 9
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";
    $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);
}
Esempio n. 10
0
 }
 if (array_key_exists($input->g['department_id'], $departments) && in_array($input->g['department_id'], $staff_departments)) {
     $search_query .= "department_id='" . $db->real_escape_string($input->g['department_id']) . "' AND ";
 }
 if (array_key_exists($input->g['priority_id'], $priority)) {
     $search_query .= "priority_id='" . $db->real_escape_string($input->g['priority_id']) . "' AND ";
 }
 if (!empty($input->g['date_from'])) {
     $daterange = daterange($input->g['date_from']);
     if ($daterange != '') {
         $date_from = $daterange[0];
         $search_query .= "date>='{$date_from}' AND ";
     }
 }
 if (!empty($input->g['date_to'])) {
     $daterange = daterange($input->g['date_to']);
     if ($daterange != '') {
         $date_to = $daterange[1];
         $search_query .= "date<='{$date_to}' AND ";
     }
 }
 if (!empty($input->g['criteria_value'])) {
     switch ($input->g['criteria']) {
         case 'code':
             $search_query .= "code='" . $db->real_escape_string($input->g['criteria_value']) . "' AND ";
             break;
         case 'subject':
             $search_query .= "subject LIKE '%" . $db->real_escape_string($input->g['criteria_value']) . "%' AND ";
             break;
         case 'name':
             $search_query .= "fullname LIKE '%" . $db->real_escape_string($input->g['criteria_value']) . "%' AND ";
function tpl_function_qishi_hunter_jobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = $a[1];
                break;
            case "职位大类":
                $aset['category'] = $a[1];
                break;
            case "职位小类":
                $aset['subclass'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "年龄":
                $aset['age'] = $a[1];
                break;
            case "工资":
                $aset['wage'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "公司规模":
                $aset['scale'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $timenow = time();
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_hunter_jobslist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : '';
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_hunter_jobsshow';
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]},refreshtime {$arr[1]}";
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY wage {$arr[1]},refreshtime {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['education']) && $aset['education'] != '') {
        $wheresql .= " AND education=" . intval($aset['education']);
    }
    if (isset($aset['scale']) && $aset['scale'] != '') {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (isset($aset['wage']) && $aset['wage'] != '') {
        $wheresql .= " AND wage=" . intval($aset['wage']);
    }
    if (isset($aset['experience']) && $aset['experience'] != '') {
        $wheresql .= " AND experience=" . intval($aset['experience']);
    }
    if (isset($aset['age']) && $aset['age'] != '') {
        $wheresql .= " AND age=" . intval($aset['age']);
    }
    if (isset($aset['trade']) && $aset['trade'] != '') {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND trade=" . intval($aset['trade']) . " ";
        }
    }
    if (!empty($aset['jobcategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['jobcategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR category =" . intval($cat[0]);
            } else {
                $xsql .= " OR subclass =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['category']) && $aset['category'] != '') {
            if (strpos($aset['category'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['category']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND category IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND category = " . intval($aset['category']);
            }
        }
        if (isset($aset['subclass']) && $aset['subclass'] != '') {
            if (strpos($aset['subclass'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['subclass']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND subclass IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND subclass = " . intval($aset['subclass']);
            }
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['hunterjobsearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['hunterjobsearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
        $jobstable = table('jobs_search_key');
    }
    if ($_CFG['operation_hunter_mode'] == '1') {
        $wheresql .= "  AND audit=1  AND display=1 ";
    } elseif ($_CFG['operation_hunter_mode'] == '2') {
        $wheresql .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    //echo "SELECT * FROM ".table('hunter_jobs')." ".$wheresql.$orderbysql.$limit;
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('hunter_jobs') . " {$wheresql}";
        //echo $total_sql;
        //echo "<br>";
        $total_count = $db->get_total($total_sql);
        if ($_CFG['hunter_list_max'] > 0) {
            $total_count > intval($_CFG['hunter_list_max']) && ($total_count = intval($_CFG['hunter_list_max']));
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,subsite_id,jobs_name,contents,jobs_qualified,companyname,refreshtime,district_cn,wage_cn FROM " . table('hunter_jobs') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['jobs_name_'] = $row['jobs_name'];
        $row['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            $row['jobs_qualified'] = cut_str(strip_tags($row['jobs_qualified']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['briefly'] = strip_tags($row['contents']);
            $row['jobs_qualified'] = strip_tags($row['jobs_qualified']);
        }
        $row['amount'] = $row['amount'] == "0" ? '若干' : $row['amount'];
        $row['briefly_'] = strip_tags($row['contents']);
        $row['companyname_'] = $row['companyname'];
        $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
        $row['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 12
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);
}
function tpl_function_qishi_hunter_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,utype,setmeal_deadline,add_mode,contents,jobs_qualified,refreshtime,language,wage_structure,jobs_name,companyname,addtime,click,wage_cn,trade_cn,scale_cn,department,reporter,nature_cn,district_cn,category_cn,age_cn,education_cn,sex_cn,experience_cn from " . table('hunter_jobs') . $wheresql . " LIMIT 1";
    $val = $db->getone($sql);
    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['jobs_url'] = url_rewrite('QS_hunter_jobsshow', array('id' => $val['id']));
        $val['expire'] = sub_day($val['deadline'], time());
        if ($aset['brieflylen'] > 0) {
            $val['briefly'] = cut_str(strip_tags($val['contents']), $aset['brieflylen'], 0, $aset['dot']);
            $val['jobs_qualified'] = cut_str(strip_tags($val['jobs_qualified']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $val['briefly'] = strip_tags($val['contents']);
            $val['jobs_qualified'] = strip_tags($val['jobs_qualified']);
        }
        $val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
        $val['company_url'] = url_rewrite('QS_companyshow', array('id' => $val['company_id']));
        $val['languagecn'] = preg_replace("/\\d+/", '', $val['language']);
        $val['languagecn'] = preg_replace('/\\,/', '', $val['languagecn']);
        $val['languagecn'] = preg_replace('/\\|/', '&nbsp;&nbsp;&nbsp;', $val['languagecn']);
        $wage_structure = explode("|", $val['wage_structure']);
        foreach ($wage_structure as $key => $value) {
            $wage = explode(",", $value);
            $val['structure'][$key]['value'] = $wage[1];
        }
        if ($val['utype'] == '1') {
            $company = GetJobsCompanyProfile($val['uid']);
            $val['company_id'] = $company['id'];
        }
        $wheresql = " WHERE huntet_uid='{$val['uid']}' AND jobs_id= '{$val['id']}' AND personal_look=1 ";
        $val['countresume'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('personal_hunter_jobs_apply') . $wheresql);
    }
    $smarty->assign($aset['listname'], $val);
}
Esempio n. 14
0
    $emergency_jobs[$key]['url'] = wap_url_rewrite("jobs-show", array("id" => $value['id']), 1, $value['subsite_id']);
    $emergency_jobs[$key]['r_time'] = daterange(time(), $value['refreshtime'], 'Y-m-d', "#FF3300");
}
$smarty->assign('emergency_jobs', $emergency_jobs);
//推荐职位
$recommend_jobs = $db->getall("SELECT id,subsite_id,jobs_name,district_cn,companyname,wage_cn,refreshtime FROM " . table('jobs') . " WHERE recommend=1 and " . $subsite_wheresql . " ORDER BY `refreshtime` DESC,`id` DESC LIMIT 5");
foreach ($recommend_jobs as $key => $value) {
    $recommend_jobs[$key]['url'] = wap_url_rewrite("jobs-show", array("id" => $value['id']), 1, $value['subsite_id']);
    $recommend_jobs[$key]['r_time'] = daterange(time(), $value['refreshtime'], 'Y-m-d', "#FF3300");
}
$smarty->assign('recommend_jobs', $recommend_jobs);
//最新职位
$new_jobs = $db->getall("SELECT id,subsite_id,jobs_name,district_cn,companyname,wage_cn,refreshtime FROM " . table('jobs') . " where " . $subsite_wheresql . "  ORDER BY `refreshtime` DESC,`id` DESC LIMIT 5");
foreach ($new_jobs as $key => $value) {
    $new_jobs[$key]['url'] = wap_url_rewrite("jobs-show", array("id" => $value['id']), 1, $value['subsite_id']);
    $new_jobs[$key]['r_time'] = daterange(time(), $value['refreshtime'], 'Y-m-d', "#FF3300");
}
$smarty->assign('new_jobs', $new_jobs);
//名企推荐广告位
$ad_list = $db->getall("SELECT id,img_path,img_url FROM " . table('ad') . " WHERE alias='QS_yellowpage'  ORDER BY `show_order` DESC,`id` DESC LIMIT 6");
$smarty->assign('ad_list', $ad_list);
//热门关键字
$sql = "select w_word,w_hot from " . table("hotword") . " order by w_hot desc limit 15 ";
$hotword_list = $db->getall($sql);
$smarty->assign('hotword', $hotword_list);
//分站
$subsite = get_cache('subsite');
$subsitelist = array();
foreach ($subsite as $key => $value) {
    $subsitelist[] = $value;
}
Esempio n. 15
0
            $value['fullname'] = "N" . str_pad($value['id'], 7, "0", STR_PAD_LEFT);
            $value['fullname_'] = $value['fullname'];
        } elseif ($value['display_name'] == "3") {
            if ($value['sex'] == 1) {
                $value['fullname'] = cut_str($value['fullname'], 1, 0, "先生");
            } elseif ($value['sex'] == 2) {
                $value['fullname'] = cut_str($value['fullname'], 1, 0, "女士");
            }
            $value['fullname_'] = $value['fullname'];
        } else {
            $value['fullname_'] = $value['fullname'];
            $value['fullname'] = $value['fullname'];
        }
        $resume[$key]['url'] = wap_url_rewrite("resume-show", array("id" => $value["id"]));
        $resume[$key]['fullname_'] = $value['fullname_'];
        $resume[$key]['fullname'] = $value['fullname'];
        $resume[$key]['refreshtime_cn'] = daterange(time(), $value['refreshtime'], 'Y-m-d', "#FF3300");
        //检测该会员的手机认证状态
        $user_info = $db->getone("SELECT mobile_audit FROM " . table('members') . " WHERE uid=" . $value['uid']);
        $resume[$key]['mobile_audit'] = $user_info['mobile_audit'];
    }
} else {
    $resume = array();
}
$smarty->assign('resume', $resume);
$smarty->assign('pagehtml', wapmulti($count, $perpage, $page, $theurl));
//热门关键字
$sql = "select w_word,w_hot from " . table("hotword") . " order by w_hot desc limit 15 ";
$hotword_list = $db->getall($sql);
$smarty->assign('hotword', $hotword_list);
$smarty->display("m/m-resume-list.html");
Esempio n. 16
0
function tpl_function_qishi_resume_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "姓名长度":
                $aset['namelen'] = $a[1];
                break;
            case "特长描述长度":
                $aset['specialtylen'] = $a[1];
                break;
            case "意向职位长度":
                $aset['jobslen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = trim($a[1]);
                break;
            case "职位大类":
                $aset['category'] = trim($a[1]);
                break;
            case "职位小类":
                $aset['subclass'] = trim($a[1]);
                break;
            case "地区分类":
                $aset['citycategory'] = trim($a[1]);
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = trim($a[1]);
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "等级":
                $aset['talent'] = $a[1];
                break;
            case "性别":
                $aset['sex'] = $a[1];
                // 添加搜索条件  男 女
                break;
            case "照片":
                $aset['photo'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "页面":
                $aset['showname'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['namelen'] = isset($aset['namelen']) ? intval($aset['namelen']) : 4;
    $aset['specialtylen'] = isset($aset['specialtylen']) ? intval($aset['specialtylen']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 0;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : null;
    $aset['showname'] = isset($aset['showname']) ? $aset['showname'] : 'QS_resumeshow';
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : 'QS_resumelist';
    $resumetable = table('resume_search_rtime');
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY r.refreshtime {$arr[1]},id desc ";
        }
    }
    if (!empty($aset['category']) || !empty($aset['subclass']) || !empty($aset['jobcategory'])) {
        if (!empty($aset['jobcategory'])) {
            $dsql = $xsql = "";
            $arr = explode(",", $aset['jobcategory']);
            $arr = array_unique($arr);
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[2]) === 0) {
                    $dsql .= " OR category =" . intval($cat[1]);
                } else {
                    $xsql .= " OR subclass =" . intval($cat[2]);
                }
            }
            $joinwheresql .= " WHERE " . ltrim(ltrim($dsql . $xsql), 'OR');
        } else {
            if (!empty($aset['category'])) {
                if (strpos($aset['category'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['category']);
                    $sqlin = implode(",", $arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND topclass IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND  topclass=" . intval($aset['category']);
                }
            }
            if (!empty($aset['subclass'])) {
                if (strpos($aset['subclass'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['subclass']);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND category IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND category=" . intval($aset['subclass']);
                }
            }
            if (!empty($joinwheresql)) {
                $joinwheresql = " WHERE " . ltrim(ltrim($joinwheresql), 'AND');
            }
        }
        $joinsql = "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_jobs') . " {$joinwheresql} )AS j ON  r.id=j.pid ";
    }
    if (!empty($aset['trade'])) {
        if (strpos($aset['trade'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['trade']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_trade .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_trade .= " AND trade=" . intval($aset['trade']);
        }
        if (!empty($joinwheresql_trade)) {
            $joinwheresql_trade = " WHERE " . ltrim(ltrim($joinwheresql_trade), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid ";
    }
    if (!empty($aset['citycategory'])) {
        if (strpos($aset['citycategory'], ",")) {
            $dsql = $xsql = "";
            $arr = explode(",", $aset['citycategory']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[1]) === 0) {
                    $dsql .= " OR r.district =" . intval($cat[0]);
                } else {
                    $xsql .= " OR r.sdistrict =" . intval($cat[1]);
                }
            }
            $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
        } else {
            $cat = explode(".", $aset['citycategory']);
            if (intval($cat[1]) > 0) {
                $wheresql .= " AND r.sdistrict =" . intval($cat[1]);
            } else {
                $wheresql .= " AND r.district=" . intval($cat[0]) . " ";
            }
        }
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND r.district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND r.district=" . intval($aset['district']) . " ";
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND r.sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND r.sdistrict=" . intval($aset['sdistrict']) . " ";
            }
        }
    }
    if (isset($aset['experience']) && !empty($aset['experience'])) {
        $wheresql .= " AND r.experience=" . intval($aset['experience']) . " ";
    }
    if (isset($aset['education']) && !empty($aset['education'])) {
        $wheresql .= " AND r.education=" . intval($aset['education']) . " ";
    }
    if (isset($aset['talent']) && !empty($aset['talent'])) {
        $wheresql .= " AND r.talent=" . intval($aset['talent']) . " ";
    }
    if (isset($aset['sex']) && !empty($aset['sex'])) {
        $wheresql .= " AND r.sex=" . intval($aset['sex']) . " ";
        // 添加搜索条件  男 女
    }
    if (isset($aset['photo']) && !empty($aset['photo'])) {
        $wheresql .= " AND r.photo='" . intval($aset['photo']) . "' ";
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['resumesearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = trim($aset['key']);
        if ($_CFG['resumesearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (r.`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND r.likekey LIKE '%{$key}%' ";
        }
        if ($_CFG['resumesearch_sort'] == '1') {
            $orderbysql = " ORDER BY r.refreshtime DESC,id desc ";
        } else {
            $orderbysql = " ORDER BY r.refreshtime DESC,id desc ";
        }
        $resumetable = table('resume_search_key');
    }
    if (isset($aset['tag']) && !empty($aset['tag'])) {
        $tag = intval($aset['tag']);
        $wheresql .= " AND  (tag1='{$tag}' OR tag2='{$tag}' OR tag3='{$tag}' OR tag4='{$tag}' OR tag5='{$tag}') ";
        $orderbysql = " order by id desc ";
        $resumetable = table('resume_search_tag');
    }
    $wheresql .= " AND r.display='1' AND r.audit='1' ";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT  COUNT(*) AS num  FROM  {$resumetable} AS r " . $joinsql . $wheresql;
        $total_count = $db->get_total($total_sql);
        if (intval($_CFG['resume_list_max']) > 0) {
            $total_count > intval($_CFG['resume_list_max']) && ($total_count = intval($_CFG['resume_list_max']));
        }
        //echo $total_sql;
        //echo "SELECT  COUNT(DISTINCT r.id) AS num  FROM  ".table('resume')." AS r ".$wheresql;
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        $smarty->assign('page', $page->show(3));
        $smarty->assign('pagemin', $page->show(4));
        $smarty->assign('total', $total_count);
        $smarty->assign('pagenow', $page->show(6));
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $idresult = $db->query("SELECT id FROM {$resumetable}  AS r" . $joinsql . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$resumetable}  AS r".$joinsql.$wheresql.$orderbysql.$limit;
    while ($row = $db->fetch_array($idresult)) {
        $id[] = $row['id'];
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") ";
        $result = $db->query("SELECT * FROM " . table('resume') . "  AS r " . $wheresql . $orderbysql);
        while ($row = $db->fetch_array($result)) {
            if ($row['display_name'] == "2") {
                $row['fullname'] = "N" . str_pad($row['id'], 7, "0", STR_PAD_LEFT);
                $row['fullname_'] = $row['fullname'];
            } elseif ($row['display_name'] == "3") {
                $row['fullname'] = cut_str($row['fullname'], 1, 0, "**");
                $row['fullname_'] = $row['fullname'];
            } else {
                $row['fullname_'] = $row['fullname'];
                $row['fullname'] = cut_str($row['fullname'], $aset['namelen'], 0, $aset['dot']);
            }
            if (in_array($row['id'], $_COOKIE['QS']['view_resume_log'])) {
                $row['checked'] = true;
            } else {
                $row['checked'] = false;
            }
            $row['specialty_'] = strip_tags($row['specialty']);
            if ($aset['specialtylen'] > 0) {
                $row['specialty'] = cut_str(strip_tags($row['specialty']), $aset['specialtylen'], 0, $aset['dot']);
            }
            if ($aset['jobslen'] > 0) {
                $row['intention_jobs'] = cut_str(strip_tags($row['intention_jobs']), $aset['jobslen'], 0, $aset['dot']);
            }
            $row['trade_cn'] = cut_str(strip_tags($row['trade_cn']), 10, 0, "..");
            $row['photosrc'] = $row['photo'] ? $_CFG['resume_photo_dir_thumb'] . $row['photo_img'] : $_CFG['resume_photo_dir_thumb'] . "no_photo.gif";
            $row['resume_url'] = url_rewrite($aset['showname'], array('id' => $row['id']), true, $row['subsite_id']);
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['age'] = date("Y") - $row['birthdate'];
            if ($row['tag']) {
                $tag = explode('|', $row['tag']);
                $taglist = array();
                if (!empty($tag) && is_array($tag)) {
                    foreach ($tag as $t) {
                        $tli = explode(',', $t);
                        $taglist[] = array($tli[0], $tli[1]);
                    }
                }
                $row['tag'] = $taglist;
            } else {
                $row['tag'] = array();
            }
            $list[] = $row;
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 17
0
File: ajax.php Progetto: winiceo/job
    }
    $simplelistarray = $db->getall("select * from " . table('simple_resume') . " ORDER BY `id` " . $wheresql . " DESC LIMIT {$offset},{$rows}");
    if (!empty($simplelistarray) && $offset <= 100) {
        foreach ($simplelistarray as $li) {
            $url = "simple-resume-show.php?id={$li['id']}";
            $simplelisthtml .= '<section class="simple-data-item thisurl box" url="' . $url . '">
						<div class="data-main">
							<div class="data-txt">
								<div class="top-info clearfix"><h4 class="f-left"><a href="' . $url . '">' . $li['uname'] . '<i class="w-icon ';
            if ($li['sex'] == 1) {
                $sex = 'w-icon-male';
            } else {
                $sex = 'w-icon-female';
            }
            $simplelisthtml .= $sex . '"></i></a></h4><span class="f-right">';
            $refreshtime_cn = daterange(time(), $li['refreshtime'], 'Y-m-d', "#FF3300");
            $simplelisthtml .= $refreshtime_cn . '</span></div>
								<p class="simple-data-detail">' . $li['age'] . '岁 | ' . $li['experience_cn'] . '  | ' . $li['category'] . '</p>
								<p class="simple-data-detail">' . $li['detailed'] . '</p>
							</div>
							<div class="data-contact layout-box box-center-v">
								<div class="box-col contact-local"><i class="w-icon w-icon-phone"></i>' . $li['tel'] . '</div>
								<div class="box-col contact-phone s-resume"><i class="w-icon w-icon-local"></i>';
            if ($li['sdistrict_cn']) {
                $district_cn = $li['district_cn'] . '-' . $li['sdistrict_cn'];
            } else {
                $district_cn = $li['district_cn'];
            }
            $simplelisthtml .= $district_cn . '</div>
							</div>
						</div>
Esempio n. 18
0
function tpl_function_qishi_jobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = $a[1];
                break;
            case "职位大类":
                $aset['category'] = $a[1];
                break;
            case "职位小类":
                $aset['subclass'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "道路":
                $aset['street'] = $a[1];
                break;
            case "写字楼":
                $aset['officebuilding'] = $a[1];
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "工资":
                $aset['wage'] = $a[1];
                break;
            case "职位性质":
                $aset['nature'] = $a[1];
                break;
            case "公司规模":
                $aset['scale'] = $a[1];
                break;
            case "紧急招聘":
                $aset['emergency'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_jobslist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_jobsshow';
    $openorderby = false;
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_rtime');
        } elseif ($arr[0] == "stickrtime") {
            $orderbysql = " ORDER BY stick {$arr[1]} , refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_stickrtime');
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
            $jobstable = table('jobs_search_hot');
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]},refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_scale');
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY wage {$arr[1]},refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_wage');
        } elseif ($arr[0] == "key") {
            $jobstable = table('jobs_search_key');
        } elseif ($arr[0] == "null") {
            $orderbysql = "";
            $jobstable = table('jobs_search_rtime');
        } else {
            $orderbysql = " ORDER BY stick {$arr[1]} , refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_stickrtime');
        }
    } else {
        $orderbysql = " ORDER BY stick DESC , refreshtime DESC";
        $jobstable = table('jobs_search_stickrtime');
    }
    $orderbysql .= ",id desc ";
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['emergency']) && $aset['emergency'] != '') {
        $wheresql .= " AND emergency=" . intval($aset['emergency']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['nature']) && $aset['nature'] != '') {
        if (strpos($aset['nature'], "-")) {
            $or = $orsql = "";
            $arr = explode("-", $aset['nature']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND nature IN  (" . $sqlin . ") ";
            }
        } else {
            $wheresql .= " AND nature=" . intval($aset['nature']) . " ";
        }
    }
    if (isset($aset['scale']) && $aset['scale'] != '') {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (isset($aset['education']) && $aset['education'] != '') {
        $wheresql .= " AND education=" . intval($aset['education']);
    }
    if (isset($aset['wage']) && $aset['wage'] != '') {
        $wheresql .= " AND wage=" . intval($aset['wage']);
    }
    if (isset($aset['experience']) && $aset['experience'] != '') {
        $wheresql .= " AND experience=" . intval($aset['experience']);
    }
    if (isset($aset['trade']) && $aset['trade'] != '') {
        if (strpos($aset['trade'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['trade']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND trade=" . intval($aset['trade']) . " ";
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode(",", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['street']) && $aset['street'] != '') {
        $wheresql .= " AND street=" . intval($aset['street']);
    }
    if (isset($aset['officebuilding']) && $aset['officebuilding'] != '') {
        $wheresql .= " AND officebuilding=" . intval($aset['officebuilding']);
    }
    if (!empty($aset['jobcategory'])) {
        $dsql = $xsql = "";
        $arr = explode(",", $aset['jobcategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[2]) === 0) {
                $dsql .= " OR category =" . intval($cat[1]);
            } else {
                $xsql .= " OR subclass =" . intval($cat[2]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['category']) && $aset['category'] != '') {
            if (strpos($aset['category'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['category']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND topclass IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND topclass = " . intval($aset['category']);
            }
        }
        if (isset($aset['subclass']) && $aset['subclass'] != '') {
            if (strpos($aset['subclass'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['subclass']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND category IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND category = " . intval($aset['subclass']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['jobsearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = trim($aset['key']);
        if ($_CFG['jobsearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
        if ($_CFG['jobsearch_sort'] == '1') {
            $orderbysql = " ORDER BY refreshtime DESC,id desc ";
        } else {
            $orderbysql = " ORDER BY refreshtime DESC,id desc ";
        }
        $jobstable = table('jobs_search_key');
    }
    if (isset($aset['tag']) && !empty($aset['tag'])) {
        $tag = intval($aset['tag']);
        $wheresql .= " AND  (tag1='{$tag}' OR tag2='{$tag}' OR tag3='{$tag}' OR tag4='{$tag}' OR tag5='{$tag}') ";
        $orderbysql = " order by id desc ";
        $jobstable = table('jobs_search_tag');
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM {$jobstable} {$wheresql}";
        //echo $total_sql;
        $total_count = $db->get_total($total_sql);
        if ($_CFG['jobs_list_max'] > 0) {
            $total_count > intval($_CFG['jobs_list_max']) && ($total_count = intval($_CFG['jobs_list_max']));
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(3));
            $smarty->assign('pagemin', $page->show(4));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $idresult = $db->query("SELECT id FROM {$jobstable} " . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$jobstable} ".$wheresql.$orderbysql.$limit;
    while ($row = $db->fetch_array($idresult)) {
        $id[] = $row['id'];
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") ";
        $result = $db->query("SELECT * FROM " . table('jobs') . $wheresql . $orderbysql);
        //echo "SELECT * FROM ".table('jobs')." ".$wheresql.$orderbysql;
        while ($row = $db->fetch_array($result)) {
            $row['jobs_name_'] = $row['jobs_name'];
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
            if (!empty($row['highlight'])) {
                $row['jobs_name'] = "<span style=\"color:{$row['highlight']}\">{$row['jobs_name']}</span>";
            }
            if ($aset['brieflylen'] > 0) {
                $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            } else {
                $row['briefly'] = strip_tags($row['contents']);
            }
            $row['amount'] = $row['amount'] == "0" ? '若干' : $row['amount'];
            $row['briefly_'] = strip_tags($row['contents']);
            $row['companyname_'] = $row['companyname'];
            $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
            $row['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id']), true, $row['subsite_id']);
            $row['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
            if ($row['tag']) {
                $tag = explode('|', $row['tag']);
                $taglist = array();
                if (!empty($tag) && is_array($tag)) {
                    foreach ($tag as $t) {
                        $tli = explode(',', $t);
                        $taglist[] = array($tli[0], $tli[1]);
                    }
                }
                $row['tag'] = $taglist;
            } else {
                $row['tag'] = array();
            }
            $list[] = $row;
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 19
0
function tpl_function_qishi_train_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "机构名长度":
                $aset['trainnamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "机构性质":
                $aset['nature'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "黄页":
                $aset['yellowpages'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "机构页面":
                $aset['trainshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_train_agency";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['trainnamelen'] = isset($aset['trainnamelen']) ? intval($aset['trainnamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : '';
    $aset['trainshow'] = isset($aset['trainshow']) ? $aset['trainshow'] : 'QS_train_agencyshow';
    $orderbysql = " ORDER BY refreshtime desc ";
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $key = trim($aset['key']);
        $wheresql .= " AND trainname LIKE '%{$key}%' ";
    }
    if (isset($aset['nature']) && $aset['nature'] != '') {
        $wheresql .= " AND nature=" . intval($aset['nature']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['yellowpages']) && $aset['yellowpages'] == '1') {
        $wheresql .= " AND yellowpages='1' ";
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('train_profile') . " {$wheresql}";
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(3));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,uid,refreshtime,trainname,contents,achievement,teacherpower,logo,district_cn,nature_cn,founddate FROM " . table('train_profile') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['trainname'] = cut_str($row['trainname'], $aset['trainnamelen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            $row['achievement'] = cut_str(strip_tags($row['achievement']), $aset['brieflylen'], 0, $aset['dot']);
            $row['teacherpower'] = cut_str(strip_tags($row['teacherpower']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['briefly'] = strip_tags($row['contents']);
            $row['achievement'] = strip_tags($row['achievement']);
            $row['teacherpower'] = strip_tags($row['teacherpower']);
        }
        $row['briefly_'] = $row['contents'];
        $row['achievement_'] = $row['achievement'];
        $row['teacherpower_'] = $row['teacherpower'];
        $row['trainname_'] = $row['trainname'];
        $row['trainname'] = cut_str($row['trainname'], $aset['trainnamelen'], 0, $aset['dot']);
        $row['train_url'] = url_rewrite($aset['trainshow'], array('id' => $row['id']));
        if ($row['logo']) {
            $row['photosrc'] = $_CFG['train_logo_dir'] . $row['logo'];
        }
        $wheresql = " WHERE train_id='{$row['id']}' ";
        $row['countresume'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('course') . $wheresql);
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
function tpl_function_qishi_curriculum_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "课程名长度":
                $aset['courselen'] = $a[1];
                break;
            case "机构名长度":
                $aset['trainnamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "课程类别":
                $aset['coursecategory'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "上课班制":
                $aset['classtype'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['refre'] = $a[1];
                break;
            case "开课时间":
                $aset['starttime'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "机构页面":
                $aset['trainshow'] = $a[1];
                break;
            case "课程页面":
                $aset['courseshow'] = $a[1];
                break;
            case "讲师页面":
                $aset['teachershow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $timenow = time();
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_courselist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['courselen'] = isset($aset['courselen']) ? intval($aset['courselen']) : 8;
    $aset['trainnamelen'] = isset($aset['trainnamelen']) ? intval($aset['trainnamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : '';
    $aset['trainshow'] = isset($aset['trainshow']) ? $aset['trainshow'] : 'QS_train_agencyshow';
    $aset['courseshow'] = isset($aset['courseshow']) ? $aset['courseshow'] : 'QS_train_curriculumshow';
    $aset['teachershow'] = isset($aset['teachershow']) ? $aset['teachershow'] : 'QS_train_lecturershow';
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "stime") {
            $orderbysql = " ORDER BY starttime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['refre']) && $aset['refre'] != '') {
        $settr = intval($aset['refre']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['refre'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['starttime']) && $aset['starttime'] != '') {
        $trart = intval($aset['starttime']);
        if ($trart > 0) {
            $trart_val = intval(strtotime("+" . $aset['starttime'] . " day"));
            $wheresql .= " AND starttime>{$timenow} AND starttime<" . $trart_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['classtype']) && $aset['classtype'] != '') {
        $wheresql .= " AND classtype=" . intval($aset['classtype']) . " ";
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    //不支持多个类型搜索
    if (!empty($aset['coursecategory']) && $aset['coursecategory'] != '') {
        $wheresql .= " AND category =" . intval($aset['coursecategory']);
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['courseearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['courseearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
    }
    $wheresql .= $_CFG['outdated_course'] == '1' ? " AND deadline > {$timenow} " : ' ';
    if ($_CFG['operation_train_mode'] == '1') {
        $wheresql .= "  AND audit=1  AND display=1 AND add_mode=1 ";
    } elseif ($_CFG['operation_train_mode'] == '2') {
        $wheresql .= "  AND audit=1  AND display=1 AND add_mode=2 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('course') . " {$wheresql}";
        //echo $total_sql;
        //echo "<br>";
        $total_count = $db->get_total($total_sql);
        if ($_CFG['course_list_max'] > 0) {
            $total_count > intval($_CFG['course_list_max']) && ($total_count = intval($_CFG['course_list_max']));
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(3));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,subsite_id,course_name,refreshtime,starttime,contents,trainname,train_id,teacher_id,teacher_cn,category_cn,classtype_cn,train_expenses,favour_expenses,district_cn,classhour FROM " . table('course') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['course_name_'] = $row['course_name'];
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['starttime_cn'] = date("Y-m-d", $row['starttime']);
        $row['course_name'] = cut_str($row['course_name'], $aset['courselen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['briefly'] = strip_tags($row['contents']);
        }
        $row['briefly_'] = strip_tags($row['contents']);
        $row['trainname_'] = $row['trainname'];
        $row['trainname'] = cut_str($row['trainname'], $aset['trainnamelen'], 0, $aset['dot']);
        $row['course_url'] = url_rewrite($aset['courseshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['train_url'] = url_rewrite($aset['trainshow'], array('id' => $row['train_id']));
        $row['teacher_url'] = url_rewrite($aset['teachershow'], array('id' => $row['teacher_id']));
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 21
0
function tpl_function_qishi_jobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "应届生职位":
                $aset['graduate'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = $a[1];
                break;
            case "职位大类":
                $aset['category'] = $a[1];
                break;
            case "职位小类":
                $aset['subclass'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "道路":
                $aset['street'] = $a[1];
                break;
            case "写字楼":
                $aset['officebuilding'] = $a[1];
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "工资":
                $aset['wage'] = $a[1];
                break;
            case "职位性质":
                $aset['nature'] = $a[1];
                break;
            case "公司规模":
                $aset['scale'] = $a[1];
                break;
            case "紧急招聘":
                $aset['emergency'] = $a[1];
                break;
            case "悬赏招聘":
                $aset['reward'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "合并":
                $aset['mode'] = $a[1];
                break;
            case "公司列表名":
                $aset['comlistname'] = $a[1];
                break;
            case "公司职位页面":
                $aset['companyjobs'] = $a[1];
                break;
            case "单个公司显示职位数":
                $aset['companyjobs_row'] = $a[1];
                break;
            case "浏览过的职位":
                $aset['view_jobs'] = $a[1];
                break;
            case "风格模板":
                $aset['tpl_compnay'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_jobslist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 20;
    if ($aset['row'] > 20) {
        $aset['row'] = 20;
    }
    $aset['companyjobs_row'] = intval($aset['companyjobs_row']) > 0 ? intval($aset['companyjobs_row']) : 3;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_jobsshow';
    $aset['companyjobs'] = isset($aset['companyjobs']) ? $aset['companyjobs'] : 'QS_companyjobs';
    $aset['mode'] = isset($aset['mode']) ? intval($aset['mode']) : 0;
    $openorderby = false;
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY  refreshtime {$arr[1]} , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_rtime');
        } elseif ($arr[0] == "stickrtime") {
            $orderbysql = " ORDER BY stick {$arr[1]} , refreshtime {$arr[1]}  , setmeal_id {$arr[1]} ";
            $jobstable = table('jobs_search_stickrtime');
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY  click {$arr[1]} , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_hot');
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]} , refreshtime {$arr[1]} , setmeal_id {$arr[1]}  ";
            $jobstable = table('jobs_search_scale');
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY  wage {$arr[1]} ,refreshtime {$arr[1]}  , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_wage');
        } elseif ($arr[0] == "key") {
            $jobstable = table('jobs_search_key');
        } elseif ($arr[0] == "null") {
            $orderbysql = "";
            $jobstable = table('jobs_search_rtime');
        } else {
            $orderbysql = " ORDER BY stick {$arr[1]} , setmeal_id {$arr[1]} , refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_stickrtime');
        }
    } else {
        $orderbysql = " ORDER BY stick DESC , refreshtime DESC , setmeal_id desc ";
        $jobstable = table('jobs_search_stickrtime');
    }
    //应届生职位
    if (isset($aset['graduate']) && !empty($aset['graduate'])) {
        $wheresql .= " AND graduate=1 ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['emergency']) && $aset['emergency'] != '') {
        $wheresql .= " AND emergency=" . intval($aset['emergency']);
    }
    if (isset($aset['reward']) && $aset['reward'] != '') {
        $wheresql .= " AND reward=" . intval($aset['reward']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['nature']) && $aset['nature'] != '') {
        if (strpos($aset['nature'], "-")) {
            $or = $orsql = "";
            $arr = explode("-", $aset['nature']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND nature IN  (" . $sqlin . ") ";
            }
        } else {
            $wheresql .= " AND nature=" . intval($aset['nature']) . " ";
        }
    }
    if (isset($aset['scale']) && $aset['scale'] != '') {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (isset($aset['education']) && $aset['education'] != '') {
        $wheresql .= " AND education=" . intval($aset['education']);
    }
    if (isset($aset['wage']) && $aset['wage'] != '') {
        $wheresql .= " AND wage=" . intval($aset['wage']);
    }
    if (isset($aset['experience']) && $aset['experience'] != '') {
        $wheresql .= " AND experience=" . intval($aset['experience']);
    }
    if (isset($aset['trade']) && $aset['trade'] != '') {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND trade=" . intval($aset['trade']) . " ";
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['street']) && $aset['street'] != '') {
        $wheresql .= " AND street=" . intval($aset['street']);
    }
    if (isset($aset['officebuilding']) && $aset['officebuilding'] != '') {
        $wheresql .= " AND officebuilding=" . intval($aset['officebuilding']);
    }
    if (!empty($aset['jobcategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['jobcategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[2]) === 0) {
                $dsql .= " OR category =" . intval($cat[1]);
            } else {
                $xsql .= " OR subclass =" . intval($cat[2]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['category']) && $aset['category'] != '') {
            if (strpos($aset['category'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['category']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND topclass IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND topclass = " . intval($aset['category']);
            }
        }
        if (isset($aset['subclass']) && $aset['subclass'] != '') {
            if (strpos($aset['subclass'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['subclass']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND category IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND category = " . intval($aset['subclass']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['jobsearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['jobsearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
        $orderbysql = " ORDER BY refreshtime DESC,id desc ";
        $jobstable = table('jobs_search_key');
    }
    /* 搜索 时间范围 */
    $moth = intval($_CFG['search_time']);
    if ($moth > 0) {
        $moth_time = $moth * 3600 * 24 * 30;
        $time = time() - $moth_time;
        $wheresql .= " AND refreshtime>{$time} ";
    }
    if (!empty($aset['tag'])) {
        $jobstable = $jobstable . ' as r ';
        if (strpos($aset['tag'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['tag']);
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_tag .= " AND tag IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_tag .= " AND tag=" . intval($aset['tag']);
        }
        if (!empty($joinwheresql_tag)) {
            $joinwheresql_tag = " WHERE " . ltrim(ltrim($joinwheresql_tag), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('jobs_tag') . " {$joinwheresql_tag} ) AS g ON  r.id=g.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('jobs_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid ";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM {$jobstable} {$joinsql} {$wheresql}";
        //echo $total_sql;
        $total_count = $db->get_total($total_sql);
        if ($_CFG['jobs_list_max'] > 0) {
            $total_count > intval($_CFG['jobs_list_max']) && ($total_count = intval($_CFG['jobs_list_max']));
        }
        //如果是浏览过的职位 总数应该算cookie中的
        if ($aset['view_jobs']) {
            $total_count = count($_COOKIE['QS']['view_jobs_log']);
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = $com_list = array();
    $idresult = $db->query("SELECT id FROM {$jobstable} " . $joinsql . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$jobstable} ".$wheresql.$orderbysql.$limit;
    // 如果是浏览过的职位,从cookie中获取职位的id
    if ($aset['view_jobs']) {
        foreach ($_COOKIE['QS']['view_jobs_log'] as $value) {
            $id[] = $value;
        }
    } else {
        while ($row = $db->fetch_array($idresult)) {
            $id[] = $row['id'];
        }
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") ";
        $result = $db->query("SELECT id,jobs_name,recommend,emergency,stick,highlight,companyname,company_id,company_audit,nature_cn,sex_cn,age,amount,category_cn,graduate,trade_cn,scale,scale_cn,district_cn,street_cn,tag_cn,education_cn,experience_cn,wage,wage_cn,contents,setmeal_id,setmeal_name,refreshtime,click FROM " . table('jobs') . " AS r " . $joinsql . $wheresql . $orderbysql);
        while ($row = $db->fetch_array($result)) {
            $row['jobs_name_'] = $row['jobs_name'];
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
            if (!empty($row['highlight'])) {
                $row['jobs_name'] = "<span style=\"color:{$row['highlight']}\">{$row['jobs_name']}</span>";
            }
            if ($aset['brieflylen'] > 0) {
                $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            } else {
                $row['briefly'] = strip_tags($row['contents']);
            }
            $row['amount'] = $row['amount'] == "0" ? '若干' : $row['amount'];
            $row['briefly_'] = strip_tags($row['contents']);
            $row['companyname_'] = $row['companyname'];
            $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
            $row['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id'], 'style' => $aset['tpl_compnay']));
            $row['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
            $row['wage_newcn'] = str_replace("元/月", "", $row['wage_cn']);
            if (isset($aset['reward']) && $aset['reward'] != '') {
                $rs = $db->getone("SELECT  cp_json from " . table("promotion") . " where cp_promotionid=5 and cp_jobid={$row['id']} ");
                $json = str_replace('&quot;', '"', trim($rs["cp_json"]));
                $row['block_balance'] = json_decode($json)->block_balance;
            }
            if ($row['tag_cn']) {
                $tag_cn = explode(',', $row['tag_cn']);
                $row['tag_cn'] = $tag_cn;
            } else {
                $row['tag_cn'] = array();
            }
            //合并公司 显示模式
            if ($aset['mode'] == 1) {
                //统计单个公司符合条件职位数
                $count_com = $db->get_total("SELECT COUNT(*) AS num FROM " . table('jobs') . "  WHERE  company_id=" . $row['company_id']);
                $row['count'] = $count_com;
                $row['count_url'] = $row['company_url'];
                $list[$row['company_id']][] = $row;
            } else {
                $list[] = $row;
            }
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 22
0
function tpl_function_qishi_hunter_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "猎头名长度":
                $aset['hunterlen'] = $a[1];
                break;
            case "公司名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "擅长行业长度":
                $aset['goodtradelen'] = $a[1];
                break;
            case "擅长职能长度":
                $aset['goodcategorylen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "猎头头衔":
                $aset['rank'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "猎头页面":
                $aset['huntershow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_hunterlist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['hunterlen'] = isset($aset['hunterlen']) ? intval($aset['hunterlen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['goodtradelen'] = isset($aset['goodtradelen']) ? intval($aset['goodtradelen']) : 13;
    $aset['goodcategorylen'] = isset($aset['goodcategorylen']) ? intval($aset['goodcategorylen']) : 13;
    $aset['rank'] = isset($aset['rank']) ? intval($aset['rank']) : 0;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $orderbysql = " ORDER BY refreshtime desc ";
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    $wheresql .= " AND audit=1 ";
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['rank']) && $aset['rank'] != '') {
        $wheresql .= " AND rank=" . intval($aset['rank']) . " ";
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $key = help::addslashes_deep(trim($aset['key']));
        $akey = explode(' ', $key);
        if (count($akey) > 1) {
            $akey = array_filter($akey);
            $akey = array_slice($akey, 0, 2);
            $akey = array_map("fulltextpad", $akey);
            $key = '+' . implode(' +', $akey);
            $mode = ' IN BOOLEAN MODE';
        } else {
            $key = fulltextpad($key);
            $mode = ' ';
        }
        $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('hunter_profile') . " {$wheresql}";
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        $countpage = $total_count % $aset['row'] == 0 ? $total_count / $aset['row'] : intval($total_count / $aset['row']) + 1;
        $smarty->assign('countpage', $countpage);
        $smarty->assign('page', $page->show(3));
        $smarty->assign('pagemin', $page->show(4));
        $smarty->assign('currenpage', $currenpage);
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,uid,refreshtime,huntername,companyname,contents,goodtrade_cn,goodcategory_cn,worktime_start,photo_img,district_cn FROM " . table('hunter_profile') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['huntername'] = cut_str($row['huntername'], $aset['hunterlen'], 0, $aset['dot']);
        $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['contents'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['contents'] = strip_tags($row['contents']);
        }
        if ($aset['goodtradelen'] > 0) {
            $row['goodtrade_cn'] = cut_str(strip_tags($row['goodtrade_cn']), $aset['goodtradelen'], 0, $aset['dot']);
        } else {
            $row['goodtrade_cn'] = strip_tags($row['goodtrade_cn']);
        }
        if ($aset['goodcategorylen'] > 0) {
            $row['goodcategory_cn'] = cut_str(strip_tags($row['goodcategory_cn']), $aset['goodcategorylen'], 0, $aset['dot']);
        } else {
            $row['goodcategory_cn'] = strip_tags($row['goodcategory_cn']);
        }
        $row['companyname_'] = $row['companyname'];
        $row['huntername_'] = $row['huntername'];
        $row['years'] = date('Y') + 1 - $row['worktime_start'];
        if ($row['photo_img']) {
            $row['photosrc'] = $_CFG['hunter_photo_dir'] . $row['photo_img'];
        } else {
            $row['photosrc'] = $_CFG['hunter_photo_dir'] . "no_photo.gif";
        }
        $timenow = time();
        if ($_CFG['operation_mode'] == '1') {
            $wheresql1 .= "  AND audit=1  AND display=1 ";
        } elseif ($_CFG['operation_train_mode'] == '2') {
            $wheresql1 .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
        }
        $row['countjobs'] = $db->get_total("select count(*) as num from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1);
        $jobs = $db->getall("select id,jobs_name,refreshtime from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1 . " limit 4");
        foreach ($jobs as $key => $value) {
            $row['jobslist'][$key]['jobs_name'] = cut_str($value['jobs_name'], 10, 0, "..");
            $row['jobslist'][$key]['refreshtime'] = date("Y-m-d", $value['refreshtime']);
            $row['jobslist'][$key]['jobs_url'] = url_rewrite("QS_hunter_jobsshow", array("id" => $value['id']));
        }
        $timenow = time();
        if ($_CFG['operation_mode'] == '1') {
            $wheresql1 .= "  AND audit=1  AND display=1 ";
        } elseif ($_CFG['operation_train_mode'] == '2') {
            $wheresql1 .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
        }
        $row['countjobs'] = $db->get_total("select count(*) as num from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1);
        $list[] = $row;
        unset($row);
    }
    $smarty->assign($aset['listname'], $list);
}
function tpl_function_qishi_resume_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "应届生简历":
                $aset['campu_sresume'] = $a[1];
                break;
            case "院校名称":
                $aset['campusname'] = $a[1];
                break;
            case "更新时间":
                $aset['refreshtime'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "姓名长度":
                $aset['namelen'] = $a[1];
                break;
            case "特长描述长度":
                $aset['specialtylen'] = $a[1];
                break;
            case "意向职位长度":
                $aset['jobslen'] = $a[1];
                break;
            case "专业长度":
                $aset['majorlen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = trim($a[1]);
                break;
            case "职位大类":
                $aset['category'] = trim($a[1]);
                break;
            case "职位小类":
                $aset['subclass'] = trim($a[1]);
                break;
            case "地区分类":
                $aset['citycategory'] = trim($a[1]);
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = trim($a[1]);
                break;
            case "专业":
                $aset['major'] = trim($a[1]);
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "等级":
                $aset['talent'] = $a[1];
                break;
            case "性别":
                $aset['sex'] = $a[1];
                // 添加搜索条件  男 女
                break;
            case "照片":
                $aset['photo'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "页面":
                $aset['showname'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "浏览过的简历":
                $aset['readresume'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 20;
    if ($aset['row'] > 20) {
        $aset['row'] = 20;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['namelen'] = isset($aset['namelen']) ? intval($aset['namelen']) : 4;
    $aset['specialtylen'] = isset($aset['specialtylen']) ? intval($aset['specialtylen']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 0;
    $aset['majorlen'] = isset($aset['majorlen']) ? intval($aset['majorlen']) : 50;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : null;
    $aset['showname'] = isset($aset['showname']) ? $aset['showname'] : 'QS_resumeshow';
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : 'QS_resumelist';
    $resumetable = table('resume_search_rtime');
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY r.refreshtime {$arr[1]},id desc ";
        }
    } else {
        $orderbysql = " ORDER BY r.refreshtime desc,id desc ";
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    //应届生简历
    if (isset($aset['campu_sresume']) && !empty($aset['campu_sresume'])) {
        $wheresql .= " AND r.experience='-1' ";
    }
    //指定院校简历
    if (isset($aset['campusname']) && !empty($aset['campusname'])) {
        $joinwheresql_campusname .= " WHERE  school = '{$aset['campusname']}' ";
        $joinsql = "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_education') . " {$joinwheresql_campusname} )AS e ON  r.id=e.pid ";
    }
    //更新时间
    if (isset($aset['refreshtime']) && !empty($aset['refreshtime'])) {
        $refreshtime_min = strtotime("-" . $aset['refreshtime'] . "day");
        $wheresql .= " AND r.refreshtime > {$refreshtime_min} ";
    }
    if (!empty($aset['category']) || !empty($aset['subclass']) || !empty($aset['jobcategory'])) {
        if (!empty($aset['jobcategory'])) {
            $dsql = $xsql = "";
            $arr = explode("_", $aset['jobcategory']);
            $arr = array_unique($arr);
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[2]) === 0) {
                    $dsql .= " OR category =" . intval($cat[1]);
                } else {
                    $xsql .= " OR subclass =" . intval($cat[2]);
                }
            }
            $joinwheresql .= " WHERE " . ltrim(ltrim($dsql . $xsql), 'OR');
        } else {
            if (!empty($aset['category'])) {
                if (strpos($aset['category'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['category']);
                    $sqlin = implode(",", $arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND topclass IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND  topclass=" . intval($aset['category']);
                }
            }
            if (!empty($aset['subclass'])) {
                if (strpos($aset['subclass'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['subclass']);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND category IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND category=" . intval($aset['subclass']);
                }
            }
            if (!empty($joinwheresql)) {
                $joinwheresql = " WHERE " . ltrim(ltrim($joinwheresql), 'AND');
            }
        }
        $joinsql = "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_jobs') . " {$joinwheresql} )AS j ON  r.id=j.pid ";
    }
    if (!empty($aset['trade'])) {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_trade .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_trade .= " AND trade=" . intval($aset['trade']);
        }
        if (!empty($joinwheresql_trade)) {
            $joinwheresql_trade = " WHERE " . ltrim(ltrim($joinwheresql_trade), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    // major 专业搜索
    if (!empty($aset['major'])) {
        if (strpos($aset['major'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['major']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND r.major IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND r.major=" . intval($aset['major']);
        }
    }
    if (!empty($aset['district']) || !empty($aset['sdistrict']) || !empty($aset['citycategory'])) {
        if (!empty($aset['citycategory'])) {
            $dsql = $xsql = "";
            $arr = explode("_", $aset['citycategory']);
            $arr = array_unique($arr);
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[1]) === 0) {
                    $dsql .= " OR r.district =" . intval($cat[0]);
                } else {
                    $xsql .= " OR r.sdistrict =" . intval($cat[1]);
                }
            }
            $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
        } else {
            if (isset($aset['district']) && $aset['district'] != '') {
                if (strpos($aset['district'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['district']);
                    $arr = array_unique($arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $wheresql .= " AND r.district IN  ({$sqlin}) ";
                    }
                } else {
                    $wheresql .= " AND r.district=" . intval($aset['district']) . " ";
                }
            }
            if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
                if (strpos($aset['sdistrict'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['sdistrict']);
                    $arr = array_unique($arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $wheresql .= " AND r.sdistrict IN  ({$sqlin}) ";
                    }
                } else {
                    $wheresql .= " AND r.sdistrict=" . intval($aset['sdistrict']) . " ";
                }
            }
        }
    }
    if (isset($aset['experience']) && !empty($aset['experience'])) {
        $wheresql .= " AND r.experience=" . intval($aset['experience']) . " ";
    }
    if (isset($aset['education']) && !empty($aset['education'])) {
        $wheresql .= " AND r.education=" . intval($aset['education']) . " ";
    }
    if (isset($aset['talent']) && !empty($aset['talent'])) {
        $wheresql .= " AND r.talent=" . intval($aset['talent']) . " ";
    }
    if (isset($aset['sex']) && !empty($aset['sex'])) {
        $wheresql .= " AND r.sex=" . intval($aset['sex']) . " ";
        // 添加搜索条件  男 女
    }
    if (isset($aset['photo']) && !empty($aset['photo'])) {
        $wheresql .= " AND r.photo='" . intval($aset['photo']) . "' ";
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['resumesearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['resumesearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (r.`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND r.likekey LIKE '%{$key}%' ";
        }
        $resumetable = table('resume_search_key');
    }
    if (!empty($aset['tag'])) {
        if (strpos($aset['tag'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['tag']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_tag .= " AND tag IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_tag .= " AND tag=" . intval($aset['tag']);
        }
        if (!empty($joinwheresql_tag)) {
            $joinwheresql_tag = " WHERE " . ltrim(ltrim($joinwheresql_tag), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid ";
    }
    /* 搜索 时间范围 */
    $moth = intval($_CFG['search_time']);
    if ($moth > 0) {
        $moth_time = $moth * 3600 * 24 * 30;
        $time = time() - $moth_time;
        $wheresql .= " AND r.refreshtime>{$time} ";
    }
    $wheresql .= " AND r.display='1' AND r.audit='1' ";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT  COUNT(*) AS num  FROM  {$resumetable} AS r " . $joinsql . $wheresql;
        $total_count = $db->get_total($total_sql);
        if (intval($_CFG['resume_list_max']) > 0) {
            $total_count > intval($_CFG['resume_list_max']) && ($total_count = intval($_CFG['resume_list_max']));
        }
        //如果是浏览过的简历 总数应该算cookie中的
        if ($aset['readresume']) {
            $total_count = count($_COOKIE['QS']['view_resume_log']);
        }
        //echo $total_sql;
        //echo "SELECT  COUNT(DISTINCT r.id) AS num  FROM  ".table('resume')." AS r ".$wheresql;
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $idresult = $db->query("SELECT id FROM {$resumetable}  AS r" . $joinsql . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$resumetable}  AS r".$joinsql.$wheresql.$orderbysql.$limit;
    // 如果是浏览过的简历,从cookie中获取简历的id
    if ($aset['readresume']) {
        foreach ($_COOKIE['QS']['view_resume_log'] as $value) {
            $id[] = $value;
        }
    } else {
        while ($row = $db->fetch_array($idresult)) {
            $id[] = $row['id'];
        }
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") and display!=3 ";
        $result = $db->query("SELECT id,subsite_id,uid,display,display_name,nature_cn,fullname,sex,major_cn,specialty,intention_jobs,trade_cn,photo,photo_img,photo_display,refreshtime,birthdate,tag_cn,talent,education_cn,sex_cn,wage_cn,experience_cn,district_cn,current_cn FROM " . table('resume') . "  AS r " . $joinsql . $wheresql . $orderbysql);
        while ($row = $db->fetch_array($result)) {
            if ($row['display_name'] == "2") {
                $row['fullname'] = "N" . str_pad($row['id'], 7, "0", STR_PAD_LEFT);
                $row['fullname_'] = $row['fullname'];
            } elseif ($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, "女士");
                } else {
                    $row['fullname'] = cut_str($row['fullname'], 1, 0, "**");
                }
            } else {
                $row['fullname_'] = $row['fullname'];
                $row['fullname'] = cut_str($row['fullname'], $aset['namelen'], 0, $aset['dot']);
            }
            if (in_array($row['id'], $_COOKIE['QS']['view_resume_log'])) {
                $row['checked'] = true;
            } else {
                $row['checked'] = false;
            }
            $row['specialty_'] = strip_tags($row['specialty']);
            if ($aset['specialtylen'] > 0) {
                $row['specialty'] = cut_str(strip_tags($row['specialty']), $aset['specialtylen'], 0, $aset['dot']);
            }
            $row['intention_jobs_'] = $row['intention_jobs'];
            if ($aset['jobslen'] > 0) {
                $row['intention_jobs'] = cut_str(strip_tags($row['intention_jobs']), $aset['jobslen'], 0, $aset['dot']);
            }
            if ($aset['majorlen'] > 0) {
                $row['major_cn'] = cut_str(strip_tags($row['major_cn']), $aset['majorlen'], 0, $aset['dot']);
            }
            $row['trade_cn_'] = $row['trade_cn'];
            $row['trade_cn'] = cut_str(strip_tags($row['trade_cn']), 10, 0, "..");
            $row['resume_url'] = url_rewrite($aset['showname'], array('id' => $row['id']), 1, $row['subsite_id']);
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['age'] = date("Y") - $row['birthdate'];
            if ($row['tag_cn']) {
                $tag_cn = explode(',', $row['tag_cn']);
                $row['tag_cn'] = $tag_cn;
            } else {
                $row['tag_cn'] = array();
            }
            // 照片显示方式
            if ($row['photo'] == "1") {
                if ($row['photo_display'] == "1") {
                    $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . $row['photo_img'];
                } else {
                    $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo_display.gif";
                }
            } else {
                $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo.gif";
            }
            //判断手机是否验证
            $is_audit_phone = $db->getone("SELECT mobile_audit FROM " . table('members') . " WHERE uid={$row['uid']}  LIMIT 1 ");
            $row['is_audit_mobile'] = $is_audit_phone['mobile_audit'];
            //语言能力
            $language = $db->getall("SELECT * FROM " . table('resume_language') . " WHERE pid={$row['id']} ");
            $row['language'] = $language;
            $list[] = $row;
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}
Esempio n. 24
0
                    $html .= "<a href=\"{$jobsli['jobs_url']}\" target=\"_blank\">{$jobsli['jobs_name']}</a>";
                }
                $html .= "</p>";
            }
        }
    }
    exit($html);
} elseif ($act == "ajaxjoblist") {
    $trade = intval($_GET['trade']);
    $wheresql = $trade > 0 ? ' WHERE trade=' . $trade . " " : "";
    $result = $db->query("SELECT * FROM " . table('jobs') . " {$wheresql} ORDER BY refreshtime desc limit 12");
    $i = 1;
    $html = '<ul class="clearfix">';
    while ($row = $db->fetch_array($result)) {
        $row['jobs_name'] = cut_str($row['jobs_name'], 12, 0, "");
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        if (!empty($row['highlight'])) {
            $row['jobs_name'] = "<span style=\"color:{$row['highlight']}\">{$row['jobs_name']}</span>";
        }
        $row['companyname_'] = $row['companyname'];
        $row['companyname'] = cut_str($row['companyname'], 13, 0, "");
        $row['jobs_url'] = url_rewrite('QS_jobsshow', array('id' => $row['id']));
        $row['company_url'] = url_rewrite('QS_companyshow', array('id' => $row['company_id']));
        if ($_CFG['closetime'] == 1) {
            $html .= "<li class=\"clearfix\"><span>.</span><a target=\"_blank\" href=\"{$row['jobs_url']}\">{$row['jobs_name']}</a><b><a target=\"_blank\" href=\"{$row['company_url']}\">{$row['companyname']}</a></b></li>";
        } else {
            $html .= "<li class=\"clearfix\"><span>.</span><a target=\"_blank\" href=\"{$row['jobs_url']}\">{$row['jobs_name']}</a><b><a target=\"_blank\" href=\"{$row['company_url']}\">{$row['companyname']}</a></b><em>{$row['refreshtime_cn']}</em></li>";
        }
        $i++;
    }
    $html .= '</div>';
Esempio n. 25
0
function get_exchange($num, $id)
{
    global $db;
    $num = intval($num);
    $id = intval($id);
    $sql = "select * from " . table('shop_exchange') . " where state=1 and shop_id={$id} order by addtime desc limit {$num} ";
    $row = $db->getall($sql);
    foreach ($row as $key => $value) {
        $value['addtime_cn'] = daterange(time(), $value['addtime'], 'Y-m-d', "#FF3300");
        $row[$key] = $value;
    }
    return $row;
}