Beispiel #1
0
/**
 * List projects that the current user has access to
 * @param integer $p_parent_id         A parent project identifier.
 * @param integer $p_project_id        A project identifier.
 * @param integer $p_filter_project_id A filter project identifier.
 * @param boolean $p_trace             Whether to trace parent projects.
 * @param boolean $p_can_report_only   If true, disables projects in which user can't report issues; defaults to false (all projects enabled).
 * @param array   $p_parents           Array of parent projects.
 * @return void
 */
function print_subproject_option_list($p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_can_report_only = false, array $p_parents = array())
{
    if (config_get('subprojects_enabled') == OFF) {
        return;
    }
    array_push($p_parents, $p_parent_id);
    $t_user_id = auth_get_current_user_id();
    $t_project_ids = user_get_accessible_subprojects($t_user_id, $p_parent_id);
    $t_can_report = true;
    foreach ($t_project_ids as $t_id) {
        if ($p_can_report_only) {
            $t_report_bug_threshold = config_get('report_bug_threshold', null, $t_user_id, $t_id);
            $t_can_report = access_has_project_level($t_report_bug_threshold, $t_id, $t_user_id);
        }
        if ($p_trace) {
            $t_full_id = join($p_parents, ';') . ';' . $t_id;
        } else {
            $t_full_id = $t_id;
        }
        echo '<option value="' . $t_full_id . '"';
        check_selected($p_project_id, $t_full_id, false);
        check_disabled($t_id == $p_filter_project_id || !$t_can_report);
        echo '>' . str_repeat('&#160;', count($p_parents)) . str_repeat('&raquo;', count($p_parents)) . ' ' . string_attribute(project_get_field($t_id, 'name')) . '</option>' . "\n";
        print_subproject_option_list($t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_can_report_only, $p_parents);
    }
}
Beispiel #2
0
function print_subproject_option_list($p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_parents = array())
{
    array_push($p_parents, $p_parent_id);
    $t_project_ids = current_user_get_accessible_subprojects($p_parent_id);
    $t_project_count = count($t_project_ids);
    for ($i = 0; $i < $t_project_count; $i++) {
        $t_full_id = $t_id = $t_project_ids[$i];
        if ($t_id != $p_filter_project_id) {
            echo "<option value=\"";
            if ($p_trace) {
                $t_full_id = join($p_parents, ";") . ';' . $t_id;
            }
            echo $t_full_id . '"';
            if ($p_project_id !== null) {
                check_selected($p_project_id, $t_full_id);
            }
            echo '>' . str_repeat('&#160;', count($p_parents)) . str_repeat('&#187;', count($p_parents)) . ' ' . string_attribute(project_get_field($t_id, 'name')) . '</option>' . "\n";
            print_subproject_option_list($t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents);
        }
    }
}
Beispiel #3
0
function print_subproject_option_list($p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_parents = array())
{
    array_push($p_parents, $p_parent_id);
    $t_project_ids = current_user_get_accessible_subprojects($p_parent_id);
    $t_project_count = count($t_project_ids);
    for ($i = 0; $i < $t_project_count; $i++) {
        $t_full_id = $t_id = $t_project_ids[$i];
        if ($t_id != $p_filter_project_id) {
            print "<option value=\"";
            if ($p_trace) {
                $t_full_id = join($p_parents, ";") . ';' . $t_id;
            }
            print "{$t_full_id}\"";
            check_selected($p_project_id, $t_full_id);
            print '>' . str_repeat('&nbsp;', count($p_parents)) . str_repeat('&raquo;', count($p_parents)) . ' ' . string_display(project_get_field($t_id, 'name')) . '</option>' . "\n";
            print_subproject_option_list($t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents);
        }
    }
}