PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/monitorremoto/view/loadEventos.php

https://gitlab.com/talueses/SIPVE
PHP | 274 lines | 193 code | 15 blank | 66 comment | 13 complexity | 4d6515165a639b25618a47f16a69e19c MD5 | raw file
  1. <?php
  2. /*******************************************************************************\
  3. * @copyright
  4. *
  5. * === SIPve ===
  6. * Sistema Integrado de Protección con capacidades de Videovigilancia
  7. * Control de Acceso y Carnetización para el resguardo físico de instalaciones.
  8. *
  9. * Copyright (C) 2012 Fundación Centro Nacional de Innovación Tecnológica, Cenit.
  10. * Dirección de Investigación, Desarrollo e Innovación.
  11. * Gilda Ramos.
  12. * José Medina.
  13. * Héctor Reverón.
  14. * David Concepción.
  15. * Ronald Delgado.
  16. * Jenner Fuentes.
  17. *
  18. * This program is free software: you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation, either VERSION 3 of the License, or
  21. * (at your option) any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. *
  31. * Para mas información visite
  32. * @link http://repositorio.softwarelibre.gob.ve/ - RNA
  33. * @link http://sourceforge.net/projects/sipve/ - SourceForge
  34. * @link https://gitlab.com/talueses/SIPVE - Gitlab Repositorio.
  35. *
  36. \*******************************************************************************/
  37. ?>
  38. <?php
  39. /*
  40. * Autor David Concepcion 07-10-2010 CENIT
  41. * Listado de eventos asociados a una camara
  42. */
  43. session_start(); // start up your PHP session!
  44. require_once "../controller/monitorremoto.control.php";
  45. //echo "<div align=\"left\"><pre>".print_r($_REQUEST,true)."</pre></div>".date("h:i:s a");
  46. $monitor = new Monitor();
  47. if ($_REQUEST["accion"]=="ultimos10"){
  48. $_SESSION['perPage'] = $_SESSION['page'] = null;
  49. $arg = "and ve.descripcion = 'movie_start' order by idevento desc /*limit 8*/";
  50. }
  51. if ($_REQUEST["accion"]=="verTodos"){
  52. $arg = "and ve.descripcion = 'movie_start' order by idevento desc";
  53. }
  54. $eventos = $monitor->getEventos($_REQUEST["idcamara"],$arg);
  55. if (count($eventos)==0){
  56. echo "<div align=\"center\" style=\"width:99%;border:2px solid green;\">No se encontraron eventos</div>";
  57. }else{
  58. date_default_timezone_set($eventos[0]->location);
  59. //echo "<div align=\"left\"><pre>".print_r($eventos,true)."</pre></div>";
  60. $linkVerTodos = basename($_SERVER["PHP_SELF"])."?idcamara=".$_REQUEST["idcamara"]."&accion=verTodos";
  61. ?>
  62. <html>
  63. <head>
  64. <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ">
  65. <title>Listado de Eventos</title>
  66. <link href="../../inicio/css/comunes.css" rel="stylesheet" type="text/css" />
  67. <link type="text/css" href="../../inicio/css/jquery-ui.css" rel="stylesheet" />
  68. <script type="text/javascript" src="../../inicio/js/jquery.js"></script>
  69. <script type="text/javascript" src="../../inicio/js/jquery-ui.min.js"></script>
  70. <style type="text/css" >
  71. #tabla {
  72. font-size: 13px;
  73. height: 99%;
  74. width:99%;
  75. border: #aaaaaa solid 1px;
  76. overflow-x:hidden
  77. width:95%;
  78. background:#fff;
  79. -moz-border-radius: 6px;
  80. -webkit-border-radius: 6px;
  81. border-radius: 6px;
  82. }
  83. #listado{
  84. width:99%;
  85. background:#fff;
  86. margin: 0px 1px 0px 1px;
  87. border: #aaaaaa solid 1px;
  88. -moz-border-radius: 6px;
  89. -webkit-border-radius: 6px;
  90. border-radius: 6px;
  91. }
  92. #titulo{
  93. height: 30px;
  94. border: 1px solid #aaaaaa; background: #cccccc url(../../inicio/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold;
  95. -moz-border-radius: 6px;
  96. -webkit-border-radius: 6px;
  97. border-radius: 6px;
  98. }
  99. #listado tr {
  100. background:#fff;
  101. }
  102. #listado tr th {
  103. border: 1px solid #d3d3d3; background: #e6e6e6 url(../../inicio/css/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555;
  104. -moz-border-radius: 6px;
  105. -webkit-border-radius: 6px;
  106. border-radius: 6px;
  107. }
  108. #listado tr.chequeada {
  109. background:#dd0;
  110. }
  111. #listado tr.pasada {
  112. background:#dd0;
  113. cursor:pointer;
  114. }
  115. .boton{
  116. font-size: 10px;
  117. }
  118. /* Para que no se vean los Botones cuando se ejecute la accion*/
  119. .ui-button{
  120. position: inherit;
  121. }
  122. </style>
  123. <script type="text/javascript" language="javascript">
  124. $(function() {
  125. $('input:text,input:password').css({
  126. background: '#fff' ,
  127. border: '1px solid #d5d5d5',
  128. '-moz-border-radius': '4px',
  129. '-webkit-border-radius': '4px',
  130. 'border-radius': '4px'
  131. });
  132. $( "input:button, input:submit, button" ).button();
  133. });
  134. filaseleccionada = {};
  135. function oclic(fila){
  136. var aux = fila.id.split("|");
  137. var idevento = aux[0];
  138. var fecha = aux[1];
  139. var evento = aux[2];
  140. var idcamara = "<?php echo $_REQUEST["idcamara"]?>";
  141. filaseleccionada.className='';
  142. filaseleccionada = fila;
  143. fila.className = 'chequeada';
  144. <?php
  145. //-------------------- INVOCADA DESDE LA MISMA VENTANA ---------------------//
  146. if ($_REQUEST["accion"]=="verTodos"){
  147. echo "$(document).attr('location','setStatusEvento.php?idevento='+idevento+'&fecha='+fecha+'&evento='+evento+'&idcamara='+idcamara+'&accion=setStatusEvento');";
  148. }
  149. //-------------------- INVOCADA DESDE LA VENTANA GRANDE --------------------//
  150. if ($_REQUEST["accion"]!="verTodos"){
  151. //echo "loadEvento('setStatusEvento.php?idevento='+idevento+'&fecha='+fecha+'&idcamara='+idcamara+'&accion=setStatusEvento');";
  152. //echo "$(document).attr('location','setStatusEvento.php?idevento='+idevento+'&fecha='+fecha+'&evento='+evento+'&idcamara='+idcamara+'&accion=setStatusEvento');";
  153. echo "top.setLoadEvento('setStatusEvento.php?idevento='+idevento+'&fecha='+fecha+'&evento='+evento+'&idcamara='+idcamara+'&accion=setStatusEvento');";
  154. }
  155. ?>
  156. }
  157. function omover(fila){
  158. if (fila.id===filaseleccionada.id ) return false;
  159. fila.className = 'pasada';
  160. }
  161. function omout(fila){
  162. if (fila.id===filaseleccionada.id ) return false;
  163. fila.className = "";
  164. }
  165. function getReloj(){
  166. var d = new Date();
  167. $("#reloj").html(d.getDate()+"-"+d.getUTCMonth()+"-"+d.getFullYear()+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds());
  168. setTimeout("getReloj()",1000);
  169. }
  170. $(function(){
  171. /*$.ajax({
  172. type: "POST",
  173. url: "getCamaraStatus.php",
  174. data: "idcamara=<?php echo $eventos[0]->idcamara?>&idservidor=<?php echo $eventos[0]->idservidor?>",
  175. success: function(html){
  176. $("#camaraStatus").html(html);
  177. }
  178. });
  179. /setTimeout("ajaxLoadEventos();", 10*1000);*/
  180. if (parseInt($('#guardRunning', parent.document).val()) != 0 ){
  181. $('#guardRunningImg').css('display','inherit');
  182. }
  183. });
  184. </script>
  185. </head>
  186. <body id="body" style="margin:0px;background:#fff;">
  187. <center>
  188. <div id="tabla" align="center">
  189. <table id="listado" align="center">
  190. <tr>
  191. <th colspan="4" style="background:#bbb;">
  192. <div id="camaraStatus" align="left" style="width: 40px;float:left;" >
  193. <?php
  194. $_REQUEST["idservidor"] = $eventos[0]->idservidor;
  195. include_once "getCamaraStatus.php";
  196. ?>
  197. </div>
  198. <div id="guardRunningImg" align="left" style="width: 40px;float:left;display: none;" >
  199. <img src="../images/Info-red-20.png" title="Existe una guardia activa para la c&aacute;mara <?php echo $eventos[0]->camara;?>." onclick="alert('Existe una guardia activa para la c&aacute;mara <?php echo $eventos[0]->camara;?>')" style="cursor: help;"/>
  200. </div>
  201. <div id="reloj" align="right" style="float:left;" >
  202. &nbsp;
  203. <?php
  204. if ($_REQUEST["accion"]!="verTodos"){
  205. echo date("d-m-Y H:i:s");
  206. }?>
  207. </div>
  208. <div style="width: 53%;float:left;" >
  209. <?php echo trim($eventos[0]->camara ." - ".$eventos[0]->numero);?>
  210. </div>
  211. <div align="right" style="float:left;" >
  212. <?php
  213. if ($_REQUEST["accion"]=="verTodos"){
  214. //echo "<input class=\"boton\" type=\"button\" value=\"Cerrar\" onclick=\"$('#loadEvento',parent.document).fadeOut('slow');\">";
  215. }else{
  216. echo "<input class=\"boton\" type=\"button\" value=\"Ver Todos\" onclick=\"top.setLoadEvento('loadEventos.php?idcamara=".$_REQUEST["idcamara"]."&accion=verTodos');\">";
  217. }
  218. ?>
  219. </div>
  220. </th>
  221. </tr>
  222. <tr>
  223. <th align="center" width="10%">N&deg;</th>
  224. <th>&nbsp;</th>
  225. <th>Fecha</th>
  226. <th>Estado</th>
  227. </tr>
  228. <?php
  229. foreach ($eventos as $key => $row){
  230. echo "<tr id=\"".$row->idevento."|".$row->fecha."|".$row->evento."\" class=\"fila\" onclick=\"oclic(this)\" onmouseover=\"omover(this)\" onmouseout=\"omout(this)\">\n";
  231. echo "<td align=\"center\"><b>".(paginationSQL::$start+$key+1)."</b></td>";
  232. echo " <td align=\"center\" >\n";
  233. if (preg_match("/timelapse/", $row->file)){
  234. //echo "<img src=\"../images/Clock-black-32.png\" />";
  235. echo "<img src=\"../images/Clock-32.png\" width=\"20\" title=\"Video generado por lapso de tiempo\"/>";
  236. }else{
  237. //echo "<img src=\"../images/user_remove-32.png\" />";
  238. //echo "<img src=\"../images/Camera-Go-32.png\" />";
  239. echo "<img src=\"../images/Video-security-32.png\" width=\"20\" title=\"Video generado por detecci&oacute;n de movimiento\"/>";
  240. }
  241. echo " </td>\n";
  242. echo " <td align=\"center\" >".Controller::formatoFecha($row->fecha)."</td>\n";
  243. if ($row->status=="1"){
  244. echo " <td align=\"center\" style=\"color:#006400;\"><b>Atendido</b></td>\n";
  245. }else{
  246. echo " <td align=\"center\" style=\"color:#FF0000;\"><b>No atendido</b></td>\n";
  247. }
  248. echo "</tr>\n";
  249. }
  250. ?>
  251. </table>
  252. <?php echo paginationSQL::links();?>
  253. </div>
  254. </center>
  255. </body>
  256. </html>
  257. <?php
  258. }
  259. ?>