/issues/my_view_page.php

https://github.com/osarrat/sigmah-website · PHP · 174 lines · 100 code · 35 blank · 39 comment · 46 complexity · 803c7a20a218dfc15ed9d57c30590eb7 MD5 · raw file

  1. <?php
  2. # MantisBT - a php based bugtracking system
  3. # MantisBT is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # MantisBT is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
  15. /**
  16. * @package MantisBT
  17. * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
  18. * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
  19. * @link http://www.mantisbt.org
  20. */
  21. /**
  22. * MantisBT Core API's
  23. */
  24. require_once( 'core.php' );
  25. require_once( 'compress_api.php' );
  26. require_once( 'filter_api.php' );
  27. require_once( 'last_visited_api.php' );
  28. auth_ensure_user_authenticated();
  29. $t_current_user_id = auth_get_current_user_id();
  30. # Improve performance by caching category data in one pass
  31. category_get_all_rows( helper_get_current_project() );
  32. compress_enable();
  33. # don't index my view page
  34. html_robots_noindex();
  35. html_page_top1( lang_get( 'my_view_link' ) );
  36. if ( current_user_get_pref( 'refresh_delay' ) > 0 ) {
  37. html_meta_redirect( 'my_view_page.php', current_user_get_pref( 'refresh_delay' )*60 );
  38. }
  39. html_page_top2();
  40. print_recently_visited();
  41. $f_page_number = gpc_get_int( 'page_number', 1 );
  42. $t_per_page = config_get( 'my_view_bug_count' );
  43. $t_bug_count = null;
  44. $t_page_count = null;
  45. $t_boxes = config_get( 'my_view_boxes' );
  46. asort ($t_boxes);
  47. reset ($t_boxes);
  48. #print_r ($t_boxes);
  49. $t_project_id = helper_get_current_project();
  50. ?>
  51. <div align="center">
  52. <table class="hide" border="0" cellspacing="3" cellpadding="0">
  53. <?php
  54. $t_status_legend_position = config_get( 'status_legend_position' );
  55. if ( $t_status_legend_position == STATUS_LEGEND_POSITION_TOP || $t_status_legend_position == STATUS_LEGEND_POSITION_BOTH ) {
  56. echo '<tr>';
  57. echo '<td colspan="2">';
  58. html_status_legend();
  59. echo '</td>';
  60. echo '</tr>';
  61. }
  62. $t_number_of_boxes = count ( $t_boxes );
  63. $t_boxes_position = config_get( 'my_view_boxes_fixed_position' );
  64. $t_counter = 0;
  65. while (list ($t_box_title, $t_box_display) = each ($t_boxes)) {
  66. # don't display bugs that are set as 0
  67. if ($t_box_display == 0) {
  68. $t_number_of_boxes = $t_number_of_boxes - 1;
  69. }
  70. # don't display "Assigned to Me" bugs to users that bugs can't be assigned to
  71. else if ( $t_box_title == 'assigned' && ( current_user_is_anonymous() OR user_get_assigned_open_bug_count( $t_current_user_id, $t_project_id ) == 0 ) ) {
  72. $t_number_of_boxes = $t_number_of_boxes - 1;
  73. }
  74. # don't display "Monitored by Me" bugs to users that can't monitor bugs
  75. else if ( $t_box_title == 'monitored' && ( current_user_is_anonymous() OR !access_has_project_level( config_get( 'monitor_bug_threshold' ), $t_project_id, $t_current_user_id ) ) ) {
  76. $t_number_of_boxes = $t_number_of_boxes - 1;
  77. }
  78. # don't display "Reported by Me" bugs to users that can't report bugs
  79. else if ( in_array( $t_box_title, array( 'reported', 'feedback', 'verify' ) ) &&
  80. ( current_user_is_anonymous() OR !access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_current_user_id ) ) ) {
  81. $t_number_of_boxes = $t_number_of_boxes - 1;
  82. }
  83. # display the box
  84. else {
  85. $t_counter++;
  86. # check the style of displaying boxes - fixed (ie. each box in a separate table cell) or not
  87. if ( ON == $t_boxes_position ) {
  88. # for even box number start new row and column
  89. if ( 1 == $t_counter%2 ) {
  90. echo '<tr><td valign="top" width="50%">';
  91. include 'my_view_inc.php';
  92. echo '</td>';
  93. }
  94. # for odd box number only start new column
  95. else if ( 0 == $t_counter%2 ) {
  96. echo '<td valign="top" width="50%">';
  97. include 'my_view_inc.php';
  98. echo '</td></tr>';
  99. }
  100. # for odd number of box display one empty table cell in second column
  101. if ( ( $t_counter == $t_number_of_boxes ) && 1 == $t_counter%2 ) {
  102. echo '<td valign="top" width="50%"></td></tr>';
  103. }
  104. }
  105. else if ( OFF == $t_boxes_position ) {
  106. # start new table row and column for first box
  107. if ( 1 == $t_counter ) {
  108. echo '<tr><td valign="top" width="50%">';
  109. }
  110. # start new table column for the second half of boxes
  111. if ( $t_counter == ceil ($t_number_of_boxes/2) + 1 ) {
  112. echo '<td valign="top" width="50%">';
  113. }
  114. # display the required box
  115. include 'my_view_inc.php';
  116. echo '<br />';
  117. # close the first column for first half of boxes
  118. if ( $t_counter == ceil ($t_number_of_boxes/2) ) {
  119. echo '</td>';
  120. }
  121. # close the table row after all of the boxes
  122. if ( $t_counter == $t_number_of_boxes ) {
  123. echo '</td></tr>';
  124. }
  125. }
  126. }
  127. }
  128. if ( $t_status_legend_position == STATUS_LEGEND_POSITION_BOTTOM || $t_status_legend_position == STATUS_LEGEND_POSITION_BOTH ) {
  129. echo '<tr>';
  130. echo '<td colspan="2">';
  131. html_status_legend();
  132. echo '</td>';
  133. echo '</tr>';
  134. }
  135. ?>
  136. </table>
  137. </div>
  138. <?php
  139. html_page_bottom();