PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/monitorremoto/view/mainControlsPanel.php

https://gitlab.com/talueses/SIPVE
PHP | 254 lines | 189 code | 15 blank | 50 comment | 8 complexity | 83f7fc80f310e45c7f545f2e5e4838d6 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. session_start(); // start up your PHP session!
  40. header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  41. header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  42. require_once "../controller/monitorremoto.control.php"; // Class CONTROLLER
  43. $obj = new CamaraCommands();
  44. //echo "<div align='left'><pre>".print_r($_REQUEST,true)."</pre></div>";
  45. if (method_exists($obj, $_REQUEST["mainControlsMethod"])){
  46. call_user_func(array($obj, $_REQUEST["mainControlsMethod"]));
  47. }
  48. ?>
  49. <html>
  50. <head>
  51. <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ">
  52. <link href="../../inicio/css/comunes.css" rel="stylesheet" type="text/css" />
  53. <link type="text/css" href="../../inicio/css/jquery-ui.css" rel="stylesheet" />
  54. <script type="text/javascript" src="../../inicio/js/jquery.js"></script>
  55. <script type="text/javascript" src="../../inicio/js/jquery-ui.min.js"></script>
  56. <style type="text/css">
  57. .listado{
  58. background:#fff;
  59. margin: 0px 1px 0px 1px;
  60. border: #aaaaaa solid 1px;
  61. -moz-border-radius: 6px;
  62. -webkit-border-radius: 6px;
  63. border-radius: 6px;
  64. }
  65. .listado tr {
  66. background:#fff;
  67. }
  68. .listado tr th {
  69. 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;
  70. -moz-border-radius: 6px;
  71. -webkit-border-radius: 6px;
  72. border-radius: 6px;
  73. }
  74. #pan, #zoom{
  75. width: 160px;
  76. }
  77. #tilt{
  78. height: 200px;
  79. }
  80. </style>
  81. <script type="text/javascript" language="javascript">
  82. $(function() {
  83. var maxPan = parseInt(<?php echo $obj->maxPan;?>);
  84. var minPan = parseInt(<?php echo $obj->minPan;?>);
  85. var maxTilt = parseInt(<?php echo $obj->maxTilt;?>);
  86. var minTilt = parseInt(<?php echo $obj->minTilt;?>);
  87. var maxZoom = parseInt(<?php echo $obj->maxZoom;?>);
  88. var minZoom = parseInt(<?php echo $obj->minZoom;?>);
  89. $('input:button, input:submit').button();
  90. //$('#radioKeyAccess').buttonset();
  91. // ------------------- Establecer Barras Slider --------------------//
  92. // PAM
  93. $( "#pan" ).slider({
  94. max:maxPan,
  95. min:minPan,
  96. stop: function( event, ui ) {
  97. setComandoCamara('pan',ui.value);
  98. $('#resPan').html(ui.value);
  99. },
  100. animate: true
  101. });
  102. // TILT
  103. if ($('.BIG', parent.document).attr('rotacion')=="180"){
  104. maxTilt -= 60;
  105. minTilt -= 60;
  106. }
  107. $( "#tilt" ).slider({
  108. orientation: "vertical",
  109. max:maxTilt,
  110. min:minTilt,
  111. stop: function( event, ui ) {
  112. setComandoCamara('tilt',ui.value);
  113. $('#resTilt').html(ui.value);
  114. },
  115. animate: true
  116. });
  117. // ZOOM
  118. $( "#zoom" ).slider({
  119. max:maxZoom,
  120. min:minZoom,
  121. stop: function( event, ui ) {
  122. setComandoCamara('zoom',ui.value);
  123. $('#resZoom').html(valZoom(ui.value));
  124. $('#currentZoom').val(ui.value);
  125. },
  126. animate: true
  127. });
  128. // --------- Posicion Actual de la Camara ---------- //
  129. setComandoCamara('position','');
  130. });
  131. function setComandoCamara(option,value){
  132. //alert('idcamara='+$('#idcamara', parent.document).val()+'&control=main&mainControlsMethod='+$('#mainControlsMethod', parent.document).val()+'&option='+option+'&value='+value);
  133. $.ajax({
  134. dataType: 'json',
  135. type: "POST",
  136. url: "setComandoCamara.php",
  137. data: 'idcamara='+$('#idcamara', parent.document).val()+'&control=main&mainControlsMethod='+$('#mainControlsMethod', parent.document).val()+'&option='+option+'&value='+value,
  138. success: function(data){
  139. //alert(data);
  140. if (data[0]=='position'){
  141. //alert(data);
  142. // PAN
  143. var pan = parseInt(data[1]);
  144. if (pan){
  145. $('#pan').slider( "option", "value", pan);
  146. $('#resPan').html(pan);
  147. }
  148. // TILT
  149. var tilt = parseInt(data[2]);
  150. if (tilt){
  151. $('#tilt').slider( "option", "value", tilt);
  152. $('#resTilt').html(tilt);
  153. }
  154. // ZOOM
  155. var zoom = parseInt(data[3]);
  156. if (zoom){
  157. $('#zoom').slider( "option", "value", zoom);
  158. $('#resZoom').html(valZoom(zoom));
  159. $('#currentZoom').val(zoom);
  160. }
  161. }
  162. }
  163. });
  164. }
  165. function setMove(option){
  166. var value = null;
  167. if (option=="home"){
  168. setComandoCamara('pan','0');
  169. $('#pan').slider( "option", "value", 0);
  170. $('#resPan').html(0);
  171. setComandoCamara('tilt','0');
  172. $('#tilt').slider( "option", "value", 0);
  173. $('#resTilt').html(0);
  174. setComandoCamara('zoom','1');
  175. $('#zoom').slider( "option", "value", 1);
  176. $('#resZoom').html(valZoom(1));
  177. $('#currentZoom').val('1');
  178. }
  179. if (option!="home"){
  180. setComandoCamara(option,value);
  181. setTimeout('setComandoCamara(\'position\',\'\');',1000);
  182. }
  183. }
  184. function valZoom(value){
  185. var maxZoom = parseInt(<?php echo $obj->maxZoom;?>);
  186. return parseInt(((parseInt(value) * 100) / maxZoom))+'%';
  187. }
  188. </script>
  189. </head>
  190. <body style="margin:0px;background:#fff;">
  191. <center>
  192. <table border="0" width="99%" class="listado">
  193. <tr>
  194. <td height="100" style="padding: 0px 0px 0px 20px;" align="center">
  195. <a href="#" onclick="setMove('upleft');"><img src="../images/ptzUpLeft.gif" /></a>
  196. <a href="#" onclick="setMove('up');"><img src="../images/ptzUp.gif" /></a>
  197. <a href="#" onclick="setMove('upright');"><img src="../images/ptzUpRight.gif" /></a>
  198. <br />
  199. <a href="#" onclick="setMove('left');" ><img src="../images/ptzLeft.gif" /></a>
  200. <a href="#" onclick="setMove('home');" ><img src="../images/ptzCenter.gif" /></a>
  201. <a href="#" onclick="setMove('right');" ><img src="../images/ptzRight.gif" /></a>
  202. <br />
  203. <a href="#" onclick="setMove('downleft');" ><img src="../images/ptzDownLeft.gif" /></a>
  204. <a href="#" onclick="setMove('down');" ><img src="../images/ptzDown.gif" /></a>
  205. <a href="#" onclick="setMove('downright');" ><img src="../images/ptzDownRight.gif" /></a>
  206. </td>
  207. <td rowspan="3" valign="top" align="center" >
  208. <b><label id="resTilt" >0</label>&deg;</b><div id="tilt"></div>
  209. </td>
  210. </tr>
  211. <tr>
  212. <td align="center" >
  213. <table class="listado" style="padding: 0px;margin: 0px;" >
  214. <tr>
  215. <th>Pan: <b><label id="resPan">0</label>&deg;</b></th>
  216. </tr>
  217. <tr>
  218. <td>
  219. <div id="pan"></div>
  220. </td>
  221. </tr>
  222. </table>
  223. <br />
  224. <table class="listado" style="padding: 0px;margin: 0px;" >
  225. <tr>
  226. <th>Zoom: <b><label id="resZoom">0%</label><input type="hidden" name="currentZoom" id="currentZoom" /></b></th>
  227. </tr>
  228. <tr>
  229. <td>
  230. <div id="zoom"></div>
  231. </td>
  232. </tr>
  233. </table>
  234. </td>
  235. </tr>
  236. </table>
  237. </center>
  238. </body>
  239. </html>