Example #1
0
function export_resume($yid)
{
    global $db;
    $yid_str = implode(",", $yid);
    $oederbysql = " order BY refreshtime desc ";
    $wheresql = empty($wheresql) ? " id in ({$yid_str}) " : " and id in ({$yid_str}) ";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    $data = $db->getall("select * from " . table('resume') . $wheresql);
    if (!empty($data)) {
        $result = $data;
    }
    if (!empty($result)) {
        foreach ($result as $key => $value) {
            $arr[$key]['num'] = $key;
            $arr[$key]['title'] = $value['title'];
            $arr[$key]['fullname'] = $value['fullname'];
            $arr[$key]['sex_cn'] = $value['sex_cn'];
            $arr[$key]['birthdate'] = $value['birthdate'];
            $arr[$key]['height'] = $value['height'];
            $arr[$key]['householdaddress'] = $value['householdaddress'];
            $arr[$key]['marriage_cn'] = $value['marriage_cn'];
            $arr[$key]['experience_cn'] = $value['experience_cn'];
            $arr[$key]['education_cn'] = $value['education_cn'];
            $arr[$key]['natrue_cn'] = $value['natrue_cn'];
            $arr[$key]['trade_cn'] = $value['trade_cn'];
            $arr[$key]['district_cn'] = $value['district_cn'];
            $arr[$key]['wage_cn'] = $value['wage_cn'];
            $arr[$key]['tag'] = preg_replace("/\\d+/", '', $value['tag']);
            $arr[$key]['tag'] = preg_replace('/\\,/', '', $arr[$key]['tag']);
            $arr[$key]['tag'] = preg_replace('/\\|/', '   ', $arr[$key]['tag']);
            $arr[$key]['school'] = "";
            $school = $db->getall("select * from " . table('resume_education') . " where pid=" . $value['id'] . " order by id desc");
            if (!empty($school)) {
                foreach ($school as $key1 => $value1) {
                    $arr[$key]['school'] .= $value1['start'] . "-" . $value1['endtime'] . "就读于" . $value1['school'] . ",所学专业:" . $value1['speciality'] . ",学历:" . $value1['education_cn'] . "; ";
                }
            }
            $arr[$key]['work'] = "";
            $work = $db->getall("select * from " . table('resume_work') . " where pid=" . $value['id'] . " order by id desc");
            if (!empty($work)) {
                foreach ($work as $key1 => $value1) {
                    $arr[$key]['work'] .= $value1['start'] . "-" . $value1['endtime'] . "就职于" . $value1['companyname'] . ",任职:" . $value1['jobs'] . "; ";
                }
            }
            $arr[$key]['train'] = "";
            $train = $db->getall("select * from " . table('resume_training') . " where pid=" . $value['id'] . " order by id desc");
            if (!empty($train)) {
                foreach ($train as $key1 => $value1) {
                    $arr[$key]['train'] .= $value1['start'] . "-" . $value1['endtime'] . "在" . $value1['agency'] . "培训" . $value1['course'] . "课程; ";
                }
            }
            $arr[$key]['telephone'] = $value['telephone'];
            $arr[$key]['email'] = $value['email'];
            $arr[$key]['qq'] = $value['qq'];
            $arr[$key]['address'] = $value['address'];
            $arr[$key]['website'] = $value['website'];
            $arr[$key]['recentjobs'] = $value['recentjobs'];
            $arr[$key]['intention_jobs'] = $value['intention_jobs'];
            $arr[$key]['specialty'] = str_replace("\n", "", str_replace("\r", "", $value['specialty']));
            $arr[$key]['addtime'] = date("Y-m-d", $value['addtime']);
            $arr[$key]['refreshtime'] = date("Y-m-d", $value['refreshtime']);
            $arr[$key]['talent'] = $value['talent'] == 1 ? "普通" : "高级";
            $arr[$key]['complete_percent'] = $value['complete_percent'];
        }
        $top_str = "序号\t简历名称\t姓名\t性别\t出生年月\t身高\t户籍所在地\t婚姻状况\t工作经验\t学历\t意向职位性质\t意向行业\t意向工作地区\t意向薪资\t标签\t教育经历\t工作经历\t培训经历\t手机\t邮箱\tQQ\t地址\t个人主页\t最近从事工作\t意向职位\t技能特长\t添加时间\t刷新时间\t简历等级\t完整度\t\n";
        create_excel($top_str, $arr);
        return true;
    } else {
        return false;
    }
}
    //
    // begin by creating pivot table from analyses_output table
    //
    // get full list of analyses
    $result = mysql_query("SELECT name from " . $current_project . ".analyses_list");
    while ($row = mysql_fetch_array($result)) {
        $analyses_list[] = $row[0];
    }
    // get full list of sessions
    $result = mysql_query("SELECT name from " . $current_project . ".session_list");
    while ($row = mysql_fetch_array($result)) {
        $session_list[] = $row[0];
    }
    // now build pivot table query
    $result = mysql_query("DROP TABLE IF EXISTS " . $current_project . ".output");
    $output_trunk = " CREATE TABLE " . $current_project . ".output AS SELECT participant ";
    foreach ($analyses_list as $analysis) {
        foreach ($session_list as $session) {
            $output_trunk .= ", avg(if(session_id = '" . $session . "' and runner='" . $analysis . "', value, NULL)) \n\t  \t\tAS " . $analysis . "_" . $session . "";
        }
    }
    $output_trunk .= " FROM " . $current_project . ".analyses_output GROUP BY participant ";
    $result = mysql_query($output_trunk);
    echo "<div>";
    table_builder($current_project . ".output");
    echo "</div>";
}
if (isset($_GET['create_excel'])) {
    create_excel($current_project . '.output');
    echo "File has been saved. \n  <br><a href='projects/" . $current_project . "/excel_output/" . $current_project . ".output.xls'><button>Click here to open it.</button></a>";
}
Example #3
0
function export_company($yid)
{
    global $db;
    $yid_str = implode(",", $yid);
    $oederbysql = " order BY refreshtime desc ";
    $wheresql = empty($wheresql) ? " uid in ({$yid_str}) " : " and uid in ({$yid_str}) ";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    $data = $db->getall("select * from " . table('company_profile') . $wheresql);
    $result = $data;
    if (!empty($result)) {
        foreach ($result as $key => $value) {
            $arr[$key]['num'] = $key;
            $user = $db->getone("select username from " . table('members') . " where uid=" . $value['uid']);
            $arr[$key]['username'] = $user['username'];
            $arr[$key]['company_id'] = $value['id'];
            $arr[$key]['companyname'] = $value['companyname'];
            $arr[$key]['nature_cn'] = $value['nature_cn'];
            $arr[$key]['trade_cn'] = $value['trade_cn'];
            $arr[$key]['scale_cn'] = $value['scale_cn'];
            $arr[$key]['district_cn'] = $value['district_cn'];
            $arr[$key]['street_cn'] = $value['street_cn'];
            $arr[$key]['registered'] = $value['registered'] . $value['currency'];
            $arr[$key]['contact'] = $value['contact'];
            $arr[$key]['website'] = $value['website'];
            $arr[$key]['telephone'] = $value['telephone'];
            $arr[$key]['address'] = $value['address'];
            $arr[$key]['email'] = $value['email'];
            $arr[$key]['contents'] = str_replace("\n", "", str_replace("\r", "", $value['contents']));
        }
        $top_str = "序号\t所属会员\t公司ID\t公司名称\t公司性质\t行业类别\t公司规模\t所在地区\t所在街道\t注册资金\t联系人\t网址\t联系电话\t联系地址\t联系邮箱\t公司简介\t\n";
        create_excel($top_str, $arr);
        write_log("导出企业uid为" . $yid_str . "的企业资料", $_SESSION['admin_name'], 3);
        return true;
    } else {
        return false;
    }
}