-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add statistics page #25
Conversation
add statistics page with top25 posts (worktime) add new resource: minified Chart.js
remove nonsense else statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, some small fixes are needed. Thanks :)
|
||
return; | ||
} | ||
echo 'no data.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use echo __("no data.", "post-worktime-logger");
} | ||
|
||
echo '<div class="wrap">'; | ||
echo '<h1>Post Worktime Logger - Statistics</h1>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use echo __();
} | ||
|
||
// Register menu entry for pwlStatsPage | ||
add_action( 'admin_menu', function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix this, so it fits with my settings page menu options, which I will implement in v1.3.0 (Remember, this feature is planned for v1.4.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget it with v1.3.0 and v1.4.0.
This feature will also available in v1.3.0
// Register menu entry for pwlStatsPage | ||
add_action( 'admin_menu', function(){ | ||
//TODO: this is a submenu of plugins but doesnt quite make sense...better move it to a separate menu | ||
add_submenu_page( 'plugins.php', 'pwlStats', 'pwl-Statistics', 'manage_options', 'pwlStats', 'pwlStatsPage' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. I will fix it.
data: { | ||
labels: ['" . implode('\', \'', $posts_titles) . "'], | ||
datasets: [{ | ||
label: 'worktime in seconds', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
|
||
foreach($tPosts as $tPost){ | ||
$posts_titles[] = $tPost->post_title; | ||
$posts_worktimes[] = get_post_meta($tPost->ID, "post-worktime", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should use round($worktime/3600, 0)
, so we have the hours instead of the seconds.
|
||
echo "<script> | ||
var ctx = document.getElementById('pwlTopFiveWorktimePosts'); | ||
var pwlTopFiveWorktimePosts = new Chart(ctx, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way, to make the bars a little bit thinner?
I have created a new pull request with the fixes. |
add statistics page with top25 posts (worktime)
add new resource: minified Chart.js