function orbis_project_get_the_logged_time($format = 'HH:MM') { global $post; $time = null; if (isset($post->project_logged_time)) { $time = orbis_time($post->project_logged_time, $format); } return $time; }
<div class="input-group inline-input-group"> <input class="form-control" size="2" type="text" name="orbis_registration_hours" value="<?php echo empty($entry->time) ? '' : esc_attr(orbis_time($entry->time, 'H')); ?> " tabindex="<?php echo esc_attr($tabindex++); ?> " /> <span class="input-group-addon"><?php _e('hours', 'orbis_timesheets'); ?> </span> </div> <div class="input-group inline-input-group"> <input class="form-control" size="2" type="text" name="orbis_registration_minutes" value="<?php echo empty($entry->time) ? '' : esc_attr(orbis_time($entry->time, 'M')); ?> " tabindex="<?php echo esc_attr($tabindex++); ?> " /> <span class="input-group-addon"><?php _e('minutes', 'orbis_timesheets'); ?> </span> </div> </div> </div> </div>
} ?> <div class="progress"> <div class="progress-bar progress-bar-<?php echo $bar; ?> " style="width: <?php echo $percentage; ?> %;" aria-valuemax="100" aria-valuemin="0" aria-valuenow="<?php echo $percentage; ?> " role="progressbar"><?php echo round($percentage) . '%'; ?> </div> </div> </div> <div class="number-hours"> <p class="h2"> <?php echo orbis_time($seconds); ?> </p> </div> </div> <?php }
echo $registration->activity_name; ?> </td> <td> <?php echo $registration->work_description; ?> </td> <td> <?php echo $registration->work_date; ?> </td> <td> <?php echo orbis_time($registration->work_duration); ?> </td> <td> <a href="<?php echo get_edit_orbis_work_registration_link($registration->work_id); ?> "><span class="glyphicon glyphicon-pencil"></span> <span style="display: none"><?php _e('Edit', 'orbis_timesheets'); ?> </span></a> </td> </tr> <?php }
echo $registration->user_display_name; ?> </td> <td> <?php echo $registration->activity_name; ?> </td> <td> <?php echo $registration->description; ?> </td> <td> <?php echo orbis_time($registration->number_seconds); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } else { ?>
/** * Project column * * @param string $column */ function orbis_task_column($column, $post_id) { switch ($column) { case 'orbis_task_project': $id = get_post_meta($post_id, '_orbis_task_project_id', true); global $post; if (isset($post->project_post_id)) { $url = get_permalink($post->project_post_id); $title = get_the_title($post->project_post_id); printf('<a href="%s" target="_blank">%s</a>', esc_attr($url), esc_attr($title)); } else { echo '—'; } break; case 'orbis_task_assignee': orbis_task_assignee(); break; case 'orbis_task_due_at': $due_at = get_post_meta($post_id, '_orbis_task_due_at', true); if (empty($due_at)) { echo '—'; } else { $seconds = strtotime($due_at); $delta = $seconds - time(); $days = round($delta / (3600 * 24)); echo $due_at, '<br />'; printf(__('%d days', 'orbis_tasks'), $days); } break; case 'orbis_task_time': $seconds = get_post_meta($post_id, '_orbis_task_seconds', true); if (empty($seconds)) { echo '—'; } else { echo orbis_time($seconds); } break; case 'orbis_task_completed': $completed = get_post_meta($post_id, '_orbis_task_completed', true); echo $completed ? __('Yes', 'orbis_tasks') : __('No', 'orbis_tasks'); break; } }
<td><?php echo $row->description; ?> </td> <td> <?php $title = sprintf(__('%s billable, %s unbillable', 'orbis'), orbis_time($row->billable_seconds), orbis_time($row->unbillable_seconds)); ?> <a href="#" data-toggle="tooltip" title="<?php echo esc_attr($title); ?> "> <?php echo orbis_time($row->number_seconds); ?> </a> </td> <td><?php echo orbis_time($total); ?> </td> </tr> <?php } ?> </tbody> </table> <?php get_footer();
<div class="content"> <?php $query = $wpdb->prepare("\n\t\tSELECT\n\t\t\tSUM( timesheet.number_seconds ) AS total_seconds,\n\t\t\tuser.display_name,\n\t\t\tproject.*\n\t\tFROM\n\t\t\t{$wpdb->orbis_timesheets} AS timesheet\n\t\t\t\tLEFT JOIN\n\t\t\t{$wpdb->users} AS user\n\t\t\t\t\tON timesheet.user_id = user.id\n\t\t\t\tLEFT JOIN\n\t\t\t{$wpdb->orbis_projects} AS project\n\t\t\t\t\tON timesheet.project_id = project.id\n\t\tWHERE\n\t\t\tproject.post_id = %d\n\t\tGROUP BY\n\t\t\tuser.id\n\t\t;\n\t", get_the_ID()); $result = $wpdb->get_results($query); $flot_data = array(); foreach ($result as $row) { $label = sprintf('<strong>%s</strong> - %s', orbis_time($row->total_seconds), $row->display_name); $flot_data[] = array('label' => $label, 'data' => array(array(0, $row->total_seconds))); } $flot_options = array('series' => array('pie' => array('innerRadius' => 0.5, 'show' => true))); ?> <div id="donut2" class="graph" style="height: 400px; width: 100%;"></div> <?php orbis_flot('donut2', $flot_data, $flot_options); ?> </div>
echo $task->assigned_to_name; ?> </td> <td> <?php echo apply_filters('orbis_task_text', $task->task); ?> </td> <td> <?php echo mysql2date('d-m-Y', $task->planned_end_date); ?> </td> <td> <?php echo orbis_time($task->planned_duration); ?> </td> <td class="number-days-column"> <?php echo round($time_diff / (3600 * 24)); ?> </td> <td> <a href="<?php echo get_finish_orbis_task_link($task->id); ?> "><span class="glyphicon glyphicon-ok"></span> <span style="display: none"><?php _e('Finish', 'orbis_tasks'); ?> </span></a>
<?php echo get_the_author_meta('display_name', $user_id); ?> </td> <?php foreach ($timesheet as $date => $time) { ?> <?php $url = add_query_arg(array('start_date' => date('Y-m-d', strtotime($date)), 'end_date' => date('Y-m-d', strtotime($date)), 'user' => $user_id)); ?> <td scope="row" style="text-align: left; border: 1px solid #ddd;"> <?php echo orbis_time($time); ?> </td> <?php } ?> </tr> <?php } ?> </tbody> </table>
function orbis_timesheets_get_project_name($orbis_id) { global $wpdb; $name = $orbis_id; // Query $query = $wpdb->prepare("\n\t\tSELECT\n\t\t\tproject.id AS project_id,\n\t\t\tprincipal.name AS principal_name,\n\t\t\tproject.name AS project_name,\n\t\t\tproject.number_seconds AS project_time,\n\t\t\tSUM( entry.number_seconds ) AS project_logged_time\n\t\tFROM\n\t\t\t{$wpdb->orbis_projects} AS project\n\t\t\t\tLEFT JOIN\n\t\t\t{$wpdb->orbis_companies} AS principal\n\t\t\t\t\tON project.principal_id = principal.id\n\t\t\t\tLEFT JOIN\n\t\t\t{$wpdb->orbis_timesheets} AS entry\n\t\t\t\t\tON entry.project_id = project.id\n\t\tWHERE\n\t\t\tproject.id = %d\n\t\t;\n\t", $orbis_id); // Project $result = $wpdb->get_row($query); if ($result) { $name = sprintf('%s. %s - %s ( %s / %s )', $result->project_id, $result->principal_name, $result->project_name, orbis_time($result->project_logged_time), orbis_time($result->project_time)); } return $name; }
function orbis_task_time() { $post_id = get_the_ID(); $seconds = get_post_meta($post_id, '_orbis_task_seconds', true); echo orbis_time($seconds); }
<input id="orbis_task_due_at" name="_orbis_task_due_at_string" value="<?php echo esc_attr($due_at_string); ?> " type="text" class="regular-text orbis-datepicker" /> </td> </tr> <tr valign="top"> <th scope="row"> <label for="_orbis_task_seconds_string"><?php _e('Time', 'orbis_tasks'); ?> </label> </th> <td> <input size="5" id="_orbis_task_seconds_string" name="_orbis_task_seconds_string" value="<?php echo esc_attr(orbis_time($seconds)); ?> " type="text" class="small-text" /> <p class="description"> <?php _e('You can enter time as 1.5 or 1:30 (they both mean 1 hour and 30 minutes).', 'orbis'); ?> </p> </td> </tr> <tr> <th scope="row"> <label for="orbis_task_completed"><?php _e('Completed', 'orbis_tasks'); ?>