PageRenderTime 28ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/ctrlpuerta/view/ctrl_puerta.Acc.php

https://gitlab.com/talueses/SIPVE
PHP | 220 lines | 149 code | 7 blank | 64 comment | 21 complexity | 67fc82b48350bf124b86bdeb67449bbd 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. * Formulario de acciones agregar, modificar y visualizar datos
  41. * @author David Concepcion
  42. */
  43. session_start(); // start up your PHP session!
  44. if(!isset($_SESSION['usuario'])){
  45. header("location: login.php",true);
  46. return false;
  47. }
  48. header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  49. header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  50. //echo "<div align='left'><pre>".print_r($_REQUEST,true)."</pre></div>";
  51. require_once "../controller/ctrl_puerta.control.op.php";// Class CONTROLLER
  52. $obj = new CtrlPuertas();
  53. $numExist = $obj->getNumerosPuertas();
  54. if ($_REQUEST["accion"] == "modificar" || $_REQUEST["accion"] == "visualizar"){
  55. $data = $obj->getCtrlPuerta($_REQUEST["idpuerta"]);
  56. if (!$data ){
  57. echo $obj->getMensaje();
  58. }
  59. }
  60. $disabled = "";
  61. if ($_REQUEST["accion"] == "visualizar"){
  62. $disabled = "disabled";
  63. }
  64. ?>
  65. <html>
  66. <head>
  67. <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ">
  68. <link href="../../inicio/css/comunes.css" rel="stylesheet" type="text/css" />
  69. <link type="text/css" href="../../inicio/css/jquery-ui.css" rel="stylesheet" />
  70. <script type="text/javascript" src="../../inicio/js/jquery.js"></script>
  71. <script type="text/javascript" src="../../inicio/js/jquery-ui.min.js"></script>
  72. <style type="text/css">
  73. .list{
  74. color: #000000;
  75. font-style: oblique;
  76. background-color: #f0ebe2;
  77. width: 300px;
  78. border: 1px solid #ccc0a9;
  79. }
  80. #contenido{
  81. float:left;
  82. width:99%;
  83. height:95%;
  84. padding: 2px;
  85. border: #aaaaaa solid 1px;
  86. overflow-x:hidden
  87. width:95%;
  88. background:#fff;
  89. -moz-border-radius: 6px;
  90. -webkit-border-radius: 6px;
  91. border-radius: 6px;
  92. }
  93. #titulo{
  94. height: 20px;
  95. 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;
  96. -moz-border-radius: 6px;
  97. -webkit-border-radius: 6px;
  98. border-radius: 6px;
  99. }
  100. #datos{
  101. width: 500px;
  102. background:#fff;
  103. margin: 5px 1px 0px 1px;
  104. padding: 5px;
  105. border: #aaaaaa solid 1px;
  106. -moz-border-radius: 6px;
  107. -webkit-border-radius: 6px;
  108. border-radius: 6px;
  109. }
  110. #botones{
  111. margin: 10px;
  112. }
  113. </style>
  114. <script type="text/javascript" language="javascript">
  115. $(function() {
  116. $( "input:button, input:submit" ).button();
  117. $('#radioPuertaEntrada').buttonset();
  118. <?php
  119. if ($_REQUEST["accion"] == "visualizar"){
  120. echo " $('#radioPuertaEntrada').buttonset({disabled: true});\n";
  121. }
  122. ?>
  123. //--------------------------------------CHECK CHECKBOX --------------------------------------//
  124. /*$('div#radioPuertaEntrada input[type=radio]')
  125. .live({
  126. click: function(){
  127. if($(this).val()=='1'){
  128. var str;
  129. str = '<center>';
  130. str += ' ';
  131. str += ' <div class="ui-widget ui-corner-all info" style="margin-top: 20px; padding: 0 .7em;">';
  132. str += ' <span class="icon-info " style="float: left; margin-right: .3em;"></span>';
  133. str += ' <p><b>Se establecer\xe1 esta puerta como entrada principal</b><br>Si ya hay otra puerta como principal, automaticamente cambiar\xe1 su configuraci\xf3n quedando esta como principal.</p>';
  134. str += ' </div>';
  135. str += ' ';
  136. str += '</center>';
  137. $('#divmensaje').html(str);
  138. }else{
  139. $('#divmensaje').html('');
  140. }
  141. }
  142. });*/
  143. });
  144. </script>
  145. </head>
  146. <body style="margin:0px;background:#ddd;">
  147. <div id="contenido" align="center">
  148. <?php
  149. if (!Controller::chkPermiso($_SESSION["usuario"], CATEGORIA,$_REQUEST["accion"])){
  150. echo Controller::$mensajePermisos;
  151. }else{
  152. ?>
  153. <div id="titulo" style="padding: 5px" ><?php echo ucfirst($_REQUEST["accion"] );?> Puerta</div>
  154. <br/>
  155. <div id="divmensaje" style="width:99%;"></div>
  156. <iframe name="ifrm1" id="ifrm1" frameborder="0" width="0" height="0" scrolling="no"></iframe>
  157. <form method="POST" name="mainForm" id="mainForm" action="ctrl_puerta.Op.php" target="ifrm1">
  158. <div id="datos" align="center">
  159. <table>
  160. <tr title="N&uacute;mero">
  161. <td align="right">N&uacute;mero:</td>
  162. <td>
  163. <select name="numero" id="numero" onchange="" <?php echo $disabled;?> >
  164. <?php
  165. for ($i=1;$i<=255;$i++){
  166. $chkNum = false;
  167. foreach ($numExist as $row){
  168. if ($row->numero == $i){
  169. $chkNum = true;
  170. }
  171. }
  172. if (!$chkNum || $data->numero == $i){
  173. echo '<option value="'.$i.'" '.ControlCtrlPuerta::busca_valor($data->numero, $i ).'>'.$i.'</option>';
  174. }
  175. }
  176. ?>
  177. </select>
  178. </td>
  179. </tr>
  180. <tr title="Puerta">
  181. <td align="right">Puerta:</td>
  182. <td>
  183. <input type="text" name="puerta" id="puerta" maxlength="100" value="<?php echo $data->puerta;?>" <?php echo $disabled;?>>
  184. </td>
  185. </tr>
  186. <tr title="Puerta de Entrada Principal">
  187. <td align="right">Entrada Principal:</td>
  188. <td>
  189. <div id="radioPuertaEntrada">
  190. <input type="radio" name="puerta_entrada" id="puerta_entrada1" value="1" <?php echo ($data->puerta_entrada=="1")?"checked":""?> /><label for="puerta_entrada1">Si</label>
  191. <input type="radio" name="puerta_entrada" id="puerta_entrada2" value="" <?php echo (!$data->puerta_entrada)?"checked":""?>/><label for="puerta_entrada2">No</label>
  192. </div>
  193. <small class="comment">Se toma en cuenta para el control de asistencia</small>
  194. </td>
  195. </tr>
  196. </table>
  197. </div>
  198. <div id="botones" style="clear:left">
  199. <input type="hidden" name="accion" value="<?php echo $_REQUEST["accion"];?>">
  200. <input type="hidden" name="idpuerta" id="idpuerta" value="<?php echo $data->idpuerta ?>">
  201. <?php
  202. if ($_REQUEST["accion"] == "agregar" || $_REQUEST["accion"] == "modificar"){
  203. echo "<input type=\"submit\" value=\"".ucfirst($_REQUEST["accion"])." Puerta\" />";
  204. }
  205. ?>
  206. </div>
  207. </form>
  208. <?php
  209. }
  210. ?>
  211. </div>
  212. </body>
  213. </html>