/** * ajax callback to setup bid info and send to client * @author Dakachi */ function fre_get_accept_bid_info() { $bid_id = $_GET['bid_id']; global $user_ID; $error = array('success' => false, 'msg' => __('Invalid bid', ET_DOMAIN)); if (!isset($_REQUEST['bid_id'])) { wp_send_json($error); } $bid_id = $_REQUEST['bid_id']; $bid = get_post($bid_id); // check bid is valid if (!$bid || is_wp_error($bid) || $bid->post_type != BID) { wp_send_json($error); } $bid_budget = get_post_meta($bid_id, 'bid_budget', true); // get commission settings $commission = ae_get_option('commission', 0); $commission_fee = $commission; // caculate commission fee by percent $commission_type = ae_get_option('commission_type'); if ($commission_type != 'currency') { $commission_fee = (double) ($bid_budget * (double) $commission) / 100; } $commission = fre_price_format($commission_fee); $payer_of_commission = ae_get_option('payer_of_commission', 'project_owner'); if ($payer_of_commission == 'project_owner') { $total = (double) $bid_budget + (double) $commission_fee; } else { $commission = 0; $total = $bid_budget; } wp_send_json(array('success' => true, 'data' => array('budget' => fre_price_format($bid_budget), 'commission' => $commission, 'total' => fre_price_format($total)))); }
// freelancer finish project form $employer_name = get_the_author_meta('display_name', $post->post_author); ?> <input type="hidden" name="action" value="ae-freelancer-review" /> <label style="line-height:2.5;"> <?php _e('You are going to finish this project.', ET_DOMAIN); ?> <br> <?php printf(__('%s has finish project. You will receive payment after you review him.', ET_DOMAIN), $employer_name); ?> </label> <p> <strong class="color-green"><?php echo fre_price_format($bid_budget); ?> </strong> <strong class="color-green"> <i class="fa fa-check"></i> </strong> </p> <div class="form-group"> <label for="post_content"><?php printf(__('Rate for "%s"', ET_DOMAIN), $employer_name); ?> </label> <div class="rating-it" style="cursor: pointer;"> <input type="hidden" name="score" > </div> </div> <div class="form-group">
/** *Convert project * * */ function ae_convert_project($result) { global $user_ID; $result->et_avatar = get_avatar($result->post_author, 35); $result->author_url = get_author_posts_url($result->post_author); $result->author_name = get_the_author_meta('display_name', $result->post_author); $result->budget = fre_price_format($result->et_budget); $result->bid_budget_text = fre_price_format(get_post_meta($result->accepted, 'bid_budget', true)); $result->rating_score = (double) get_post_meta($result->ID, 'rating_score', true); $result->permalink = apply_filters('wpml_permalink', get_permalink(), ICL_LANGUAGE_CODE); $comment = get_comments(array('post_id' => $result->ID, 'type' => 'fre_review')); if ($comment) { $result->project_comment = $comment['0']->comment_content; } else { $result->project_comment = ''; } // project is disputing if ($result->post_status == 'disputing') { $result->status_text = __("DISPUTE", 'projects-backend'); } // project completed text status if ($result->post_status == 'complete') { $result->status_text = __("COMPLETED", 'projects-backend'); } // project close for working when accepted a bids if ($result->post_status == 'close') { $result->status_text = __("HIRED", 'projects-backend'); if ($user_ID == $result->post_author) { $result->workspace_link = add_query_arg(array('workspace' => 1), $result->permalink); } } /** * return carousels */ if (current_user_can('manage_options') || $result->post_author == $user_ID) { $children = get_children(array('numberposts' => 15, 'order' => 'ASC', 'post_parent' => $result->ID, 'post_type' => 'attachment')); $result->et_carousels = array(); foreach ($children as $key => $value) { $result->et_carousels[] = $key; } /** * set post thumbnail in one of carousel if the post thumbnail doesnot exists */ if (has_post_thumbnail($result->ID)) { $thumbnail_id = get_post_thumbnail_id($result->ID); if (!in_array($thumbnail_id, $result->et_carousels)) { $result->et_carousels[] = $thumbnail_id; } } } $result->posted_by = sprintf(__("Posted by %s", 'projects-backend'), $result->author_name); return $result; }
the_author_posts_link(); ?> </span> </div> <div class="col-md-2 col-sm-2 hidden-sm hidden-xs"> <span> <?php echo get_the_date(); ?> </span> </div> <div class="col-md-1 col-sm-2 col-xs-4 hidden-xs"> <span class="budget-project"> <?php echo fre_price_format($current->et_budget); ?> </span> </div> <div class="col-md-2 col-sm-2 col-xs-5"> <p class="wrapper-btn"> <a href="<?php the_permalink(); ?> " class="btn-sumary btn-apply-project"> <?php _e('Apply', ET_DOMAIN); ?> </a> </p> </div>
</span> <span class="text-right"><?php echo $bid_posts; ?> </span> </li> <li> <i class="fa fa-money"></i> <span class="text"><?php _e('Total earned:', 'list-bids'); ?> </span> <span class="text-right"><?php echo fre_price_format(fre_count_total_user_earned($user_data->ID)); ?> </span> </li> <li> <i class="fa fa-map-marker"></i> <span class="text"><?php _e('Country:', 'list-bids'); ?> </span> <span class="text-right"> <?php echo $country; ?> </span>
} elseif ($convert->total_bids == 1) { _e('1 <span class="text-normal">bid</span>', ET_DOMAIN); } else { printf(__('%s <span class="text-normal">bids</span>', ET_DOMAIN), $convert->total_bids); } ?> </span> </li> <li> <span class="number-blue"> <?php $avg = 0; if ($convert->total_bids > 0) { $avg = get_total_cost_bids($convert->ID) / $convert->total_bids; } echo fre_price_format($avg); ?> </span> <span class="text-normal"> <?php printf(__("Avg Bid (%s)", ET_DOMAIN), $currency['code']); ?> </span> </li> <li> <?php if ($post->post_status == 'publish') { ?> <span class="number-blue"> <?php _e("Open", ET_DOMAIN);
/** * convert profile * @package FreelanceEngine */ function ae_convert_profile($result) { $result->et_avatar = get_avatar($result->post_author, 70); $result->author_link = get_author_posts_url($result->post_author); if ($result->et_experience) { if ($result->et_experience > 1) { $result->experience = sprintf(__("%d years", 'profiles-backend'), $result->et_experience); } else { $result->experience = sprintf(__("%d year", 'profiles-backend'), $result->et_experience); } } else { $result->experience = get_post_meta($result->ID, 'experience', true); } // override profile ling $result->permalink = $result->author_link; $result->author_name = get_the_author_meta('display_name', $result->post_author); $result->hourly_rate_price = sprintf(__("%s/h", 'profiles-backend'), fre_price_format($result->hour_rate)); // $rating = Fre_Review::freelancer_rating_score($result->post_author); //var_dump($result->rating_score); // $result->rating_score = $rating['rating_score']; // var_dump($result->rating_score); ob_start(); $i = 1; if ($result->tax_input['skill']) { $total_skill = count($result->tax_input['skill']); $string_length = 0; foreach ($result->tax_input['skill'] as $tax) { $i++; $string_length += strlen($tax->name); ?> <li><span class="skill-name-profile"><?php echo $tax->name; ?> </span></li> <?php if ($string_length > 20) { break; } if ($i >= 5) { break; } } if ($i < $total_skill) { echo '<li><span class="skill-name-profile">+' . ($total_skill - $i) . '</span></li>'; } } $skill_list = ob_get_clean(); // skill dont need id array unset($result->skill); // generate skill list $result->skill_list = $skill_list; return $result; }
<?php _e('Hourly rate', 'filter-profiles'); ?> </h2> <input id="hour_rate" type="text" name="hour_rate" class="slider-ranger" value="" data-slider-min="0" data-slider-max="<?php echo $max_value; ?> " data-slider-step="5" data-slider-value="[0,<?php echo $max_value; ?> ]" /> <b class="currency"><?php echo fre_price_format($max_value); ?> </b> <input type="hidden" name="et_hour_rate" id="et_hour_rate" value= "" /> </div> </div> <div class="col-md-2 col-sm-6"> <div class="content-search-form-top-wrapper"> <div class="skill-control"> <h2 class="title-search-form-top"> <?php _e('Skills Required', 'filter-profiles'); ?> </h2> <button type="button" class="btn btn-primary btn-block" data-toggle="modal"
} else { printf(__('<span class="number">%d</span>Comments', ET_DOMAIN), $total_count); } ?> </li> <li> <?php if ($convert->total_bids && $convert->total_bids > 1) { printf(__('<span class="number">%d</span> bids', ET_DOMAIN), $convert->total_bids); } else { printf(__('<span class="number">%d</span> bid', ET_DOMAIN), $convert->total_bids); } ?> </li> <li><span class="number"><?php echo fre_price_format($convert->bid_average); ?> </span> <?php printf(__("Avg Bids(%s)", ET_DOMAIN), $currency['code']); ?> </li> <li class="clearfix"></li> <li class="stt-bid"> <div class="time"> <span class="number"><?php _e("Open", ET_DOMAIN); ?> </span><?php if (empty($exp)) { printf(__('%s ago', ET_DOMAIN), human_time_diff(get_the_time('U'), time())); } else {
/** * convert bid */ function ae_convert_bid($result) { global $user_ID; $result->et_avatar = get_avatar($result->post_author, 70); $result->author_url = get_author_posts_url($result->post_author); $profile_id = get_user_meta($result->post_author, 'user_profile_id', true); $result->rating_score = (double) get_post_meta($result->ID, 'rating_score', true); if (isset($_REQUEST) && isset($_REQUEST['query']) && isset($_REQUEST['query']['is_single']) || is_singular(PROJECT)) { $result->rating_score = (double) get_post_meta($profile_id, 'rating_score', true); } if ($profile_id) { $result->et_professional_title = get_post_meta($profile_id, 'et_professional_title', true); $result->experience = get_post_meta($profile_id, 'experience', true); $result->profile_display = get_the_author_meta('display_name', $result->post_author); } else { $result->et_professional_title = ''; $result->experience = __('Unknow', ET_DOMAIN); $result->profile_display = get_the_author_meta('display_name', $result->post_author); } if ($result->type_time == 'day') { if ($result->bid_time > 1) { $result->bid_time_text = sprintf(__("in %d days", ET_DOMAIN), $result->bid_time); } else { $result->bid_time_text = sprintf(__("in %d day", ET_DOMAIN), $result->bid_time); } } else { if ($result->bid_time > 1) { $result->bid_time_text = sprintf(__("in %d weeks", ET_DOMAIN), $result->bid_time); } else { $result->bid_time_text = sprintf(__("in %d week", ET_DOMAIN), $result->bid_time); } } $result->bid_budget_text = fre_price_format($result->bid_budget); //convert project infor to bid $project_post = get_post($result->post_parent); /** * add project data to bid */ if ($project_post && !is_wp_error($project_post)) { $result->accepted = get_post_status($project_post->ID, 'accepted', true); $result->project_author_avatar = get_avatar($project_post->post_author, 30); $result->project_link = get_permalink($project_post->ID); $result->project_title = $project_post->post_title; $result->project_status = $project_post->post_status; $result->project_id = $project_post->ID; $result->project_author = (int) get_post_field('post_author', $project_post->ID); // check user role and project status to disable bid budget if (in_array($result->project_status, array('complete', 'close', 'disputing')) || $user_ID && $user_ID == $project_post->post_author || $user_ID && $user_ID == $result->post_author) { // dont do any thing } else { // hide bid text $result->bid_budget_text = __("In Progress", ET_DOMAIN); // hide bid time $result->bid_time_text = ''; // hide bid budget $result->bid_budget = ''; } if (!current_user_can('manage_options') && !($user_ID && $user_ID == $project_post->post_author || $user_ID && $user_ID == $result->post_author)) { $result->post_content = ''; } /* get bid review */ $result->project_comment = ''; if ($result->project_status == 'complete') { // only project complete should have review $comment = get_comments(array('post_id' => $result->ID, 'type' => 'em_review')); if ($comment) { $result->project_comment = $comment['0']->comment_content; } } $result->project_post_date = $project_post->post_date; //$result->et_budget = $project_post->et_budget; $result->et_budget = fre_price_format(get_post_meta($project_post->ID, 'et_budget', true)); // add new fields return @author ThaiNT $result->total_bids = $project_post->total_bids ? $project_post->total_bids : 0; $result->bid_average = $project_post->bid_average ? $project_post->bid_average : 0; } else { $result->accepted = ''; $result->project_author_avatar = ''; $result->project_link = ''; $result->project_title = ''; $result->project_status = ''; $result->project_post_date = ''; $result->et_budget = ''; $result->project_id = ''; $result->project_author = ''; } $result->is_admin = current_user_can('manage_options') == TRUE ? 1 : 0; $result->current_user = $user_ID; return $result; }
<!-- employer info !--> <div class="info-bid-wrapper"> <ul class="bid-top"> <li> <span class="number"><?php echo fre_count_user_posts_by_type($author_id, 'project', '"publish","complete","close" ', true); ?> </span> <?php _e("Project posted", ET_DOMAIN); ?> </li> <li> <span class="number"><?php echo fre_price_format(fre_count_total_user_spent($author_id)); ?> </span> <?php _e('Total spent ', ET_DOMAIN); ?> </li> <li> <span class="number"> <?php echo fre_count_user_posts_by_type($author_id, 'project', 'complete'); ?> </span> <?php _e('Hired', ET_DOMAIN); ?>
?> </span> <span class="text-right"><?php echo $bid_posts; ?> </span> </li> <li> <i class="fa fa-money"></i> <span class="text"><?php _e('Total earned:', ET_DOMAIN); ?> </span> <span class="text-right"><?php echo fre_price_format(fre_count_total_user_earned($author_id)); ?> </span> </li> <li> <i class="fa fa-map-marker"></i> <span class="text"><?php _e('Country:', ET_DOMAIN); ?> </span> <span class="text-right"> <?php if ($convert->tax_input['country']) { echo $convert->tax_input['country']['0']->name; }
<?php _e('Hourly rate', ET_DOMAIN); ?> </h2> <input id="hour_rate" type="text" name="hour_rate" class="slider-ranger" value="" data-slider-min="0" data-slider-max="<?php echo $max_slider; ?> " data-slider-step="5" data-slider-value="[0,<?php echo $max_slider; ?> ]" /> <b class="currency"><?php echo fre_price_format($max_slider); ?> </b> <input type="hidden" name="et_hour_rate" id="et_hour_rate" value= "" /> </div> </div> <div class="col-md-15 col-sm-6"> <div class="content-search-form-top-wrapper"> <div class="skill-control"> <h2 class="title-search-form-top"> <?php _e('Skills Require', ET_DOMAIN); ?> </h2> <div class="skills-wrap">
function view_account_balance() { global $current_user; $user_balance = get_user_meta($current_user->data->ID, 'account_cash_balance', true); //var_dump(get_user_meta($current_user->data->ID,'account_cash_balance',true)); ?> <div class="account-balance"> <label>Your account balance:</label> <?php if ($user_balance > 0) { ?> <span class="balance"> <?php echo fre_price_format($user_balance / 100); ?> </span> <?php } else { ?> <span class="negative_balance"> <?php echo fre_price_format($user_balance / 100); ?> </span> <?php } ?> </div> <?php }