Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
32 kB
0
Indexable
Never
<?php
/*
 * Template Name: Point Test Calculator
 */
$mailSent = false;
if ($_POST) {
    if (!function_exists('wp_handle_upload')) require_once(ABSPATH . 'wp-admin/includes/file.php');
    if ($_FILES['resume']) {
        $options = array('test_form' => false);
        $f = wp_handle_upload($_FILES['resume'], $options);
    }

    $data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

    $keys = [
        'visa' => 'Which of the following subclasses are you applying for?',
        'age' => 'How old are you',
        'english' => 'What is your English language ability?',
        'qualification' => 'Have you studied in Australia for at least 2 years (92 weeks) which resulted in a degree, diploma, advanced diploma or trade qualification(s) relevant to your nominated occupation?',
        'study_in_region' => 'Have you been awarded a degree, diploma, advanced diploma or trade qualification(s); of at least 2 years (92 weeks) of full-time study in Australia;
                            the campus of your institution is in a regional area and you lived in a regional area during that 2 years?',
        'qualification2' => 'What is your highest Qualification?*',
        'specialist_educational_qualification' => 'Do you have a Masters degree by research or a Doctorate degree from an Australian educational institution that included at least 2 academic years to
                            in a relevant field (Natural and physical sciences, IT, Engineering and related technologies)?',
        'professional_year' => 'Did you complete a professional year in Australia? in your occupation after your studies - currently available for accountants, engineers and IT
                            professionals',
        'oversea_experience' => 'Overseas, in the last 10 years, how long have you worked in your nominated occupation or closely related occupation?*',
        'australian_work_experience' => 'Australian skilled employment, in the last 10 years, in your nominated occupation or closely related skilled occupation:*',
        'partner_skill' => 'Partner Skill Qualifications',
        'designated_language' => 'Designated Language',
        'city' => 'City and country you are living in now?',
        'user_name' => 'Name',
        'email' => 'Email',
        'phone' => 'Phone Number',
        'score' => "Total Score"
    ];
    ob_start(); ?>
    <table cellpadding="5">
        <?php
        foreach ($keys as $key => $v) :?>
            <tr><td><strong><?php echo $v; ?></strong><br/><?php echo $data[$key]; ?></td></tr><?php endforeach; ?>
        <?php if ($f && !isset($f['error'])): ?>
            <tr>
                <td><strong>Resume</strong><br><a href="<?php echo $f['url']; ?>">Download file</a></td>
            </tr>
        <?php endif; ?>
    </table>
    <?php
    $mailContent = ob_get_contents();
    ob_end_clean();
    $errorPack = [];
    if ($_FILES['resume']['error'] != 4 && $f && isset($f['error'])) {
        $errorPack['file'] = $f['error'];
    } else {
        //   $mailSent = wp_mail('info@oracleimmi.com', 'Insta Point Test', $mailContent);
        $mailSent = wp_mail(get_option('admin_email'), 'Insta Point Test', $mailContent);
    }
}
get_header(); ?>
<?php if ($mailSent == true): ?>
    <div class="container pt-4">
        <div class="row">
            <div class="col-sm-12">
                <?php get_template_part('templates/partial', 'breadcrumb'); ?>
                <?php get_template_part('templates/partial', 'title'); ?>


                <?php if ($_POST['score'] >= 65): ?><h3 style="color: #0cca58">Your score is <?php echo $_POST['score']; ?></h3>
                    <p>Congratulations! According to information you entered, it appears that you may meet the requirements for an Australian Skilled visa. Contact us for a full assessment.</p>
                <?php else: ?><h3 style="color: #0cca58">Your score is <?php echo $_POST['score']; ?></h3>
                    <p>As the pass mark for an Australian Skilled visa is 65, you would not appear to meet the criteria for this type of visa. Contact us to see if you are eligible for other
                        visas.</p>
                <?php endif; ?>
            </div>
        </div>
    </div>
