Exemple #1
0
function projectTheme_get_post_main_function($arr = '')
{
    $pid = get_the_ID();
    global $post, $current_user;
    get_current_user();
    $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);
    $views = get_post_meta(get_the_ID(), 'views', 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));
    $days_left = $closed == "0" ? ProjectTheme_prepare_seconds_to_words($ending - current_time('timestamp', 0)) : __("Expired/Closed", 'ProjectTheme');
    $posted = get_the_time("jS F Y");
    $auth = get_userdata($post->post_author);
    $hide_project_p = get_post_meta($post->ID, 'private_bids', true);
    if ($post->post_title) {
        $post_title_new = urldecode($post->post_title);
    } else {
        $post_title_new = "Title exist";
    }
    ?>

    	

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

    		<div class="post-title"><a href="<?php 
    the_permalink();
    ?>
"><?php 
    echo $post_title_new;
    ?>
</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 title="Budget">

                     	<p><i class="budget-icon-me" ></i></p>

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

                    </li>

                    

                    <li title="Count of proposals">

                    	 <p><i class="proposals-icon-me"></i></p>

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

                    </li>

                    

                    <li title="Start date">

                    	<p><i class="calendar-icon-me"></i></p>

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

                    </li>

                    

                    <li title="Time left">

                    	<p><i class="clock-icon-me"></i></p>

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

                    </li>

                    <li class="last" title="Count of visits">

                    	<p><!-- <i class="clock-icon-me"></i> --></p>

                        <h4><?php 
    echo 'Visits - ' . $views;
    ?>
</h4>

                    </li>                    

                    

                </ul>

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

            

            <div class="excerpt-thing">
                
                <div class="project-description">
                    
                    <label><?php 
    _e('Description', 'ProjectTheme');
    ?>
</label>
                    <p>

            	<?php 
    if (has_excerpt(get_the_ID())) {
        $tg = strip_tags(get_the_excerpt());
        echo substr($tg, 0, -10);
    } else {
        $tg = strip_tags(get_the_content());
        echo substr($tg, 0, 250);
    }
    ?>
                    </p>
                    </div>
                    <?php 
    if ($closed == 0) {
        ProjectTheme_get_buttons_my_deliv_2();
    }
    ?>

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

            <?php 
    global $wpdb;
    $hide_users = '';
    $providersResult = $wpdb->get_results('select * FROM wp_users inner JOIN wp_postmeta on wp_users.ID = wp_postmeta.meta_value where wp_postmeta.meta_key="winner" and wp_postmeta.post_id=' . $pid);
    if ($post->post_author != $current_user->ID) {
        foreach ($providersResult as $key => $value) {
            if ($value->ID != $current_user->ID) {
                unset($providersResult[$key]);
            }
        }
        $hide_users = ' hidden ';
    }
    if ($providersResult) {
        echo '<div class="excerpt-thing">';
        //            			echo "<strong>Current QA Engineers</strong>";
        $time_spent = get_post_meta($pid, 'time_spent', true);
        $time_spent = unserialize($time_spent);
        /*
         * users table
         */
        ?>
                            <table class="table-condensed table-hover">
                            <tr>
                                <th class="bold_stuff" <?php 
        echo $hide_users;
        ?>
><?php 
        _e('Current QA Engineer', 'ThemeProject');
        ?>
</th>
                                <th class="bold_stuff center"><?php 
        _e('Time work', 'ThemeProject');
        ?>
</th>
                                <th class="bold_stuff center"><?php 
        _e('Bid status', 'ThemeProject');
        ?>
</th>
                                <th ></th>
                            </tr>

                        <?php 
        foreach ($providersResult as $user_info) {
            //$user_info = get_userdata($id);
            $bid = Bid::get_by_pid_uid($pid, $user_info->ID);
            $status = Bid::get_status($bid);
            if ($time_spent[$user_info->ID]['count_time']) {
                $curent_time_spent = $time_spent[$user_info->ID]['count_time'];
            } else {
                $curent_time_spent = 0;
            }
            $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;
            }
            $str_time = $hours . ':' . $minutes . ':' . $seconds;
            //            				echo '<p><a href="'.ProjectTheme_get_user_profile_link($user_info->ID).'">' . $user_info->user_login .'</a><span> ('.$str_time.')</span></p>';
            ?>
            
            
                            <tr>
                                <td <?php 
            echo $hide_users;
            ?>
><?php 
            echo '<a href="' . ProjectTheme_get_user_profile_link($user_info->ID) . '">' . $user_info->user_login . '</a>';
            ?>
</td>
                                <td class="center"><span>(<?php 
            echo $str_time;
            ?>
)</span></td>
                                <td class="center"><?php 
            echo $status['name'];
            ?>
</td>
                                <td></td>
                            </tr>
                            

                        
            
                        <?php 
        }
        ?>
 </table> <?php 
        echo "</div>";
    }
    ?>

            

            <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 
    the_author(get_the_ID());
    ?>
</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 
}