/issues/main_page.php

https://github.com/osarrat/sigmah-website · PHP · 117 lines · 64 code · 26 blank · 27 comment · 13 complexity · 39c6f30a99f084d9a3743eeb77088772 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. * This is the first page a user sees when they login to the bugtracker
  17. * News is displayed which can notify users of any important changes
  18. *
  19. * @package MantisBT
  20. * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
  21. * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
  22. * @link http://www.mantisbt.org
  23. */
  24. /**
  25. * MantisBT Core API's
  26. */
  27. require_once( 'core.php' );
  28. require_once( 'current_user_api.php' );
  29. require_once( 'news_api.php' );
  30. require_once( 'date_api.php' );
  31. require_once( 'print_api.php' );
  32. require_once( 'rss_api.php' );
  33. access_ensure_project_level( VIEWER );
  34. $f_offset = gpc_get_int( 'offset', 0 );
  35. $t_project_id = helper_get_current_project();
  36. $t_rss_enabled = config_get( 'rss_enabled' );
  37. if ( OFF != $t_rss_enabled && news_is_enabled() ) {
  38. $t_rss_link = rss_get_news_feed_url( $t_project_id );
  39. html_set_rss_link( $t_rss_link );
  40. }
  41. html_page_top( lang_get( 'main_link' ) );
  42. if ( !current_user_is_anonymous() ) {
  43. $t_current_user_id = auth_get_current_user_id();
  44. $t_hide_status = config_get( 'bug_resolved_status_threshold' );
  45. echo '<div class="quick-summary-left">';
  46. echo lang_get( 'open_and_assigned_to_me' ) . ': ';
  47. print_link( "view_all_set.php?type=1&handler_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_assigned_open_bug_count(), false, 'subtle' );
  48. echo '</div>';
  49. echo '<div class="quick-summary-right">';
  50. echo lang_get( 'open_and_reported_to_me' ) . ': ';
  51. print_link( "view_all_set.php?type=1&reporter_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_reported_open_bug_count(), false, 'subtle' );
  52. echo '</div>';
  53. echo '<div class="quick-summary-left">';
  54. echo lang_get( 'last_visit' ) . ': ';
  55. echo date( config_get( 'normal_date_format' ), current_user_get_field( 'last_visit' ) );
  56. echo '</div>';
  57. }
  58. echo '<br />';
  59. echo '<br />';
  60. if ( news_is_enabled() ) {
  61. echo '<br />';
  62. $t_news_rows = news_get_limited_rows( $f_offset, $t_project_id );
  63. $t_news_count = count( $t_news_rows );
  64. # Loop through results
  65. for ( $i = 0; $i < $t_news_count; $i++ ) {
  66. $t_row = $t_news_rows[$i];
  67. # only show VS_PRIVATE posts to configured threshold and above
  68. if ( ( VS_PRIVATE == $t_row[ 'view_state' ] ) &&
  69. !access_has_project_level( config_get( 'private_news_threshold' ) ) ) {
  70. continue;
  71. }
  72. print_news_entry_from_row( $t_row );
  73. echo '<br />';
  74. } # end for loop
  75. echo '<div align="center">';
  76. print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) );
  77. $t_news_view_limit = config_get( 'news_view_limit' );
  78. $f_offset_next = $f_offset + $t_news_view_limit;
  79. $f_offset_prev = $f_offset - $t_news_view_limit;
  80. if ( $f_offset_prev >= 0) {
  81. print_bracket_link( 'main_page.php?offset=' . $f_offset_prev, lang_get( 'newer_news_link' ) );
  82. }
  83. if ( $t_news_count == $t_news_view_limit ) {
  84. print_bracket_link( 'main_page.php?offset=' . $f_offset_next, lang_get( 'older_news_link' ) );
  85. }
  86. if ( OFF != $t_rss_enabled ) {
  87. print_bracket_link( $t_rss_link, lang_get( 'rss' ) );
  88. }
  89. echo '</div>';
  90. }
  91. html_page_bottom();