Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Template Name: Careers form */
- ob_start();
- get_header();
- get_template_part( 'page-templates/vacancy-filter');
- if ( have_posts() ) : while ( have_posts() ) : the_post();
- // $_GET['v'] vervanger voor url rewrite
- $real_publication_id = $wp_query->query_vars['v'];
- $result = overviewdetail($real_publication_id); // selectie van boven.
- $publication_id = $vacancys = $result["CRPublication"];
- $vacancy_id = $vacancys["toVacancy"]["CRVacancy"]["@attributes"]["id"];
- $i = 0;
- $checked_male = '';
- $checked_woman = '';
- ?>
- <section class="content container vervolg">
- <?
- // Check if Vacancy exists
- if($vacancys["@attributes"]["id"] == $real_publication_id): ?>
- <h1 class="h2"><?php echo($vacancys["titleInformation"])?></h1>
- <noscript>
- This content is not available for non-javascript browsers. Please enable JavaScript in you browser.<br><br>
- </noscript>
- <div class="row">
- <div class="col-sm-8" id="formdiv" style="display:none">
- <?php if($_SERVER["REQUEST_METHOD"] == "POST") {
- if(isset($_FILES)) {
- for($i=0; $i<count($_FILES['upload']['name']); $i++) {
- /* switch ($i) {
- case 0:
- $file = 'CV';
- break;
- case 1:
- $file = 'Photo';
- break;
- case 2:
- $file = 'Additional File';
- break;
- default:
- $file = '';
- break;
- }
- */
- //$allowed_ext= array('doc','pdf','docx','zip','rtf');
- $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
- //$file_name = $_FILES['upload']["name"][$i];
- $file_tmp = explode(".", $_FILES['upload']["name"][$i]);
- //$file_ext = strtolower( end(explode('.',$file_name)));
- //$file_size=$_FILES['upload']['size'][$i];
- $newFilePath = $_SERVER['DOCUMENT_ROOT'] . '/user_tmp/';
- $errors=array();
- /* if(!$_FILES['upload']["name"][$i]) {
- $errors[] = $file . ' is required. <br>';
- }else {
- if(in_array($file_ext,$allowed_ext) === false)
- {
- $errors[] = $file . ': File extension not allowed. Please try docx, doc or PDF';
- }
- if($file_size > 2334344)
- {
- $errors[] = 'File size must be under 2mb<br>';
- }
- } */
- //print_r($errors);
- if (!empty($errors)) {
- foreach($errors as $error) {
- echo '<li class="errors">' . $error , '</li>';
- }
- } else {
- if ($tmpFilePath != ""){
- if(
- $_POST['firstName'] &&
- $_POST['lastName']) {
- if($i == 0) {
- $newfilename[$i] = getUrlFriendlyString($vacancys["titleInformation"]).'-'.$_POST['firstName'].'-'.$_POST['lastName'].'-cv.' . end($file_tmp);
- } elseif($i == 1) {
- $newfilename[$i] = getUrlFriendlyString($vacancys["titleInformation"]).'-'.$_POST['firstName'].'-'.$_POST['lastName'].'-motivation.' . end($file_tmp);
- } elseif($i == 2) {
- $newfilename[$i] = getUrlFriendlyString($vacancys["titleInformation"]).'-'.$_POST['firstName'].'-'.$_POST['lastName'].'-foto.' . end($file_tmp);
- }
- } else {
- $newfilename[$i] = $_FILES['upload']["name"][$i];
- }
- $fileContents[$i] = file_get_contents($tmpFilePath);
- $fileContents[$i] = base64_encode($fileContents[$i]);
- //move_uploaded_file($tmpFilePath, $newFilePath.$newfilename[$i]);
- $_SESSION['firstName'] = $_POST['firstName'];
- $_SESSION['gender'] = $_POST['gender'];
- if(isset($_SESSION['gender'])) { if($_SESSION['gender'] == '2541') { $checked_male = 'checked="checked"'; } else { $checked_woman = 'checked="checked"'; } }
- // Setup variables for post Array
- $p_Cv = $newfilename[0];
- $p_Photo = $newfilename[1];
- $p_AdditionalFile = $newfilename[2];
- $p_Cv_FileContents = $fileContents[0];
- $p_Photo_FileContents = $fileContents[1];
- $p_AdditionalFile_FileContents = $fileContents[2];
- $p_Vacancy = getUrlFriendlyString($vacancys["titleInformation"]);
- }
- } // END ERROR CHECK
- } // END FOREACH
- $postArray = array(
- 'toGenderNode' => $_POST['gender'],
- 'firstName' => $_POST['firstName'],
- 'lastName' => $_POST['lastName'],
- 'lastNamePrefix' => $_POST['lastNamePrefix'],
- 'initials' => $_POST['initials'],
- 'suffix' => $_POST['suffix'],
- 'title' => $_POST['title'],
- 'birthDate' => $_POST['birthDate']. ' 00:00:00',
- 'fullAddress' => $_POST['fullAddress'],
- 'homeNumber' => $_POST['homeNumber'],
- 'homeNumberSuffix' => $_POST['homeNumberSuffix'],
- 'homePostalCode' => $_POST['homePostalCode'],
- 'homeCity' => $_POST['homeCity'],
- 'emailAddress' => $_POST['emailAddress'],
- 'phoneNumber' => $_POST['phoneNumber'],
- 'phoneNumberBusiness' => $_POST['phoneNumberBusiness'],
- 'motivation' => $_POST['motivation'],
- 'toCountryNode' => $_POST['country'],
- 'toSourceNode' => $_POST['source'],
- 'Nationality' => $_POST['country'],
- 'privacy' => $_POST['privacy'],
- '70_file' => $p_Cv,
- '4429_file' => $p_AdditionalFile,
- '9006_file' => $p_Photo,
- '70_contents' => $p_Cv_FileContents,
- '4429_contents' => $p_AdditionalFile_FileContents,
- '9006_contents' => $p_Photo_FileContents,
- 'vacancy_id' => $vacancy_id,
- 'publication_id'=> $real_publication_id
- );
- //print_r($postArray);
- // Function to Load data into the Api Function
- $result = emailvancansy($postArray);
- // echo '<pre>';
- // print_r($postArray);
- // echo '</pre>';
- // $wpdb->insert( 'alls_privacy_requests', array
- // (
- // 'p_content' => $_POST['privacy'],
- // 'p_email' => $_POST['emailAddress'],
- // 'p_name' => $_POST['lastName']
- // ),
- // array( '%s','%s' ) );
- $body = json_decode($result['body']);
- if (isset($body->errors) && $body->errors == true) {
- $msg = '<div class="errorwrapper bottommarge">Your request is already in our system. <a href="mailto:recruitment@allseas.com">Please contact us</a> for further information.</div>';
- } else {
- $msg = '<div class="succeswrapper bottommarge">We have received your application for this vacancy. Our Recruitment Department is currently reviewing applications. Please contact us for further information.</div><script type="text/javascript">
- ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
- p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
- };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
- n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d6unz3nsyh8vw.cloudfront.net/3SFv8DuWrRsddehY9xMi45LjA.js","snowplow"));
- window.snowplow(\'newTracker\', \'co\', "com-vonq-main.collector.snplow.net", {
- platform: \'web\',
- post: true,
- contexts: {
- webPage: true,
- performanceTiming: true
- }
- });
- window.snowplow(\'trackSelfDescribingEvent\', {
- schema: \'iglu:com.vonq/step_view/jsonschema/1-2-0\',
- data: {
- label : "application-success",
- // Set this field to a unique id or hash that identifies the job in customer\'s system.
- // Required for websites that don\'t have a uniquely identifying absoulte job URL to match with a campaign
- customerReferenceId: "",
- entity : "ac8ad763-fd70-43b6-b337-eb3474c8a2e7"
- }
- });
- window.snowplow(\'trackSelfDescribingEvent\',{schema:\'iglu:com.vonq/applicant_conversion/jsonschema/1-0-0\',data:{label:"application-success"}});
- window.snowplow(\'enableActivityTracking\',10,10);
- window.snowplow(\'trackPageView\');
- </script>';
- }
- //print_r($postArray);
- if(empty($errors)){echo $msg;}
- } // END FILES
- } // END POST
- else{?>
- <script type="text/javascript">
- ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
- p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
- };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
- n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d6unz3nsyh8vw.cloudfront.net/3SFv8DuWrRsddehY9xMi45LjA.js","snowplow"));
- window.snowplow('newTracker', 'co', "com-vonq-main.collector.snplow.net", {
- platform: 'web',
- post: true,
- contexts: {
- webPage: true,
- performanceTiming: true
- }
- });
- window.snowplow('trackSelfDescribingEvent', {
- schema: 'iglu:com.vonq/step_view/jsonschema/1-2-0',
- data: {
- label : "application-form",
- // Set this field to a unique id or hash that identifies the job in customer's system.
- // Required for websites that don't have a uniquely identifying absoulte job URL to match with a campaign
- customerReferenceId: "",
- entity : "ac8ad763-fd70-43b6-b337-eb3474c8a2e7"
- }
- });
- (function () {
- var vqParam=(location.search.split('_vq=')[1]||'').split('&')[0];
- if (vqParam.length) {
- try {
- var vqString = window.atob(vqParam);
- var vqObj = JSON.parse(vqString);
- window.snowplow('trackSelfDescribingEvent', {
- schema: 'iglu:com.vonq/cta/jsonschema/1-0-1',
- data: vqObj
- });
- } catch (e) {/* Do nothing, invalid input */ };
- }
- }());
- window.snowplow('enableActivityTracking',10,10);
- window.snowplow('trackPageView');
- </script>
- <?php }
- ?>
- <div class="error_box"></div>
- <?php require('Browser.php');
- $browser = new Browser;
- //if($browser->getBrowser() == 'Chrome'):
- // if($_SERVER['REMOTE_ADDR'] != '92.66.166.46') {
- // echo 'The form is temporarily not available. Please use the emailadress: recruitment@allseas.com';
- // } else {
- ?>
- <form class="resume" name="applyform" method="POST" action="" enctype="multipart/form-data" >
- <script>
- /*jQuery(document).ready(function(){
- function truncate(n, len) {
- var ext = n.substring(n.lastIndexOf(".") + 1, n.length).toLowerCase();
- var filename = n.replace('.' + ext,'');
- if(filename.length <= len) {
- return n;
- }
- filename = filename.substr(0, len) + (n.length > len ? '[...]' : '');
- return filename + '.' + ext;
- };
- $("[type=file]").on("change", function(){
- var file = this.files[0].name;
- file = truncate(file, 10)
- var dflt = $(this).attr("placeholder");
- if($(this).val()!=""){
- $(this).next().text(file);
- } else {
- $(this).next().text(dflt);
- }
- });
- });
- */
- </script>
- <script>
- $(function() {
- $( "#datepicker" ).datepicker({changeMonth: true,changeYear: true, yearRange: "-100:+0"});
- });
- </script>
- <div class="radiowrap">
- <input type="radio" name="gender" value='2541' id="male" <?php echo $checked_male ?> required><label for="male">Male</label>
- <input type="radio" name="gender" value='2542' id="female" <?php echo $checked_woman ?> required><label for="female">Female</label>
- </div>
- <input type="hidden" name="vacancy_id" value="<?php echo $vacancy_id ?>" />
- <input type="hidden" name="publication_id" value="<?php echo $real_publication_id ?>" />
- <input type="text" name='firstName' required value='' placeholder="First name *">
- <input type="text" name='lastName' required value='' placeholder="Last name *">
- <input type="text" name='birthDate' value='' placeholder="Date of birth" id="datepicker" >
- <span class="select-icon half" style="margin-right: 0">
- <select name="Nationality" required>
- <option disabled selected style="display:none;" value="">Nationality *</option>
- <option value="">-- select one --</option>
- <?php echo getNationalities(); ?>
- </select>
- </span>
- <input type="email" name='emailAddress' required value='' placeholder="Email address *" >
- <input type="tel" name='phoneNumber' value=''required placeholder="Phone number *" >
- <div class="filewrap">
- <span>Resume (CV) *</span> <input name='upload[]' accept=".doc, .docx, .pdf" required type="file" id="resume" placeholder="Select file" class="bestandje">
- <span id="file_error"></span>
- </div>
- <div class="filewrap">
- <span>Motivation *</span> <input name='upload[]' type="file" id="addfile" required placeholder="Select file">
- <span id="addfile_error"></span>
- </div>
- <div class="filewrap">
- <span>Photo</span> <input name='upload[]' accept="image/*" type="file" id="photo" placeholder="Select file">
- <span id="photo_error"></span>
- </div>
- <span class="select-icon">
- <select name="source" id="">
- <option disabled selected style="display: none"; value="">How did you hear about this vacancy?</option>
- <?php echo getSources(); ?>
- </select>
- </span>
- <!-- <input type="hidden" name="vacancy_id" value="<?php echo $vacancy_id ?>" />
- <input type="hidden" name="publication_id" value="<?php echo $real_publication_id ?>" />
- <input type="text" name='title' value='' placeholder="Title">
- <input type="text" name='initials' value='' placeholder="Initials">
- <input type="text" name='suffix' value='' placeholder="Suffix">
- <input type="text" name='lastName' required value='' placeholder="Last name *">
- <input type="text" name='firstName' required value='' placeholder="First name *">
- <input type="text" name='lastNamePrefix' value='' placeholder="Last name prefix">
- <input type="text" name='birthDate' required value='' placeholder="Date of birth *" id="datepicker" >
- <input type="text" name='fullAddress' required value='' placeholder="Full address *">
- <input type="text" name='homeNumber' required value='' placeholder="Home number *" >
- <input type="text" name='homeNumberSuffix' value='' placeholder="Home number suffix">
- <input type="text" name='homePostalCode' required value='' placeholder="Zip code *" >
- <input type="text" name='homeCity' required value='' placeholder="City *">
- <input type="email" name='emailAddress' required value='' placeholder="Email address *" >
- <input type="tel" name='phoneNumber' value=''required placeholder="Phone number private *" >
- <input type="tel" name='phoneNumberBusiness' value='' placeholder="Phone number work">
- <textarea name='motivation' required placeholder="Motivation *"></textarea>
- <span class="select-icon">
- <select name="country" required>
- <option disabled selected style="display:none;" value="">Select country *</option>
- <?php echo getCountries(); ?>
- </select>
- </span>
- <span class="select-icon">
- <select name="Nationality" required>
- <option disabled selected style="display:none;" value="">Nationality *</option>
- <option value="">-- select one --</option>
- <?php echo getNationalities(); ?>
- </select>
- </span>
- <div class="filewrap">
- <span>Resume (CV) *</span> <input name='upload[]' accept=".doc, .docx, .pdf" required type="file" id="resume" placeholder="Select file" class="bestandje">
- <span id="file_error"></span>
- </div>
- <div class="filewrap">
- <span>Photo</span> <input name='upload[]' accept="image/*" type="file" id="photo" placeholder="Select file">
- <label for="resume">Select file</label><span id="photo_error"></span>
- </div>
- <div class="filewrap">
- <span>Additional file</span> <input name='upload[]' type="file" id="addfile" placeholder="Select file">
- <label for="resume">Select file</label><span id="addfile_error"></span>
- </div> -->
- <div class="radiowrap">
- <p> By clicking βyesβ, you consent to Allseas storing your personal data for up to one year after the end of the application procedure,
- in order for us to consider whether your profile matches other job opportunities within Allseas.<br><br>
- By clicking βnoβ, your personal data will be deleted within four weeks after the conclusion of the application procedure.
- For further information, please read our <a href="<?php echo site_url();?>/privacy" target="_blank">Privacy Policy</a></p>
- <input type="radio" name="privacy" value='yes' id="yes" required><label for="yes">Yes</label>
- <input type="radio" name="privacy" value='no' id="no" required><label for="no">No</label>
- <button type="submit" class="button red">Send application</button>
- <p style="clear:both;">In our <a target="_blank" href="https://allseas.com/applying-for-a-job-at-allseas/">application procedure</a>, you can read what to expect when you apply for a job at Allseas.</p>
- </div>
- </form>
- <?php //}
- //else: ?>
- <!-- <div class="error_box_browser">The form is currently not available in your browser. Please use Google Chrome to apply for this vacancy.</div> -->
- <?php //endif; ?>
- </div>
- <div class="col-sm-4">
- <div class="shadow">
- <table class="vacancydetail">
- <tr>
- <td width="40%">Field:</td>
- <td><?php echo($vacancys["toVacancy"]["CRVacancy"]["toProductTypeNode"]["CRDataNode"]["value"])?></td>
- </tr>
- <tr>
- <td>Discipline:</td>
- <td><?php echo($vacancys["toVacancy"]["CRVacancy"]["toCompany"]["CRCompany"]["name"])?></td>
- </tr>
- <tr>
- <td>Location:</td>
- <td><?php echo($vacancys["workLocation"])?></td>
- </tr>
- <tr>
- <td>Workweek:</td>
- <td><?php echo($vacancys["toVacancy"]["CRVacancy"]["hoursPerWeek"])?> hours</td>
- </tr>
- </table>
- <i>Or call us at <a href="tel:+31 15 2681800">+31 15 2681800</a></i>
- <div class="linkwrap">
- <a href="//www.linkedin.com/shareArticle?mini=true&url=<?php echo site_url() ?>/vacancy/<?php echo $real_publication_id; ?>&title=<?php echo($vacancys["titleInformation"])?>" onclick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=<?php echo site_url() ?>/vacancy/<?php echo $real_publication_id; ?>&title=<?php echo($vacancys["titleInformation"])?>','LinkedIn', 'width=600,height=475,scrollbars=no,toolbar=no,location=no'); return false" alt="LinkedIn" class="symbol linkedin">
- <img src="<?php echo get_template_directory_uri()?>/images/icon-linkedin.png" alt="LinkedIn">
- </a>
- <a href="mailto:<[emailaddress]>?subject=Allseas Vacancy: <?php echo($vacancys["titleInformation"])?>&body=Hi, I found this vacancy and thought you might like it: <?php echo site_url() ?>/vacancy/<?php echo $real_publication_id; ?>"><img src="<?php echo get_template_directory_uri()?>/images/icon-mail.png" alt="E-mail"></a>
- </div>
- </div>
- </div>
- <? else: ?>
- <h1 class="h2">This vacancy does not exists</h1>
- <div class="row">
- <div class="col-sm-12 bottommarge">
- Please use the red filter to find vacancies.
- </div>
- </row>
- <? endif; ?>
- </div>
- </section>
- <script>
- document.getElementById("formdiv").style.display = "block";
- $(".resume").validate({
- invalidHandler: function(event, validator) {
- var errors = validator.numberOfInvalids();
- if (errors) {
- $(".error_box").show();
- }else{
- $(".error_box").hide();
- }
- },
- errorLabelContainer: $(".error_box"),
- rules: {
- homeNumber: {
- required: true,
- number: true,
- maxlength: 9
- },
- homeNumberSuffix: {
- required: false,
- maxlength: 9
- }
- },
- messages: {
- required: "test",
- gender: "Please select your gender.",
- lastName: "Please fill in your last name.",
- firstName: "Please fill in your first name.",
- birthDate: "Please fill in your date of birth.",
- fullAddress: "Please fill in your full address.",
- homeNumber: {required:"Please fill in your home number.",number:"Your House Number contains only numbers",maxlength:"Your House Number must contain not more than 9 characters."},
- homeNumberSuffix: {required:"Please fill in your home number.",maxlength:"Your House Number must contain not more than 9 characters."},
- homePostalCode: "Please fill in your zip code.",
- homeCity: "Please fill in your city.",
- emailAddress: {
- required: "Please fill in your email address.",
- email: "Please fill in a valid email address."
- },
- phoneNumber: {
- required: "Please fill in your work phone number.",
- tel: "Please fill in a valid work phone number."
- },
- motivation: "Please fill in your motivation.",
- country: "Please select your country.",
- Nationality: "Please select your nationality.",
- 'upload[]': "Please upload your resume."
- }
- });
- /*$("input[type='file']").each(function(){
- $(this).rules("add", {
- required:true,
- filesize: 33,
- accept: "png|jpe?g|gif",
- messages: {
- filesize: "Only jpeg, jpg or png images",
- accept: "Only jpeg, jpg or png images"
- }
- });
- });*/
- $('#resume').bind('change', function () {
- document.getElementById('file_error').innerHTML = '';
- var ext = $(this).val().split('.').pop().toLowerCase();
- if($.inArray(ext, ['doc','docx','pdf']) == -1 || this.files[0].size>2334344) {
- if(this.files[0].size>2334344){document.getElementById('file_error').innerHTML = "File size is too large. Max is 2MB. <br />";}
- if($.inArray(ext, ['doc','docx','pdf']) == -1){document.getElementById('file_error').innerHTML = document.getElementById('file_error').innerHTML + "Invalid filetype. The following filetypes are allowed: .doc, .docx, .pdf";}
- document.getElementById('file_error').style.display = 'block';
- this.value = null;
- }else {
- document.getElementById('file_error').style.display = 'none';
- }
- });
- $('#photo').bind('change', function () {
- document.getElementById('photo_error').innerHTML = '';
- var ext = $(this).val().split('.').pop().toLowerCase();
- if($.inArray(ext, ['gif','png','jpg','jpeg']) == -1 || this.files[0].size>2334344) {
- if(this.files[0].size>2334344){document.getElementById('photo_error').innerHTML = "File size is too large. Max is 2MB. <br />";}
- if($.inArray(ext, ['gif','png','jpg','jpeg']) == -1){document.getElementById('photo_error').innerHTML = document.getElementById('photo_error').innerHTML + "Invalid filetype. The following filetypes are allowed: .jpg, .jpeg, .png, .gif";}
- document.getElementById('photo_error').style.display = 'block';
- this.value = null;
- }else {
- document.getElementById('file_error').style.display = 'none';
- }
- });
- $('#addfile').bind('change', function () {
- document.getElementById('addfile_error').innerHTML = '';
- if(this.files[0].size>2334344) {
- document.getElementById('addfile_error').innerHTML = "File size is too large. Max is 2MB.";
- document.getElementById('addfile_error').style.display = 'block';
- this.value = null;
- }else {
- document.getElementById('file_error').style.display = 'none';
- }
- });
- </script>
- <?php
- /*
- if(isset($_FILES['file']['tmp_name']))
- {
- // Number of uploaded files
- $num_files = count($_FILES['file']['tmp_name']);
- print $num_files;
- for($i=0; $i < $num_files;$i++)
- {
- // check if there is a file in the array
- if(!is_uploaded_file($_FILES['file']['tmp_name'][$i]))
- {
- $messages[] = 'No file uploaded';
- }
- else
- {
- // copy the file to the specified dir
- if(@copy($_FILES['file']['tmp_name'][$i], $_SERVER['DOCUMENT_ROOT'] . '/user_tmp/'.$_FILES['file']['name'][$i]))
- {
- $messages[] = $_FILES['file']['name'][$i].' uploaded';
- }
- else
- {
- $messages[] = 'Uploading '.$_FILES['file']['name'][$i].' Failed';
- }
- }
- }
- }
- */
- endwhile; endif;
- get_template_part('page-templates/ajaxFilter'); ?>
- <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment