Esempio n. 1
0
$pid = $wp_query->query_vars['pid'];
$bid = Bid::get_by_id($wp_query->query_vars['bid']);
global $current_user;
get_currentuserinfo();
$uid = $current_user->ID;
$post_pr = get_post($pid);
//---------------------------
if ($uid != $post_pr->post_author) {
    wp_redirect(get_bloginfo('siteurl'));
    exit;
}
//---------------------------
if (isset($_POST['yes'])) {
    $tm = current_time('timestamp', 0);
    //		$mark_seller_accepted = get_post_meta($pid, 'mark_seller_accepted', true);
    $mark_seller_accepted = Bid::get_field_by_id($bid->id, 'mark_seller_accepted', true);
    if (empty($mark_seller_accepted)) {
        //			update_post_meta($pid, 'mark_seller_accepted',		"1");
        Bid::update_meta_by_id($bid->id, 'mark_seller_accepted', "1");
        Bid::update_meta_by_id($bid->id, 'mark_seller_accepted_date', $tm);
        /////my_edits
        //			update_post_meta($pid, 'closed',		"1");
        ////
        //			update_post_meta($pid, 'mark_seller_accepted_date',		$tm);
        //			update_post_meta($pid, 'outstanding',	"0");
        //			update_post_meta($pid, 'delivered',		"1");
        Bid::update_meta_by_id($bid->id, 'outstanding', "0");
        Bid::update_meta_by_id($bid->id, 'delivered', "1");
        //update postmeta project
        Project::update_postmeta($pid, 'mark_seller_accepted');
        Project::update_postmeta($pid, 'outstanding');
Esempio n. 2
0
function projectTheme_get_post_outstanding_project_function()
{
    $pid = get_the_ID();
    global $post, $current_user;
    get_currentuserinfo();
    $ending = get_post_meta(get_the_ID(), 'ending', true);
    $sec = $ending - current_time('timestamp', 0);
    $location = get_post_meta(get_the_ID(), 'Location', true);
    $closed = get_post_meta(get_the_ID(), 'closed', true);
    $featured = get_post_meta(get_the_ID(), 'featured', true);
    $private_bids = get_post_meta(get_the_ID(), 'private_bids', true);
    $paid = get_post_meta(get_the_ID(), 'paid', true);
    $budget = ProjectTheme_get_budget_name_string_fromID(get_post_meta($pid, 'budgets', true));
    $proposals = sprintf(__('%s proposals', 'ProjectTheme'), projectTheme_number_of_bid($pid));
    //$proposals 			= sprintf(__('%s proposals','ProjectTheme'), projectTheme_number_of_bid($pid));
    $posted = get_the_time("jS F Y");
    $auth = get_userdata($post->post_author);
    $hide_project_p = get_post_meta($post->ID, 'private_bids', true);
    $tm_d = get_post_meta(get_the_ID(), 'expected_delivery', true);
    $tm_bid = Bid::get_by_pid_uid($pid, $current_user->ID)->expected_delivery;
    $due_date = sprintf(__('Due Date: %s', 'ProjectTheme'), date_i18n('d-M-Y g:iA', $tm_bid));
    //----------------------
    //		$bid = projectTheme_get_bid_by_uid($pid, $current_user->ID);
    $bid = Bid::get_by_pid_uid($pid, $current_user->ID, true);
    $mark_coder_delivered = Bid::get_field_by_id($bid->id, 'mark_coder_delivered', $single = true);
    $my_bid = projecttheme_get_show_price($bid->bid);
    //		$mark_coder_delivered 	= get_post_meta(get_the_ID(), 'mark_coder_delivered', true);
    ?>

    	

        <div class="post" id="post-<?php 
    the_ID();
    ?>
"><div class="padd10">

    		<div class="post-title"><a href="<?php 
    the_permalink();
    ?>
"><?php 
    the_title();
    ?>
</a>

            

             <?php 
    if ($featured == "1") {
        echo '<span class="featured_thing_project2">' . __('Featured Project', 'ProjectTheme') . '</span>';
    }
    if ($hide_project_p == "1" or $hide_project_p == "yes") {
        echo '<span class="private_thing_project2">' . __('Sealed Bidding', 'ProjectTheme') . '</span>';
    }
    ?>

            

            </div>

    		<div class="post-main-details">

            	<ul>

                	<li>

                    	<p><img src="<?php 
    bloginfo('template_url');
    ?>
/images/wallet_icon2.png" alt="project budget" width="16" height="16" /></p>

                        <h4><?php 
    echo sprintf(__('My Bid: %s', 'ProjectTheme'), $my_bid);
    ?>
</h4>

                    </li>

                    

                    <li>

                    	<p><img src="<?php 
    bloginfo('template_url');
    ?>
/images/prop_icon.png" alt="project proposals" width="16" height="16" /></p>

                        <h4><?php 
    echo $proposals;
    ?>
</h4>

                    </li>

                    

                    <li>

                    	<p><img src="<?php 
    bloginfo('template_url');
    ?>
/images/cal_icon.png" alt="project calendar" width="16" height="16" /></p>

                        <h4><?php 
    echo $posted;
    ?>
</h4>

                    </li>

                    

                    <li class="last">

                    	<p><img src="<?php 
    bloginfo('template_url');
    ?>
/images/clock_icon.png" alt="project clock" width="16" height="16" /></p>

                        <h4><?php 
    echo $due_date;
    ?>
</h4>

                    </li>

                    

                </ul>

            </div> <!-- end post-main-details -->

          

            <div class="excerpt-thing">

                <?php 
    if ($mark_coder_delivered != "1") {
        $time_spent = get_post_meta($pid, 'time_spent', true);
        if ($time_spent) {
            $time_spent = unserialize($time_spent);
        } else {
            $button_timer = '<button class="work_timer" act="start" pid="' . $pid . '">Start work timer</button>';
        }
        if ($time_spent[$current_user->ID]) {
            $curent_time_spent = $time_spent[$current_user->ID]['count_time'];
            if ($time_spent[$current_user->ID]['start'] == 0) {
                $button_timer = '<button class="work_timer" act="start" pid="' . $pid . '">Start work timer</button>';
                $timer_class = 'not_active_timer';
            }
            if ($time_spent[$current_user->ID]['end'] == 0) {
                $tm = current_time('timestamp', 0);
                $curent_time_spent = $time_spent[$current_user->ID]['count_time'] + $tm - $time_spent[$current_user->ID]['start'];
                //$curent_time_spent = $time_spent[$uid]['count_time'];
                $button_timer = '<button class="work_timer" act="stop" pid="' . $pid . '">Stop work timer</button>';
                $timer_class = 'active_timer';
            }
        } else {
            $curent_time_spent = 0;
            $button_timer = '<button class="work_timer" act="start" pid="' . $pid . '">Start work timer</button>';
        }
    } elseif ($mark_coder_delivered == 1) {
        $time_spent = get_post_meta($pid, 'time_spent', true);
        if ($time_spent) {
            $time_spent = unserialize($time_spent);
            $curent_time_spent = $time_spent[$current_user->ID]['count_time'];
        } else {
            $curent_time_spent = 0;
        }
    }
    ?>
     

                              	

                <div class="my-deliv_2 work_timer_line">

                <?php 
    /*$hours = floor($curent_time_spent/3600);                 	
    
                     	$minutes = floor(($curent_time_spent/3600 - $hours)*60);                 	
    
                     	if($minutes<10){$minutes='0'.$minutes;}
    
    					$seconds = round(((($curent_time_spent/3600 - $hours)*60)-$minutes)*60);
    
    					if($seconds<10){$seconds='0'.$seconds;}
    
    					if($hours<10){$hours='0'.$hours;}
    
                     	$str_time = $hours.':'.$minutes.':'.$seconds;*/
    $str_time = convert_timestamp($curent_time_spent);
    ?>

                	<?php 
    echo $button_timer . '<strong> Time spent: <span  class="' . $timer_class . '" id="stopwatch' . $pid . '" cur_time="' . $curent_time_spent . '">' . $str_time . '</span></strong>';
    ?>

                </div> 

                <div class="work_timer_terms">  

                	<div class="work_timer_terms_inner">

	                	By clicking in, you acknowledge that the project owner has the right to terminate your participation in this project due to any of the following:<br>

	                	1. Inadequate performance<br>

	                	2. Unmet deadlines<br>

	                	3. Lack of communication<br>

	                	etc. (more to be added)<br>

	                	<label><input type="checkbox" class="timer_accept"> accept</label><br>

	                	<input type="button" value="cancel" class="cansel_timer"><input type="button" value="ok" class="accept_timer">

	                </div>

                </div> 

                	<?php 
    if ($mark_coder_delivered != "1") {
        ?>

            	<div class="my-deliv_1"><?php 
        _e('After finishing the work on the project, you can mark it as <em><strong>delivered</strong></em>', 'ProjectTheme');
        ?>
</div>

                	<?php 
    }
    ?>

                <div class="my-deliv_2">

					 	<?php 
    do_action('ProjectTheme_outstanding_proj_buttons');
    ?>
    

		

						<?php 
    if ($mark_coder_delivered != "1") {
        $cannot_mark_delivered = 0;
        $projectTheme_enable_paypal_ad = get_option('projectTheme_enable_paypal_ad');
        if ($projectTheme_enable_paypal_ad == "yes") {
            $adaptive_done = get_post_meta(get_the_ID(), 'adaptive_done', true);
            if (empty($adaptive_done)) {
                $cannot_mark_delivered = 1;
            }
        }
        if (!$cannot_mark_delivered) {
            ?>

           

                            <a href="<?php 
            echo get_bloginfo('siteurl');
            ?>
/?p_action=mark_delivered&pid=<?php 
            echo get_the_ID();
            ?>
&bid=<?php 
            echo $bid->id;
            ?>
" 

                            class="green_btn"><?php 
            echo __("Mark Delivered", "ProjectTheme");
            ?>
</a>

                            

                            

                            <?php 
        } else {
            echo '<div class="cpts_n1">';
            _e('The Project Owner must deposit the money escrow through PayPal before the project starts.', 'ProjectTheme');
            echo '</div>';
        }
        $projectTheme_enable_paypal_ad = get_option('projectTheme_enable_paypal_ad');
        if ($projectTheme_enable_paypal_ad == "yes") {
            $adaptive_done = get_post_meta(get_the_ID(), 'adaptive_done', true);
            if ($adaptive_done == 'started') {
                echo '<br/>';
                echo '<div style="margin-top:20px;" class="ep_ep2">' . __('The project owner has put the money into escrow for you. Once you mark the project as delivered the owner will release the money. ', 'ProjectTheme') . '</div>';
            }
        }
        ?>

                            

                       

                       <?php 
    } else {
        //                            $dv = get_post_meta(get_the_ID(), 'mark_coder_delivered_date', true);
        $dv = Bid::get_field_by_id($bid->id, 'mark_coder_delivered_date', true);
        $dv = date_i18n('d-M-Y H:i:s', $dv);
        ?>

                       

                       <span class="zbk_zbk">

                       <?php 
        printf(__("Awaiting buyer response.<br/>Marked as delivered on: %s", "ProjectTheme"), $dv);
        ?>

                       </span>

                       

                       <?php 
    }
    ?>



                

                </div>

            </div> <!-- end excerpt-thing -->

            

            

            <div class="user-poster-thing">

            	<div class="user-avatar-me">

                	<img src="<?php 
    echo ProjectTheme_get_avatar($post->post_author, 25, 25);
    ?>
" alt="avatar-user" class="acc_m1" width="25" height="25" />

                </div>

                

                <div class="user-avatar-me fun-time">

                <div class="post-main-details">

            	<ul>

                	<li><a class="avatar-posted-by-username" href="<?php 
    bloginfo('siteurl');
    ?>
/?p_action=user_profile&post_author=<?php 
    echo $post->post_author;
    ?>
"><?php 
    echo $auth->user_login;
    ?>
</a></li>

                	<li><?php 
    echo ProjectTheme_project_get_star_rating($post->post_author);
    ?>
</li>

                    <li class="last"><a href="<?php 
    echo ProjectTheme_get_user_feedback_link($post->post_author);
    ?>
"><?php 
    _e('View User Feedback', 'ProjectTheme');
    ?>
</a></li>

                </ul>

                

                </div>

                </div>

                

            </div> <!-- end user-poster-thing -->

        

        </div></div>

        

        <?php 
}
Esempio n. 3
0
        $bid = $bidd;
        break;
    } else {
        $bol = false;
    }
}
if (!$bol) {
    wp_redirect(get_bloginfo('siteurl'));
    exit;
}
//if($uid != $winner_bd->uid) { wp_redirect(get_bloginfo('siteurl')); exit; }
//---------------------------
if (isset($_POST['yes'])) {
    $tm = current_time('timestamp', 0);
    //		$mark_coder_delivered = get_post_meta($pid, 'mark_coder_delivered', true);
    $mark_coder_delivered = Bid::get_field_by_id($bid->id, 'mark_coder_delivered', $single = true);
    //		if(empty($mark_coder_delivered)) {
    if (empty($mark_coder_delivered) || $mark_coder_delivered != 1) {
        //			update_post_meta($pid, 'mark_coder_delivered', "1");
        //			update_post_meta($pid, 'mark_coder_delivered_date',	$tm);
        Bid::update_meta_by_id($bid->id, 'mark_coder_delivered', "1");
        //            Bid::update_meta_by_id($bid->id, 'delivered',	"1");
        Bid::update_meta_by_id($bid->id, 'mark_coder_delivered_date', $tm);
        ProjectTheme_send_email_on_delivered_project_to_bidder($pid, $uid);
        ProjectTheme_send_email_on_delivered_project_to_owner($pid);
        //update postmeta `mark_coder_delivered` (for project)
        Project::update_postmeta($pid, 'mark_coder_delivered');
    }
    wp_redirect(get_permalink(get_option('ProjectTheme_my_account_outstanding_projects_id')));
    exit;
}