/** * Print the list of selected issues and the legend for the status colors. * * @param $p_bug_ids_array An array of issue ids. */ function bug_group_action_print_bug_list($p_bug_ids_array) { $t_legend_position = config_get('status_legend_position'); if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) { html_status_legend(); echo '<br />'; } echo '<div align="center">'; echo '<table class="width75" cellspacing="1">'; echo '<tr class="row-1">'; echo '<td class="category" colspan="2">'; echo lang_get('actiongroup_bugs'); echo '</td>'; echo '</tr>'; $t_i = 1; foreach ($p_bug_ids_array as $t_bug_id) { $t_class = sprintf("row-%d", $t_i++ % 2 + 1); echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary'))); } echo '</table>'; echo '</form>'; echo '</div>'; if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) { echo '<br />'; html_status_legend(); } }
/** * Print table head * @param $status_cols */ function print_thead($status_cols) { echo '<thead>'; echo '<tr>'; echo '<th></th>'; foreach ($status_cols as $status_col) { echo '<th bgcolor="' . get_status_color($status_col, null, null) . '" class="center">'; $assocArray = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string')); echo $assocArray[$status_col]; echo '</th>'; } echo '</tr>'; echo '</thead>'; }
function renderLists() { $content = ''; $status_codes = config_get('status_enum_string'); $t_status_array = MantisEnum::getAssocArrayIndexedByValues($status_codes); foreach ($t_status_array as $status => $statusCode) { if ($statusCode != "backlog" && $statusCode != "closed") { $issues = $this->renderIssues($status); $statusName = string_display_line(get_enum_element('status', $status)); $content .= '<div class="column"> <div class="inside" style="background-color: ' . get_status_color($status) . '" id="' . $status . '"> <h5 title="' . $status . '">' . $statusName . ' (' . sizeof($issues) . ')</h5>'; $content .= implode("\n", $issues); $content .= '</div>'; // inside $content .= '</div>'; // column } } return $content; }
function getBugsInfoJSONPResponse($bugsString) { $t_bug_table = db_get_table('mantis_bug_table'); $t_statuses = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string')); $statuses = ''; foreach ($t_statuses as $t_state => $t_label) { $statuses .= '"' . $t_label . '": "' . get_status_color($t_state) . '", '; } $bugs_list = array_unique(str_split($bugsString, 7)); $bugs_list = "'" . implode("', '", $bugs_list) . "'"; $query = "SELECT id, status, summary\r\n\t\t\t FROM `" . $t_bug_table . "`\r\n\t\t\t WHERE id IN (" . $bugs_list . ")\r\n\t\t\t ORDER BY FIELD(id, " . $bugs_list . ")"; $results = db_query_bound($query); if ($results) { $json = ''; while ($row = db_fetch_array($results)) { $id = $row['id']; $statusId = $row['status']; $summary = $row['summary']; $json .= '"' . $id . '": { "status": "' . $t_statuses[$statusId] . '", "summary": "' . htmlspecialchars($summary) . '" }, '; } } header("Content-Type: application/javascript; charset=utf-8"); echo 'bugtrackerConnection_callback( { "offset": "' . $_REQUEST['offset'] . '", "length": "' . $_REQUEST['length'] . '", "statuses": { ' . substr($statuses, 0, -2) . ' }, "bugsInfo" : { ' . substr($json, 0, -2) . ' } } );'; }
/** * Print the amount of issues for each specified status in the user row of the plugin table * * @param $data_row * @param $stat_issue_count * @param $group_index * @param $print * @return mixed */ function print_amount_of_issues($data_row, $group_index, $stat_issue_count, $print) { $user_id = $data_row['user_id']; for ($stat_index = 1; $stat_index <= userprojectapi::get_stat_count(); $stat_index++) { $stat_spec_status_ign = plugin_config_get('CStatIgn' . $stat_index); $temp_stat_issue_count = userprojectapi::calc_group_spec_amount($data_row, $group_index, $stat_index); $stat_issue_count_threshold = plugin_config_get('IAMThreshold' . $stat_index); $stat_status_id = plugin_config_get('CStatSelect' . $stat_index); $stat_issue_count[$stat_index] += $temp_stat_issue_count; /** group 2 -> mark all cells where issue count > 0 */ if (!userprojectapi::check_user_id_is_enabled($user_id) && $temp_stat_issue_count > 0 && $group_index != 3) { echo '<td class="group_row_bg" style="background-color:' . plugin_config_get('TAMHBGColor') . '">'; } else { if ($stat_issue_count_threshold <= $temp_stat_issue_count && $stat_issue_count_threshold > 0) { echo '<td style="background-color:' . plugin_config_get('TAMHBGColor') . '">'; } else { echo '<td style="background-color:' . get_status_color($stat_status_id, null, null) . '">'; } } if (!$print && $temp_stat_issue_count > 0) { $assigned_project_id = $data_row['assigned_project_id']; $target_version_id = $data_row['target_version_id']; $target_version = ''; if (strlen($target_version_id) > 0) { $target_version = version_get_field($target_version_id, 'version'); } $filter_string = '<a href="search.php?project_id=' . $assigned_project_id . '&status_id=' . $stat_status_id; if ($group_index != 3 || $stat_spec_status_ign == OFF && $group_index == 3) { $filter_string .= '&handler_id=' . userprojectapi::get_link_user_id($data_row['user_id']); } $filter_string .= '&sticky_issues=on' . '&target_version=' . $target_version . '&sortby=last_updated' . '&dir=DESC' . '&hide_status_id=-2' . '&match_type=0">'; echo $filter_string; echo $temp_stat_issue_count; echo '</a>'; } else { echo $temp_stat_issue_count; } echo '</td>' . PHP_EOL; } return $stat_issue_count; }
/** * @param $amount_stat_columns * @param $print_flag * @param $version * @param $version_spec_bugs * @param $null_issues_flag */ function print_issue_amount($amount_stat_columns, $print_flag, $version, $version_spec_bugs, $null_issues_flag) { if (plugin_config_get('ShowSpecStatCols') == ON) { for ($column_index = 1; $column_index <= $amount_stat_columns; $column_index++) { $column_spec_status = plugin_config_get('CStatSelect' . $column_index); $column_spec_bug_count = 0; if (!$null_issues_flag) { foreach ($version_spec_bugs as $version_spec_bug) { if (bug_get_field($version_spec_bug, 'status') == $column_spec_status) { $column_spec_bug_count++; } } echo '<td class="status" bgcolor="' . get_status_color($column_spec_status) . '">'; print_amount($print_flag, $column_spec_bug_count, $version); } else { echo '<td class="status" bgcolor="' . get_status_color($column_spec_status) . '">0'; } echo '</td>'; } } $version_spec_bug_count = count($version_spec_bugs); echo '<td class="status">'; print_amount($print_flag, $version_spec_bug_count, $version); echo '</td>'; }
function get_status_bgcolor($p_status) { if (!(CLOSED == $p_status)) { return "bgcolor=\"" . get_status_color($p_status) . "\""; } else { return ""; } }
function write_bug_rows($p_rows) { global $t_columns, $t_filter; $t_in_stickies = $t_filter && 'on' == $t_filter['sticky_issues']; mark_time('begin loop'); # -- Loop over bug rows -- $t_rows = sizeof($p_rows); for ($i = 0; $i < $t_rows; $i++) { $t_row = $p_rows[$i]; if (0 == $t_row['sticky'] && 0 == $i) { $t_in_stickies = false; } if (0 == $t_row['sticky'] && $t_in_stickies) { # demarcate stickies, if any have been shown ?> <tr> <td class="left" colspan="<?php echo sizeof($t_columns); ?> " bgcolor="#999999"> </td> </tr> <?php $t_in_stickies = false; } # choose color based on status $status_color = get_status_color($t_row['status']); echo '<tr bgcolor="', $status_color, '" border="1">'; foreach ($t_columns as $t_column) { $t_column_value_function = 'print_column_value'; helper_call_custom_function($t_column_value_function, array($t_column, $t_row)); } echo '</tr>'; } }
function html_status_percentage_legend() { $t_mantis_bug_table = config_get('mantis_bug_table'); $t_project_id = helper_get_current_project(); $t_user_id = auth_get_current_user_id(); #checking if it's a per project statistic or all projects $t_specific_where = helper_project_specific_where($t_project_id, $t_user_id); $query = "SELECT status, COUNT(*) AS number\r\n\t\t\t\tFROM {$t_mantis_bug_table}\r\n\t\t\t\tWHERE {$t_specific_where}\r\n\t\t\t\tGROUP BY status"; $result = db_query($query); $t_bug_count = 0; $t_status_count_array = array(); while ($row = db_fetch_array($result)) { $t_status_count_array[$row['status']] = $row['number']; $t_bug_count += $row['number']; } $t_arr = explode_enum_string(config_get('status_enum_string')); $enum_count = count($t_arr); if ($t_bug_count > 0) { echo '<br />'; echo '<table class="width100" cellspacing="1">'; echo '<tr>'; echo '<td class="form-title" colspan="' . $enum_count . '">' . lang_get('issue_status_percentage') . '</td>'; echo '</tr>'; echo '<tr>'; for ($i = 0; $i < $enum_count; $i++) { $t_s = explode_enum_arr($t_arr[$i]); $t_color = get_status_color($t_s[0]); $t_status = $t_s[0]; if (!isset($t_status_count_array[$t_status])) { $t_status_count_array[$t_status] = 0; } $width = round($t_status_count_array[$t_status] / $t_bug_count * 100); if ($width > 0) { echo "<td class=\"small-caption-center\" width=\"{$width}%\" bgcolor=\"{$t_color}\">{$width}%</td>"; } } echo '</tr>'; echo '</table>'; } }
# spacer if ($t_spacer > 0) { echo '<td colspan="', $t_spacer, '"> </td>'; } echo '</tr>'; } # # Status, Resolution # if ($tpl_show_status || $tpl_show_resolution) { echo '<tr ', helper_alternate_class(), '>'; $t_spacer = 2; # Status if ($tpl_show_status) { echo '<th class="bug-status category">', lang_get('status'), '</th>'; echo '<td class="bug-status" bgcolor="', get_status_color($tpl_bug->status), '">', $tpl_status, '</td>'; } else { $t_spacer += 2; } # Resolution if ($tpl_show_resolution) { echo '<th class="bug-resolution category">', lang_get('resolution'), '</th>'; echo '<td class="bug-resolution">', $tpl_resolution, '</td>'; } else { $t_spacer += 2; } # spacer if ($t_spacer > 0) { echo '<td colspan="', $t_spacer, '"> </td>'; } echo '</tr>';
function write_bug_rows($p_rows) { global $t_columns, $t_filter; $t_in_stickies = $t_filter && 'on' == $t_filter['sticky_issues']; # pre-cache custom column data columns_plugin_cache_issue_data($p_rows); # -- Loop over bug rows -- $t_rows = count($p_rows); for ($i = 0; $i < $t_rows; $i++) { $t_row = $p_rows[$i]; if (0 == $t_row->sticky && 0 == $i) { $t_in_stickies = false; } if (0 == $t_row->sticky && $t_in_stickies) { # demarcate stickies, if any have been shown ?> <tr> <td class="left" colspan="<?php echo count($t_columns); ?> " bgcolor="#999999"> </td> </tr> <?php $t_in_stickies = false; } # choose color based on status $status_color = get_status_color($t_row->status, auth_get_current_user_id(), $t_row->project_id); echo '<tr bgcolor="', $status_color, '" border="1" valign="top">'; $t_column_value_function = 'print_column_value'; foreach ($t_columns as $t_column) { helper_call_custom_function($t_column_value_function, array($t_column, $t_row)); } echo '</tr>'; } }
} echo "({$v_start} - {$v_end} / {$t_bug_count})"; ?> </td> </tr> <?php mark_time('begin loop'); # -- Loop over bug rows and create $v_* variables -- for ($i = 0; $i < sizeof($rows); $i++) { # prefix bug data with v_ extract($rows[$i], EXTR_PREFIX_ALL, 'v'); $t_summary = string_attribute($v_summary); $t_last_updated = date(config_get('normal_date_format'), $v_last_updated); # choose color based on status $status_color = get_status_color($v_status); # grab the bugnote count # @@@ thraxisp - not used??? # $bugnote_info = bug_get_bugnote_stats( $v_id ); # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($v_id)) { $t_attachment_count = file_bug_attachment_count($v_id); } # grab the project name $project_name = project_get_field($v_project_id, 'name'); ?> <tr bgcolor="<?php echo $status_color; ?>
$t_total_paid = 0; for ($i = 0; $i < $t_sponsors; ++$i) { $row = db_fetch_array($result); $t_bug = bug_get($row['bug']); $t_sponsor = sponsorship_get($row['sponsor']); $t_buglist[] = $row['bug'] . ':' . $row['sponsor']; # describe bug $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id)); $t_version_id = version_get_id($t_bug->fixed_in_version, $t_project); if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) { $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>'; } else { $t_released_label = $t_bug->fixed_in_version; } echo '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">'; echo '<td><a href="' . string_get_bug_view_url($row['bug']) . '">' . bug_format_id($row['bug']) . '</a></td>'; echo '<td>' . project_get_field($t_bug->project_id, 'name') . ' </td>'; echo '<td class="right">' . $t_released_label . ' </td>'; echo '<td><a title="' . $t_resolution . '"><u>' . $t_status . '</u> </a></td>'; # summary echo '<td>' . string_display_line($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } # describe sponsorship amount echo '<td>'; print_user($t_sponsor->user_id); echo '</td>'; echo '<td class="right">' . sponsorship_format_amount($t_sponsor->amount) . '</td>'; echo '<td><select name="sponsor_' . $row['bug'] . '_' . $t_sponsor->id . '">';
$t_total_paid = 0; for ($i = 0; $i < $t_sponsors; ++$i) { $row = db_fetch_array($result); $t_bug = bug_get($row['bug']); $t_sponsor = sponsorship_get($row['sponsor']); $t_buglist[] = $row['bug'] . ':' . $row['sponsor']; # describe bug $t_status = string_attribute(get_enum_element('status', $t_bug->status)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution)); $t_version_id = version_get_id($t_bug->fixed_in_version, $t_project); if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) { $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>'; } else { $t_released_label = $t_bug->fixed_in_version; } echo '<tr bgcolor="' . get_status_color($t_bug->status) . '">'; echo '<td><a href="' . string_get_bug_view_url($row['bug']) . '">' . bug_format_id($row['bug']) . '</a></td>'; echo '<td>' . project_get_field($t_bug->project_id, 'name') . ' </td>'; echo '<td class="right">' . $t_released_label . ' </td>'; echo '<td><a title="' . $t_resolution . '"><u>' . $t_status . '</u> </a></td>'; # summary echo '<td>' . string_display_line($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } # describe sponsorship amount echo '<td>'; print_user($t_sponsor->user_id); echo '</td>'; echo '<td class="right">' . sponsorship_format_amount($t_sponsor->amount) . '</td>'; echo '<td><select name="sponsor_' . $row['bug'] . '_' . $t_sponsor->id . '">';
$v_end = 0; } echo "({$v_start} - {$v_end} / {$t_bug_count})"; ?> </td> </tr> <?php # -- Loop over bug rows and create $v_* variables -- $t_count = count($rows); for ($i = 0; $i < $t_count; $i++) { $t_bug = $rows[$i]; $t_summary = string_display_line_links($t_bug->summary); $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated); # choose color based on status $status_color = get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); # Check for attachments $t_attachment_count = 0; # TODO: factor in the allow_view_own_attachments configuration option # instead of just using a global check. if (file_can_view_bug_attachments($t_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($t_bug->id); } # grab the project name $project_name = project_get_field($t_bug->project_id, 'name'); ?> <tr bgcolor="<?php echo $status_color; ?> ">
function relationship_get_details($p_bug_id, $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false) { $t_summary_wrap_at = strlen(config_get('email_separator2')) - 28; $t_icon_path = config_get('icon_path'); $p_user_id = auth_get_current_user_id(); if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; $t_related_project_name = project_get_name($p_relationship->dest_project_id); $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the src side $t_related_bug_id = $p_relationship->src_bug_id; $t_related_project_name = project_get_name($p_relationship->src_project_id); $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # related bug not existing... if (!bug_exists($t_related_bug_id)) { return ''; } # user can access to the related bug at least as a viewer if (!access_has_bug_level(VIEWER, $t_related_bug_id)) { return ''; } if ($p_html_preview == false) { $t_td = '<td>'; } else { $t_td = '<td class="print">'; } # get the information from the related bug and prepare the link $t_bug = bug_prepare_display(bug_get($t_related_bug_id, true)); $t_status = string_attribute(get_enum_element('status', $t_bug->status)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution)); $t_relationship_info_html = $t_td . '<nobr>' . $t_relationship_descr . '</nobr> </td>'; if ($p_html_preview == false) { $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . bug_format_id($t_related_bug_id) . '</a></td>'; $t_relationship_info_html .= '<td><a title="' . $t_resolution . '"><u>' . $t_status . '</u> </a></td>'; } else { $t_relationship_info_html .= $t_td . bug_format_id($t_related_bug_id) . '</td>'; $t_relationship_info_html .= $t_td . $t_status . ' </td>'; } $t_relationship_info_text = str_pad($t_relationship_descr, 20); $t_relationship_info_text .= str_pad(bug_format_id($t_related_bug_id), 8); # get the handler name of the related bug $t_relationship_info_html .= $t_td; if ($t_bug->handler_id > 0) { $t_relationship_info_html .= '<nobr>' . prepare_user_name($t_bug->handler_id) . '</nobr>'; } $t_relationship_info_html .= ' </td>'; # add project name if ($p_show_project) { $t_relationship_info_html .= $t_td . $t_related_project_name . ' </td>'; } # add summary $t_relationship_info_html .= $t_td . $t_bug->summary; if (VS_PRIVATE == $t_bug->view_state) { $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } if (strlen($t_bug->summary) <= $t_summary_wrap_at) { $t_relationship_info_text .= $t_bug->summary; } else { $t_relationship_info_text .= substr($t_bug->summary, 0, $t_summary_wrap_at - 3) . '...'; } # add delete link if bug not read only and user has access level if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) { if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { $t_relationship_info_html .= " [<a class=\"small\" href=\"bug_relationship_delete.php?bug_id={$p_bug_id}&rel_id={$p_relationship->id}\">" . lang_get('delete_link') . '</a>]'; } } $t_relationship_info_html .= ' </td>'; $t_relationship_info_text .= "\n"; if ($p_html_preview == false) { $t_relationship_info_html = '<tr bgcolor="' . get_status_color($t_bug->status) . '">' . $t_relationship_info_html . '</tr>' . "\n"; } else { $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>'; } if ($p_html == true) { return $t_relationship_info_html; } else { return $t_relationship_info_text; } }
<?php # -- Loop over bug rows and create $v_* variables -- $t_count = count($rows); for ($i = 0; $i < $t_count; $i++) { $t_bug = $rows[$i]; $t_summary = string_display_line_links($t_bug->summary); $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated); $t_bug_due_date = $t_bug->__get('due_date'); if (!date_is_null($t_bug_due_date)) { $t_bug_due_date = date(config_get('normal_date_format'), $t_bug_due_date); } else { $t_bug_due_date = ''; } # choose color based on status $status_color = get_status_color($t_bug->status); # grab the project name $project_name = project_get_field($t_bug->project_id, 'name'); ?> <tr bgcolor="<?php echo $status_color; ?> "> <?php # -- Bug ID and details link + Pencil shortcut -- ?> <td class="center" valign="top" width ="0" nowrap="nowrap"> <span class="small"> <?php print_bug_link($t_bug->id);
</tr> </table> <?php echo "<center><table class='list' cellpadding='3' cellspacing='0'>\n"; echo "<tr>"; echo "<td class='list'><b>id</b></td>\n"; echo "<td class='list'><b>" . _('Title') . "</b></td>\n"; echo "<td class='list'><b>" . _('Views') . "</b></td>\n"; echo "<td class='list'><b>" . _('Total views') . "</b></td>\n"; echo "<td class='list'><b>" . _('Last views') . "</b></td>\n"; echo "<td class='list'><b>" . _('How many storages') . "</b></td>\n"; echo "</tr>\n"; while ($arr = $video->next()) { echo "<tr>"; echo "<td class='list'>" . $arr['id'] . "</td>\n"; echo "<td class='list' style='color:" . get_status_color($arr['id']) . "'>" . $arr['name'] . "</td>\n"; echo "<td class='list'>" . $arr['counter'] . "</td>\n"; echo "<td class='list'>" . $arr['count'] . "</td>\n"; echo "<td class='list'>" . $arr['last_played'] . "</td>\n"; echo "<td class='list'>" . count_storages($arr['id']) . "</td>\n"; echo "</tr>\n"; } echo "</table>\n"; echo "<table width='700' align='center' border=0>\n"; echo "<tr>\n"; echo "<td width='100%' align='center'>\n"; echo page_bar(); echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</center>\n";
* means: Column 1 of your board has the name of the key "header_column_1" (e.g. "New"), * shows all tickets with status = 10 and has a "work in progress" limit of 0 (unlimited). */ $columns = array(lang_get('header_column_1') => array('status' => array(10), 'wip_limit' => 0), lang_get('header_column_2') => array('status' => array(30), 'wip_limit' => 0), lang_get('header_column_3') => array('status' => array(40), 'wip_limit' => 8), lang_get('header_column_4') => array('status' => 20, 'wip_limit' => 0), lang_get('header_column_5') => array('status' => 50, 'wip_limit' => 8)); if (ON == plugin_config_get('kanban_simple_columns')) { $defaults = MantisEnum::getAssocArrayIndexedByValues($g_status_enum_string); $columns = null; $hideUntilThisStatus = config_get('bug_resolved_status_threshold'); foreach ($defaults as $num => $status) { if ($num < $hideUntilThisStatus) { $wip_limit = 12; //no limit for "new" if (10 == $num) { $wip_limit = 0; } $columns[kanban_get_status_text($num)] = array('status' => array($num), 'wip_limit' => $wip_limit, 'color' => get_status_color($num)); } } } // default sorting of the tickets in the columns // either 'last_updated' or 'priority' $f_default_sort_by = 'priority'; //'last_updated'; // current sorting $f_sort_by = gpc_get_string('sort', $f_default_sort_by); auth_ensure_user_authenticated(); $t_current_user_id = auth_get_current_user_id(); compress_enable(); # don't index the kanban page html_robots_noindex(); html_page_top1(plugin_lang_get('kanban_link'));
# spacer if ($t_spacer > 0) { echo '<td colspan="', $t_spacer, '"> </td>'; } echo '</tr>'; } # # Status, Resolution # if ($tpl_show_status || $tpl_show_resolution) { echo '<tr ', helper_alternate_class(), '>'; $t_spacer = 2; # Status if ($tpl_show_status) { echo '<td class="category">', lang_get('status'), '</td>'; echo '<td bgcolor="', get_status_color($tpl_bug->status), '">', $tpl_status, '</td>'; } else { $t_spacer += 2; } # Resolution if ($tpl_show_resolution) { echo '<td class="category">', lang_get('resolution'), '</td>'; echo '<td>', $tpl_resolution, '</td>'; } else { $t_spacer += 2; } # spacer if ($t_spacer > 0) { echo '<td colspan="', $t_spacer, '"> </td>'; } echo '</tr>';
/** * return formatted string with all the details on the requested relationship * @param int $p_bug_id Bug id * @param BugRelationshipData $p_relationship Relationsip object * @param bool $p_html Generate html * @param bool $p_html_preview ???? generate printable version??? * @param bool $p_show_project Show Project details * @return string */ function relationship_get_details($p_bug_id, $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false) { $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28; $t_icon_path = config_get('icon_path'); if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; $t_related_project_name = project_get_name($p_relationship->dest_project_id); $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the src side $t_related_bug_id = $p_relationship->src_bug_id; $t_related_project_name = project_get_name($p_relationship->src_project_id); $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # related bug not existing... if (!bug_exists($t_related_bug_id)) { return ''; } # user can access to the related bug at least as a viewer if (!access_has_bug_level(VIEWER, $t_related_bug_id)) { return ''; } if ($p_html_preview == false) { $t_td = '<td>'; } else { $t_td = '<td class="print">'; } # get the information from the related bug and prepare the link $t_bug = bug_get($t_related_bug_id, false); $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id); $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id); $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . ' </td>'; if ($p_html_preview == false) { $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>'; $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>'; } else { $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>'; $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . ' </td>'; } $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20); $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8); # get the handler name of the related bug $t_relationship_info_html .= $t_td; if ($t_bug->handler_id > 0) { $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id)); } $t_relationship_info_html .= ' </td>'; # add project name if ($p_show_project) { $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . ' </td>'; } # add summary if ($p_html == true) { $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } } else { if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) { $t_relationship_info_text .= string_email_links($t_bug->summary); } else { $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...'; } } # add delete link if bug not read only and user has access level if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) { if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]'; } } $t_relationship_info_html .= ' </td>'; $t_relationship_info_text .= "\n"; if ($p_html_preview == false) { $t_relationship_info_html = '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">' . $t_relationship_info_html . '</tr>' . "\n"; } else { $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>'; } if ($p_html == true) { return $t_relationship_info_html; } else { return $t_relationship_info_text; } }
/** * Print the legend for the status percentage * @return null */ function html_status_percentage_legend() { $t_mantis_bug_table = db_get_table('mantis_bug_table'); $t_project_id = helper_get_current_project(); $t_user_id = auth_get_current_user_id(); # checking if it's a per project statistic or all projects $t_specific_where = helper_project_specific_where($t_project_id, $t_user_id); $query = "SELECT status, COUNT(*) AS number\n\t\t\t\tFROM {$t_mantis_bug_table}\n\t\t\t\tWHERE {$t_specific_where}"; if (!access_has_project_level(config_get('private_bug_threshold'))) { $query .= ' AND view_state < ' . VS_PRIVATE; } $query .= ' GROUP BY status'; $result = db_query_bound($query); $t_bug_count = 0; $t_status_count_array = array(); while ($row = db_fetch_array($result)) { $t_status_count_array[$row['status']] = $row['number']; $t_bug_count += $row['number']; } $t_enum_values = MantisEnum::getValues(config_get('status_enum_string')); $enum_count = count($t_enum_values); if ($t_bug_count > 0) { echo '<br />'; echo '<table class="width100" cellspacing="1">'; echo '<tr>'; echo '<td class="form-title" colspan="' . $enum_count . '">' . lang_get('issue_status_percentage') . '</td>'; echo '</tr>'; echo '<tr>'; foreach ($t_enum_values as $t_status) { $t_color = get_status_color($t_status); if (!isset($t_status_count_array[$t_status])) { $t_status_count_array[$t_status] = 0; } $width = round($t_status_count_array[$t_status] / $t_bug_count * 100); if ($width > 0) { echo "<td class=\"small-caption-center\" width=\"{$width}%\" bgcolor=\"{$t_color}\">{$width}%</td>"; } } echo '</tr>'; echo '</table>'; } }
function render_host_simple($detail) { $result = ""; $id = $detail["id"]; $anchor = $detail["anchor"]; $icolor = $detail["icolor"]; $name = $detail["name"]; $title = $detail["title"]; $displayname = $detail["displayname"]; $status = $detail["status"]; $sdisplay = $detail["sdisplay"]; $hostname = $detail["hostname"]; $ptime = $detail["ping_time"]; $d = $detail["last_fail"]; $avail = $detail["availibility"]; $dt = $detail["downtime"]; $color = get_status_color($status); $result .= "\t\t<a class=info href='{$anchor}'><font id='status_{$id}' color='{$color}'>{$displayname}</font><span>{$title}</span><br><font color='red'>{$dt}</font></a>\n"; return $result; }
function GetRelationshipContent($p_bug_id, $p_html = false, $p_html_preview = false, $p_summary = false, $p_icons = false) { $t_summary = ''; $t_icons = ''; $t_show_project = false; $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 10; $t_relationship_all = relationship_get_all($p_bug_id, $t_show_project); $t_relationship_all_count = count($t_relationship_all); if ($p_summary) { for ($i = 0; $i < $t_relationship_all_count; $i++) { $p_relationship = $t_relationship_all[$i]; if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the src side $t_related_bug_id = $p_relationship->src_bug_id; $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # get the information from the related bug and prepare the link $t_bug = bug_get($t_related_bug_id, false); $t_text = trim(utf8_str_pad($t_relationship_descr, 20)) . ' '; if ($p_html_preview == true) { $t_text .= '<a href="' . string_get_bug_view_url($t_related_bug_id) . '"'; $t_text .= ' class="rcv_tooltip"'; //$t_text .= ' title="' . utf8_str_pad (bug_format_id ($t_related_bug_id), 8) . "\n" . string_attribute ($t_bug->summary) . '"'; $t_text .= '>'; } $t_text .= string_display_line(bug_format_id($t_related_bug_id)); if ($p_html_preview == true) { $t_text .= '<span class="rcv_tooltip_box">'; $t_text .= '<span class="rcv_tooltip_title">' . bug_format_id($t_related_bug_id) . '</span>'; $t_text .= '<span class="rcv_tooltip_content">' . utf8_substr(string_email_links($t_bug->summary), 0, MAX_TOOLTIP_CONTENT_LENGTH); $t_text .= MAX_TOOLTIP_CONTENT_LENGTH < strlen($t_bug->summary) ? '...' : ''; $t_text .= '</span>'; $t_text .= '</span>'; $t_text .= '</a>'; } if (plugin_config_get('ShowRelationshipsControl') && !bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && true == $p_html_preview) { // bug not read only if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { // user has access level // add a delete link $t_text .= ' ['; $t_text .= '<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id; $t_text .= '&rel_id=' . $p_relationship->id; $t_text .= '&redirect_url=view_all_bug_page.php'; $t_text .= htmlspecialchars(form_security_param('bug_relationship_delete')); $t_text .= '">' . lang_get('delete_link') . '</a>'; $t_text .= ']'; } } // $t_text = relationship_get_details ($p_bug_id, $t_relationship_all[$i], true, false, $t_show_project); if (false == $p_html) { // p_html == No if ($i != 0) { if ($p_html_preview == true) { $t_summary .= ",<br/>"; } else { $t_summary .= ", "; } } $t_summary .= $t_text; } else { // p_html == Yes if ($p_html_preview == true) { $t_summary .= '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">'; $t_summary .= '<td>' . $t_text . '</td>'; $t_summary .= '</tr>' . "\n"; } else { if ($i != 0) { $t_summary .= ", "; } $t_summary .= $t_text; } } } } if (plugin_config_get('ShowRelationshipIcons') && !current_user_is_anonymous() && true == $p_html_preview) { $t_text = RelationshipsUtils::GetBugSmybols($p_bug_id, !is_blank($t_summary)); if (!is_blank($t_text)) { if (false == $p_html) { // p_html == No $t_icons .= $t_text; } else { // p_html == Yes if ($p_html_preview == true) { $t_icons .= '<tr><td>' . $t_text . '</td></tr>' . "\n"; } else { $t_icons .= $t_text; } } } } if ($p_html_preview == true) { $t_icons_table = ''; $t_summary_table = ''; if (!is_blank($t_icons)) { $t_icons_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_icons . '</table>'; } if (!is_blank($t_summary)) { $t_summary_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_summary . '</table>'; } if (!is_blank($t_icons_table) && !is_blank($t_summary_table)) { return '<table border="0" width="100%" cellpadding="0" cellspacing="0">' . '<tr><td valign="top" style="padding:0px;">' . $t_summary_table . '</td><td valign="top" style="padding:0px;">' . $t_icons_table . '</td></tr>' . '</table>'; } else { return $t_summary_table . $t_icons_table; } } else { $t_result = $t_icons; if (!is_blank($t_icons) && !is_blank($t_summary)) { $t_result .= '<br/>'; } $t_result .= $t_summary; return $t_result; } }
function relgraph_add_bug_to_graph(&$p_graph, $p_bug_id, $p_bug, $p_url = null, $p_highlight = false) { $t_node_attributes = array(); $t_node_attributes['label'] = $p_bug_id; if ($p_highlight) { $t_node_attributes['color'] = '#0000FF'; $t_node_attributes['style'] = 'bold, filled'; } else { $t_node_attributes['color'] = 'black'; $t_node_attributes['style'] = 'filled'; } $t_node_attributes['fillcolor'] = get_status_color($p_bug->status); if (null !== $p_url) { $t_node_attributes['URL'] = $p_url; } $t_summary = string_display_line_links($p_bug->summary); $t_status = get_enum_element('status', $p_bug->status); $t_node_attributes['tooltip'] = '[' . $t_status . '] ' . $t_summary; $p_graph->add_node($p_bug_id, $t_node_attributes); }
</tr> <tr <?php echo helper_alternate_class(); ?> > <!-- Status --> <td class="category"> <?php echo lang_get('status'); ?> </td> <td bgcolor="<?php echo get_status_color($t_bug->status); ?> "> <?php echo get_enum_element('status', $t_bug->status); ?> </td> <?php # Duplicate Id # MASC RELATIONSHIP if (OFF == config_get('enable_relationship')) { # Duplicate ID echo '<td class="category">', lang_get('duplicate_id'), ' </td>'; echo '<td>'; print_duplicate_id($t_bug->duplicate_id);
function gantt_chart($p_metrics, $p_title, $p_subtitle, $p_graph_width = 300, $p_graph_height = 380) { $t_graph_font = graph_get_font(); $t_metrics = $p_metrics['metrics']; $t_range = $p_metrics['range']; // Diff in weeks of the range: $t_60s = 60; // 1 minute $t_60min = 60; // 1 hour $t_24h = 24; // 1 day $t_7d = 7; // 1 week $t_minute = $t_60s; $t_hour = $t_60min * $t_minute; $t_day = $t_24h * $t_hour; $t_week = $t_7d * $t_day; $t_gantt_chart_max_rows = plugin_config_get('rows_max'); error_check(is_array($t_metrics) ? count($t_metrics) : 0, $p_title . " (" . $p_subtitle . ")"); if (plugin_config_get('eczlibrary') == ON) { // DO NOTHING SINCE eczlibrary DOES NOT SUPPORT GANTT CHART } else { // A new graph with automatic size $graph = new GanttGraph(0, 0, "auto"); $graph->SetShadow(); // Add title and subtitle $graph->title->Set($p_title); $graph->title->SetFont($t_graph_font, FS_BOLD, 12); $graph->subtitle->Set($p_subtitle); // Show day, week and month scale $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH); // Instead of week number show the date for the first day in the week // on the week scale $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY); // Make the week scale font smaller than the default $graph->scale->week->SetFont($t_graph_font, FS_NORMAL, 8); // Use the short name of the month together with a 2 digit year // on the month scale $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4); $graph->scale->month->SetFontColor("white"); $graph->scale->month->SetBackgroundColor("blue"); // Setup a horizontal grid $graph->hgrid->Show(); $graph->hgrid->SetRowFillColor('darkblue@0.9'); // Setup a vertical grid // $graph->vgrid->Show(); //Setup the divider display $graph->scale->divider->SetWeight(3); $graph->scale->divider->SetColor("darkblue"); $graph->scale->dividerh->SetWeight(3); $graph->scale->dividerh->SetColor("darkblue"); $graph->scale->dividerh->Show(); $graph->scale->actinfo->vgrid->SetStyle('solid'); $graph->scale->actinfo->vgrid->SetColor('darkblue'); $graph->scale->actinfo->vgrid->Show(); // // Set the column headers and font // $graph->scale->actinfo->SetColTitles( array('Task','Start','End'),array(100)); // $graph->scale->actinfo->SetFont( $t_graph_font, FS_BOLD, 10 ); //Adding columns: //The following is an example: 1st element, an array of the columns, // 2nd element an optional array of min width of the columns (here the min width of the 2 first columns) //$graph->scale->actinfo->SetColTitles( // array('Note','Task','Duration','Start','Finish'),array(30,100)); //Adding a table title $graph->scale->tableTitle->Set("{$p_subtitle}"); $graph->scale->tableTitle->SetFont($t_graph_font, FS_NORMAL, 8); $graph->scale->SetTableTitleBackground('darkblue@0.6'); $graph->scale->tableTitle->Show(); // if ( null != $t_constrain ){ // $t_activity->SetConstrain( $t_constrain, CONSTRAIN_ENDSTART ); // } // if ( null != $t_constrain ){ // $t_activity->SetConstrain( $t_constrain['row'], $t_constrain['type'] ); // } // We first need to get the list of rows, in order to know whether to // display the constraint or not (in case of missing referenced row) $t_row_list = array(); foreach ($t_metrics as $t_metric_row) { $t_row_list[] = $t_metric_row[0]; } foreach ($t_metrics as $t_metric_row) { $t_row = $t_metric_row[0] % $t_gantt_chart_max_rows; $t_activity_type = $t_metric_row[1]; $t_bug_id = $t_metric_row[2]; $t_start_date = $t_metric_row[3]; $t_end_date = $t_metric_row[4]; $t_extra = " {$t_bug_id}" . $t_metric_row[5]; $t_level = $t_metric_row[6]; $t_constraints = $t_metric_row[7]; if (isset($t_level)) { $t_row_label = utf8_str_pad('', $t_level * 2, ' ') . htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD)); } else { $t_row_label = htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD)); } // Limit the label to max defined $t_row_label = strlen($t_row_label) > plugin_config_get('label_max') ? substr($t_row_label, 0, plugin_config_get('label_max') - 3) . '...' : $t_row_label; $t_activity_arr = array('left' => null, 'main' => array('row' => $t_row, 'label' => $t_row_label, 'start' => $t_start_date, 'end' => $t_end_date, 'info' => $t_extra), 'right' => null); if ($t_end_date < $t_range['min']) { // complete left bar // ** | o[ ]-[ ]o $t_activity_arr = array('left' => array('row' => $t_row, 'label' => $t_row_label, 'start' => $t_range['min'], 'end' => $t_range['min'], 'info' => "<- " . graph_date_format($t_start_date)), 'main' => null, 'right' => array('row' => $t_row, 'label' => "", 'start' => $t_range['min'] + $t_day, 'end' => $t_range['min'] + $t_day, 'info' => "<<- [" . graph_date_format($t_start_date) . " / " . graph_date_format($t_end_date) . "]" . $t_extra)); } else { if ($t_range['max'] < $t_start_date) { // complete right bar // o[ ]-[ ]o | ** $t_activity_arr = array('left' => array('row' => $t_row, 'label' => $t_row_label, 'start' => $t_range['max'] - $t_day, 'end' => $t_range['max'] - $t_day, 'info' => ""), 'main' => null, 'right' => array('row' => $t_row, 'label' => "", 'start' => $t_range['max'], 'end' => $t_range['max'], 'info' => "[" . graph_date_format($t_start_date) . " / " . graph_date_format($t_end_date) . "] ->>" . $t_extra)); } else { if ($t_start_date < $t_range['min']) { // left bar // * | o[ ]-[ ] $t_activity_arr['left'] = array('row' => $t_row, 'label' => '', 'start' => $t_range['min'], 'end' => $t_range['min'], 'info' => "<- " . graph_date_format($t_start_date)); $t_activity_arr['main']['start'] = $t_range['min'] + $t_day; //4 * $t_day;// @TODO: what happens if duration is less than that } if ($t_range['max'] < $t_end_date) { // right bar // [ ]-[ ]o | * $t_activity_arr['main']['end'] = $t_range['max'] - $t_day; //4 * $t_day; $t_activity_arr['main']['info'] = ""; $t_activity_arr['right'] = array('row' => $t_row, 'label' => "", 'start' => $t_range['max'], 'end' => $t_range['max'], 'info' => graph_date_format($t_end_date) . " ->" . $t_extra); } } } switch ($t_activity_type) { case ACTYPE_NORMAL: if (null != $t_activity_arr['left']) { $t_activity_left = new GanttBar($t_activity_arr['left']['row'], $t_activity_arr['left']['label'], graph_date_format($t_activity_arr['left']['start']), graph_date_format($t_activity_arr['left']['end']), $t_activity_arr['left']['info']); // Add a left marker $t_activity_left->leftMark->Show(); $t_activity_left->leftMark->SetType(MARK_FILLEDCIRCLE); $t_activity_left->leftMark->SetWidth(8); // $t_activity_left->leftMark->SetColor( 'red' ); $t_activity_left->leftMark->SetFillColor('red'); $t_activity_left->leftMark->title->Set(''); $t_activity_left->leftMark->title->SetFont($t_graph_font, FS_NORMAL, 8); $t_activity_left->leftMark->title->SetColor('white'); if (null != gantt_get_resolution_date($t_bug_id)) { $t_activity_left->SetPattern(BAND_RDIAG, get_status_color(bug_get_field($t_bug_id, 'status'))); } $t_activity_left->SetFillColor(get_status_color(bug_get_field($t_bug_id, 'status'))); } if (null != $t_activity_arr['main']) { $t_activity_main = new GanttBar($t_activity_arr['main']['row'], $t_activity_arr['main']['label'], graph_date_format($t_activity_arr['main']['start']), graph_date_format($t_activity_arr['main']['end']), $t_activity_arr['main']['info']); if (null != gantt_get_resolution_date($t_bug_id)) { $t_activity_main->SetPattern(BAND_RDIAG, get_status_color(bug_get_field($t_bug_id, 'status'))); } $t_activity_main->SetFillColor(get_status_color(bug_get_field($t_bug_id, 'status'))); $t_activity_main->title->SetFont($t_graph_font, FS_NORMAL, 8); // Set the constraint if any... foreach ($t_constraints as $t_constraint) { // ... and if possible if (in_array($t_constraint['row'], $t_row_list)) { $t_activity_main->SetConstrain($t_constraint['row'], $t_constraint['type']); } } $graph->add($t_activity_main); } if (null != $t_activity_arr['right']) { $t_activity_right = new GanttBar($t_activity_arr['right']['row'], $t_activity_arr['right']['label'], graph_date_format($t_activity_arr['right']['start']), graph_date_format($t_activity_arr['right']['end']), $t_activity_arr['right']['info']); // Add a left marker $t_activity_right->rightMark->Show(); $t_activity_right->rightMark->SetType(MARK_FILLEDCIRCLE); $t_activity_right->rightMark->SetWidth(8); $t_activity_right->rightMark->SetColor('red'); $t_activity_right->rightMark->SetFillColor('red'); $t_activity_right->rightMark->title->Set(''); $t_activity_right->rightMark->title->SetFont($t_graph_font, FS_NORMAL, 8); $t_activity_right->rightMark->title->SetColor('white'); if (null != gantt_get_resolution_date($t_bug_id)) { $t_activity_right->SetPattern(BAND_RDIAG, get_status_color(bug_get_field($t_bug_id, 'status'))); } $t_activity_right->SetFillColor(get_status_color(bug_get_field($t_bug_id, 'status'))); } if (isset($t_activity_left)) { $graph->add($t_activity_left); } if (isset($t_activity_right)) { $graph->add($t_activity_right); } break; case ACTYPE_MILESTONE: $t_size = 5; if ($t_start_date < $t_range['min']) { $t_extra = "(<-- " . graph_date_format($t_start_date) . ")" . $t_extra; $t_start_date = $t_range['min']; $t_size = 8; } else { if ($t_range['max'] < $t_start_date) { $t_extra = "(--> " . graph_date_format($t_start_date) . ")" . $t_extra; $t_start_date = $t_range['max']; $t_size = 8; } } $t_milestone = new MileStone($t_row, $t_row_label, graph_date_format($t_start_date), $t_extra); $t_milestone->title->SetFont($t_graph_font, FS_NORMAL, 8); $t_milestone->mark->SetType(MARK_FILLEDCIRCLE); $t_milestone->mark->SetWidth($t_size); if (5 != $t_size) { $t_milestone->mark->SetFillColor('red'); } // foreach( $t_constraints as $t_constraint){ // $t_milestone->SetConstrain( $t_constraint['row'], $t_constraint['type'] ); // } $graph->add($t_milestone); break; } } // Setting the min and max date: $t_minmax = $graph->GetBarMinMax(); $t_week_in_seconds = 7 * 24 * 3600; // 1 week offset min: if ($t_minmax[0] - $t_week_in_seconds > 0) { $t_graph_offset_min = $t_minmax[0] - $t_week_in_seconds; } else { $t_graph_offset_min = $t_minmax[0]; } // 2 weeks offset max: $t_graph_offset_max = $t_minmax[1] + 3 * $t_week_in_seconds; $graph->SetDateRange(graph_date_format($t_graph_offset_min), graph_date_format($t_graph_offset_max)); // Add a vertical line for today if in the range of GetBarMinMax() (retruns an arry ($min, $max) ): $t_minmax = $graph->GetBarMinMax(); $t_now = date(config_get('short_date_format')); if ($t_now >= graph_date_format($t_graph_offset_min) && $t_now <= graph_date_format($t_graph_offset_max)) { $t_today = new GanttVLine($t_now, "Today", "darkred", 2, "solid"); $t_today->SetDayOffset(0.5); $graph->add($t_today); } // $t_today = new GanttVLine( "2011-03-01" , "" , "darkred", 2, "solid");// // $t_today->SetDayOffset(0.5); // $graph->add( $t_today ); $t_gantt_chart_height = gantt_chart_get_height($graph); $t_legend = gantt_chart_legend(false); $t_legend_height = 60; // Display the Gantt chart // $graph->Stroke(); //-------------------------------------- // Create a combined graph //-------------------------------------- $mgraph = new MGraph(); $mgraph->Add($graph, 0, 0); $mgraph->Add($t_legend, 0, $t_gantt_chart_height + $t_legend_height); $mgraph->Stroke(); } }