/** * Print the legend for the status percentage * @return null */ function html_status_percentage_legend() { $t_status_percents = get_percentage_by_status(); $t_status_enum_string = config_get('status_enum_string'); $t_enum_values = MantisEnum::getValues($t_status_enum_string); $enum_count = count($t_enum_values); $t_bug_count = array_sum($t_status_percents); 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_percent = isset($t_status_percents[$t_status]) ? $t_status_percents[$t_status] : 0; if ($t_percent > 0) { $t_status_label = MantisEnum::getLabel($t_status_enum_string, $t_status); echo "<td class=\"small-caption-center {$t_status_label}-color {$t_status_label}-percentage\">{$t_percent}%</td>"; } } echo '</tr>'; echo '</table>'; } }
* should only be known internally to the server. */ /** * @todo Modify to run sections only on certain pages. * eg. status colors are only necessary on a few pages.(my view, view all bugs, bug view, etc. ) * other pages may need to include dynamic css styles as well */ $t_referer_page = array_key_exists('HTTP_REFERER', $_SERVER) ? basename(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH)) : basename(__FILE__); switch ($t_referer_page) { case 'login_page.php': case 'signup_page.php': case 'lost_pwd_page.php': case 'account_update.php': # We don't need custom status colors on login page, and this is # actually causing an error since we're not authenticated yet. exit; } $t_status_string = config_get('status_enum_string'); $t_statuses = MantisEnum::getAssocArrayIndexedByValues($t_status_string); $t_colors = config_get('status_colors'); $t_color_count = count($t_colors); $t_color_width = $t_color_count > 0 ? round(100 / $t_color_count) : 0; $t_status_percents = auth_is_user_authenticated() ? get_percentage_by_status() : array(); foreach ($t_statuses as $t_id => $t_label) { if (array_key_exists($t_label, $t_colors)) { echo ".{$t_label}-color { background-color: {$t_colors[$t_label]}; width: {$t_color_width}%; }\n"; } if (array_key_exists($t_id, $t_status_percents)) { echo ".{$t_label}-percentage { width: {$t_status_percents[$t_id]}%; }\n"; } }
* should only be known internally to the server. */ /** * @todo Modify to run sections only on certain pages. * eg. status colors are only necessary on a few pages.(my view, view all bugs, bug view, etc. ) * other pages may need to include dynamic css styles as well */ $t_referer_page = basename(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH)); switch ($t_referer_page) { case 'login_page.php': case 'signup_page.php': case 'lost_pwd_page.php': case 'account_update.php': # We don't need custom status colors on login page, and this is # actually causing an error since we're not authenticated yet. exit; } $t_status_string = config_get('status_enum_string'); $t_statuses = MantisEnum::getAssocArrayIndexedByValues($t_status_string); $t_colors = config_get('status_colors'); $t_color_count = count($t_colors); $t_color_width = $t_color_count > 0 ? round(100 / $t_color_count) : 0; $t_status_percents = get_percentage_by_status(); foreach ($t_statuses as $t_id => $t_label) { if (array_key_exists($t_label, $t_colors)) { echo ".{$t_label}-color { background-color: {$t_colors[$t_label]}; width: {$t_color_width}%; }\n"; } if (array_key_exists($t_id, $t_status_percents)) { echo ".{$t_label}-percentage { width: {$t_status_percents[$t_id]}%; }\n"; } }
/** * Print the legend for the status percentage * @return void */ function html_status_percentage_legend() { $t_status_percents = get_percentage_by_status(); $t_status_enum_string = config_get('status_enum_string'); $t_enum_values = MantisEnum::getValues($t_status_enum_string); $t_enum_count = count($t_enum_values); $t_bug_count = array_sum($t_status_percents); if ($t_bug_count > 0) { echo '<br />'; echo '<table class="width100" cellspacing="1">'; echo '<tr>'; echo '<td class="form-title" colspan="' . $t_enum_count . '">' . lang_get('issue_status_percentage') . '</td>'; echo '</tr>'; echo '<tr>'; foreach ($t_enum_values as $t_status) { $t_percent = isset($t_status_percents[$t_status]) ? $t_status_percents[$t_status] : 0; if ($t_percent > 0) { $t_class = html_get_status_css_class($t_status); echo '<td class="small-caption-center ' . $t_class . ' ' . str_replace('color', 'percentage', $t_class) . '">' . $t_percent . '%</td>'; } } echo '</tr>'; echo '</table>'; } }