/themes/default/views/reports.php

https://github.com/lutherj/Ushahidi_Web · PHP · 109 lines · 94 code · 9 blank · 6 comment · 7 complexity · 5f542a177996e8afea144e3465403e74 MD5 · raw file

  1. <div id="content">
  2. <div class="content-bg">
  3. <!-- start reports block -->
  4. <div class="big-block">
  5. <?php
  6. // Filter::report_stats - The block that contains reports list statistics
  7. Event::run('ushahidi_filter.report_stats', $report_stats);
  8. echo $report_stats;
  9. ?>
  10. <h1><?php echo Kohana::lang('ui_main.reports').": ";?> <?php echo ($category_title) ? " in $category_title" : ""?> <?php echo $pagination_stats; ?></h1>
  11. <div style="clear:both;"></div>
  12. <div class="r_cat_tooltip"> <a href="#" class="r-3">2a. Structures a risque | Structures at risk</a> </div>
  13. <div class="reports-box">
  14. <?php
  15. foreach ($incidents as $incident)
  16. {
  17. $incident_id = $incident->id;
  18. $incident_title = $incident->incident_title;
  19. $incident_description = $incident->incident_description;
  20. //$incident_category = $incident->incident_category;
  21. // Trim to 150 characters without cutting words
  22. // XXX: Perhaps delcare 150 as constant
  23. $incident_description = text::limit_chars(strip_tags($incident_description), 150, "...", true);
  24. $incident_date = date('H:i M d, Y', strtotime($incident->incident_date));
  25. //$incident_time = date('H:i', strtotime($incident->incident_date));
  26. $location_id = $incident->location_id;
  27. $location_name = $incident->location->location_name;
  28. $incident_verified = $incident->incident_verified;
  29. if ($incident_verified)
  30. {
  31. $incident_verified = '<span class="r_verified">'.Kohana::lang('ui_main.verified').'</span>';
  32. }
  33. else
  34. {
  35. $incident_verified = '<span class="r_unverified">'.Kohana::lang('ui_main.unverified').'</span>';
  36. }
  37. $comment_count = $incident->comment->count();
  38. $incident_thumb = url::base()."media/img/report-thumb-default.jpg";
  39. $media = $incident->media;
  40. if ($media->count())
  41. {
  42. foreach ($media as $photo)
  43. {
  44. if ($photo->media_thumb)
  45. { // Get the first thumb
  46. $prefix = url::base().Kohana::config('upload.relative_directory');
  47. $incident_thumb = $prefix."/".$photo->media_thumb;
  48. break;
  49. }
  50. }
  51. }
  52. ?>
  53. <div class="rb_report">
  54. <div class="r_media">
  55. <p class="r_photo"> <a href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>">
  56. <img src="<?php echo $incident_thumb; ?>" height="59" width="89" /> </a>
  57. </p>
  58. <!-- Only show this if the report has a video -->
  59. <p class="r_video" style="display:none;"><a href="#">Video</a></p>
  60. <!-- Category Selector -->
  61. <div class="r_categories">
  62. <h4><?php echo Kohana::lang('ui_main.categories'); ?></h4>
  63. <?php
  64. foreach ($incident->category AS $category)
  65. {
  66. //don't show hidden categories
  67. if($category->category_visible == 0)
  68. {
  69. continue;
  70. }
  71. if ($category->category_image_thumb)
  72. {
  73. ?>
  74. <a class="r_category" href="<?php echo url::site(); ?>reports/?c=<?php echo $category->id; ?>"><span class="r_cat-box"><img src="<?php echo url::base().Kohana::config('upload.relative_directory')."/".$category->category_image_thumb; ?>" height="16" width="16" /></span> <span class="r_cat-desc"><?php echo $localized_categories[(string)$category->category_title];?></span></a>
  75. <?php
  76. }
  77. else
  78. {
  79. ?>
  80. <a class="r_category" href="<?php echo url::site(); ?>reports/?c=<?php echo $category->id; ?>"><span class="r_cat-box" style="background-color:#<?php echo $category->category_color;?>;"></span> <span class="r_cat-desc"><?php echo $localized_categories[(string)$category->category_title];?></span></a>
  81. <?php
  82. }
  83. }
  84. ?>
  85. </div>
  86. </div>
  87. <div class="r_details">
  88. <h3><a class="r_title" href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>"><?php echo $incident_title; ?></a> <a href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>#discussion" class="r_comments"><?php echo $comment_count; ?></a> <?php echo $incident_verified; ?></h3>
  89. <p class="r_date r-3 bottom-cap"><?php echo $incident_date; ?></p>
  90. <div class="r_description"> <?php echo $incident_description; ?> </div>
  91. <p class="r_location"><a href="<?php echo url::site(); ?>reports/?l=<?php echo $location_id; ?>"><?php echo $location_name; ?></a></p>
  92. </div>
  93. </div>
  94. <?php } ?>
  95. </div>
  96. <?php echo $pagination; ?>
  97. </div>
  98. <!-- end reports block -->
  99. </div>
  100. </div>