Beispiel #1
0
}
# only MANAGERS can set global defaults.for a project
if ($f_manage_page && $t_dst_project_id != ALL_PROJECTS) {
    access_ensure_project_level(MANAGER, $t_dst_project_id);
}
# user should only be able to set columns for a project that is accessible.
if ($t_dst_project_id != ALL_PROJECTS) {
    access_ensure_project_level(VIEWER, $t_dst_project_id);
}
# Calculate the user id to set the configuration for.
if ($f_manage_page) {
    $t_user_id = NO_USER;
} else {
    $t_user_id = auth_get_current_user_id();
}
$t_all_columns = columns_get_all();
$t_default = null;
$t_view_issues_page_columns = config_get('view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id);
$t_view_issues_page_columns = columns_remove_invalid($t_view_issues_page_columns, $t_all_columns);
$t_print_issues_page_columns = config_get('print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id);
$t_print_issues_page_columns = columns_remove_invalid($t_print_issues_page_columns, $t_all_columns);
$t_csv_columns = config_get('csv_columns', $t_default, $t_user_id, $t_src_project_id);
$t_csv_columns = columns_remove_invalid($t_csv_columns, $t_all_columns);
$t_excel_columns = config_get('excel_columns', $t_default, $t_user_id, $t_src_project_id);
$t_excel_columns = columns_remove_invalid($t_excel_columns, $t_all_columns);
config_set('view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_dst_project_id);
config_set('print_issues_page_columns', $t_print_issues_page_columns, $t_user_id, $t_dst_project_id);
config_set('csv_columns', $t_csv_columns, $t_user_id, $t_dst_project_id);
config_set('excel_columns', $t_excel_columns, $t_user_id, $t_dst_project_id);
form_security_purge('manage_columns_copy');
$t_redirect_url = $f_manage_page ? 'manage_config_columns_page.php' : 'account_manage_columns_page.php';
Beispiel #2
0
/**
 * returns an array of the column names to be displayed.
 * The column names to use are those of the field names in the bug table.
 * In addition, you can use the following:
 * - "selection" for selection checkboxes.
 * - "edit" for icon to open the edit page.
 * - "custom_xxxx" were xxxx is the name of the custom field that is valid for the
 *   current project.  In case of "All Projects, the field will be empty where it is
 *   not applicable.
 *
 * @param integer $p_columns_target See COLUMNS_TARGET_* in constant_inc.php.
 * @param integer $p_user_id        The user id or null for current logged in user.
 * @return array
 */
function custom_function_default_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null)
{
    $t_project_id = helper_get_current_project();
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE) {
        $t_columns = config_get('csv_columns', '', $p_user_id, $t_project_id);
    } else {
        if ($p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
            $t_columns = config_get('excel_columns', '', $p_user_id, $t_project_id);
        } else {
            if ($p_columns_target == COLUMNS_TARGET_VIEW_PAGE) {
                $t_columns = config_get('view_issues_page_columns', '', $p_user_id, $t_project_id);
            } else {
                $t_columns = config_get('print_issues_page_columns', '', $p_user_id, $t_project_id);
            }
        }
    }
    $t_columns = columns_remove_invalid($t_columns, columns_get_all($t_project_id));
    return $t_columns;
}
Beispiel #3
0
require_api('file_api.php');
require_api('form_api.php');
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
$t_manage_page = defined('MANAGE_COLUMNS');
$t_account_page = defined('ACCOUNT_COLUMNS');
$t_project_id = helper_get_current_project();
# Calculate the user id to set the configuration for.
if ($t_manage_page) {
    $t_user_id = NO_USER;
} else {
    $t_user_id = auth_get_current_user_id();
}
$t_columns = columns_get_all($t_project_id);
$t_all = implode(', ', $t_columns);
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_CSV_PAGE, false, $t_user_id);
$t_csv = implode(', ', $t_columns);
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_VIEW_PAGE, false, $t_user_id);
$t_view_issues = implode(', ', $t_columns);
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_PRINT_PAGE, false, $t_user_id);
$t_print_issues = implode(', ', $t_columns);
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_EXCEL_PAGE, false, $t_user_id);
$t_excel = implode(', ', $t_columns);
?>

<div id="manage-columns-div" class="form-container">
	<form id="manage-columns-form" method="post" action="manage_config_columns_set.php">
		<fieldset class="has-required">
			<legend><span><?php 
function custom_function_default_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null)
{
    $t_project_id = helper_get_current_project();
    $t_boo = true;
    $t_config_table = db_get_table('mantis_config_table');
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE) {
        $t_columns = config_get('csv_columns', '', $p_user_id, $t_project_id);
    } else {
        if ($p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
            $t_columns = config_get('excel_columns', '', $p_user_id, $t_project_id);
        } else {
            if ($p_columns_target == COLUMNS_TARGET_VIEW_PAGE) {
                $t_columns = config_get('view_issues_page_columns', '', $p_user_id, $t_project_id);
            } else {
                if ($p_columns_target == COLUMNS_TARGET_PRINT_PAGE) {
                    $t_columns = config_get('print_issues_page_columns', '', $p_user_id, $t_project_id);
                } else {
                    $t_columns = helper_user_exists($p_user_id, $t_config_table) ? config_get('home_view_columns', '', $p_user_id, $t_project_id) : columns_get_custom_fields($t_project_id);
                    $t_boo = false;
                }
            }
        }
    }
    $t_columns_get = $t_boo ? columns_get_all($t_project_id) : columns_get_custom_fields($t_project_id);
    $t_columns = columns_remove_invalid($t_columns, $t_columns_get);
    return $t_columns;
}