Custom Function override
Posted: 13 Oct 2008, 22:03
Hi all,
I modified the html.api file to highlight the current selected project into the Project Menu Bar and everything was working as expected. Than I moved my modificationt to the custom_functions_inc.php file so that I do not touch the original code, but now it's not working anymore the patch.
what is wrong?
The code above removes the hyperlink to the current project, set bold as font and RED as text colour.
I modified the html.api file to highlight the current selected project into the Project Menu Bar and everything was working as expected. Than I moved my modificationt to the custom_functions_inc.php file so that I do not touch the original code, but now it's not working anymore the patch.
Code: Select all
<?php
function custom_function_override_print_project_menu_bar() {
$t_project_ids = current_user_get_accessible_projects();
$t_current_project = helper_get_current_project();
PRINT '<table class="width100" cellspacing="0">';
PRINT '<tr>';
PRINT '<td class="menu">';
if ($t_current_project == ALL_PROJECTS) {
PRINT '<b><font color="#FF0000"><href="set_project.php?project_id=' . ALL_PROJECTS . '">' . lang_get( 'all_projects' ) . '</style></a></b></font>';
}
else {
PRINT '<small><a href="set_project.php?project_id=' . ALL_PROJECTS . '">' . lang_get( 'all_projects' ) . '</a></small>';
}
foreach ( $t_project_ids as $t_id ) {
if ($t_current_project == $t_id) {
PRINT ' | <b><font color="#FF0000"><href=\"set_project.php?project_id=$t_id\">' . string_display( project_get_field( $t_id, 'name' ) ) . '</a></b></font>';
}
else {
PRINT " | <small><a href=\"set_project.php?project_id=$t_id\">" . string_display( project_get_field( $t_id, 'name' ) ) . '</a></small>';
}
custom_function_override_print_subproject_menu_bar( $t_id, $t_id . ';' );
}
PRINT '</td>';
PRINT '</tr>';
PRINT '</table>';
}
?>
<?php
function custom_function_override_print_subproject_menu_bar( $p_project_id, $p_parents = '' ) {
$t_subprojects = current_user_get_accessible_subprojects( $p_project_id );
$t_current_subproject = helper_get_current_project();
$t_char = ':';
foreach ( $t_subprojects as $t_subproject ) {
if ($t_current_subproject == $t_subproject) {
PRINT "$t_char <b><font color='#FF0000'><href=\"set_project.php?project_id=$p_parents$t_subproject\">" . string_display( project_get_field( $t_subproject, 'name' ) ) . '</a></b></font>';
}
else {
PRINT "<small>$t_char <a href=\"set_project.php?project_id=$p_parents$t_subproject\">" . string_display( project_get_field( $t_subproject, 'name' ) ) . '</a></small>';
}
print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' );
$t_char = ',';
}
}
?>The code above removes the hyperlink to the current project, set bold as font and RED as text colour.