| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisConnect - A webservice interface to Mantis Bug Tracker 3 # Copyright (C) 2004-2011 Victor Boctor - vboctor@users.sourceforge.net 4 # This program is distributed under dual licensing. These include 5 # GPL and a commercial licenses. Victor Boctor reserves the right to 6 # change the license of future releases. 7 # See docs/ folder for more details 8 9 /** 10 * Get all user defined issue filters for the given project. 11 * 12 * @param string $p_username The name of the user trying to access the filters. 13 * @param string $p_password The password of the user. 14 * @param integer $p_project_id The id of the project to retrieve filters for. 15 * @return Array that represents a FilterDataArray structure 16 */ 17 function mc_filter_get( $p_username, $p_password, $p_project_id ) { 18 $t_user_id = mci_check_login( $p_username, $p_password ); 19 if( $t_user_id === false ) { 20 return mci_soap_fault_login_failed(); 21 } 22 if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { 23 return mci_soap_fault_access_denied( $t_user_id ); 24 } 25 $t_result = array(); 26 foreach( mci_filter_db_get_available_queries( $p_project_id, $t_user_id ) as $t_filter_row ) { 27 $t_filter = array(); 28 $t_filter['id'] = $t_filter_row['id']; 29 $t_filter['owner'] = mci_account_get_array_by_id( $t_filter_row['user_id'] ); 30 $t_filter['project_id'] = $t_filter_row['project_id']; 31 $t_filter['is_public'] = $t_filter_row['is_public']; 32 $t_filter['name'] = $t_filter_row['name']; 33 $t_filter['filter_string'] = $t_filter_row['filter_string']; 34 $t_filter['url'] = $t_filter_row['url']; 35 $t_result[] = $t_filter; 36 } 37 return $t_result; 38 } 39 40 /** 41 * Get all issues matching the specified filter. 42 * 43 * @param string $p_username The name of the user trying to access the filters. 44 * @param string $p_password The password of the user. 45 * @param integer $p_filter_id The id of the filter to apply. 46 * @param integer $p_page_number Start with the given page number (zero-based) 47 * @param integer $p_per_page Number of issues to display per page 48 * @return Array that represents an IssueDataArray structure 49 */ 50 function mc_filter_get_issues( $p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page ) { 51 $t_user_id = mci_check_login( $p_username, $p_password ); 52 if( $t_user_id === false ) { 53 return mci_soap_fault_login_failed(); 54 } 55 $t_lang = mci_get_user_lang( $t_user_id ); 56 57 if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { 58 return mci_soap_fault_access_denied( $t_user_id ); 59 } 60 61 $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number; 62 $t_page_count = 0; 63 $t_bug_count = 0; 64 $t_filter = filter_db_get_filter( $p_filter_id ); 65 $t_filter_detail = explode( '#', $t_filter, 2 ); 66 if( !isset( $t_filter_detail[1] ) ) { 67 return new soap_fault( 'Server', '', 'Invalid Filter' ); 68 } 69 $t_filter = unserialize( $t_filter_detail[1] ); 70 $t_filter = filter_ensure_valid_filter( $t_filter ); 71 72 $t_result = array(); 73 $t_rows = filter_get_bug_rows( $p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id ); 74 75 // the page number was moved back, so we have exceeded the actual page number, see bug #12991 76 if ( $t_orig_page_number > $p_page_number ) 77 return $t_result; 78 79 foreach( $t_rows as $t_issue_data ) { 80 $t_result[] = mci_issue_data_as_array( $t_issue_data, $t_user_id, $t_lang ); 81 } 82 83 return $t_result; 84 } 85 86 /** 87 * Get the issue headers that match the specified filter and paging details. 88 * 89 * @param string $p_username The name of the user trying to access the filters. 90 * @param string $p_password The password of the user. 91 * @param integer $p_filter_id The id of the filter to apply. 92 * @param integer $p_page_number Start with the given page number (zero-based) 93 * @param integer $p_per_page Number of issues to display per page 94 * @return Array that represents an IssueDataArray structure 95 */ 96 function mc_filter_get_issue_headers( $p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page ) { 97 $t_user_id = mci_check_login( $p_username, $p_password ); 98 if( $t_user_id === false ) { 99 return mci_soap_fault_login_failed(); 100 } 101 if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { 102 return mci_soap_fault_access_denied( $t_user_id ); 103 } 104 105 $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number; 106 $t_page_count = 0; 107 $t_bug_count = 0; 108 $t_filter = filter_db_get_filter( $p_filter_id ); 109 $t_filter_detail = explode( '#', $t_filter, 2 ); 110 if( !isset( $t_filter_detail[1] ) ) { 111 return new soap_fault( 'Server', '', 'Invalid Filter' ); 112 } 113 $t_filter = unserialize( $t_filter_detail[1] ); 114 $t_filter = filter_ensure_valid_filter( $t_filter ); 115 116 $t_result = array(); 117 $t_rows = filter_get_bug_rows( $p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id ); 118 119 // the page number was moved back, so we have exceeded the actual page number, see bug #12991 120 if ( $t_orig_page_number > $p_page_number ) 121 return $t_result; 122 123 foreach( $t_rows as $t_issue_data ) { 124 $t_id = $t_issue_data->id; 125 126 $t_issue = array(); 127 128 $t_issue['id'] = $t_id; 129 $t_issue['view_state'] = $t_issue_data->view_state; 130 $t_issue['last_updated'] = timestamp_to_iso8601( $t_issue_data->last_updated ); 131 132 $t_issue['project'] = $t_issue_data->project_id; 133 $t_issue['category'] = mci_get_category( $t_issue_data->category_id ); 134 $t_issue['priority'] = $t_issue_data->priority; 135 $t_issue['severity'] = $t_issue_data->severity; 136 $t_issue['status'] = $t_issue_data->status; 137 138 $t_issue['reporter'] = $t_issue_data->reporter_id; 139 $t_issue['summary'] = $t_issue_data->summary; 140 if( !empty( $t_issue_data->handler_id ) ) { 141 $t_issue['handler'] = $t_issue_data->handler_id; 142 } 143 $t_issue['resolution'] = $t_issue_data->resolution; 144 145 $t_issue['attachments_count'] = count( mci_issue_get_attachments( $t_issue_data->id ) ); 146 $t_issue['notes_count'] = count( mci_issue_get_notes( $t_issue_data->id ) ); 147 148 $t_result[] = $t_issue; 149 } 150 151 return $t_result; 152 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |