public function display($p_bug, $p_columns_target) { plugin_push_current('Timecard'); $p_bug_id = $p_bug->id; $t_bug = TimecardBug::load($p_bug_id, true); $t_bug->calculate(); if ($t_bug->estimate >= 0) { echo $t_bug->estimate, plugin_lang_get('hours'); } plugin_pop_current(); }
/** * Load child TimecardBug objects. * @param boolean Load TimecardUpdate objects */ function load_bugs($p_load_updates = false) { if (empty($this->bugs)) { $this->bugs = TimecardBug::load_by_project($this->project_id, $p_load_updates); } }
echo '<td>' . plugin_lang_get('timecard') . '</td>'; } if (plugin_config_get('use_updates')) { echo '<td>' . plugin_lang_get('hours_spent') . '</td>'; } echo ' <td>' . plugin_lang_get('hours_remaining') . '</td> <td>' . plugin_lang_get('days_since') . '</td> </tr>'; $i = 1; #row class selector $t_time_sum = 0; foreach ($t_all_projects as $t_all_project) { $t_query = "SELECT * FROM {$t_bug_table}\n\t\t\tWHERE project_id=" . db_param(); $t_result = db_query_bound($t_query, array($t_all_project)); while ($t_row = db_fetch_array($t_result)) { $t_timecard = TimecardBug::load($t_row['id']); $t_timecard->summary = $t_row['summary']; $t_timecard->assigned = user_get_name($t_row['handler_id']); $t_timecard->calculate(); if ('user0' == $t_timecard->assigned) { # When bug not assigned don't print user0 $t_timecard->assigned = ''; } $t_timecard->status = MantisEnum::getLabel(config_get('status_enum_string'), $t_row['status']); $t_timecard->diff = time_get_diff($t_timecard->timestamp); if ($t_timecard->estimate < 0) { $t_timecard->estimate = plugin_lang_get('estimate_zero'); $row_class = 'negative'; } else { $t_time_sum += $t_timecard->estimate; $row_class = "row-{$i}";
/** * Show timecard and estimate information when viewing bugs. * @param string Event name * @param int Bug ID */ function view_bug($p_event, $p_bug_id) { if (!access_has_bug_level(plugin_config_get('view_threshold'), $p_bug_id)) { return; } $t_bug = TimecardBug::load($p_bug_id, true); $t_bug->calculate(); $t_columns = 6; echo '<tr ', helper_alternate_class(), '>'; if (plugin_config_get('use_estimates')) { echo '<td class="category">', plugin_lang_get('estimate'), '</td><td>'; if ($t_bug->estimate >= 0) { if (plugin_config_get('use_updates')) { $t_bug->calculate(); if ($t_bug->spent > $t_bug->estimate) { echo sprintf(plugin_lang_get('estimate_over'), $t_bug->estimate, $t_bug->spent - $t_bug->estimate); } else { echo sprintf(plugin_lang_get('estimate_display'), $t_bug->estimate, $t_bug->estimate - $t_bug->spent); } } else { echo $t_bug->estimate, plugin_lang_get('hours'); } } else { echo plugin_lang_get('estimate_zero'); } echo '</td>'; $t_columns -= 2; } if (plugin_config_get('use_timecard')) { echo '<td class="category">', plugin_lang_get('timecard'), '</td><td>', string_display_line($t_bug->timecard), '</td>'; $t_columns -= 2; } if ($t_columns > 0) { echo '<td colspan="', $t_columns, '"></td>'; } echo '</tr>'; }