Esempio n. 1
0
/**
 * Preview View
 *
 * The default "Preview" view in WP Job Manager adds a little extra and doesn't
 * use the exact template file that displays what we need. Override it here.
 *
 * @since Jobify 1.6.0
 *
 * @return void
 */
function jobify_preview_handler()
{
    global $job_manager, $post;
    if (version_compare(JOB_MANAGER_VERSION, '1.22.0', '<')) {
        $job_id = WP_Job_Manager_Form_Submit_Job::get_job_id();
        $step = WP_Job_Manager_Form_Submit_Job::get_step();
        $form_name = WP_Job_Manager_Form_Submit_Job::$form_name;
    } else {
        $form = WP_Job_Manager_Form_Submit_Job::instance();
        $job_id = $form->get_job_id();
        $step = $form->get_step();
        $form_name = $form->form_name;
    }
    if ($job_id) {
        $post = get_post($job_id);
        setup_postdata($post);
        ?>
		<form method="post" id="job_preview">
			<div class="job_listing_preview_title">
				<input type="submit" name="continue" id="job_preview_submit_button" class="button" value="<?php 
        echo apply_filters('submit_job_step_preview_submit_text', __('Submit Listing &rarr;', 'jobify'));
        ?>
" />
				<input type="submit" name="edit_job" class="button" value="<?php 
        esc_attr_e('&larr; Edit listing', 'jobify');
        ?>
" />
				<input type="hidden" name="job_id" value="<?php 
        echo esc_attr($job_id);
        ?>
" />
				<input type="hidden" name="step" value="<?php 
        echo esc_attr($step);
        ?>
" />
				<input type="hidden" name="job_manager_form" value="<?php 
        echo $form_name;
        ?>
" />
			</div>
			<?php 
        get_job_manager_template_part('content-single', 'job');
        ?>
		</form>
		<?php 
        wp_reset_postdata();
    }
}
    /**
     * Choose package form
     */
    public static function choose_package($atts = array())
    {
        if (version_compare(JOB_MANAGER_VERSION, '1.22.0', '<')) {
            $job_id = WP_Job_Manager_Form_Submit_Job::get_job_id();
            $step = WP_Job_Manager_Form_Submit_Job::get_step();
            $form_name = WP_Job_Manager_Form_Submit_Job::$form_name;
        } else {
            $form = WP_Job_Manager_Form_Submit_Job::instance();
            $job_id = $form->get_job_id();
            $step = $form->get_step();
            $form_name = $form->form_name;
        }
        $packages = self::get_packages(isset($atts['packages']) ? explode(',', $atts['packages']) : array());
        $user_packages = wc_paid_listings_get_user_packages(get_current_user_id(), 'job_listing');
        $button_text = 'before' !== get_option('job_manager_paid_listings_flow') ? __('Submit &rarr;', 'wp-job-manager-wc-paid-listings') : __('Listing Details &rarr;', 'wp-job-manager-wc-paid-listings');
        ?>
		<form method="post" id="job_package_selection">
			<div class="job_listing_packages_title">
				<input type="submit" name="continue" class="button" value="<?php 
        echo apply_filters('submit_job_step_choose_package_submit_text', $button_text);
        ?>
" />
				<input type="hidden" name="job_id" value="<?php 
        echo esc_attr($job_id);
        ?>
" />
				<input type="hidden" name="step" value="<?php 
        echo esc_attr($step);
        ?>
" />
				<input type="hidden" name="job_manager_form" value="<?php 
        echo $form_name;
        ?>
" />
				<h2><?php 
        _e('Choose a package', 'wp-job-manager-wc-paid-listings');
        ?>
</h2>
			</div>
			<div class="job_listing_packages">
				<?php 
        get_job_manager_template('package-selection.php', array('packages' => $packages, 'user_packages' => $user_packages), 'wc-paid-listings', JOB_MANAGER_WCPL_PLUGIN_DIR . '/templates/');
        ?>
			</div>
		</form>
		<?php 
    }