PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/FuChi/ushahidi/application/views/admin/messages.php

https://github.com/dannyrealfox/Fu-Chi--Future-Chinatown
PHP | 233 lines | 206 code | 11 blank | 16 comment | 37 complexity | cda485e67bcb890207c6c33163f298be MD5 | raw file
  1. <?php
  2. /**
  3. * Messages view page.
  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 <team@ushahidi.com>
  10. * @package Ushahidi - http://source.ushahididev.com
  11. * @module API Controller
  12. * @copyright Ushahidi - http://www.ushahidi.com
  13. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
  14. */
  15. ?>
  16. <div class="bg">
  17. <h2>
  18. <?php admin::messages_subtabs($service_id); ?>
  19. </h2>
  20. <?php
  21. Event::run('ushahidi_action.admin_messages_custom_layout');
  22. // Kill the rest of the page if this event has been utilized by a plugin
  23. if( ! Event::has_run('ushahidi_action.admin_messages_custom_layout')){
  24. ?>
  25. <!-- tabs -->
  26. <div class="tabs">
  27. <!-- tabset -->
  28. <ul class="tabset">
  29. <li><a href="<?php echo url::site()."admin/messages/index/".$service_id; ?>?type=1" <?php if ($type == '1') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.inbox');?></a></li>
  30. <?php
  31. if ($service_id == 1)
  32. {
  33. ?><li><a href="<?php echo url::site()."admin/messages/index/".$service_id; ?>?type=2" <?php if ($type == '2') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.outbox');?></a></li><?php
  34. }
  35. ?>
  36. <?php if ($type == '1')
  37. { ?>
  38. <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
  39. <li><a href="?type=<?php echo $type ?>&level=0" <?php if ($level == '0') echo "class=\"active2\""; ?>><?php echo Kohana::lang('ui_main.all');?> (<?php echo $count_all; ?>)</a></li>
  40. <li><a href="?type=<?php echo $type ?>&level=4" <?php if ($level == '4') echo "class=\"active2\""; ?>>Trusted (<?php echo $count_trusted; ?>)</a></li>
  41. <li><a href="?type=<?php echo $type ?>&level=2" <?php if ($level == '2') echo "class=\"active2\""; ?>><?php echo Kohana::lang('ui_main.spam');?> (<?php echo $count_spam; ?>)</a></li>
  42. <?php } ?>
  43. <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
  44. <li><a href="<?php echo url::site()."admin/messages/reporters/index/".$service_id; ?>">Reporters</a></li>
  45. </ul>
  46. <!-- tab -->
  47. <div class="tab">
  48. <ul>
  49. <li><a href="#" onClick="messagesAction('d', 'DELETE', '')"><?php echo strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
  50. <li><a href="#" onClick="messagesAction('s', 'SPAM', '')"><?php echo strtoupper(Kohana::lang('ui_main.spam'));?></a></li>
  51. <li><a href="#" onClick="messagesAction('n', 'NOT SPAM', '')"><?php echo strtoupper(Kohana::lang('ui_main.not_spam'));?></a></li>
  52. </ul>
  53. </div>
  54. </div>
  55. <?php
  56. if ($form_error) {
  57. ?>
  58. <!-- red-box -->
  59. <div class="red-box">
  60. <h3><?php echo Kohana::lang('ui_main.error');?></h3>
  61. <ul><?php echo Kohana::lang('ui_main.select_one');?></ul>
  62. </div>
  63. <?php
  64. }
  65. if ($form_saved) {
  66. ?>
  67. <!-- green-box -->
  68. <div class="green-box" id="submitStatus">
  69. <h3><?php echo Kohana::lang('ui_main.messages');?> <?php echo $form_action; ?> <a href="#" id="hideMessage" class="hide">hide this message</a></h3>
  70. </div>
  71. <?php
  72. }
  73. ?>
  74. <!-- report-table -->
  75. <?php print form::open(NULL, array('id' => 'messageMain', 'name' => 'messageMain')); ?>
  76. <input type="hidden" name="action" id="action" value="">
  77. <input type="hidden" name="level" id="level" value="">
  78. <input type="hidden" name="message_id[]" id="message_single" value="">
  79. <div class="table-holder">
  80. <table class="table">
  81. <thead>
  82. <tr>
  83. <th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'message_id[]' )" /></th>
  84. <th class="col-2"><?php echo Kohana::lang('ui_main.message_details');?></th>
  85. <th class="col-3"><?php echo Kohana::lang('ui_main.date');?></th>
  86. <th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
  87. </tr>
  88. </thead>
  89. <tfoot>
  90. <tr class="foot">
  91. <td colspan="4">
  92. <?php echo $pagination; ?>
  93. </td>
  94. </tr>
  95. </tfoot>
  96. <tbody>
  97. <?php
  98. if ($total_items == 0)
  99. {
  100. ?>
  101. <tr>
  102. <td colspan="4" class="col">
  103. <h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
  104. </td>
  105. </tr>
  106. <?php
  107. }
  108. foreach ($messages as $message)
  109. {
  110. $message_id = $message->id;
  111. $message_from = $message->reporter->service_account;
  112. $message_to = $message->message_to;
  113. $incident_id = $message->incident_id;
  114. $message_description = text::auto_link($message->message);
  115. $message_detail = nl2br(text::auto_link($message->message_detail));
  116. $message_date = date('Y-m-d', strtotime($message->message_date));
  117. $message_type = $message->message_type;
  118. $message_level = $message->message_level;
  119. $level_id = $message->reporter->level_id;
  120. ?>
  121. <tr <?php if ($message_level == "99") {
  122. echo " class=\"spam_tr\"";
  123. } ?>>
  124. <td class="col-1"><input name="message_id[]" id="message" value="<?php echo $message_id; ?>" type="checkbox" class="check-box"/></td>
  125. <td class="col-2">
  126. <div class="post">
  127. <p><?php echo $message_description; ?></p>
  128. <?php
  129. if ($message_detail)
  130. {
  131. ?>
  132. <p><a href="javascript:preview('message_preview_<?php echo $message_id?>')"><?php echo Kohana::lang('ui_main.preview_message');?></a></p>
  133. <div id="message_preview_<?php echo $message_id?>" style="display:none;">
  134. <?php echo $message_detail; ?>
  135. <?php
  136. // Retrieve Attachments if any
  137. foreach($message->media as $photo)
  138. {
  139. if ($photo->media_type == 1)
  140. {
  141. print "<div class=\"attachment_thumbs\" id=\"photo_". $photo->id ."\">";
  142. $thumb = $photo->media_thumb;
  143. $photo_link = $photo->media_link;
  144. $prefix = url::base().Kohana::config('upload.relative_directory');
  145. print "<a class='photothumb' rel='lightbox-group".$message_id."' href='$prefix/$photo_link'>";
  146. print "<img src=\"$prefix/$thumb\" border=\"0\" >";
  147. print "</a>";
  148. print "</div>";
  149. }
  150. }
  151. ?>
  152. </div>
  153. <?php
  154. }
  155. // Action::message_extra_admin - Message Additional/Extra Stuff
  156. Event::run('ushahidi_action.message_extra_admin', $message_id);
  157. ?>
  158. <?php if($reply_to == TRUE) { ?>
  159. <?php
  160. if ($service_id == 1 && $message_type == 1)
  161. {
  162. ?>
  163. <div id="replies">
  164. </div>
  165. <a href="javascript:showReply('reply_<?php echo $message_id; ?>')" class="more">+<?php echo Kohana::lang('ui_main.reply');?></a>
  166. <div id="reply_<?php echo $message_id; ?>" class="reply">
  167. <?php print form::open(url::site() . 'admin/messages/send/',array('id' => 'newreply_' . $message_id,
  168. 'name' => 'newreply_' . $message_id)); ?>
  169. <div class="reply_can"><a href="javascript:cannedReply('1', 'message_<?php echo $message_id; ?>')">+<?php echo Kohana::lang('ui_main.request_location');?></a>&nbsp;&nbsp;&nbsp;<a href="javascript:cannedReply('2', 'message_<?php echo $message_id; ?>')">+<?php echo Kohana::lang('ui_main.request_information');?></a></div>
  170. <div id="replyerror_<?php echo $message_id; ?>" class="reply_error"></div>
  171. <div class="reply_input"><?php print form::input('message_' . $message_id, '', ' class="text long2" onkeyup="limitChars(this.id, \'160\', \'replyleft_' . $message_id . '\')" '); ?></div>
  172. <div class="reply_input"><a href="javascript:sendMessage('<?php echo $message_id; ?>' , 'sending_<?php echo $message_id; ?>')" title="Submit Message"><img src="<?php echo url::base() ?>media/img/admin/btn-send.gif" alt="Submit" border="0" /></a></div>
  173. <div class="reply_input" id="sending_<?php echo $message_id; ?>"></div>
  174. <div style="clear:both"></div>
  175. <?php print form::close(); ?>
  176. <div id="replyleft_<?php echo $message_id; ?>" class="replychars"></div>
  177. </div>
  178. <?php
  179. }
  180. ?>
  181. <?php } ?>
  182. </div>
  183. <ul class="info">
  184. <?php
  185. if ($message_type == 2)
  186. {
  187. ?><li class="none-separator">To: <strong><?php echo $message_to; ?></strong><?php
  188. }
  189. else
  190. {
  191. ?><li class="none-separator">From: <a href="<?php echo url::site()."admin/messages/reporters/index/".$service_id."?k=".urlencode($message_from);?>"><strong class="reporters_<?php echo $level_id?>"><?php echo $message_from; ?></strong></a><?php
  192. }
  193. ?>
  194. </ul>
  195. </td>
  196. <td class="col-3"><?php echo $message_date; ?></td>
  197. <td class="col-4">
  198. <ul>
  199. <?php
  200. if ($incident_id != 0 && $message_type != 2) {
  201. echo "<li class=\"none-separator\"><a href=\"". url::base() . 'admin/reports/edit/' . $incident_id ."\" class=\"status_yes\"><strong>View Report</strong></a></li>";
  202. }
  203. elseif ($message_type != 2)
  204. {
  205. echo "<li class=\"none-separator\"><a href=\"". url::base() . 'admin/reports/edit?mid=' . $message_id ."\">Create Report?</a></li>";
  206. }
  207. ?>
  208. <li><a href="javascript:messagesAction('d','DELETE','<?php echo(rawurlencode($message_id)); ?>')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
  209. </ul>
  210. </td>
  211. </tr>
  212. <?php
  213. }
  214. ?>
  215. </tbody>
  216. </table>
  217. </div>
  218. <?php print form::close(); ?>
  219. </div>
  220. <?php
  221. }
  222. ?>