/** * JobRoller Edit Job form * Function outputs the job edit form * * * @version 1.0 * @author AppThemes * @package JobRoller * @copyright 2010 all rights reserved * */ function jr_edit_job_form($relisting = false) { global $post, $posted, $job_details; jr_geolocation_scripts(); ?> <form action="<?php echo get_permalink($post->ID); ?> ?edit=<?php echo $job_details->ID; ?> " method="post" enctype="multipart/form-data" id="submit_form" class="submit_form main_form"> <fieldset> <legend><?php _e('Company Details', 'appthemes'); ?> </legend> <p><?php _e('Fill in the company section to provide details of the company listing the job. Leave this section blank to show your display name and profile page link instead.', 'appthemes'); ?> </p> <p class="optional"><label for="your_name"><?php _e('Your Name/Company Name', 'appthemes'); ?> </label> <input type="text" class="text" name="your_name" id="your_name" value="<?php if (isset($posted['your_name'])) { echo $posted['your_name']; } else { echo get_post_meta($job_details->ID, '_Company', true); } ?> " /></p> <p class="optional"><label for="website"><?php _e('Website', 'appthemes'); ?> </label> <input type="text" class="text" name="website" value="<?php if (isset($posted['website'])) { echo $posted['website']; } else { echo get_post_meta($job_details->ID, '_CompanyURL', true); } ?> " placeholder="http://" id="website" /></p> <p class="optional"><label for="company-logo"><?php _e('Logo (.jpg, .gif or .png)', 'appthemes'); ?> </label> <input type="file" class="text" name="company-logo" id="company-logo" /></p> </fieldset> <fieldset> <legend><?php _e('Job Details', 'appthemes'); ?> </legend> <p><?php _e('Enter details about the job below. Be as descriptive as possible so that potential candidates can find your job listing easily.', 'appthemes'); ?> </p> <p><label for="job_title"><?php _e('Job title', 'appthemes'); ?> <span title="required">*</span></label> <input type="text" class="text" name="job_title" id="job_title" value="<?php if (isset($posted['job_title'])) { echo $posted['job_title']; } else { echo $job_details->post_title; } ?> " /></p> <p><label for="job_type"><?php _e('Job type', 'appthemes'); ?> <span title="required">*</span></label> <select name="job_term_type" id="job_type"> <?php $job_types = get_terms('job_type', array('hide_empty' => '0')); if ($job_types && sizeof($job_types) > 0) { foreach ($job_types as $type) { ?> <option value="<?php echo $type->slug; ?> " <?php if (isset($posted['job_term_type'])) { if ($posted['job_term_type'] == $type->slug) { echo 'selected="selected"'; } } else { $job_has_terms = array(); $get_terms = wp_get_post_terms($job_details->ID, 'job_type'); foreach ($get_terms as $term) { $job_has_terms[] = $term->slug; } if (in_array($type->slug, $job_has_terms)) { echo 'selected="selected"'; } } ?> ><?php echo $type->name; ?> </option> <?php } } ?> </select></p> <p class="<?php if (get_option('jr_submit_cat_required') !== 'yes') { echo 'optional'; } ?> "><label for="job_cat"><?php _e('Job Category', 'appthemes'); ?> <?php if (get_option('jr_submit_cat_required') == 'yes') { ?> <span title="required">*</span><?php } ?> </label> <?php $sel = 0; global $featured_job_cat_id; if (isset($posted['job_term_cat']) && $posted['job_term_cat'] > 0) { $sel = $posted['job_term_cat']; } else { $get_terms = wp_get_post_terms($job_details->ID, 'job_cat'); foreach ($get_terms as $term) { if ($term->term_id !== $featured_job_cat_id) { $sel = $term->term_id; } } } $args = array('orderby' => 'name', 'exclude' => $featured_job_cat_id, 'order' => 'ASC', 'name' => 'job_term_cat', 'hierarchical' => 1, 'echo' => 0, 'class' => 'job_cat', 'selected' => $sel, 'taxonomy' => 'job_cat', 'hide_empty' => false); $dropdown = wp_dropdown_categories($args); $dropdown = str_replace('class=\'job_cat\' >', 'class=\'job_cat\' ><option value="">Select a category…</option>', $dropdown); echo $dropdown; ?> </p> <?php if (get_option('jr_enable_salary_field') !== 'no') { ?> <p class="optional"><label for="job_term_salary"><?php _e('Job Salary', 'appthemes'); ?> </label> <?php $sel = 0; if (isset($posted['job_term_salary']) && $posted['job_term_salary'] > 0) { $sel = $posted['job_term_salary']; } else { $get_terms = wp_get_post_terms($job_details->ID, 'job_salary'); foreach ($get_terms as $term) { $sel = $term->term_id; } } $args = array('orderby' => 'ID', 'order' => 'ASC', 'name' => 'job_term_salary', 'hierarchical' => 1, 'echo' => 0, 'class' => 'job_salary', 'selected' => $sel, 'taxonomy' => 'job_salary', 'hide_empty' => false); $dropdown = wp_dropdown_categories($args); $dropdown = str_replace('class=\'job_salary\' >', 'class=\'job_salary\' ><option value="">Select a salary…</option>', $dropdown); echo $dropdown; ?> </p><?php } ?> <p class="optional"><label for="tags"><?php _e('Tags (comma separated)', 'appthemes'); ?> </label> <input type="text" class="text" name="tags" value="<?php if (isset($posted['tags'])) { echo $posted['tags']; } else { $job_tags = array(); $get_terms = wp_get_post_terms($job_details->ID, 'job_tag'); foreach ($get_terms as $term) { $job_tags[] = $term->name; } echo implode(', ', $job_tags); } ?> " id="tags" /></p> </fieldset> <fieldset> <legend><?php _e('Job Location', 'appthemes'); ?> </legend> <p><?php _e('Leave blank if the location of the applicant does not matter e.g. the job involves working from home.', 'appthemes'); ?> </p> <div id="geolocation_box"> <p><label><input id="geolocation-load" type="button" class="button geolocationadd" value="<?php _e('Find Address/Location', 'appthemes'); ?> " /></label> <input type="text" class="text" name="jr_address" id="geolocation-address" value="<?php if (isset($posted['jr_address'])) { echo $posted['jr_address']; } else { echo get_post_meta($job_details->ID, 'geo_address', true); } ?> " /><input type="hidden" class="text" name="jr_geo_latitude" id="geolocation-latitude" value="<?php if (isset($posted['jr_geo_latitude'])) { echo $posted['jr_geo_latitude']; } else { echo get_post_meta($job_details->ID, '_jr_geo_latitude', true); } ?> " /><input type="hidden" class="text" name="jr_geo_longitude" id="geolocation-longitude" value="<?php if (isset($posted['jr_geo_longitude'])) { echo $posted['jr_geo_longitude']; } else { echo get_post_meta($job_details->ID, '_jr_geo_longitude', true); } ?> " /></p> <div id="map_wrap" style="border:solid 2px #ddd;"><div id="geolocation-map" style="width:100%;height:350px;"></div></div> </div> </fieldset> <fieldset> <legend><?php _e('Job Description', 'appthemes'); ?> </legend> <p><?php _e('Give details about the position, such as responsibilities & salary.', 'appthemes'); if (get_option('jr_html_allowed') == 'no') { _e(' HTML is not allowed.', 'appthemes'); } ?> </p> <p><textarea rows="5" cols="30" name="details" id="details" class="mceEditor"><?php if (isset($posted['details'])) { echo $posted['details']; } else { echo $job_details->post_content; } ?> </textarea></p> </fieldset> <?php if (get_option('jr_submit_how_to_apply_display') == 'yes') { ?> <fieldset> <legend><?php _e('How to apply', 'appthemes'); ?> </legend> <p><?php _e('Tell applicants how to apply – they will also be able to email you via the “apply” form on your job listing\'s page.', 'appthemes'); if (get_option('jr_html_allowed') == 'no') { _e(' HTML is not allowed.', 'appthemes'); } ?> </p> <p><textarea rows="5" cols="30" name="apply" id="apply" class="how mceEditor"><?php if (isset($posted['apply'])) { echo $posted['apply']; } else { echo get_post_meta($job_details->ID, '_how_to_apply', true); } ?> </textarea></p> </fieldset><?php } ?> <?php if ($relisting) { $packs = jr_get_job_packs(); $user_packs = jr_get_user_job_packs(); if (sizeof($packs) > 0 || sizeof($user_packs) > 0) { echo '<h2 style="margin-top: 20px;">' . __('Select a Job Pack:', 'appthemes') . '</h2>'; echo '<ul class="packs">'; $checked = 'checked="checked"'; if (sizeof($user_packs) > 0) { foreach ($user_packs as $pack) { $choose_or_use = __('Choose this pack', 'appthemes'); if (!$pack->jobs_limit) { $pack->jobs_count = __('Unlimited', 'appthemes') . ' ' . __('Jobs remaining', 'appthemes'); } else { $pack->jobs_count = $pack->jobs_limit - $pack->jobs_count; if ($pack->jobs_count == 1) { $pack->jobs_count = $pack->jobs_count . ' ' . __('Job remaining', 'appthemes'); } else { $pack->jobs_count = $pack->jobs_count . ' ' . __('Jobs remaining', 'appthemes'); } } if ($pack->pack_expires) { $pack->pack_expires = __('Usable before ', 'appthemes') . mysql2date(get_option('date_format'), $pack->pack_expires); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } echo '<li><span class="cost">' . __('Purchased', 'appthemes') . '</span><h3>' . $pack->pack_name . '</h3> <p>' . $pack->jobs_count . '' . $pack->job_duration . '. ' . $pack->pack_expires . '.</p> <div><label>' . $choose_or_use . ': <input type="radio" name="job_pack" value="user_' . $pack->id . '" ' . $checked . ' /></label></div> </li>'; $checked = ''; } } if (sizeof($packs) > 0) { foreach ($packs as $pack) { $choose_or_use = ''; if (!$pack->job_count) { $pack->job_count = __('Unlimited', 'appthemes'); } if ($pack->pack_duration) { $pack->pack_duration = __(' usable within ', 'appthemes') . $pack->pack_duration . __(' days', 'appthemes'); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } if ($pack->pack_cost) { $pack->pack_cost = jr_get_currency($pack->pack_cost) . ''; $choose_or_use = __('Buy this pack', 'appthemes'); } else { $pack->pack_cost = __('Free', 'appthemes'); $choose_or_use = __('Choose this pack', 'appthemes'); } echo '<li><span class="cost">' . $pack->pack_cost . '</span><h3>' . $pack->pack_name . ' – <small>' . $pack->pack_description . '</small></h3> <p>' . $pack->job_count . ' ' . __('Jobs', 'appthemes') . '' . $pack->job_duration . $pack->pack_duration . '.</p> <div><label>' . $choose_or_use . ': <input type="radio" name="job_pack" value="' . $pack->id . '" ' . $checked . ' /></label></div> </li>'; $checked = ''; } } echo '</ul>'; } echo '<input type="hidden" name="relist" value="true" />'; ?> <?php $featured_cost = get_option('jr_cost_to_feature'); if ($featured_cost && is_numeric($featured_cost) && $featured_cost > 0) { // Featuring is an option echo '<h2>' . __('Feature your listing for ', 'appthemes') . jr_get_currency($featured_cost) . __('?', 'appthemes') . '</h2>'; echo '<p>' . __('Featured listings are displayed on the homepage and are also highlighted in all other listing pages.', 'appthemes') . '</p>'; echo '<p><input type="checkbox" name="featureit" id="featureit" /> <label for="featureit" style="float:none">' . __('Yes please, feature my listing.', 'appthemes') . '</label></p>'; } } ?> <p><input type="submit" class="submit" name="job_submit" value="<?php if ($relisting) { _e('Relist →', 'appthemes'); } else { _e('Save →', 'appthemes'); } ?> " /></p> <div class="clear"></div> </form> <?php if (get_option('jr_html_allowed') == 'yes') { jr_tinymce(); } ?> <?php }
function jr_dashboard_charts() { global $wpdb; $sql = "SELECT COUNT(post_title) as total, post_date FROM " . $wpdb->posts . " WHERE post_type = 'job_listing' AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "' GROUP BY DATE(post_date) DESC"; $results = $wpdb->get_results($sql); $listings = array(); // put the days and total posts into an array foreach ($results as $result) { $the_day = date('Y-m-d', strtotime($result->post_date)); $listings[$the_day] = $result->total; } // setup the last 30 days for ($i = 0; $i < 30; $i++) { $each_day = date('Y-m-d', strtotime('-' . $i . ' days')); // if there's no day with posts, insert a goose egg if (!in_array($each_day, array_keys($listings))) { $listings[$each_day] = 0; } } // sort the values by date ksort($listings); // print_r($listings); // Get sales - completed orders with a cost $sql = "SELECT SUM(cost) as total, order_date FROM " . $wpdb->prefix . "jr_orders WHERE status = 'completed' AND order_date > '" . date('Y-m-d', strtotime('-30 days')) . "' GROUP BY DATE(order_date) DESC"; $results = $wpdb->get_results($sql); $sales = array(); // put the days and total posts into an array foreach ($results as $result) { $the_day = date('Y-m-d', strtotime($result->order_date)); $sales[$the_day] = $result->total; } // setup the last 30 days for ($i = 0; $i < 30; $i++) { $each_day = date('Y-m-d', strtotime('-' . $i . ' days')); // if there's no day with posts, insert a goose egg if (!in_array($each_day, array_keys($sales))) { $sales[$each_day] = 0; } } // sort the values by date ksort($sales); ?> <div id="placeholder"></div> <script language="javascript" type="text/javascript"> // <![CDATA[ jQuery(function () { var posts = [ <?php foreach ($listings as $day => $value) { $sdate = strtotime($day); $sdate = $sdate * 1000; // js timestamps measure milliseconds vs seconds $newoutput = "[{$sdate}, {$value}],\n"; //$theoutput[] = $newoutput; echo $newoutput; } ?> ]; var sales = [ <?php foreach ($sales as $day => $value) { $sdate = strtotime($day); $sdate = $sdate * 1000; // js timestamps measure milliseconds vs seconds $newoutput = "[{$sdate}, {$value}],\n"; //$theoutput[] = $newoutput; echo $newoutput; } ?> ]; var placeholder = jQuery("#placeholder"); var output = [ { data: posts, label: "<?php _e('New Job Listings', 'appthemes'); ?> ", symbol: '' }, { data: sales, label: "<?php _e('Total Sales', 'appthemes'); ?> ", symbol: '<?php echo jr_get_currency(); ?> ', yaxis: 2 } ]; var options = { series: { lines: { show: true }, points: { show: true } }, grid: { tickColor:'#f4f4f4', hoverable: true, clickable: true, borderColor: '#f4f4f4', backgroundColor:'#FFFFFF' }, xaxis: { mode: 'time', timeformat: "%m/%d" }, yaxis: { min: 0 }, y2axis: { min: 0, tickFormatter: function (v, axis) { return "<?php echo jr_get_currency_in_position('left'); ?> " + v.toFixed(axis.tickDecimals) + "<?php echo jr_get_currency_in_position('right'); ?> " }}, legend: { position: 'nw' } }; jQuery.plot(placeholder, output, options); // reload the plot when browser window gets resized jQuery(window).resize(function() { jQuery.plot(placeholder, output, options); }); function showChartTooltip(x, y, contents) { jQuery('<div id="charttooltip">' + contents + '</div>').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, opacity: 1 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#placeholder").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.datapoint) { previousPoint = item.datapoint; jQuery("#charttooltip").remove(); var x = new Date(item.datapoint[0]), y = item.datapoint[1]; var xday = x.getDate(), xmonth = x.getMonth()+1; // jan = 0 so we need to offset month showChartTooltip(item.pageX, item.pageY, xmonth + "/" + xday + " - <b>" + item.series.symbol + y + "</b> " + item.series.label); } } else { jQuery("#charttooltip").remove(); previousPoint = null; } }); }); // ]]> </script> <?php }
function jr_job_packs() { global $message, $errors, $posted; $errors = new WP_Error(); $message = ''; jr_add_job_pack(); $packs = jr_get_job_packs(); if (sizeof($packs) > 0) { echo '<ul class="packs">'; foreach ($packs as $pack) { if (!$pack->job_count) { $pack->job_count = __('Unlimited', 'appthemes'); } if ($pack->pack_duration) { $pack->pack_duration = __(' usable within ', 'appthemes') . $pack->pack_duration . __(' days', 'appthemes'); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } if ($pack->pack_cost) { $pack->pack_cost = jr_get_currency($pack->pack_cost) . ''; } else { $pack->pack_cost = __('Free', 'appthemes'); } echo '<li><span class="cost">' . $pack->pack_cost . '</span><h3>' . $pack->pack_name . ' – <small>' . $pack->pack_description . '</small></h3> <p>' . $pack->job_count . ' ' . __('Jobs', 'appthemes') . '' . $pack->job_duration . $pack->pack_duration . '.</p> <p><a href="admin.php?page=jobpacks&edit=' . $pack->id . '">Edit Pack</a></p> <p><a href="admin.php?page=jobpacks&delete=' . $pack->id . '" class="deletepack">Delete this pack</a></p> </li>'; } echo '</ul>'; } ?> <script type="text/javascript"> /* <![CDATA[ */ jQuery('a.deletepack').click(function(){ var answer = confirm ("<?php _e('Are you sure you want to delete this pack? This action cannot be undone...', 'appthemes'); ?> ") if (answer) return true; return false; }); /* ]]> */ </script> <h3><?php _e('Create a New Job Pack', 'appthemes'); ?> </h3> <p><?php _e('Job Packs let you define packages that customers can purchase in order to post multiple/single jobs for varying durations. Once you add a pack the values on the "pricing" page will no longer be used.', 'appthemes'); ?> </p> <?php jr_show_errors($errors); if (isset($message) && !empty($message)) { echo '<p class="success">' . $message . '</p>'; } ?> <form method="post" id="mainform" action=""> <table class="widefat fixed" id="tblspacer" style="width:850px;"> <thead> <tr> <th scope="col" width="200px"><?php _e('Job Pack Details', 'appthemes'); ?> </th> <th scope="col"> </th> </tr> </thead> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a name for this pack. This will be visible on the website', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Name', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_name" id="pack_name" type="text" value="<?php if (isset($posted['pack_name'])) { echo $posted['pack_name']; } ?> " class="required" /></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a description for this pack. This will be visible on the website', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Description', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_description" id="pack_description" type="text" value="<?php if (isset($posted['pack_description'])) { echo $posted['pack_description']; } ?> " class="required" /></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter the number of days', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Duration', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_duration" id="pack_duration" type="text" value="<?php if (isset($posted['pack_duration'])) { echo $posted['pack_duration']; } ?> " /><br/><small><?php _e('Days this pack remains valid to use. Leave blank if it never expires.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value, do not include currency values.', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Cost', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_cost" id="pack_cost" type="text" value="<?php if (isset($posted['pack_cost'])) { echo $posted['pack_cost']; } ?> " /><br/><small><?php _e('Pack cost. Leave blank if free.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value or leave blank', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Job Count', 'appthemes'); ?> :</td> <td class="forminp"><input name="job_count" id="job_count" type="text" value="<?php if (isset($posted['job_count'])) { echo $posted['job_count']; } ?> " /><br/><small><?php _e('How many jobs can the user list with this pack? Leave blank for an <em>unlimited</em> amount.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value or leave blank', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Job Duration', 'appthemes'); ?> :</td> <td class="forminp"><input name="job_duration" id="job_duration" type="text" value="<?php if (isset($posted['job_duration'])) { echo $posted['job_duration']; } ?> " class="required" /><br/><small><?php _e('How long do jobs last? e.g. <code>30</code> for 30 days. Leave blank for endless jobs.', 'appthemes'); ?> </small></td> </tr> </table> <p class="submit bbot"><input name="save" type="submit" value="<?php _e('Create Job Pack', 'appthemes'); ?> " /> <input name="submitted" type="hidden" value="yes" /></p> </form> <?php }
/** * JobRoller Preview Job form * Function outputs the job preview form * * * @version 1.0 * @author AppThemes * @package JobRoller * @copyright 2010 all rights reserved * */ function jr_preview_job_form() { global $post, $posted; ?> <form action="<?php echo get_permalink($post->ID); ?> " method="post" enctype="multipart/form-data" id="submit_form" class="submit_form main_form"> <p><?php _e('Below is a preview of what your job listing will look like when published:', 'appthemes'); ?> </p> <ol class="jobs"> <li class="job <?php if ($alt == 1) { echo 'job-alt'; } ?> " style="padding-left:0; padding-right:0;"><dl> <dt><?php _e('Type', 'appthemes'); ?> </dt> <dd class="type"><?php $job_type = get_term_by('slug', sanitize_title($posted['job_term_type']), 'job_type'); echo '<span class="' . $job_type->slug . '">' . wptexturize($job_type->name) . '</span>'; ?> </dd> <dt><?php _e('Job', 'appthemes'); ?> </dt> <dd class="title"><strong><?php echo $posted['job_title']; ?> </strong><?php $author = get_user_by('id', get_current_user_id()); if ($posted['your_name']) { echo $posted['your_name']; if ($author && ($link = get_author_posts_url($author->ID, $author->user_nicename))) { echo sprintf(__(' – Posted by <a href="%s">%s</a>', 'appthemes'), $link, $author->display_name); } } else { if ($author && ($link = get_author_posts_url($author->ID, $author->user_nicename))) { echo sprintf(__('<a href="%s">%s</a>', 'appthemes'), $link, $author->display_name); } } ?> </dd> <dt><?php _e('_Location', 'appthemes'); ?> </dt> <dd class="location"><?php $latitude = jr_clean_coordinate($posted['jr_geo_latitude']); $longitude = jr_clean_coordinate($posted['jr_geo_longitude']); if ($latitude && $longitude) { $address = jr_reverse_geocode($latitude, $longitude); echo '<strong>' . wptexturize($address['short_address']) . '</strong> ' . wptexturize($address['short_address_country']) . ''; } else { echo '<strong>Anywhere</strong>'; } ?> </dd> <dt><?php _e('Date Posted', 'appthemes'); ?> </dt> <dd class="date"><strong><?php echo date_i18n(__('j M', 'appthemes')); ?> </strong> <span class="year"><?php echo date_i18n(__('Y', 'appthemes')); ?> </span></dd> </dl></li> </ol> <p><?php _e('The job listing’s page will contain the following information:', 'appthemes'); ?> </p> <blockquote> <h2><?php _e('Job description', 'appthemes'); ?> </h2> <?php echo wpautop(wptexturize($posted['details'])); ?> <?php if (get_option('jr_submit_how_to_apply_display') == 'yes') { ?> <h2><?php _e('How to apply', 'appthemes'); ?> </h2> <?php echo wpautop(wptexturize($posted['apply'])); ?> <?php } ?> </blockquote> <?php $packs = jr_get_job_packs(); $user_packs = jr_get_user_job_packs(); if (sizeof($packs) > 0 || sizeof($user_packs) > 0) { echo '<h2>' . __('Select a Job Pack:', 'appthemes') . '</h2>'; echo '<ul class="packs">'; $checked = 'checked="checked"'; if (sizeof($user_packs) > 0) { foreach ($user_packs as $pack) { $choose_or_use = __('Choose this pack', 'appthemes'); if (!$pack->jobs_limit) { $pack->jobs_count = __('Unlimited', 'appthemes') . ' ' . __('Jobs remaining', 'appthemes'); } else { $pack->jobs_count = $pack->jobs_limit - $pack->jobs_count; if ($pack->jobs_count == 1) { $pack->jobs_count = $pack->jobs_count . ' ' . __('Job remaining', 'appthemes'); } else { $pack->jobs_count = $pack->jobs_count . ' ' . __('Jobs remaining', 'appthemes'); } } if ($pack->pack_expires) { $pack->pack_expires = __('Usable before ', 'appthemes') . mysql2date(get_option('date_format'), $pack->pack_expires); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } echo '<li><span class="cost">' . __('Purchased', 'appthemes') . '</span><h3>' . $pack->pack_name . '</h3> <p>' . $pack->jobs_count . '' . $pack->job_duration . '. ' . $pack->pack_expires . '.</p> <div><label>' . $choose_or_use . ': <input type="radio" name="job_pack" value="user_' . $pack->id . '" ' . $checked . ' /></label></div> </li>'; $checked = ''; } } if (sizeof($packs) > 0) { foreach ($packs as $pack) { $choose_or_use = ''; if (!$pack->job_count) { $pack->job_count = __('Unlimited', 'appthemes'); } if ($pack->pack_duration) { $pack->pack_duration = __(' usable within ', 'appthemes') . $pack->pack_duration . __(' days', 'appthemes'); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } if ($pack->pack_cost) { $pack->pack_cost = jr_get_currency($pack->pack_cost) . ''; $choose_or_use = __('Buy this pack', 'appthemes'); } else { $pack->pack_cost = __('Free', 'appthemes'); $choose_or_use = __('Choose this pack', 'appthemes'); } echo '<li><span class="cost">' . $pack->pack_cost . '</span><h3>' . $pack->pack_name . ' – <small>' . $pack->pack_description . '</small></h3> <p>' . $pack->job_count . ' ' . __('Jobs', 'appthemes') . '' . $pack->job_duration . $pack->pack_duration . '.</p> <div><label>' . $choose_or_use . ': <input type="radio" name="job_pack" value="' . $pack->id . '" ' . $checked . ' /></label></div> </li>'; $checked = ''; } } echo '</ul>'; } ?> <?php $featured_cost = get_option('jr_cost_to_feature'); if ($featured_cost && is_numeric($featured_cost) && $featured_cost > 0) { // Featuring is an option echo '<h2>' . __('Feature your listing for ', 'appthemes') . jr_get_currency($featured_cost) . __('?', 'appthemes') . '</h2>'; echo '<p>' . __('Featured listings are displayed on the homepage and are also highlighted in all other listing pages.', 'appthemes') . '</p>'; echo '<p><input type="checkbox" name="featureit" id="featureit" /> <label for="featureit" style="float:none">' . __('Yes please, feature my listing.', 'appthemes') . '</label></p>'; } ?> <p> <input type="submit" name="goback" class="goback" value="<?php _e('Go Back', 'appthemes'); ?> " /> <input type="submit" class="submit" name="preview_submit" value="<?php _e('Next →', 'appthemes'); ?> " /> <input type="hidden" value='<?php echo htmlentities(json_encode($posted), ENT_QUOTES); ?> ' name="posted" /> </p> <div class="clear"></div> </form> <?php }
function jr_order_complete($order) { global $jr_log; $ordersurl = admin_url("admin.php?page=orders&show=completed"); $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = __('Dear Admin,', 'appthemes') . PHP_EOL . PHP_EOL; $message .= sprintf(__('Order number %s has just been completed on your %s website.', 'appthemes'), $order->id, $blogname) . PHP_EOL . PHP_EOL; $message .= __('Order Details', 'appthemes') . PHP_EOL; $message .= __('-----------------') . PHP_EOL; $message .= __('Order Date: ', 'appthemes') . $order->order_date . PHP_EOL; $message .= __('Order Cost: ', 'appthemes') . jr_get_currency($order->cost) . PHP_EOL; $message .= __('User ID: ', 'appthemes') . $order->user_id . PHP_EOL; $message .= __('Pack ID: ', 'appthemes') . $order->pack_id . PHP_EOL; $message .= __('Job ID: ', 'appthemes') . $order->job_id . PHP_EOL; if ($order->payment_date) { $message .= __('Payment Date: ', 'appthemes') . $order->payment_date . PHP_EOL; } if ($order->payment_type) { $message .= __('Payment Type: ', 'appthemes') . $order->payment_type . PHP_EOL; } if ($order->approval_method) { $message .= __('Approval Method: ', 'appthemes') . $order->approval_method . PHP_EOL; } if ($order->payer_first_name) { $message .= __('First name: ', 'appthemes') . $order->payer_first_name . PHP_EOL; } if ($order->payer_last_name) { $message .= __('Last name: ', 'appthemes') . $order->payer_last_name . PHP_EOL; } if ($order->payer_email) { $message .= __('Email: ', 'appthemes') . $order->payer_email . PHP_EOL; } if ($order->payer_address) { $message .= __('Address: ', 'appthemes') . $order->payer_address . PHP_EOL; } if ($order->transaction_id) { $message .= __('Txn ID: ', 'appthemes') . $order->transaction_id . PHP_EOL; } $message .= __('-----------------') . PHP_EOL . PHP_EOL; $message .= __('View completed orders: ', 'appthemes') . $ordersurl . PHP_EOL . PHP_EOL; if ($order->job_id) { $job_info = get_post($order->job_id); $job_title = stripslashes($job_info->post_title); $job_author = stripslashes(get_the_author_meta('user_login', $job_info->post_author)); $job_author_email = stripslashes(get_the_author_meta('user_email', $job_info->post_author)); $job_status = stripslashes($job_info->post_status); $job_slug = stripslashes($job_info->guid); $adminurl = admin_url("post.php?action=edit&post=" . $order->job_id . ""); $message .= __('Job Details', 'appthemes') . PHP_EOL; $message .= __('-----------------') . PHP_EOL; $message .= __('Title: ', 'appthemes') . $job_title . PHP_EOL; $message .= __('Author: ', 'appthemes') . $job_author . PHP_EOL; $message .= __('-----------------') . PHP_EOL . PHP_EOL; $message .= __('Preview Job: ', 'appthemes') . $job_slug . PHP_EOL; $message .= sprintf(__('Edit Job: %s', 'appthemes'), $adminurl) . PHP_EOL . PHP_EOL . PHP_EOL; } $message .= __('Regards,', 'appthemes') . PHP_EOL . PHP_EOL; $message .= __('JobRoller', 'appthemes') . PHP_EOL . PHP_EOL; $mailto = get_option('admin_email'); $headers = 'From: ' . __('JobRoller Admin', 'appthemes') . ' <' . get_option('admin_email') . '>' . PHP_EOL; $subject = __('Order Complete', 'appthemes') . ' [' . $blogname . ']'; wp_mail($mailto, $subject, $message, $headers); $jr_log->write_log('Email Sent to Admin: Order Complete (' . $order->id . ')'); }
/** * JobRoller Confirm Job form * Function outputs the job confirmation form * * * @version 1.0 * @author AppThemes * @package JobRoller * @copyright 2010 all rights reserved * */ function jr_confirm_job_form() { global $post, $posted, $wpdb; $posted = json_decode(stripslashes($_POST['posted']), true); $cost = 0; $payment_required = false; // Get Pack from previous step if (isset($_POST['job_pack']) && !empty($_POST['job_pack'])) { $posted['job_pack'] = stripslashes(trim($_POST['job_pack'])); if (strstr($posted['job_pack'], 'user_')) { // This is a user's pack and has already been purchased } else { // Get pack price $cost += $wpdb->get_var("SELECT pack_cost FROM " . $wpdb->prefix . "jr_job_packs WHERE id = " . $wpdb->escape($posted['job_pack']) . " LIMIT 1;"); } } else { // No Packs $posted['job_pack'] = ''; $listing_cost = get_option('jr_jobs_listing_cost'); $cost += $listing_cost; } // Get Featured from previous step if (isset($_POST['featureit']) && $_POST['featureit']) { $posted['featureit'] = 'yes'; $featured_cost = get_option('jr_cost_to_feature'); $cost += $featured_cost; } else { $posted['featureit'] = ''; } if ($cost > 0) { $payment_required = true; } ?> <form action="<?php echo get_permalink($post->ID); ?> " method="post" enctype="multipart/form-data" id="submit_form" class="submit_form main_form"> <p><?php _e('Your job is ready to be submitted, check the details are correct and then click “confirm” to submit your listing', 'appthemes'); if (get_option('jr_jobs_require_moderation') == 'yes') { _e(' for approval', 'appthemes'); } ?> .</p> <blockquote> <h2><?php echo wptexturize($posted['job_term_type']) . ' – '; echo wptexturize($posted['job_title']); ?> </h2> <?php if ($posted['your_name']) { ?> <h3><?php _e('Company/Poster', 'appthemes'); ?> </h3> <p><?php if ($posted['website']) { echo '<a href="' . strip_tags($posted['website']) . '">'; } echo strip_tags($posted['your_name']); if ($posted['website']) { echo '</a>'; } ?> </p> <?php } ?> <h3><?php _e('Job description', 'appthemes'); ?> </h3> <?php echo wpautop(wptexturize($posted['details'])); ?> <?php if (get_option('jr_submit_how_to_apply_display') == 'yes') { ?> <h3><?php _e('How to apply', 'appthemes'); ?> </h3> <?php echo wpautop(wptexturize($posted['apply'])); ?> <?php } ?> </blockquote> <?php if ($payment_required) { ?> <p><?php _e('After confirming your submission you will be taken to the payment page and charged ', 'appthemes'); echo '<strong>' . jr_get_currency($cost) . '</strong>'; _e(' — as soon as your payment clears your listing will become active.', 'appthemes'); ?> </p> <?php } ?> <p> <input type="submit" name="goback" class="goback" value="<?php _e('Go Back', 'appthemes'); ?> " /> <input type="submit" class="submit" name="confirm" value="<?php _e('Confirm & Submit', 'appthemes'); ?> " /> <input type="hidden" value='<?php echo htmlentities(json_encode($posted), ENT_QUOTES); ?> ' name="posted" /> </p> <div class="clear"></div> </form> <?php }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Available Job Packs', 'appthemes') : $instance['title'], $instance, $this->id_base); $packs = jr_get_job_packs(); if (sizeof($packs) > 0) { echo $before_widget; if (isset($title) && $title) { echo $before_title . $title . $after_title; } echo '<ul class="pack_overview">'; foreach ($packs as $pack) { if (!$pack->job_count) { $pack->job_count = __('Unlimited', 'appthemes'); } if ($pack->pack_duration) { $pack->pack_duration = __(' usable within ', 'appthemes') . $pack->pack_duration . __(' days', 'appthemes'); } if ($pack->job_duration) { $pack->job_duration = __(' lasting ', 'appthemes') . $pack->job_duration . __(' days', 'appthemes'); } if ($pack->pack_cost) { $pack->pack_cost = jr_get_currency($pack->pack_cost) . ''; } else { $pack->pack_cost = __('Free', 'appthemes'); } echo '<li><span class="cost">' . $pack->pack_cost . '</span><p><strong>' . $pack->pack_name . '</strong><br />' . $pack->job_count . ' ' . __('Jobs', 'appthemes') . '' . $pack->job_duration . $pack->pack_duration . '.</p> </li>'; $checked = ''; } echo '</ul>'; echo $after_widget; } }
function jr_dashboard() { global $wpdb, $app_rss_feed, $app_twitter_rss_feed, $app_forum_rss_feed, $options_dashboard, $app_version; $date_today = date('Y-m-d'); $date_yesterday = date('Y-m-d', strtotime('-1 days')); $job_count_live = $wpdb->get_var($wpdb->prepare("SELECT count(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = '" . APP_POST_TYPE . "'")); $resume_count_live = $wpdb->get_var($wpdb->prepare("SELECT count(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = '" . APP_POST_TYPE_RESUME . "'")); $job_count_pending = $wpdb->get_var($wpdb->prepare("SELECT count(ID) FROM {$wpdb->posts} WHERE post_status = 'pending' AND post_type = '" . APP_POST_TYPE . "'")); $job_rev_total = $wpdb->get_var($wpdb->prepare("SELECT sum(cost) FROM {$wpdb->prefix}" . 'jr_orders' . " WHERE status = 'completed'")); $job_seekers_today = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id WHERE {$wpdb->usermeta}.meta_key = 'wp_capabilities' AND ({$wpdb->usermeta}.meta_value LIKE '%job_seeker%') AND {$wpdb->users}.user_registered >= '{$date_today}'"); $job_listers_today = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id WHERE {$wpdb->usermeta}.meta_key = 'wp_capabilities' AND ({$wpdb->usermeta}.meta_value LIKE '%job_lister%') AND {$wpdb->users}.user_registered >= '{$date_today}'"); $job_seekers_yesterday = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id WHERE {$wpdb->usermeta}.meta_key = 'wp_capabilities' AND ({$wpdb->usermeta}.meta_value LIKE '%job_seeker%') AND {$wpdb->users}.user_registered BETWEEN '{$date_yesterday}' AND '{$date_today}'"); $job_listers_yesterday = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id WHERE {$wpdb->usermeta}.meta_key = 'wp_capabilities' AND ({$wpdb->usermeta}.meta_value LIKE '%job_lister%') AND {$wpdb->users}.user_registered BETWEEN '{$date_yesterday}' AND '{$date_today}'"); $total_users = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users}"); ?> <div class="wrap jobroller"> <div class="icon32" id="icon-themes"><br/></div> <h2><?php _e('JobRoller Dashboard', 'appthemes'); ?> </h2> <div class="dash-left metabox-holder"> <div class="postbox"> <div class="statsico"></div> <h3 class="hndle"><span><?php _e('JobRoller Info', 'appthemes'); ?> </span></h3> <div class="preloader-container"> <div class="insider" id="boxy"> <div class="stats-info"> <ul> <li><?php _e('Total Live Jobs', 'appthemes'); ?> : <a href="edit.php?post_status=publish&post_type=job_listing"><strong><?php echo number_format_i18n($job_count_live); ?> </strong></a></li> <li><?php _e('Total Pending Jobs', 'appthemes'); ?> : <a href="edit.php?post_status=pending&post_type=job_listing"><strong><?php echo number_format_i18n($job_count_pending); ?> </strong></a></li> <li><?php _e('Total Live Resumes', 'appthemes'); ?> : <a href="edit.php?post_status=publish&post_type=resume"><strong><?php echo number_format_i18n($resume_count_live); ?> </strong></a></li> <li><?php _e('Total Users', 'appthemes'); ?> : <a href="users.php"><strong><?php echo number_format_i18n($total_users); ?> </strong></a></li> <li><?php _e('Total Revenue', 'appthemes'); ?> : <strong><?php echo jr_get_currency(number_format($job_rev_total, 2)); ?> </strong></li> <li><?php _e('Product Version', 'appthemes'); ?> : <strong><?php echo $app_version; ?> </strong></li> <li><?php _e('Product Support', 'appthemes'); ?> : <a href="http://forums.appthemes.com/" target="_new"><?php _e('Forum', 'appthemes'); ?> </a> | <a href="http://www.appthemes.com/support/docs/" target="_new"><?php _e('Documentation', 'appthemes'); ?> </a></li> </ul> </div> <div class="stats_overview"> <h3><?php _e('New Registrations', 'appthemes'); ?> </h3> <div class="overview_today"> <p class="overview_day"><?php _e('Today', 'appthemes'); ?> </p> <p class="overview_count"><?php echo number_format_i18n($job_listers_today); ?> </p> <p class="overview_type"><em><?php _e('Job Listers', 'appthemes'); ?> </em></p> <p class="overview_count"><?php echo number_format_i18n($job_seekers_today); ?> </p> <p class="overview_type_seek"><em><?php _e('Job Seekers', 'appthemes'); ?> </em></p> </div> <div class="overview_previous"> <p class="overview_day"><?php _e('Yesterday', 'appthemes'); ?> </p> <p class="overview_count"><?php echo number_format_i18n($job_listers_yesterday); ?> </p> <p class="overview_type"><em><?php _e('Job Listers', 'appthemes'); ?> </em></p> <p class="overview_count"><?php echo number_format_i18n($job_seekers_yesterday); ?> </p> <p class="overview_type_seek"><em><?php _e('Job Seekers', 'appthemes'); ?> </em></p> </div> </div> <div class="clear"></div> </div> </div> </div> <!-- postbox end --> <div class="postbox"> <div class="newspaperico"></div><a target="_new" href="<?php echo $app_rss_feed; ?> "><div class="rssico"></div></a> <h3 class="hndle" id="poststuff"><span><?php _e('Latest News', 'appthemes'); ?> </span></h3> <div class="preloader-container"> <div class="insider" id="boxy"> <?php appthemes_dashboard_appthemes(); ?> </div> <!-- inside end --> </div> </div> <!-- postbox end --> </div> <!-- dash-left end --> <div class="dash-right metabox-holder"> <div class="postbox"> <div class="statsico"></div> <h3 class="hndle" id="poststuff"><span><?php _e('Stats - Last 30 Days', 'appthemes'); ?> </span></h3> <div class="preloader-container"> <div class="insider" id="boxy"> <?php jr_dashboard_charts(); ?> </div> <!-- inside end --> </div> </div> <!-- postbox end --> <div class="postbox"> <div class="twitterico"></div><a target="_new" href="<?php echo $app_twitter_rss_feed; ?> "><div class="rssico"></div></a> <h3 class="hndle" id="poststuff"><span><?php _e('Latest Tweets', 'appthemes'); ?> </span></h3> <div class="preloader-container"> <div class="insider" id="boxy"> <?php appthemes_dashboard_twitter(); ?> </div> <!-- inside end --> </div> </div> <!-- postbox end --> <div class="postbox"> <div class="forumico"></div><a target="_new" href="<?php echo $app_forum_rss_feed; ?> "><div class="rssico"></div></a> <h3 class="hndle" id="poststuff"><span><?php _e('Support Forum', 'appthemes'); ?> </span></h3> <div class="preloader-container"> <div class="insider" id="boxy"> <?php appthemes_dashboard_forum(); ?> </div> <!-- inside end --> </div> </div> <!-- postbox end --> </div> <!-- dash-right end --> </div> <!-- /wrap --> <?php }
function jr_orders() { global $wpdb; $message = ''; jr_tables_install(); if (isset($_GET['export'])) { ob_end_clean(); header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=jobroller_export_" . date('Ymd') . ".csv"); $jr_orders = new jr_orders(); $csv = array(); $row = array("ID", "User", "Job", "Pack", "Featured", "Cost", "Order Date", "Payment Date", "Payer", "Payment type", "Txn ID", "Approval Method", "Order Status"); $csv[] = '"' . implode('","', $row) . '"'; $row = array(); if (sizeof($jr_orders->orders) > 0) { foreach ($jr_orders->orders as $order) { $user_info = get_userdata($order->user_id); $row[] = $order->id; $row[] = '#' . $user_info->ID . ' - ' . $user_info->first_name . ' ' . $user_info->last_name . ' (' . $user_info->user_email . ')'; if ($order->job_id > 0) { $job_post = get_post($order->job_id); $row[] = '#' . $order->job_id . ' - ' . $job_post->post_title; } else { $row[] = ''; } if ($order->pack_id > 0) { $row[] = $order->pack_id; } else { $row[] = ''; } if ($order->featured) { $row[] = __('Yes', 'appthemes'); } else { $row[] = __('No', 'appthemes'); } if ($order->cost) { $row[] = jr_get_currency($order->cost); } else { $row[] = __('Free', 'appthemes'); } $row[] = mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $order->order_date); if ($order->payment_date) { $row[] = mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $order->payment_date); } else { $row[] = ''; } if ($order->payer_first_name || $order->payer_last_name) { $row[] = trim($order->payer_first_name . ' ' . $order->payer_last_name) . ', ' . trim($order->payer_address); } else { $row[] = ''; } if ($order->payment_type) { $row[] = trim($order->payment_type); } else { $row[] = ''; } if ($order->transaction_id) { $row[] = trim($order->transaction_id); } else { $row[] = ''; } if ($order->approval_method) { $row[] = trim($order->approval_method); } else { $row[] = ''; } $row[] = $order->status; $row = array_map('trim', $row); $row = array_map('html_entity_decode', $row); $row = array_map('addslashes', $row); $csv[] = '"' . implode('","', $row) . '"'; $row = array(); } } echo implode("\n", $csv); exit; } if (isset($_GET['paid'])) { $paid_listing = (int) $_GET['paid']; if ($paid_listing > 0) { $order = new jr_order($paid_listing); $order->complete_order(__('Manual', 'appthemes')); $message = __('Order complete.', 'appthemes'); } } if (isset($_GET['cancel'])) { $cancelled_listing = (int) $_GET['cancel']; if ($cancelled_listing > 0) { $order = new jr_order($cancelled_listing); $order->cancel_order(); $message = __('Order cancelled.', 'appthemes'); } } ?> <div class="wrap jobroller"> <div class="icon32" id="icon-themes"><br/></div> <h2><?php _e('Orders', 'appthemes'); ?> <a href="admin.php?page=orders&export=true" class="button" title=""><?php _e('Export CSV', 'appthemes'); ?> </a></h2> <?php if (isset($_GET['message'])) { $message = stripslashes(urldecode($_GET['message'])); } if (isset($message) && !empty($message)) { echo '<p class="success">' . $message . '</p>'; } ?> <?php $jr_orders = new jr_orders(); if (isset($_GET['p'])) { $page = $_GET['p']; } else { $page = 1; } $dir = 'ASC'; $sort = 'ID'; $per_page = 20; $total_pages = 1; $show = 'pending_payment'; if (isset($_GET['show'])) { switch ($_GET['show']) { case "completed": $show = 'completed'; $total_pages = ceil($jr_orders->completed_count / 20); break; case "cancelled": $show = 'cancelled'; $total_pages = ceil($jr_orders->cancelled_count / 20); break; default: $total_pages = ceil($jr_orders->pending_count / 20); break; } } else { $_GET['show'] = ''; } if (isset($_GET['dir'])) { $posteddir = $_GET['dir']; } else { $posteddir = ''; } if (isset($_GET['sort'])) { $postedsort = $_GET['sort']; } else { $postedsort = ''; } $jr_orders->get_orders($show, $per_page * ($page - 1), $per_page, $postedsort, $posteddir); ?> <div class="tablenav"> <div class="tablenav-pages alignright"> <?php if ($total_pages > 1) { echo paginate_links(array('base' => 'admin.php?page=orders&show=' . $_GET['show'] . '%_%&sort=' . $postedsort . '&dir=' . $posteddir, 'format' => '&p=%#%', 'prev_text' => __('« Previous'), 'next_text' => __('Next »'), 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5)); } ?> </div> <ul class="subsubsub"> <li><a href="admin.php?page=orders" <?php if ($show == 'pending_payment') { echo 'class="current"'; } ?> ><?php _e('Pending', 'appthemes'); ?> <span class="count">(<?php echo $jr_orders->pending_count; ?> )</span></a> |</li> <li><a href="admin.php?page=orders&show=completed" <?php if ($show == 'completed') { echo 'class="current"'; } ?> ><?php _e('Completed', 'appthemes'); ?> <span class="count">(<?php echo $jr_orders->completed_count; ?> )</span></a> |</li> <li><a href="admin.php?page=orders&show=cancelled" <?php if ($show == 'cancelled') { echo 'class="current"'; } ?> ><?php _e('Cancelled', 'appthemes'); ?> <span class="count">(<?php echo $jr_orders->cancelled_count; ?> )</span></a></li> </ul> </div> <div class="clear"></div> <table class="widefat fixed"> <thead> <tr> <th scope="col" style="width:3em;"><a href="<?php echo jr_echo_ordering_link('id', 'DESC'); ?> "><?php _e('ID', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('user_id', 'ASC'); ?> "><?php _e('User', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('job_id', 'ASC'); ?> "><?php _e('Job', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('pack_id', 'ASC'); ?> "><?php _e('Pack', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('featured', 'DESC'); ?> "><?php _e('Featured', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('cost', 'DESC'); ?> "><?php _e('Total Cost', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('order_date', 'DESC'); ?> "><?php _e('Order Date', 'appthemes'); ?> </a></th> <?php if ($show !== 'pending_payment' && $show !== 'cancelled') { ?> <th scope="col"><a href="<?php echo jr_echo_ordering_link('payment_date', 'DESC'); ?> "><?php _e('Payment Date', 'appthemes'); ?> </a></th> <th scope="col"><?php _e('Payer', 'appthemes'); ?> </th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('payment_type', 'ASC'); ?> "><?php _e('Payment type', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('transaction_id', 'ASC'); ?> "><?php _e('Txn ID', 'appthemes'); ?> </a></th> <th scope="col"><a href="<?php echo jr_echo_ordering_link('approval_method', 'ASC'); ?> "><?php _e('Approval Method', 'appthemes'); ?> </a></th> <?php } ?> <th scope="col"><?php _e('Actions', 'appthemes'); ?> </th> </tr> </thead> <?php if (sizeof($jr_orders->orders) > 0) { $rowclass = ''; ?> <tbody id="list"> <?php foreach ($jr_orders->orders as $order) { $rowclass = 'even' == $rowclass ? 'alt' : 'even'; if ($order->user_id) { $user_info = get_userdata($order->user_id); } ?> <tr class="<?php echo $rowclass; ?> "> <td><?php echo $order->id; ?> </td> <td><?php if ($user_info) { ?> #<?php echo $user_info->ID; ?> – <strong><?php echo $user_info->first_name; ?> <?php echo $user_info->last_name; ?> </strong><br/><a href="mailto:<?php echo $user_info->user_email; ?> "><?php echo $user_info->user_email; ?> </a><?php } ?> </td> <td> <?php if ($order->job_id > 0) { $job_post = get_post($order->job_id); if ($job_post) { echo '<a href="post.php?action=edit&post=' . $order->job_id . '">'; echo '#' . $order->job_id . ' – ' . $job_post->post_title; echo '</a>'; } else { echo '#' . $order->job_id; } } else { _e('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->pack_id > 0) { echo $order->pack_id; } else { _e('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->featured) { echo __('Yes', 'appthemes'); } else { echo __('No', 'appthemes'); } ?> </td> <td><?php if ($order->cost) { echo jr_get_currency($order->cost); } else { _e('Free', 'appthemes'); } ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $order->order_date); ?> </td> <?php if ($show !== 'pending_payment' && $show !== 'cancelled') { ?> <td><?php if ($order->payment_date) { echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $order->payment_date); } else { echo __('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->payer_first_name || $order->payer_last_name) { echo trim($order->payer_first_name . ' ' . $order->payer_last_name) . '<br/>' . trim($order->payer_address); } else { echo __('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->payment_type) { echo trim($order->payment_type); } else { echo __('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->transaction_id) { echo trim($order->transaction_id); } else { echo __('N/A', 'appthemes'); } ?> </td> <td><?php if ($order->approval_method) { echo trim($order->approval_method); } else { echo __('N/A', 'appthemes'); } ?> </td> <?php } ?> <td> <?php if ($order->status == 'pending_payment') { ?> <a href="admin.php?page=orders&paid=<?php echo $order->id; ?> " class="button button-primary">Mark as paid</a> <a href="admin.php?page=orders&cancel=<?php echo $order->id; ?> " class="button cancel">Cancel</a> <?php } else { ?> <?php _e('N/A', 'appthemes'); ?> <?php } ?> </td> </tr> <?php } ?> </tbody> <?php } else { ?> <tr><td colspan="<?php if ($show !== 'pending_payment' && $show !== 'cancelled') { ?> 15<?php } else { ?> 8<?php } ?> "><?php _e('No orders found.', 'appthemes'); ?> </td></tr> <?php } ?> </table> <br /> <script type="text/javascript"> /* <![CDATA[ */ jQuery('a.cancel').click(function(){ var answer = confirm ("<?php _e('Are you sure you want to cancel this order? The order will be cancelled and the Job Post will be deleted from the system.', 'appthemes'); ?> "); if (answer) return true; return false; }); /* ]]> */ </script> </div><!-- end wrap --> <?php }
echo get_permalink(get_option('jr_submit_page_id')); ?> " class="button"><span><?php _e('Submit a Job', 'appthemes'); ?> </span></a> <?php if ($text = get_option('jr_jobs_submit_text')) { echo wpautop(wptexturize($text)); } else { $packs = jr_get_job_packs(); if (sizeof($packs) == 0) { // display standard pricing $amount = get_option('jr_jobs_listing_cost'); if ($amount && $amount > 0) { echo '<p class="pricing"><em>' . jr_get_currency($amount) . '</em> ' . __('for', 'appthemes') . ' <em>30 ' . __('days', 'appthemes') . '</em></p>'; } } } ?> </div> <?php } ?> <?php if (is_user_logged_in() && current_user_can('can_submit_resume')) { ?> <?php