Ejemplo n.º 1
0
function html_dynamic_tree($session_variable, $tree_array, $root_node, $highlighted = null, $column_map = array())
{
    # Get the expanded tree array from the session
    $s_display_options = session_get_display_options($session_variable);
    $expanded = $s_display_options["filter"]["tree"];
    # Add expanded node (if there is one)
    if (isset($_GET['expand'])) {
        $expanded[] = $_GET['expand'];
    }
    # Remove collapsed node (if there is one)
    if (isset($_GET['collapse'])) {
        $expanded = array_diff($expanded, array($_GET['collapse']));
    }
    # Create variable to update the session
    $update_expanded = array("tree" => $expanded);
    # Update the tree variable in the session and get the returned value
    $s_display_options = session_set_display_options($session_variable, $update_expanded);
    $expanded = $s_display_options["filter"]["tree"];
    global $db;
    # images html
    $img_tree_T = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_T.gif' alt=''>";
    $img_tree_L = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_L.gif' alt=''>";
    $img_tree_column = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_column.gif' alt=''>";
    $img_tree_plus = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_plus.gif' alt=''>";
    $img_tree_plus_b = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_plus_b.gif' alt=''>";
    $img_tree_minus = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_minus.gif' alt=''>";
    $img_tree_minus_b = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_dots_minus_b.gif' alt=''>";
    $img_tree_folder = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_folder.gif' alt=''>";
    $img_tree_folder_b = "<img align='absmiddle' border=0 src='" . IMG_SRC . "tree_folder_b.gif' alt=''>";
    $img_spacer = "<img align='absmiddle' border=0 src='" . IMG_SRC . "1px_transparent.gif' width=15 height=1 alt=''>";
    $column = $img_tree_column . $img_spacer;
    # display each child node
    for ($i = 0; $i < sizeof($tree_array); $i++) {
        $req_id = $tree_array[$i]['uid'];
        $req_version_id = requirement_get_latest_version($req_id);
        echo $img_spacer;
        foreach ($column_map as $column_type) {
            if ($column_type == "|") {
                echo $column;
            } elseif ($column_type == " ") {
                echo $img_spacer;
            }
        }
        # if the last node
        if ($i == sizeof($tree_array) - 1) {
            # if the last node has no children
            if (empty($tree_array[$i]["children"])) {
                echo $img_tree_L;
                # if the last node has children
            } else {
                # if last node has children and the node is in the expanded array
                if (util_array_value_search($req_id, $expanded)) {
                    echo "<a href='?collapse={$req_id}#{$req_id}'>" . $img_tree_minus_b . $img_tree_folder_b . "</a>";
                    # if last node has children and the node is not in the expanded array
                } else {
                    echo "<a href='?expand={$req_id}#{$req_id}'>" . $img_tree_plus_b . $img_tree_folder . "</a>";
                }
            }
            $column_type = array(" ");
            # if not the last node
        } else {
            # if not the last node and the node has no children
            if (empty($tree_array[$i]["children"])) {
                echo $img_tree_T;
            } else {
                # if not the last node and the node is in the expanded array
                if (util_array_value_search($req_id, $expanded)) {
                    echo "<a href='?collapse={$req_id}#{$req_id}'>" . $img_tree_minus . $img_tree_folder_b . "</a>";
                    # if not the last node and the node is not in the expanded array
                } else {
                    echo "<a href='?expand={$req_id}#{$req_id}'>" . $img_tree_plus . $img_tree_folder . "</a>";
                }
            }
            $column_type = array("|");
        }
        # prints a closed folder if node has no children and $root_node is set to true
        if (empty($tree_array[$i]["children"]) && $root_node) {
            echo $img_tree_folder;
        }
        # formatting for highlighted node
        $style = "";
        if ($req_id == $highlighted) {
            $style = "style='font-weight: bold; font-size: 120%;'";
        }
        # print the node name
        echo " <a {$style} name={$req_id} href='requirement_detail_page.php?req_id={$req_id}&req_version_id={$req_version_id}'>" . $tree_array[$i]['name'] . "</a>";
        echo "<br>" . NEWLINE;
        # display this nodes children
        if (util_array_value_search($req_id, $expanded)) {
            html_dynamic_tree($session_variable, $tree_array[$i]['children'], false, $highlighted, array_merge($column_map, $column_type));
        }
    }
}
function session_records_ischecked_group($property_set, $group)
{
    $is_checked = util_array_value_search($group, $_SESSION['properties'][$property_set]['select_group']);
    return $is_checked;
}
if (!empty($release_details)) {
    print "<div align=center>" . NEWLINE;
    print "<table class=width100 rules=cols>" . NEWLINE;
    print "<tr class=tbl_header>" . NEWLINE;
    print "<th></th>" . NEWLINE;
    html_tbl_print_header(lang_get('release_name'), RELEASE_NAME, $order_by, $order_dir);
    html_tbl_print_header(lang_get('rel_date_received'), RELEASE_DATE_RECEIVED, $order_by, $order_dir);
    html_tbl_print_header(lang_get('rel_description'));
    print "</tr>" . NEWLINE;
    foreach ($release_details as $release_detail) {
        $release_id = $release_detail[RELEASE_ID];
        $release_name = $release_detail[RELEASE_NAME];
        $release_date_received = date_trim_time($release_detail[RELEASE_DATE_RECEIVED]);
        $release_description = $release_detail[RELEASE_DESCRIPTION];
        $row_style = html_tbl_alternate_bgcolor($row_style);
        if (util_array_value_search($release_id, $assoc_releases)) {
            $checked = "checked";
        } else {
            $checked = "";
        }
        print "<tr class='{$row_style}'>" . NEWLINE;
        print "<td><input type='checkbox' name='row_releases[{$release_id}]' {$checked}></td>" . NEWLINE;
        print "<td class='tbl-l'>{$release_name}</td>" . NEWLINE;
        print "<td class='tbl-c'>{$release_date_received}</td>" . NEWLINE;
        print "<td class='tbl-c'>{$release_description}</td>" . NEWLINE;
        print "</tr>" . NEWLINE;
    }
    print "</table>" . NEWLINE;
    print "</div>" . NEWLINE;
    if (session_use_javascript()) {
        print "<input id=select_all type=checkbox name=thispage onClick='checkAll( this )'>" . NEWLINE;
Ejemplo n.º 4
0
function util_strip_get($remove_keys, $get)
{
    $return_value = array();
    foreach ($get as $key => $value) {
        if (!util_array_value_search($remove_keys, $key)) {
            $return_value[$key] = $value;
        }
    }
    return $return_value;
}
}
###########################################################################################
# put project prefs into an array
$associated_projects = array();
# name all the project preferences
$project_preferences = array("project_rights", "delete_rights", "email_testset", "email_discussion", "email_new_bug", "email_update_bug", "email_assigned_bug", "email_bugnote_bug", "email_status_bug", "ba_owner", "qa_owner", "project_name", "remove");
foreach ($_POST as $key => $value) {
    # split associated projects into an array(project_id, _project_pref_name)
    $exploded_post = explode("_", $key, 2);
    $associated_project_id = $exploded_post[0];
    # add projects and preferences to $associated_projects.
    # the array format is:
    #	$associated_projects[project_id][project_preference] = project_preference_value
    #
    if (isset($exploded_post[1])) {
        if (util_array_value_search($exploded_post[1], $project_preferences)) {
            $associated_projects[$associated_project_id][$exploded_post[1]] = $value;
        }
    }
}
# fill in any project prefs which are left out
# i.e. unchecked checkboxes
foreach ($associated_projects as $key_project => $value_preferences) {
    # look for project prefs not set in $project_pref
    foreach ($project_preferences as $row_project_preference) {
        if (!util_array_key_search($row_project_preference, $value_preferences)) {
            $associated_projects[$key_project][$row_project_preference] = "N";
        }
    }
}
if (isset($_POST['add_to_projects'])) {