<?php else: ?>
    <form id="form" enctype="multipart/form-data" method="post" class="point-test">
        <div class="container pt-4">
            <div class="row">
                <div class="col-sm-12">
                    <?php get_template_part('templates/partial', 'breadcrumb'); ?>
                    <?php get_template_part('templates/partial', 'title'); ?>


                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Visa Subclass</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px">Which of the following subclasses are you applying for?*</label>
                    <?php
                    $items = [
                        'Skilled Work Regional 491 visa (Provisional) - requires sponsorship by a relative living in a regional area or a state or territory government. For further details see the 491 visa page' => 15,
                        'Skilled Nominated 190 visa (permanent) - allows skilled workers who are nominated by an Australian state or territory government live and work in Australia as a permanent resident. Your occupation must be on the 190 visa list' => 5,
                        'Skilled Independent 189 visa (permanent) - skilled workers who are not sponsored by an employer or family member or nominated by a state or territory government.- Your occupation must be on the 189 visa list' => 0
                    ];
                    foreach ($items as $k => $v) : ?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".visa-e" data-point="<?php echo $v; ?>" type="radio" class="form-check-input" value="<?php echo $k; ?>" name="visa"><?php echo $k; ?></label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error visa-e"></div>
                    <div class="visa-s score"></div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Age</div>

                    <div class="form-group">
                        <label for="" style="font-weight: 900; font-size: 20px;">How old are you?*</label>
                        <?php $items = [
                            '18 to 24' => '25',
                            '25 to 32' => '30',
                            '33 to 39' => '25',
                            '40 to 44' => '15'
                        ]; ?>

                        <?php foreach ($items as $k => $v): ?>
                            <div class="form-check">
                                <label class="form-check-label">
                                    <input data-error=".age-e" data-point="<?php echo $v; ?>" type="radio" class="form-check-input" value="<?php echo $k; ?>" name="age"> <?php echo $k; ?>
                                </label>
                            </div>
                        <?php endforeach; ?>

                    </div>
                    <div class="age-e"></div>
                    <div class="score age-s"></div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">English Language Ability</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px; ">What is your English language ability?* </label>
                    <div class="form-check">
                        <div class="row">
                            <div class="col-sm-12 mb-4"><label class="form-check-label">
                                    <input data-point="0" type="radio" class="form-check-input" data-error=".english-e" value="Competent English" name="english">
                                    Competent English:
                                    <div class="detail">
                                        Passport from UK, USA, Ireland, Canada or NZ; or<br>
                                        IELTS: 6+ in each component; or<br>
                                        PTE Academic: 50+ in each component; or<br>
                                        Cambridge (CAE): 169+ in each component; or<br>
                                        TOEFL iBT: 12 in Listening, 13 Reading, 21 Writing, 18 Speaking
                                    </div>
                                </label></div>
                            <div class="col-sm-12 mb-4"><label class="form-check-label">
                                    <input data-error=".english-e" data-point="10" type="radio" class="form-check-input" value="Proficient English" name="english">
                                    Proficient English:
                                    <div class="detail">
                                        IELTS: 7+ in each component; or<br>
                                        OET: B pass in each component; or<br>
                                        PTE Academic: 65+ in each component; or<br>
                                        Cambridge (CAE): 185+ in each component; or<br>
                                        TOEFL iBT: 24 in Listening, 24 Reading, 27 Writing, 23 Speaking
                                    </div>
                                </label></div>
                            <div class="col-sm-12"><label class="form-check-label">
                                    <input data-error=".english-e" data-point="20" type="radio" class="form-check-input" value="Superior English" name="english">
                                    Superior English:
                                    <div class="detail">
                                        IELTS: 8+ in each component; or<br>
                                        OET: A pass in each component; or<br>
                                        PTE Academic: 79+ in each component; or<br>
                                        Cambridge (CAE): 200+ in each component; or<br>
                                        TOEFL iBT: 28 in Listening, 29 Reading, 30 Writing, 26 Speaking
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="error english-e"></div>
                    <div class="score english-s"></div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Australian Educational Qualification</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;"> Have you studied in Australia for at least 2 years (92 weeks) which resulted in a degree, diploma, advanced diploma or trade qualification(s) relevant
                        to
                        your nominated occupation?*</label>
                    <div class="form-check">
                        <label class="form-check-label">
                            <input data-error=".qualification-e" data-point="5" type="radio" class="form-check-input" value="yes" name="qualification">
                            Yes: Degree, diploma advanced diploma or trade qualification(s) taking at least 2 years of full-time study in Australia.
                        </label>
                    </div>
                    <div class="form-check">
                        <label class="form-check-label">
                            <input data-error=".qualification-e" data-point="0" type="radio" class="form-check-input" value="no" name="qualification">
                            No
                        </label>
                    </div>
                    <div class="error qualification-e"></div>
                    <div class="score qualification-s"></div>
                    <!-- -->
                    <div class="show-when-yes" style="display: none;">
                        <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Study in Regional Australia or a Low Population Growth Area</div>
                        <label for="" class="main" style="font-weight: 900; font-size: 20px;">Have you been awarded a degree, diploma, advanced diploma or trade qualification(s); of at least 2 years (92 weeks) of full-time study in Australia;
                            the campus of your institution is in a regional area and you lived in a regional area during that 2 years?*</label>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error="study_in_region-e" required type="radio" class="form-check-input" name="study_in_region" data-point="5" value="Yes">
                                Yes
                            </label>
                        </div>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error="study_in_region-e" required type="radio" class="form-check-input" name="study_in_region" data-point="0" value="No">
                                No
                            </label>
                        </div>
                        <div class="error study_in_region-e"></div>
                        <div class="score study_in_region-s"></div>
                        <!-- -->
                        <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Specialist Educational Qualification</div>
                        <label for="" class="main" style="font-weight: 900; font-size: 20px;">Do you have a Masters degree by research or a Doctorate degree from an Australian educational institution that included at least 2 academic years to
                            in a relevant field (Natural and physical sciences, IT, Engineering and related technologies)?*</label>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".specialist_educational_qualification-e" required type="radio" class="form-check-input" name="specialist_educational_qualification" data-point="5"
                                       value="Yes">
                                Yes
                            </label>
                        </div>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".specialist_educational_qualification-e" required type="radio" class="form-check-input" name="specialist_educational_qualification" data-point="0"
                                       value="No">
                                No
                            </label>
                        </div>
                        <div class="error specialist_educational_qualification-e"></div>
                        <div class="score specialist_educational_qualification-s"></div>
                        <!-- -->
                        <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Professional Year</div>
                        <label for="" class="main" style="font-weight: 900; font-size: 20px;">Did you complete a professional year in Australia? in your occupation after your studies - currently available for accountants, engineers and IT
                            professionals:*</label>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".professional_year-e" required type="radio" class="form-check-input" name="professional_year" data-point="5"
                                       value="Yes">
                                Yes
                            </label>
                        </div>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".professional_year-e" required type="radio" class="form-check-input" name="professional_year" data-point="0"
                                       value="No">
                                No
                            </label>
                        </div>
                        <div class="error professional_year-e"></div>
                        <div class="score professional_year-s"></div>
                    </div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Qualifications</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;">Qualifications </label>
                    <?php $items = [
                        '20: Recognised PhD (Doctorate)' => 20,
                        '15: Recognised Bachelor degree or higher' => 15,
                        '10: Recognised Trade Qualification including' => 10,
                        '0: No Recognised Qualifications' => 0
                    ];
                    foreach ($items as $k => $v): ?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".qu-2" data-point=<?php echo $v; ?> type="radio" class="form-check-input" value="<?php echo $k; ?>" name="qualification2">
                                <?php echo $k; ?>
                            </label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error qu-2"></div>
                    <div class="score qualification2-s"></div>
                    <!-- -->

                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Overseas Work Experience</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;">Overseas, in the last 10 years, how long have you worked in your nominated occupation or closely related occupation?*</label>
                    <?php $items = [
                        '8 Years or more' => 15,
                        '5 Years or more' => 10,
                        '3 Years or more' => 5,
                        'Less than 3 Years' => 0,
                    ];
                    foreach ($items as $k => $v): ?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".oversea-e" data-point=<?php echo $v; ?> type="radio" class="form-check-input" value="<?php echo $k; ?>" name="oversea_experience">
                                <?php echo $k; ?>
                            </label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error oversea-e"></div>
                    <div class="score oversea_experience-s"></div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Australian Work Experience</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;">Australian skilled employment, in the last 10 years, in your nominated occupation or closely related skilled occupation:*</label>
                    <?php $items = [
                        '8 Years or more' => 20,
                        '5 Years or more' => 15,
                        '3 Years or more' => 10,
                        '1 Year or more' => 5,
                        'Less than 1 Year' => 0,
                    ];
                    foreach ($items as $k => $v):?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".awe-e" data-point="<?php echo $v; ?>" type="radio" class="form-check-input" value="<?php echo $k; ?>" name="australian_work_experience">
                                <?php echo $k; ?>
                            </label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error awe-e"></div>
                    <div class="score australian_work_experience-s"></div>

                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Partner Skill Qualifications</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;">Check only ONE box that applies to you*</label>
                    <?php
                    $items = [
                        'My partner has a skills assessment in an occupation on the applicable list and has competent English.' => 10,
                        'My partner has competent English ability (IELTS 6 or equivalent)' => 5,
                        'My partner does not have a skills assessment and cannot get competent English' => 0,
                        'I am single' => 10
                    ];
                    foreach ($items as $item => $v) :?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".psq-e" data-point="<?php echo $v; ?>" type="radio" class="form-check-input" name="partner_skill" value="<?php echo $item; ?>">
                                <?php echo $item; ?>
                            </label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error psq-e"></div>
                    <div class="score partner_skill-s"></div>
                    <!-- -->
                    <div class="divider" style="font-weight: 500; font-size: 16px; margin-top: 3vh">Designated Language</div>
                    <label for="" class="main" style="font-weight: 900; font-size: 20px;">Do any of the following apply to you?*</label>
                    <?php
                    $items = [
                        'My partner has a skills assessment in an occupation on the applicable list and has competent English.Have you been accredited at the paraprofessional level or above, certified at the certified provisional level or above, or have a community language credential for interpreting or translating by the National Accreditation Authority for Translators and Interpreters' => 5,
                        'None of the above' => 0,
                    ];
                    foreach ($items as $item => $v) :?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input data-error=".dl-e" data-point="<?php echo $v; ?>" type="radio" class="form-check-input" name="designated_language" value="<?php echo $item; ?>">
                                <?php echo $item; ?>
                            </label>
                        </div>
                    <?php endforeach; ?>
                    <div class="error dl-e"></div>
                    <div class="score designated_language-s"></div>
                    <div class="row mt-4">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="main" for="" style="font-weight: 900; font-size: 20px; margin-top: 3vh";>City and country you are living in now?</label>
                                <input required type="text"
                                       class="form-control" name="city">

                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="" class="main" style="font-weight: 900; font-size: 20px; margin-top: 3vh";>Name</label>
                                <input required type="text" class="form-control" name="user_name">
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="" class="main" style="font-weight: 900; font-size: 20px; margin-top: 3vh";>Email</label>
                                <input required type="email" class="form-control" name="email">
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="" class="main" style="font-weight: 900; font-size: 20px; margin-top: 3vh";>Phone no.</label>
                                <input type="text" class="form-control" name="phone">
                            </div>
                        </div>
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label for="exampleFormControlFile1" style="font-weight: 900; font-size: 20px; margin-top: 3vh";>Resume</label>
                                <input name="resume" type="file" class="form-control-file" id="exampleFormControlFile1">
                            </div>
                        </div>
                    </div>
                    <input type="text" name="score" id="score" value="0">
                    <button class="btn-primary btn btn-block mb-5" type="submit" style="margin-top: 3vh">Submit</button>
                </div>
            </div>
        </div>

    </form>
    <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script>
    <script>
        (function ($) {
            $(document).ready(function () {
                var totalScore = 0;
                var calculatePoints = {
                    visa: 0,
                    age: 0,
                    english: 0,
                    qualification: 0,
                    qualification2: 0,
                    oversea_experience: 0,
                    australian_work_experience: 0,
                    designated_language: 0,
                    partner_skill: 0,
                    study_in_region: 0,
                    specialist_educational_qualification: 0,
                    professional_year: 0,

                };

                function placeScores() {
                    totalScore = 0;

                    $.each(calculatePoints, function (i, n) {
                        $('.' + i + '-s').text('Score: ' + n);
                        totalScore += +n;
                    });
                    $('#score').val(totalScore);
                }

                $('input[name="visa"]').change(function () {
                    calculatePoints.visa = $(this).attr('data-point');
                    placeScores();
                });
                $('input[name="study_in_region"]').change(function () {
                    calculatePoints.study_in_region = $(this).attr('data-point');
                    placeScores();
                });
                $('input[name="professional_year"]').change(function () {
                    calculatePoints.professional_year = $(this).attr('data-point');
                    placeScores();
                });
                $('input[name="specialist_educational_qualification"]').change(function () {
                    calculatePoints.specialist_educational_qualification = $(this).attr('data-point');
                    placeScores();
                });
                $('input[name="age"]').change(function () {
                    calculatePoints.age = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="english"]').change(function () {
                    calculatePoints.english = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="qualification"]').change(function () {
                    calculatePoints.qualification = $(this).attr('data-point');
                    if ($(this).val() == 'no') {
                        $('.show-when-yes').hide();
                        $('input[name="study_in_region"]').attr('disabled', true);
                        $('input[name="specialist_educational_qualification"]').attr('disabled', true);
                        $('input[name="professional_year"]').attr('disabled', true);
                    } else {
                        $('.show-when-yes').show();
                        $('input[name="study_in_region"]').attr('disabled', false);
                        $('input[name="specialist_educational_qualification"]').attr('disabled', false);
                        $('input[name="professional_year"]').attr('disabled', false);
                    }
                    placeScores();
                });
                $('input[name="qualification2"]').change(function () {
                    calculatePoints.qualification2 = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="oversea_experience"]').change(function () {
                    calculatePoints.oversea_experience = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="australian_work_experience"]').change(function () {
                    calculatePoints.australian_work_experience = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="partner_skill"]').change(function () {
                    calculatePoints.partner_skill = $(this).attr('data-point');
                    placeScores();

                });
                $('input[name="designated_language"]').change(function () {
                    calculatePoints.designated_language = $(this).attr('data-point');
                    placeScores();

                });

                $("#form").validate({
                    rules: {
                        visa: {
                            required: true
                        }, age: {
                            required: true
                        }, english: {
                            required: true
                        }, qualification: {
                            required: true
                        }, qualification2: {
                            required: true
                        }, oversea_experience: {
                            required: true
                        }, australian_work_experience: {
                            required: true
                        }, partner_skill: {
                            required: true
                        }, designated_language: {
                            required: true
                        }
                    }, errorPlacement: function (error, element) {
                        var placement = $(element).data('error');
                        if (placement) {
                            $(placement).append(error)
                        } else {
                            error.insertAfter(element);
                        }
                    },
                    submitHandler: function (form) {

                        form.submit();
                    }

                });

            })
        })(jQuery);
    </script>
<?php endif; ?>

<?php get_footer(); ?>