Пример #1
0
function psp_current_projects()
{
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $projects = new WP_Query(array('post_type' => 'psp_projects', 'paged' => $paged, 'posts_per_page' => '10'));
    if ($projects->have_posts()) {
        $panorama_shortcode = '<table class="psp_project_list">
			<thead>
				<tr>
					<th class="psp_pl_col1">Project</th>
					<th class="psp_pl_col2">Progress</th>
				</tr>
			</thead>';
        while ($projects->have_posts()) {
            $projects->the_post();
            $panorama_shortcode .= '<tr>
					<td><a href="' . get_permalink() . '">' . get_the_title() . '</a></td>
					<td>';
            $post;
            $completed = psp_compute_progress($post->ID);
            if (!empty($completed)) {
                $panorama_shortcode .= '<p class="progress"><span class="psp-' . $completed . '"><b>' . $completed . '%</b></span></p>';
            }
            $panorama_shortcode .= '</td>
				</tr>';
        }
        $panorama_shortcode .= '</table>';
        return $panorama_shortcode . ' ' . next_posts_link('&laquo; Next Projects') . ' ' . previous_posts_link('Previous Projects &raquo;');
    } else {
        return '<p>No active projects at this time</p>';
    }
}
Пример #2
0
function psp_update_total_fe()
{
    $project_id = $_POST["project_id"];
    // If the project is now complete, mark it complete
    if (psp_compute_progress($project_id) == 100) {
        update_post_meta($project_id, '_psp_completed', '1');
    } else {
        update_post_meta($project_id, '_psp_completed', '0');
    }
    echo psp_compute_progress($project_id);
    die;
}
Пример #3
0
function psp_project_header_content($column_name, $post_ID)
{
    if ($column_name == 'client') {
        echo get_field('client');
    } elseif ($column_name == 'progress') {
        $completed = psp_compute_progress($post_DID);
        if ($completed > 10) {
            echo '<p class="progress"><span class="psp-' . $completed . '"><strong>%' . $completed . '</strong></span></p>';
        } else {
            echo '<p class="progress"><span class="psp-' . $completed . '"></span></p>';
        }
    } elseif ($column_name == 'shortcode') {
        echo '[project_status id="' . $post_ID . '"]';
    }
}
 /**
  * Display the content for the column
  *
  * @param string  $column_name
  * @param int     $id          post_id
  * @return string
  */
 public static function column_display($column_name, $id)
 {
     $project = SI_Project::get_instance($id);
     if (!is_a($project, 'SI_Project')) {
         return;
         // return for that temp post
     }
     switch ($column_name) {
         case 'psp':
             $psp_project_id = self::get_psp_project_id_from_si_project_id($id);
             printf('<a href="%s">%s</a>', get_edit_post_link($psp_project_id), get_the_title($psp_project_id));
             $completed = psp_compute_progress($psp_project_id);
             if ($completed > 10) {
                 echo '<p class="psp-progress"><span class="psp-' . $completed . '"><strong>%' . $completed . '</strong></span></p>';
             } else {
                 echo '<p class="psp-progress"><span class="psp-' . $completed . '"></span></p>';
             }
             break;
         default:
             // code...
             break;
     }
 }
