Exemplo n.º 1
0
 public function editresume()
 {
     if (Auth::check()) {
         $user = Auth::user();
         $id = $user->id;
         $resume = User::find($id)->resume()->first();
         if (!is_null($resume)) {
             $project = Resume::find($id)->userproject()->get();
         }
         return View::make('account.resumes', compact('user', 'resume', 'project'));
     } else {
         return Redirect::guest('ow_login');
     }
 }
Exemplo n.º 2
0
 public function changeheader()
 {
     $this->wrongTokenAjax();
     $imgdata = Input::get('imgdata');
     if (is_null($imgdata)) {
         return 'false';
     }
     $img = str_replace('data:image/png;base64,', '', $imgdata);
     $img = str_replace(' ', '+', $img);
     $data = base64_decode($img);
     $fileName = Auth::user()->id . '/avatar.png';
     $destinationPath = 'uploads/avatars/' . Auth::user()->id;
     if (!is_dir($destinationPath)) {
         if (!mkdir($destinationPath, 0777)) {
             return false;
         }
     }
     $file = $destinationPath . '/avatar.png';
     $sucess = file_put_contents($file, $data);
     $image_size = getimagesize($file);
     print "文件的格式为: " . $image_size[2];
     if ($sucess) {
         $Resum = new Resume();
         if ($Resum->find(Auth::user()->id)) {
             //            $Resum->find(Auth::user()->id)->update(['head_img'=>$filename]);
             DB::table('Resume')->where('user_id', Auth::user()->id)->update(['head_img' => $fileName]);
             DB::table('users')->where('id', Auth::user()->id)->update(['avatar' => $fileName]);
         } else {
             $Resum->user_id = Auth::user()->id;
             $Resum->head_img = $fileName;
             $Resum->save();
             DB::table('users')->where('id', Auth::user()->id)->update(['avatar' => $fileName]);
         }
         return $file;
     }
     return 'false';
 }
Exemplo n.º 3
0
 private function get_resumes()
 {
     $resume = new Resume();
     $criteria = array('columns' => "id, file_name, DATE_FORMAT(modified_on, '%e %b, %Y') AS formatted_modified_on", 'match' => "member = '" . $this->member->getId() . "' AND \n                        deleted = 'N' AND \n                        is_yel_uploaded = FALSE", 'order' => "modified_on DESC");
     return $resume->find($criteria);
 }
Exemplo n.º 4
0
 public function GetSkillByUserid()
 {
     $resume = Resume::find($this->id);
     if (is_null($resume)) {
         return "用户尚未添加";
     }
     $skill = $resume->Skill()->first();
     return $skill->skill;
 }
Exemplo n.º 5
0
 $i = 0;
 foreach ($result as $row) {
     $job_list .= '- ' . htmlspecialchars_decode(stripslashes($row['title'])) . "\n";
     $i++;
 }
 $message = str_replace('%company%', htmlspecialchars_decode(stripslashes($employer->getName())), $message);
 $message = str_replace('%jobs%', $job_list, $message);
 $message = str_replace('%protocol%', $GLOBALS['protocol'], $message);
 $message = str_replace('%root%', $GLOBALS['root'], $message);
 if (!empty($_POST['message'])) {
     $message = str_replace('%message%', "A message from our consultant:\n\n" . $_POST['message'], $message);
 }
 // 2. get the selected resume file
 $criteria = array("columns" => "file_name, file_hash, file_size, file_type", "match" => "id = " . $resume, "limit" => "1");
 $member_resume = new Resume();
 $result = $member_resume->find($criteria);
 $original_filename = explode('.', $result[0]['file_name']);
 $extension = $original_filename[1];
 $resume_file_raw = $resume . '.' . $result[0]['file_hash'];
 $attached_filename = $resume . '.' . $extension;
 $filetype = $result[0]['file_type'];
 $attachment = chunk_split(base64_encode(file_get_contents($GLOBALS['resume_dir'] . '/' . $resume_file_raw)));
 // 3. make mail with attachment
 $subject = '';
 if ($has_many_jobs) {
     $subject = 'Multiple Jobs Applications - Resume #' . $_POST['resume'];
 } else {
     $subject = trim(substr($job_list, 2)) . ' - Resume #' . $_POST['resume'];
 }
 //$headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
 $headers = 'From: ' . $employee->getEmailAddress() . "\n";
