/** * Get set of bug rows from given filter * @todo Had to make all these parameters required because we can't use call-time pass by reference anymore. * I really preferred not having to pass all the params in if you didn't want to, but I wanted to get * rid of the errors for now. If we can think of a better way later (maybe return an object) that would be great. * * @param integer &$p_page_number Page number of the page you want to see (set to the actual page on return). * @param integer &$p_per_page The number of bugs to see per page (set to actual on return) * -1 indicates you want to see all bugs * null indicates you want to use the value specified in the filter. * @param integer &$p_page_count You don't need to give a value here, the number of pages will be stored here on return. * @param integer &$p_bug_count You don't need to give a value here, the number of bugs will be stored here on return. * @param mixed $p_custom_filter Custom Filter to use. * @param integer $p_project_id Project id to use in filtering. * @param integer $p_user_id User id to use as current user when filtering. * @param boolean $p_show_sticky True/false - get sticky issues only. * @return boolean|array */ function filter_get_bug_rows(&$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $p_custom_filter = null, $p_project_id = null, $p_user_id = null, $p_show_sticky = null) { # assigning to $p_* for this function writes the values back in case the caller wants to know if ($p_custom_filter === null) { $t_filter = filter_get_bug_rows_filter($p_project_id, $p_user_id); } else { $t_filter = $p_custom_filter; } # Get the query clauses $t_query_clauses = filter_get_bug_rows_query_clauses($t_filter, $p_project_id, $p_user_id, $p_show_sticky); # Get the total number of bugs that meet the criteria. # Keep the db_params in stack for next query $p_bug_count = filter_get_bug_count($t_query_clauses, false); if (0 == $p_bug_count) { # reset the db_param stack that was initialized by "filter_get_bug_rows_query_clauses()" db_param_pop(); return array(); } # Calculate pagination $p_per_page = filter_per_page($t_filter, $p_bug_count, $p_per_page); $p_page_count = filter_page_count($p_bug_count, $p_per_page); $p_page_number = filter_valid_page_number($p_page_number, $p_page_count); $t_offset = filter_offset($p_page_number, $p_per_page); # Execute query $t_result = filter_get_bug_rows_result($t_query_clauses, $p_per_page, $t_offset); # Read results into rows array $t_bug_id_array = array(); while ($t_row = db_fetch_array($t_result)) { $t_bug_id_array[] = (int) $t_row['id']; $t_rows[] = $t_row; } # Return the processed rows: cache data, convert to bug objects return filter_cache_result($t_rows, $t_bug_id_array); }
define('DISABLE_INLINE_ERROR_REPORTING', true); require_once 'core.php'; require_api('authentication_api.php'); require_api('columns_api.php'); require_api('constant_inc.php'); require_api('csv_api.php'); require_api('file_api.php'); require_api('filter_api.php'); require_api('helper_api.php'); require_api('print_api.php'); auth_ensure_user_authenticated(); helper_begin_long_process(); $t_nl = csv_get_newline(); $t_sep = csv_get_separator(); # Get current filter $t_filter = filter_get_bug_rows_filter(); # Get the query clauses $t_query_clauses = filter_get_bug_rows_query_clauses($t_filter); # Get the total number of bugs that meet the criteria. $p_bug_count = filter_get_bug_count($t_query_clauses, false); if (0 == $p_bug_count) { print_header_redirect('view_all_set.php?type=0'); } # Execute query $t_result = filter_get_bug_rows_result($t_query_clauses); # Get columns to be exported $t_columns = csv_get_columns(); csv_start(csv_get_default_filename()); # export the titles $t_first_column = true; ob_start();