Пример #5
0
function psp_total_progress($id, $style = null)
{
    $psp_progress = '
		<div class="' . $style . '">
		
			<h2>Overall Project Completion</h2>
			
			<div class="psp-holder"></div>';
    $completed = psp_compute_progress($id);
    if (get_field('display_milestones', $id)) {
        $frequency = get_field('milestone_frequency', $id);
        if (get_field('milestone_frequency', $id) == 'quarters') {
            $first = '25';
            $second = '50';
            $third = '75';
            $fourth = '100';
        } else {
            $first = '20';
            $second = '40';
            $third = '60';
            $fourth = '80';
        }
        ?>
 
				<?php 
        if ($style != 'psp-shortcode') {
            $psp_progress .= '
				<ul class="top-milestones cf psp-milestones frequency-' . $frequency . '">
					<li class="psp-' . $first . '-milestone';
            if ($completed >= $first) {
                $psp_progress .= 'completed';
            }
            $psp_progress .= '">
						<div>
							<h4>' . get_field('25%_title', $id) . '</h4>
							<p>' . get_field('25%_description', $id) . '</p>
							<span>' . $first . '%</span>
						</div>
					</li>
					<li class="psp-' . $third . '-milestone';
            if ($completed >= $third) {
                $psp_progress .= 'completed';
            }
            $psp_progress .= '">
						<div>
							<h4>' . get_field('75%_title', $id) . '</h4>
							<p>' . get_field('75%_description', $id) . '</p>
							<span>' . $third . '%</span>
						</div>
					</li>
				</ul>';
        }
    }
    $startDate = get_field('start_date', $id);
    $endDate = get_field('end_date', $id);
    $psp_progress .= '<p class="progress"><span class="psp-' . $completed . '"><b>' . $completed . '%</b></span></p>';
    if (get_field('display_milestones', $id)) {
        if ($style != 'psp-shortcode') {
            $psp_progress .= '<ul class="bottom-milestones cf psp-milestones frequency-' . $frequency . '">
					<li class="psp-' . $second . '-milestone';
            if ($completed >= $second) {
                $psp_progress .= 'completed';
            }
            $psp_progress .= '">
						<div>
							<span>' . $second . '%</span>
							<h4>' . get_field('50%_title', $id) . '</h4>
							<p>' . get_field('50%_description', $id) . '</p>
						</div>
					</li>';
            if ($frequency == 'fifths') {
                $psp_progress .= '<li class="psp-' . $fourth . '-milestone';
                if ($completed >= $fourth) {
                    $psp_progress .= 'completed';
                }
                $psp_progress .= '">
						<div>
							<span>' . $fourth . '%</span>
							<h4>' . get_field('100%_title', $id) . '</h4>
							<p>' . get_field('100%_description', $id) . '</p>
						</div>
					</li>';
            }
            $psp_progress .= '</ul>';
        }
    }
    if (get_field('display_milestones', $id)) {
        $psp_progress .= '<div class="progress-table ' . $style . '">
				<table class="progress-table">
					<tr>
						<th class="psp-milestones ';
        if ($completed >= $first) {
            $psp_progress .= 'completed';
        }
        $psp_progress .= '"><span>' . $first . '%</span></th>
						<td>
							<h4>' . get_field('25%_title', $id) . '</h4>
							<p>' . get_field('25%_description', $id) . '</p>
						</td>
					</tr>
					<tr>
						<th class="psp-milestones ';
        if ($completed >= $second) {
            $psp_progress .= 'completed';
        }
        $psp_progress .= '"><span>' . $second . '%</span></th>
						<td>
							<h4>' . get_field('50%_title', $id) . '</h4>
							<p>' . get_field('50%_description', $id) . '</p>
						</td>
					</tr>
					<tr>
						<th class="psp-milestones ';
        if ($completed >= $third) {
            $psp_progress .= 'completed';
        }
        $psp_progress .= '"><span>' . $third . '%</span></th>
						<td>
							<h4>' . get_field('75%_title', $id) . '</h4>
							<p>' . get_field('75%_description', $id) . '</p>
						</td>
					</tr>';
        if ($frequency == 'fifths') {
            $psp_progress .= '<tr>
						<th class="psp-milestones ';
            if ($completed >= $fourth) {
                $psp_progress .= 'completed';
            }
            $psp_progress .= '"><span>' . $fourth . '%</span></th>
						<td>
							<h4>' . get_field('100%_title', $id) . '</h4>
							<p>' . get_field('100%_description', $id) . '</p>
						</td>
					</tr>';
        }
        $psp_progress .= ' </table>
			</div>';
    }
    $psp_progress .= '</div>';
    return $psp_progress;
}
Пример #6
0
		<div class="<?php 
echo $style;
?>
">
		
			<h2><?php 
_e("Overall Project Completion", "psp_projects");
?>
</h2>
			
			<div class="psp-holder"></div>
						
			<?php 