Exemplo n.º 6
0
    $data = array();
    $data['remarks'] = sanitize($_POST['remark']);
    if ($member->update($data)) {
        echo 'ok';
    } else {
        echo 'ko';
    }
    exit;
}
if ($_POST['action'] == 'get_resumes') {
    $order_by = 'modified_on desc';
    if (isset($_POST['order_by'])) {
        $order_by = $_POST['order_by'];
    }
    $criteria = array('columns' => 'id, name, private, DATE_FORMAT(modified_on, \'%e %b, %Y\') AS modified_date, file_hash, file_name', 'order' => $order_by, 'match' => 'member = \'' . $_POST['id'] . '\' AND deleted = \'N\'');
    $resumes = Resume::find($criteria);
    $response = array('resumes' => array('resume' => $resumes));
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array($response);
    exit;
}
if ($_POST['action'] == 'save_profile') {
    $member = new Member($_POST['email_addr']);
    $data = array();
    $data['firstname'] = sanitize($_POST['firstname']);
    $data['lastname'] = sanitize($_POST['lastname']);
    $data['phone_num'] = $_POST['phone_num'];
    $data['zip'] = $_POST['zip'];
    $data['country'] = $_POST['country'];
    if (!$member->update($data)) {
        echo 'ko';
Exemplo n.º 7
0
    echo "ko";
    exit;
    //redirect_to('login.php');
}
$xml_dom = new XMLDOM();
if (!isset($_POST['action'])) {
    redirect_to('resumes.php');
}
if ($_POST['action'] == 'get_resumes') {
    $order_by = 'modified_on desc';
    if (isset($_POST['order_by'])) {
        $order_by = $_POST['order_by'];
    }
    $resume = new Resume();
    $criteria = array('columns' => 'id, file_name, DATE_FORMAT(modified_on, \'%e %b, %Y\') AS formatted_modified_on', 'order' => $order_by, 'match' => 'member = \'' . $_POST['id'] . '\' AND deleted = \'N\'');
    $result = $resume->find($criteria);
    $response = array('resumes' => array('resume' => $result));
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array($response);
    exit;
}
if ($_POST['action'] == 'upload') {
    $resume = NULL;
    $member = new Member($_POST['member']);
    $is_update = false;
    $data = array();
    $data['modified_on'] = now();
    $data['name'] = str_replace(array('\'', '"', '\\'), '', basename($_FILES['my_file']['name']));
    $data['private'] = 'N';
    if ($_POST['id'] == '0') {
        $resume = new Resume($member->getId());
Exemplo n.º 8
0
 public function show($_from_search = false)
 {
     $this->begin();
     $this->top_search("Job Details");
     if (!is_null($this->member)) {
         $this->menu('member');
     }
     $this->howitworks();
     $job = $this->job;
     $career = $this->get_member_career();
     $error_message = '';
     if (count($job) <= 0 || is_null($job)) {
         $error_message = 'The job that you are looking for cannot be found.';
     } else {
         if ($job === false) {
             $error_message = 'An error occured while loading the job details.';
         } else {
             if ($job['expired'] >= 0 || $job['closed'] == 'Y') {
                 // $error_message = 'The job that you are looking for is no longer available.';
             }
         }
     }
     // format tags to HTML
     $job['description'] = format_job_description($job['description']);
     $page = file_get_contents(dirname(__FILE__) . '/../../../html/job_page.html');
     $page = str_replace('%root%', $this->url_root, $page);
     $page = str_replace('%job_id%', $this->job_id, $page);
     $toggle = '';
     if (is_null($this->member)) {
         $toggle = '<div class="howitworks_pulldown_bar">
             <div class="pulldown job_page">
                 <a class="no_link how_it_works" onClick="toggle_howitworks();">How Yellow Elevator Works? <img id="howitworks_arrow" src="../common/images/howitworks_down.gif" /></a>
             </div>
         </div>';
     }
     $page = str_replace('%howitworks_toggler%', $toggle, $page);
     if (!empty($error_message)) {
         $page = str_replace('%error_message%', $error_message, $page);
         $page = str_replace('%show_error%', 'block', $page);
         $page = str_replace('%show_job%', 'none', $page);
     } else {
         $page = str_replace('%show_error%', 'none', $page);
         $page = str_replace('%show_job%', 'block', $page);
         $this->add_view_count();
         $page = str_replace('%job_title%', $job['title'], $page);
         $employer_name = $job['employer_name'];
         if (!is_null($job['employer_website_url']) && !empty($job['employer_website_url'])) {
             $employer_name = '<a href="' . $job['employer_website_url'] . '" target="_new">' . $job['employer_name'] . '</a>';
         }
         $page = str_replace('%employer_name%', $employer_name, $page);
         $page = str_replace('%job_description%', $job['description'], $page);
         $employer_country = !is_null($job['state']) && !empty($job['state']) ? $job['state'] . ', ' : '';
         $employer_country .= $job['country_name'];
         $page = str_replace('%employer_country%', $employer_country, $page);
         $page = str_replace('%full_industry%', $job['full_industry'], $page);
         $page = str_replace('%currency%', $job['currency'], $page);
         $salary_range = $job['salary'];
         if ($job['salary_end'] > 0) {
             $salary_range .= ' to ' . $job['salary_end'];
         }
         $page = str_replace('%salary_range%', $salary_range, $page);
         if ($job['salary_negotiable'] == 'Y') {
             $page = str_replace('%negotiable%', '<br/><span class="negotiable">Negotiable</span>', $page);
         } else {
             $page = str_replace('%negotiable%', '', $page);
         }
         $page = str_replace('%expire_on%', $job['formatted_expire_on'], $page);
         $page = str_replace('%potential_reward%', $job['potential_reward'], $page);
         $page = str_replace('%potential_token_reward%', $job['potential_token_reward'], $page);
         if ($_from_search) {
             $page = str_replace('%from_search%', 'default', $page);
         } else {
             $page = str_replace('%from_search%', 'none', $page);
         }
         // popup windows
         // refer
         $refer_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_refer_common_form.html');
         if (!is_null($this->member)) {
             $refer_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_refer_logged_in_form.html');
             $refer_form = str_replace('%refer_member_id%', $this->member->getId(), $refer_form);
             $refer_form = str_replace('%refer_member_fullname%', $this->member->getFullname(), $refer_form);
             $refer_form = str_replace('%refer_member_phone%', $this->member->getPhone(), $refer_form);
         }
         $page = str_replace('<!-- %refer_form% -->', $refer_form, $page);
         // apply
         $apply_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_apply_common_form.html');
         if (!is_null($this->member)) {
             $apply_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_apply_logged_in_form.html');
             $apply_form = str_replace('%apply_member_id%', $this->member->getId(), $apply_form);
             $apply_form = str_replace('%apply_member_fullname%', $this->member->getFullname(), $apply_form);
             $apply_form = str_replace('%apply_member_phone%', $this->member->getPhone(), $apply_form);
             $apply_form = str_replace('%apply_current_pos%', $career['current_position'], $apply_form);
             $apply_form = str_replace('%apply_current_emp%', $career['current_employer'], $apply_form);
             $existing_resumes_select = '<select id="existing_resume" name="existing_resume" onChange="toggle_resume_upload();">' . "\n";
             $existing_resumes_select .= '<option value="0" selected>Choose from one of your pre-uploads</option>' . "\n";
             $existing_resumes_select .= '<option value="0" disabled>&nbsp;</option>' . "\n";
             if ($this->member->hasResume()) {
                 $criteria = array('columns' => 'id, file_name', 'match' => "member = '" . $this->member->getId() . "' AND \n                                    is_yel_uploaded = FALSE");
                 $resume = new Resume();
                 $result = $resume->find($criteria);
                 foreach ($result as $row) {
                     $existing_resumes_select .= '<option value="' . $row['id'] . '">' . $row['file_name'] . '</option>' . "\n";
                 }
                 $existing_resumes_select .= '</select> or<br/>' . "\n";
             }
             $apply_form = str_replace('<!-- %existing_resumes_select% -->', $existing_resumes_select, $apply_form);
         }
         $page = str_replace('<!-- %apply_form% -->', $apply_form, $page);
     }
     echo $page;
 }
Exemplo n.º 9
0
 public function avatarUpload()
 {
     $this->wrongTokenAjax();
     if (!Auth::check()) {
         Redirect::guest('ow_login');
     }
     //        $this->wrongTokenAjax();
     $file = Input::file('uploadImg');
     $input = array('uploadImg' => $file);
     $rules = array('image' => 'uploadImg');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
     }
     $destinationPath = 'uploads/avatars/';
     $filename = $file->getClientOriginalName();
     $filePath_Name = Auth::user()->id . '/' . $filename;
     if (!File::exists(Auth::user()->id)) {
         File::makeDirectory(Auth::user()->id);
     }
     $destinationPath = $destinationPath . Auth::user()->id;
     $file->move($destinationPath, $filename);
     $Resum = new Resume();
     if ($Resum->find(Auth::user()->id)) {
         //            $Resum->find(Auth::user()->id)->update(['head_img'=>$filename]);
         DB::table('Resume')->where('user_id', Auth::user()->id)->update(['head_img' => $filePath_Name]);
         DB::table('users')->where('id', Auth::user()->id)->update(['avatar' => $filePath_Name]);
     } else {
         $Resum->user_id = Auth::user()->id;
         $Resum->head_img = $filePath_Name;
         $Resum->save();
         DB::table('users')->where('id', Auth::user()->id)->update(['avatar' => $filePath_Name]);
     }
     return Response::json(['success' => true, 'avatar' => asset($destinationPath . '/' . $filename)]);
 }
Exemplo n.º 10
0
        redirect_to($GLOBALS['protocol'] . '://' . $GLOBALS['root'] . '/job/' . $job->getId() . '?error=2');
        exit;
    }
} else {
    if ($_POST['existing_resume'] > 0) {
        $data = array();
        $data['existing_resume_id'] = $_POST['existing_resume'];
        $data['resume_file_name'] = 'NULL';
        $data['resume_file_type'] = 'NULL';
        $data['resume_file_hash'] = 'NULL';
        $data['resume_file_size'] = 'NULL';
        $data['resume_file_text'] = 'NULL';
        $referral_buffer->update($data);
        $criteria = array('columns' => "file_hash, file_type, file_name", 'match' => "id = " . $data['existing_resume_id']);
        $cv = new Resume();
        $result = $cv->find($criteria);
        $file_path = $GLOBALS['resume_dir'] . "/" . $data['existing_resume_id'] . '.' . $result[0]['file_hash'];
        $filename = $result[0]['file_name'];
        $file_type = $result[0]['file_type'];
        $has_resume = 'EXISTING';
    }
    // else {
    //     redirect_to($GLOBALS['protocol']. '://'. $GLOBALS['root']. '/job/'. $job->getId(). '?error=3');
    //     exit();
    // }
}
// 4 Send email to team.xx@yellowelevator.com
$mail_lines = file(dirname(__FILE__) . '/private/mail/new_application.txt');
$message = '';
foreach ($mail_lines as $line) {
    $message .= $line;