PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/admin/reporters.php

https://github.com/rindou240/Ushahidi_Web
PHP | 263 lines | 253 code | 7 blank | 3 comment | 9 complexity | 3db62184e8a571e171fe8439a2463daf MD5 | raw file
  1. <div class="bg">
  2. <h2>
  3. <?php admin::messages_subtabs($service_id); ?>
  4. </h2>
  5. <!-- tabs -->
  6. <div class="tabs">
  7. <!-- tabset -->
  8. <ul class="tabset">
  9. <li><a href="<?php echo url::site()."admin/messages/index/".$service_id; ?>?type=1"><?php echo Kohana::lang('ui_main.inbox');?></a></li>
  10. <?php
  11. if ($service_id == 1)
  12. {
  13. ?><li><a href="<?php echo url::site()."admin/messages/index/".$service_id; ?>?type=2"><?php echo Kohana::lang('ui_main.outbox');?></a></li><?php
  14. }
  15. ?>
  16. <li><a href="<?php echo url::site()."admin/messages/reporters/?s=".$service_id; ?>" class="active">Reporters</a></li>
  17. </ul>
  18. <!-- tab -->
  19. <div class="tab">
  20. <ul>
  21. <li><a href="#" onClick="reportersAction('d', 'DELETE', '', '')"><?php echo strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
  22. <?php foreach($levels as $level) { ?>
  23. <li><a href="#" onClick="reportersAction('l', 'Mark As <?php echo $level->level_title?>', '', <?php echo $level->id?>)" class="reporters_tab_<?php echo $level->id;?>"><?php echo $level->level_title?></a></li>
  24. <?php } ?>
  25. </ul>
  26. </div>
  27. </div>
  28. <!-- tabs -->
  29. <div class="tabs">
  30. <!-- tab -->
  31. <div class="tab">
  32. <?php print form::open(NULL,array('method' => 'get',
  33. 'id' => 'searchReporters')); ?>
  34. <div class="tab_form_item">
  35. <?php print form::input('k', $keyword, ' class="text long"'); ?>
  36. </div>
  37. <div class="tab_form_item">
  38. <?php print form::dropdown('s', $search_type_array, $search_type); ?>
  39. </div>
  40. <div class="tab_form_item">
  41. <a href="#" onclick="submitSearch()"><strong><?php echo Kohana::lang('ui_admin.search');?></strong></a>
  42. </div>
  43. <?php print form::close(); ?>
  44. </div>
  45. </div>
  46. <div class="tabs" id="addedit" style="display:none">
  47. <!-- tabset -->
  48. <a name="add"></a>
  49. <ul class="tabset">
  50. <li><a href="#add" class="active"><?php echo Kohana::lang('ui_main.edit');?></a></li>
  51. </ul>
  52. <!-- tab -->
  53. <div class="tab reporters">
  54. <?php print form::open(NULL,array('id' => 'reporterEdit',
  55. 'name' => 'reporterEdit')); ?>
  56. <input type="hidden" name="action"
  57. id="action" value="a"/>
  58. <input type="hidden" id="reporter_id"
  59. name="reporter_id[]" value="<?php echo $form['reporter_id']; ?>" />
  60. <input type="hidden" id="service_account" name="service_account" value="">
  61. <input type="hidden" id="service_name" name="service_name" value="">
  62. <input type="hidden" id="location_id" name="location_id" value="">
  63. <div style="clear:both;"></div>
  64. <div class="tab_form_item">
  65. <strong><?php echo Kohana::lang('ui_main.reporter');?>:</strong><br />
  66. <h3 id="reporter_account"><?php echo $form['service_account']; ?></h3>
  67. </div>
  68. <div style="clear:both;"></div>
  69. <div class="tab_form_item">
  70. <strong><?php echo Kohana::lang('ui_main.service');?>:</strong><br />
  71. <h3 id="reporter_service"><?php echo $form['service_name']; ?></h3>
  72. </div>
  73. <div style="clear:both;"></div>
  74. <div class="tab_form_item">
  75. <strong><?php echo Kohana::lang('ui_main.reporter_level');?>:</strong><br />
  76. <?php print form::dropdown('level_id', $level_array, $form['level_id']); ?>
  77. </div>
  78. <div style="clear:both;"></div>
  79. <div id="reporter_location">
  80. <h3>Give this Reporter A Location <span>(Giving the reporter a location will allow their reports to be mapped immediately if they are trusted)</span></h3>
  81. <div class="tab_form_item">
  82. <strong><?php echo Kohana::lang('ui_main.location');?>:</strong><br />
  83. <?php print form::input('location_name', $form['location_name'], ' class="text"'); ?>
  84. </div>
  85. <div class="tab_form_item">
  86. <strong><?php echo Kohana::lang('ui_main.latitude');?>:</strong><br />
  87. <?php print form::input('latitude', $form['latitude'], ' class="text"'); ?>
  88. </div>
  89. <div class="tab_form_item">
  90. <strong><?php echo Kohana::lang('ui_main.longitude');?>:</strong><br />
  91. <?php print form::input('longitude', $form['longitude'], ' class="text"'); ?>
  92. </div>
  93. <div style="clear:both;"></div>
  94. <div class="tab_form_item">
  95. <strong><?php echo Kohana::lang('ui_main.location');?>:</strong><br />
  96. <div id="ReporterMap"></div>
  97. </div>
  98. <div style="clear:both;"></div>
  99. </div>
  100. <div class="tab_form_item">
  101. <input type="image" src="<?php echo url::base() ?>media/img/admin/btn-save.gif" class="save-rep-btn" />
  102. </div>
  103. <?php print form::close(); ?>
  104. </div>
  105. </div>
  106. <?php
  107. if ($form_error) {
  108. ?>
  109. <!-- red-box -->
  110. <div class="red-box">
  111. <h3><?php echo Kohana::lang('ui_main.error');?></h3>
  112. <ul>
  113. <?php
  114. foreach ($errors as $error_item => $error_description)
  115. {
  116. print (!$error_description) ? '' : "<li>" . $error_description . "</li>";
  117. }
  118. ?>
  119. </ul>
  120. </div>
  121. <?php
  122. }
  123. if ($form_saved) {
  124. ?>
  125. <!-- green-box -->
  126. <div class="green-box">
  127. <h3><?php echo Kohana::lang('ui_main.reporter_has_been');?> <?php echo $form_action; ?></h3>
  128. </div>
  129. <?php
  130. }
  131. ?>
  132. <!-- report-table -->
  133. <div class="report-form">
  134. <?php print form::open(NULL,array('id' => 'reporterMain',
  135. 'name' => 'reporterMain')); ?>
  136. <input type="hidden" name="action" id="reporter_action" value="">
  137. <input type="hidden" name="reporter_id[]" id="reporter_single" value="">
  138. <input type="hidden" name="level_id" id="level_id_main" value="">
  139. <div class="table-holder">
  140. <table class="table">
  141. <thead>
  142. <tr>
  143. <td colspan="4">
  144. <?php echo $pagination; ?>
  145. </td>
  146. </tr>
  147. <tr>
  148. <th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'reporter_id[]' )" /></th>
  149. <th class="col-2"><?php echo Kohana::lang('ui_main.reporter');?></th>
  150. <th class="col-3"><?php echo Kohana::lang('ui_main.service');?></th>
  151. <th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
  152. </tr>
  153. </thead>
  154. <tfoot>
  155. <tr class="foot">
  156. <td colspan="4">
  157. <?php echo $pagination; ?>
  158. </td>
  159. </tr>
  160. </tfoot>
  161. <tbody>
  162. <?php
  163. if ($total_items == 0)
  164. {
  165. ?>
  166. <tr>
  167. <td colspan="4" class="col">
  168. <h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
  169. </td>
  170. </tr>
  171. <?php
  172. }
  173. foreach ($reporters as $reporter)
  174. {
  175. $reporter_id = $reporter->id;
  176. $service_id = $reporter->service_id;
  177. $level_id = $reporter->level_id;
  178. $service = new Service_Model($service_id);
  179. $service_name = $service->service_name;
  180. $service_userid = $reporter->service_userid;
  181. $service_account = $reporter->service_account;
  182. if ($keyword)
  183. {
  184. $service_account = str_ireplace($keyword,
  185. "<span class=\"highlight\">$keyword</span>", $service_account);
  186. }
  187. // Get Location Information
  188. $location_id = "";
  189. $location_name = "";
  190. $latitude = "";
  191. $longitude = "";
  192. $location = $reporter->location;
  193. if ($location->loaded)
  194. {
  195. $location_id = $location->id;
  196. $location_name = $location->location_name;
  197. $latitude = $location->latitude;
  198. $longitude = $location->longitude;
  199. }
  200. // Get Message Information
  201. $message_count = $reporter->message->count();
  202. // Get Reporter Level
  203. $reporter_level = $level_array[$level_id];
  204. ?>
  205. <tr>
  206. <td class="col-1"><input name="reporter_id[]" id="reporter" value="<?php echo $reporter_id; ?>" type="checkbox" class="check-box"/></td>
  207. <td class="col-2">
  208. <div class="post">
  209. <h4><?php echo $service_account; ?> <span>[<a href="<?php echo url::site()."admin/messages/index/".$service_id."?rid=".$reporter_id;?>">View Messages</a>]</span></h4>
  210. </div>
  211. <ul class="info">
  212. <li class="none-separator"><?php echo Kohana::lang('ui_main.messages');?>: <strong><?php echo $message_count; ?></strong></li>
  213. <li class="none-separator">Reporter Level: <strong class="reporters_<?php echo $level_id?>"><?php echo $reporter_level; ?></strong></li>
  214. </ul>
  215. </td>
  216. <td class="col-3">
  217. <div>
  218. <?php echo $service_name; ?>
  219. </div>
  220. </td>
  221. <td class="col-4">
  222. <ul>
  223. <li class="none-separator"><a href="#add" onClick="fillFields(
  224. '<?php echo(rawurlencode($reporter_id)); ?>',
  225. '<?php echo(rawurlencode($level_id)); ?>',
  226. '<?php echo(rawurlencode($service_name)); ?>',
  227. '<?php echo(rawurlencode($reporter->service_account)); ?>',
  228. '<?php echo(rawurlencode($location_id)); ?>',
  229. '<?php echo(rawurlencode($location_name)); ?>',
  230. '<?php echo(rawurlencode($latitude)); ?>',
  231. '<?php echo(rawurlencode($longitude)); ?>')"><?php echo Kohana::lang('ui_main.edit');?></a></li>
  232. <li><a href="javascript:reportersAction('d','DELETE','<?php echo(rawurlencode($reporter_id)); ?>', '')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
  233. </ul>
  234. </td>
  235. </tr>
  236. <?php
  237. }
  238. ?>
  239. </tbody>
  240. </table>
  241. </div>
  242. <!-- tabs -->
  243. <div class="tabs">
  244. <!-- tab -->
  245. <div class="tab">
  246. <ul>
  247. <li><a href="#" onClick="reportersAction('d', 'DELETE', '', '')"><?php echo strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
  248. <?php foreach($levels as $level) { ?>
  249. <li><a href="#" onClick="reportersAction('l', 'Mark As <?php echo $level->level_title?>', '', <?php echo $level->id?>)" class="reporters_tab_<?php echo $level->id;?>"><?php echo $level->level_title?></a></li>
  250. <?php } ?>
  251. </ul>
  252. </div>
  253. </div>
  254. <?php print form::close(); ?>
  255. </div>
  256. </div>