$completed = psp_compute_progress($id);
$display_milestones = get_field('display_milestones', $id);
if ($options != 'no') {
    $frequency = get_field('milestone_frequency', $id);
    if (get_field('milestone_frequency', $id) == 'quarters') {
        $first = '25';
        $second = '50';
        $third = '75';
        $fourth = '100';
    } else {
        $first = '20';
        $second = '40';
        $third = '60';
        $fourth = '80';
        $frequency = 'fifths';
    }
    if ($options != 'condensed') {
        ?>
Пример #7
0
/**
 *
 * Function psp_populate_dashboard_widget
 *
 * Gathers the dashboard content and returns it in a variable
 *
 * @param
 * @return (variable) ($output)
 *
 */
function psp_populate_dashboard_widget()
{
    $projects = get_posts(array('post_type' => 'psp_projects', 'posts_per_page' => '-1'));
    $total_projects = count($projects);
    $taxonomies = get_terms('psp_tax', 'fields=count');
    $recent = new WP_Query(array('post_type' => 'psp_projects', 'posts_per_page' => '10', 'orderby' => 'modified', 'order' => 'DESC', 'post_status' => 'publish'));
    // Calculate the number of completed projects
    $completed_projects = 0;
    $not_started = 0;
    $active = 0;
    foreach ($projects as $project) {
        if (get_post_meta($project->ID, '_psp_completed', true) == '1') {
            $completed_projects++;
        }
        if (psp_compute_progress($project->ID) == 0) {
            $not_started++;
        } else {
            $active++;
        }
    }
    $percent_complete = floor($completed_projects / $total_projects * 100);
    $percent_not_started = floor($not_started / $total_projects * 100);
    $percent_remaining = 100 - $percent_complete - $percent_not_started;
    ob_start();
    ?>
	
	<div class="psp-chart">
		<canvas id="psp-dashboard-chart" width="100%" height="150"></canvas>
	</div>
	
	<script>

        jQuery(document).ready(function() {

			var chartOptions = {
				responsive: true
			}

            var data = [
                {
                    value: <?php 
    echo $percent_complete;
    ?>
,
                    color: "#2a3542",
                    label: "Completed"
                },
                {
                    value: <?php 
    echo $percent_remaining;
    ?>
,
                    color: "#3299bb",
                    label: "In Progress"
                },
                {
                    value: <?php 
    echo $percent_not_started;
    ?>
,
                    color: "#666666",
                    label: "Not Started"
                }
            ];


            var psp_dashboard_chart = document.getElementById("psp-dashboard-chart").getContext("2d");

            new Chart(psp_dashboard_chart).Doughnut(data,chartOptions);

        });

	</script>


			<ul data-pie-id="psp-dashboard-chart" class="dashboard-chart-legend">
				<li data-value="<?php 
    echo $percent_not_started;
    ?>
"><span><?php 
    echo $percent_not_started;
    ?>
% <?php 
    _e('Not Started', 'psp_projects');
    ?>
</span></li>
				<li data-value="<?php 
    echo $percent_remaining;
    ?>
"><span><?php 
    echo $percent_remaining;
    ?>
% <?php 
    _e('In Progress', 'psp_projects');
    ?>
</span></li>
				<li data-value="<?php 
    echo $percent_complete;
    ?>
"><span><?php 
    echo $percent_complete;
    ?>
% <?php 
    _e('Complete', 'psp_projects');
    ?>
</span></li>
			</ul>

			 <ul class="psp-projects-overview">
					<li><span class="psp-dw-projects"><?php 
    echo $total_projects;
    ?>
</span> <strong><?php 
    _e('Projects', 'psp_projects');
    ?>
</strong> </li>
					<li><span class="psp-dw-completed"><?php 
    echo $completed_projects;
    ?>
</span> <strong><?php 
    _e('Completed', 'psp_projects');
    ?>
</strong></li>
					<li><span class="psp-dw-active"><?php 
    echo $active;
    ?>
</span> <strong><?php 
    _e('active', 'psp_projects');
    ?>
</strong></li>
					<li><span class="psp-dw-types"><?php 
    echo $taxonomies;
    ?>
</span> <strong><?php 
    _e('Types', 'psp_projects');
    ?>
</strong></li>
			  </ul>

			  <hr>

			 <h4><?php 
    _e('Recently Updated', 'psp_projects');
    ?>
</h4>
			 <table class="psp-dashboard-widget-table">
				<tr>
					<th><?php 
    _e('Project', 'psp_projects');
    ?>
</th>
					<th><?php 
    _e('Progress', 'psp_projects');
    ?>
</th>
					<th><?php 
    _e('Updated', 'psp_projects');
    ?>
</th>
					<th>&nbsp;</th>
				</tr>

    			<?php 
    while ($recent->have_posts()) {
        $recent->the_post();
        global $post;
        ?>
        			<tr>
					   <td><a href="<?php 
        echo get_edit_post_link();
        ?>
"><?php 
        the_title();
        ?>
</a></td>
					   <td>
						   <?php 
        $completed = psp_compute_progress($post->ID);
        if ($completed > 10) {
            ?>
          						<p class="psp-progress"><span class="psp-<?php 
            echo $completed;
            ?>
"><strong>%<?php 
            echo $completed;
            ?>
</strong></span></p>
							<?php 
        } else {
            ?>
            					<p class="psp-progress"><span class="psp-<?php 
            echo $completed;
            ?>
"></span></p>
        					<?php 
        }
        ?>
  					  </td>
					  <td class="psp-dwt-date"><?php 
        echo get_the_modified_date("m/d/Y");
        ?>
</td>
					  <td class="psp-dwt-date"><a href="<?php 
        the_permalink();
        ?>
" target="_new" class="psp-dw-view"><?php 
        _e('View', 'psp_projects');
        ?>
</a></td>
				</tr>
    			<?php 
    }
    ?>
		</table>
	
	<?php 
    return ob_get_clean();
}
<?php

/**
 * Created by PhpStorm.
 * User: rossjohnson
 * Date: 1/3/15
 * Time: 1:18 PM
 */
?>

<div id="psp-short-progress">
	<h4><?php 
_e('Project Progress', 'psp_projects');
?>
</h4>
	<p class="psp-progress"><span class="psp-<?php 
echo psp_compute_progress($id);
?>
"><b><?php 
echo psp_compute_progress($id);
?>
%</b></span></p>
</div>
Пример #9
0
function psp_user_project_list()
{
    $user_id = $_GET['user'];
    $user = get_user_by('id', $user_id);
    $username = psp_username_by_id($user_id);
    ?>

    <div class="wrap">

        <h2 class="psp-user-list-title">
            <?php 
    echo get_avatar($user_id);
    ?>
 <span><?php 
    _e('Projects Assigned to', 'psp_projects');
    ?>
 <?php 
    echo $username;
    ?>
</span>
        </h2>

        <br style="clear:both">

        <table id="psp-user-list-table" class="wp-list-table widefat fixed posts">
            <thead>
            <tr>
                <th><?php 
    _e('Title', 'psp_projects');
    ?>
</th>
                <th><?php 
    _e('Client', 'psp_projects');
    ?>
</th>
                <th><?php 
    _e('% Complete', 'psp_projects');
    ?>
</th>
                <th><?php 
    _e('Timing', 'psp_projects');
    ?>
</th>
                <th><?php 
    _e('Project Types', 'psp_projects');
    ?>
</th>
                <th><span><span class="vers"><span title="Comments" class="comment-grey-bubble"></span></span></span></th>
                <th><?php 
    _e('Last Updated', 'psp_projects');
    ?>
</th>
            </tr>
            </thead>
            <tbody>
            <?php 
    $args = array('post_type' => 'psp_projects', 'posts_per_page' => '-1', 'meta_query' => array(array('key' => 'allowed_users_%_user', 'value' => $user_id)));
    $projects = new WP_Query($args);
    $i = 0;
    while ($projects->have_posts()) {
        $projects->the_post();
        global $post;
        ?>
                <tr <?php 
        if ($i % 2 == 0) {
            echo 'class="alternate"';
        }
        ?>
>
                    <td><strong><a href="post.php?post=<?php 
        echo $post->ID;
        ?>
&action=edit"><?php 
        the_title();
        ?>
</a></strong></td>
                    <td><?php 
        the_field('client');
        ?>
</td>
                    <td>
                        <?php 
        $completed = psp_compute_progress($post->ID);
        if ($completed > 10) {
            echo '<p class="psp-progress"><span class="psp-' . $completed . '"><strong>%' . $completed . '</strong></span></p>';
        } else {
            echo '<p class="psp-progress"><span class="psp-' . $completed . '"></span></p>';
        }
        ?>
                    </td>
                    <td>
                        <?php 
        psp_the_timing_bar($post->ID);
        ?>
                    </td>
                    <td><?php 
        the_terms($post->ID, 'psp_tax');
        ?>
</td>
                    <td><div class="post-com-count-wrapper">
                            <a href='edit-comments.php?p=<?php 
        echo $post->ID;
        ?>
' class='post-com-count'><span class='comment-count'><?php 
        comments_number('0', '1', '%');
        ?>
</span></a></div></td>
                    <td><?php 
        the_modified_date();
        ?>
</td>
                </tr>
                <?php 
        $i++;
    }
    ?>
            </tbody>
        </table>
    </div>

<?php 
}
    ?>
	<p>
		<a href="<?php 
    echo get_edit_post_link($psp_project_id);
    ?>
"><b><?php 
    echo get_the_title($psp_project_id);
    ?>
</b></a> <small><?php 
    the_field('client', $psp_project_id);
    ?>
</small>
	</p>

	<?php 
    $completed = psp_compute_progress($psp_project_id);
    ?>
	<?php 
    if ($completed > 10) {
        ?>
		<p class="psp-progress"><span class="psp-<?php 
        echo $completed;
        ?>
"><strong>%<?php 
        echo $completed;
        ?>
</strong></span></p>
	<?php 
    } else {
        ?>
		<p class="psp-progress"><span class="psp-<?php 
function psp_notify_users($post_id)
{
    // Bail if we're doing an auto save
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // if our current user can't edit this post, bail
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    if (get_post_type($post_id) == 'psp_projects') {
        // Check to see if notifications were turned on
        if (isset($_POST['psp-notify-users'])) {
            // Get an array of users
            $user_ids = $_POST['psp-user'];
            $progress = psp_compute_progress($post_id);
            $subject = $_POST['psp-notification-subject'];
            $message = $_POST['psp-notify-message'];
            foreach ($user_ids as $user_id) {
                psp_send_notification($user_id, $subject, $message, $post_id, $progress);
            }
        }
    }
}
Пример #12
0
function psp_mark_as_complete($post_id, $post)
{
    // Bail if we're doing an auto save
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    $project_completion = psp_compute_progress($post->ID);
    $current_status = get_post_meta($post->ID, '_psp_completed', true);
    if ($current_status == '') {
        update_post_meta($post->ID, '_psp_completed', '0');
    }
    if ($project_completion == '100') {
        update_post_meta($post->ID, '_psp_completed', '1');
        wp_set_post_terms($post->ID, 'completed', 'psp_status');
    } else {
        update_post_meta($post->ID, '_psp_completed', '0');
        wp_set_post_terms($post->ID, 'incomplete', 'psp_status');
    }
}
function psp_current_projects($atts)
{
    extract(shortcode_atts(array('type' => 'all', 'status' => 'all', 'access' => 'user', 'count' => '10', 'sort' => 'default', 'order' => 'ASC'), $atts));
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $cuser = wp_get_current_user();
    $cid = $cuser->ID;
    unset($meta_args);
    unset($status_args);
    // Determine the sorting
    if ($sort == 'start') {
        $meta_sort = 'start_date';
        $orderby = 'meta_value';
    } elseif ($sort == 'end') {
        $meta_sort = 'end_date';
        $order_by = 'meta_value';
    } else {
        $meta_sort = 'start_date';
        $order_by = 'menu_order';
    }
    // Set the initial arguments
    $args = array('post_type' => 'psp_projects', 'paged' => $paged, 'posts_per_page' => $count, 'meta_key' => $meta_sort, 'orderby' => $order_by, 'order' => $order);
    // If a type has been selected, add it to the argument
    if (!empty($type) && $type != 'all') {
        $tax_args = array('psp_tax' => $type);
        $args = array_merge($args, $tax_args);
    }
    if ($status == 'active') {
        $status_args = array('tax_query' => array(array('taxonomy' => 'psp_status', 'field' => 'slug', 'terms' => 'completed', 'operator' => 'NOT IN')));
        $args = array_merge($args, $status_args);
    }
    if ($status == 'completed') {
        $status_args = array('tax_query' => array(array('taxonomy' => 'psp_status', 'field' => 'slug', 'terms' => 'completed')));
        $args = array_merge($args, $status_args);
    }
    if ($access == 'user') {
        // Just restricting access, not worried about active or complete
        if (!current_user_can('manage_options')) {
            $cuser = wp_get_current_user();
            $cid = $cuser->ID;
            $meta_args = array('meta_query' => array('relation' => 'OR', array('key' => 'allowed_users_%_user', 'value' => $cid), array('key' => 'restrict_access_to_specific_users', 'value' => '')));
            $args = array_merge($args, $meta_args);
        }
    }
    $projects = new WP_Query($args);
    if ($access == 'user' && !is_user_logged_in()) {
        ?>
		
		<div id="psp-overview">
		
        	<div id="psp-login" class="shortcode-login">
        	
				<h2><?php 
        _e('Please Login to View Projects', 'psp_projects');
        ?>
</h2>
            
				<?php 
        echo panorama_login_form();
        ?>
			
			</div> <!--/#psp-login-->
		
		</div>
	
	<?php 
        psp_front_assets(1);
        return;
    }
    if ($projects->have_posts()) {
        ob_start();
        ?>

        <table class="psp_project_list">
            <thead>
            <tr>
                <th class="psp_pl_col1"><?php 
        _e('Project', 'psp_projects');
        ?>
</th>
                <th class="psp_pl_col2"><?php 
        _e('Progress', 'psp_projects');
        ?>
</th>
                <th class="psp_pl_col3"><?php 
        _e('Start', 'psp_projects');
        ?>
</th>
                <th class="psp_pl_col4"><?php 
        _e('End', 'psp_projets');
        ?>
</th>
            </tr>
            </thead>

            <?php 
        while ($projects->have_posts()) {
            $projects->the_post();
            global $post;
            ?>

                <tr>
                    <td>
                        <a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
                        <div class="psp-table-meta">
                            <p><strong><?php 
            _e('Client', 'psp_projects');
            ?>
:</strong> <?php 
            the_field('client');
            ?>
<br> <strong><?php 
            _e('Last Updated', 'psp_projects');
            ?>
:</strong> <?php 
            the_modified_date();
            ?>
</p>
                        </div>
                    </td>
                    <td>
                        <?php 
            global $post;
            $completed = psp_compute_progress($post->ID);
            if (!empty($completed)) {
                echo '<p class="psp-progress"><span class="psp-' . $completed . '"><b>' . $completed . '%</b></span></p>';
            }
            ?>
                    </td>
                    <td>
                        <?php 
            psp_the_start_date($post->ID);
            ?>
                    </td>
                    <td>
                        <?php 
            psp_the_end_date($post->ID);
            ?>
                    </td>
                </tr>

            <?php 
        }
        ?>

        </table>

        <p><?php 
        echo get_next_posts_link('&laquo; More Projects', $projects->max_num_pages) . ' ' . get_previous_posts_link('Previous Projects &raquo;');
        ?>
</p>

        <?php 
        psp_front_assets(1);
        return ob_get_clean();
    } else {
        return '<p>' . __('No projects found', 'psp_projects') . '</p>';
    }
}
function psp_upgrade_db()
{
    if (isset($_GET['psp_upgrade_db']) && '0' == $_GET['psp_upgrade_db']) {
        $projects = new WP_Query(array('post_type' => 'psp_projects', 'posts_per_page' => -1));
        while ($projects->have_posts()) {
            $projects->the_post();
            global $post;
            $auto_progress = 0;
            while (have_rows('phases')) {
                the_row();
                if (get_sub_field('auto_progress')) {
                    $auto_progress = 1;
                }
            }
            if ($auto_progress == 1) {
                update_field('field_5436e7f4e06b4', 'Yes', $post->ID);
            }
            if (psp_compute_progress($post->ID) == 100) {
                wp_set_post_terms($post->ID, 'completed', 'psp_status');
            }
        }
        ?>
        <div class="updated">

            <p>Panorama has successfully updated your WordPress database.</p>

        </div>

        <?php 
        update_option('psp_database_version', 3);
    }
}
Пример #15
0
function psp_the_timing_bar($post_id)
{
    $time_elapsed = psp_calculate_timing($post_id);
    $completed = psp_compute_progress($post_id);
    if ($completed < $time_elapsed[0]) {
        $progress_class = 'psp-behind';
    } else {
        $progress_class = 'psp-ontime';
    }
    if ($time_elapsed[0] < 0) {
        $time_elapsed[0] = 100;
    }
    echo '<p class="psp-timing-progress psp-progress ' . $progress_class . '"><span class="psp-' . $time_elapsed[0] . '"><strong>%' . $time_elapsed[0] . '</strong></span></p>';
}