PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/themes/default/views/reports/list.php

https://github.com/Magaz/Ushahidi_Web
PHP | 175 lines | 145 code | 12 blank | 18 comment | 7 complexity | 8388818c303605a6599422e3f6ff3a46 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-3.0, BSD-3-Clause, GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * View file for updating the reports display
  4. *
  5. * PHP version 5
  6. * LICENSE: This source file is subject to LGPL license
  7. * that is available through the world-wide-web at the following URI:
  8. * http://www.gnu.org/copyleft/lesser.html
  9. * @author Ushahidi Team - http://www.ushahidi.com
  10. * @package Ushahidi - http://source.ushahididev.com
  11. * @copyright Ushahidi - http://www.ushahidi.com
  12. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
  13. */
  14. ?>
  15. <!-- Top reportbox section-->
  16. <div class="rb_nav-controls r-5">
  17. <table border="0" cellspacing="0" cellpadding="0">
  18. <tr>
  19. <td>
  20. <ul class="link-toggle report-list-toggle lt-icons-and-text">
  21. <li class="active"><a href="#rb_list-view" class="list"><?php echo Kohana::lang('ui_main.list'); ?></a></li>
  22. <li><a href="#rb_map-view" class="map"><?php echo Kohana::lang('ui_main.map'); ?></a></li>
  23. </ul>
  24. </td>
  25. <td><?php echo $pagination; ?></td>
  26. <td><?php echo $stats_breadcrumb; ?></td>
  27. <td class="last">
  28. <ul class="link-toggle lt-icons-only">
  29. <?php //@todo Toggle the status of these links depending on the current page ?>
  30. <li><a href="#" class="prev" id="page_<?php echo $previous_page; ?>"><?php echo Kohana::lang('ui_main.previous'); ?></a></li>
  31. <li><a href="#" class="next" id="page_<?php echo $next_page; ?>"><?php echo Kohana::lang('ui_main.next'); ?></a></li>
  32. </ul>
  33. </td>
  34. </tr>
  35. </table>
  36. </div>
  37. <!-- /Top reportbox section-->
  38. <!-- Report listing -->
  39. <div class="r_cat_tooltip"><a href="#" class="r-3"></a></div>
  40. <div class="rb_list-and-map-box">
  41. <div id="rb_list-view">
  42. <?php
  43. foreach ($incidents as $incident)
  44. {
  45. $incident = ORM::factory('incident')->with('location')->find($incident->incident_id);
  46. $incident_id = $incident->id;
  47. $incident_title = strip_tags($incident->incident_title);
  48. $incident_description = strip_tags($incident->incident_description);
  49. //$incident_category = $incident->incident_category;
  50. // Trim to 150 characters without cutting words
  51. // XXX: Perhaps delcare 150 as constant
  52. $incident_description = text::limit_chars(strip_tags($incident_description), 140, "...", true);
  53. $incident_date = date('H:i M d, Y', strtotime($incident->incident_date));
  54. //$incident_time = date('H:i', strtotime($incident->incident_date));
  55. $location_id = $incident->location_id;
  56. $location_name = $incident->location->location_name;
  57. $incident_verified = $incident->incident_verified;
  58. if ($incident_verified)
  59. {
  60. $incident_verified = '<span class="r_verified">'.Kohana::lang('ui_main.verified').'</span>';
  61. $incident_verified_class = "verified";
  62. }
  63. else
  64. {
  65. $incident_verified = '<span class="r_unverified">'.Kohana::lang('ui_main.unverified').'</span>';
  66. $incident_verified_class = "unverified";
  67. }
  68. $comment_count = $incident->comment->count();
  69. $incident_thumb = url::file_loc('img')."media/img/report-thumb-default.jpg";
  70. $media = $incident->media;
  71. if ($media->count())
  72. {
  73. foreach ($media as $photo)
  74. {
  75. if ($photo->media_thumb)
  76. { // Get the first thumb
  77. $incident_thumb = url::convert_uploaded_to_abs($photo->media_thumb);
  78. break;
  79. }
  80. }
  81. }
  82. ?>
  83. <div id="<?php echo $incident_id ?>" class="rb_report <?php echo $incident_verified_class; ?>">
  84. <div class="r_media">
  85. <p class="r_photo" style="text-align:center;"> <a href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>">
  86. <img src="<?php echo $incident_thumb; ?>" style="max-width:89px;max-height:59px;" /> </a>
  87. </p>
  88. <!-- Only show this if the report has a video -->
  89. <p class="r_video" style="display:none;"><a href="#"><?php echo Kohana::lang('ui_main.video'); ?></a></p>
  90. <!-- Category Selector -->
  91. <div class="r_categories">
  92. <h4><?php echo Kohana::lang('ui_main.categories'); ?></h4>
  93. <?php foreach ($incident->category as $category): ?>
  94. <?php // Don't show hidden categories ?>
  95. <?php if($category->category_visible == 0) continue; ?>
  96. <?php if ($category->category_image_thumb): ?>
  97. <?php $category_image = url::base().Kohana::config('upload.relative_directory')."/".$category->category_image_thumb; ?>
  98. <a class="r_category" href="<?php echo url::site(); ?>reports/?c=<?php echo $category->id; ?>">
  99. <span class="r_cat-box"><img src="<?php echo $category_image; ?>" height="16" width="16" /></span>
  100. <span class="r_cat-desc"><?php echo Category_Lang_Model::category_title($category->id); ?></span>
  101. </a>
  102. <?php else: ?>
  103. <a class="r_category" href="<?php echo url::site(); ?>reports/?c=<?php echo $category->id; ?>">
  104. <span class="r_cat-box" style="background-color:#<?php echo $category->category_color;?>;"></span>
  105. <span class="r_cat-desc"><?php echo Category_Lang_Model::category_title($category->id); ?></span>
  106. </a>
  107. <?php endif; ?>
  108. <?php endforeach; ?>
  109. </div>
  110. <?php
  111. // Action::report_extra_media - Add items to the report list in the media section
  112. Event::run('ushahidi_action.report_extra_media', $incident_id);
  113. ?>
  114. </div>
  115. <div class="r_details">
  116. <h3><a class="r_title" href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>">
  117. <?php echo html::specialchars($incident_title); ?>
  118. </a>
  119. <a href="<?php echo url::site(); ?>reports/view/<?php echo $incident_id; ?>#discussion" class="r_comments">
  120. <?php echo $comment_count; ?></a>
  121. <?php echo $incident_verified; ?>
  122. </h3>
  123. <p class="r_date r-3 bottom-cap"><?php echo $incident_date; ?></p>
  124. <div class="r_description"> <?php echo $incident_description; ?>
  125. <a class="btn-show btn-more" href="#<?php echo $incident_id ?>"><?php echo Kohana::lang('ui_main.more_information'); ?> &raquo;</a>
  126. <a class="btn-show btn-less" href="#<?php echo $incident_id ?>">&laquo; <?php echo Kohana::lang('ui_main.less_information'); ?></a>
  127. </div>
  128. <p class="r_location"><a href="<?php echo url::site(); ?>reports/?l=<?php echo $location_id; ?>"><?php echo html::specialchars($location_name); ?></a></p>
  129. <?php
  130. // Action::report_extra_details - Add items to the report list details section
  131. Event::run('ushahidi_action.report_extra_details', $incident_id);
  132. ?>
  133. </div>
  134. </div>
  135. <?php } ?>
  136. </div>
  137. <div id="rb_map-view" style="display:none; width: 590px; height: 384px; border:1px solid #CCCCCC; margin: 3px auto;">
  138. </div>
  139. </div>
  140. <!-- /Report listing -->
  141. <!-- Bottom paginator -->
  142. <div class="rb_nav-controls r-5">
  143. <table border="0" cellspacing="0" cellpadding="0">
  144. <tr>
  145. <td>
  146. <ul class="link-toggle report-list-toggle lt-icons-and-text">
  147. <li class="active"><a href="#rb_list-view" class="list"><?php echo Kohana::lang('ui_main.list'); ?></a></li>
  148. <li><a href="#rb_map-view" class="map"><?php echo Kohana::lang('ui_main.map'); ?></a></li>
  149. </ul>
  150. </td>
  151. <td><?php echo $pagination; ?></td>
  152. <td><?php echo $stats_breadcrumb; ?></td>
  153. <td class="last">
  154. <ul class="link-toggle lt-icons-only">
  155. <?php //@todo Toggle the status of these links depending on the current page ?>
  156. <li><a href="#" class="prev" id="page_<?php echo $previous_page; ?>"><?php echo Kohana::lang('ui_main.previous'); ?></a></li>
  157. <li><a href="#" class="next" id="page_<?php echo $next_page; ?>"><?php echo Kohana::lang('ui_main.next'); ?></a></li>
  158. </ul>
  159. </td>
  160. </tr>
  161. </table>
  162. </div>
  163. <!-- /Bottom paginator -->