278 Commits
v3.0 ... main

Author SHA1 Message Date
c4f537c433 Eliminar 'assets/mysql/complucine-FER_SURFACE.sql' 2023-04-16 00:10:33 +02:00
632cc52b99 Eliminar 'assets/mysql/complucine-FER_SURFACE-2.sql' 2023-04-16 00:10:27 +02:00
af885e9302 Delete _old.index.php 2021-08-09 11:20:58 +02:00
a22130ac67 Delete formSelectSeat-FER_SURFACE.php 2021-08-09 11:12:50 +02:00
357465a383 Delete formSelectCinemaSession-FER_SURFACE.php 2021-08-09 11:12:47 +02:00
81a6296f01 Delete formPurchase-FER_SURFACE.php 2021-08-09 11:12:39 +02:00
03e54d0f7d Delete formPurchase-FER_SURFACE-3.php 2021-08-09 11:12:33 +02:00
f947d40543 Delete formPurchase-FER_SURFACE-2.php 2021-08-09 11:12:27 +02:00
c607dbcf27 Delete confirm-FER_SURFACE.php 2021-08-09 11:12:18 +02:00
485a696067 Delete panelAdmin-FER_SURFACE.php 2021-07-30 16:48:06 +00:00
0368df8bbd Delete formRegister-FER_SURFACE.php 2021-07-15 21:41:40 +02:00
f6d8bbb05e Delete main-FER_SURFACE.css 2021-07-12 09:31:38 +02:00
39424ff5e2 Delete highContrast-FER_SURFACE.css 2021-07-12 09:31:32 +02:00
204dac6c78 Delete cambiarCSS-FER_SURFACE.js 2021-07-12 09:31:10 +02:00
b71f54db46 Delete session_dao-FER_SURFACE.php 2021-07-12 09:30:52 +02:00
b5d3ee539f Delete session-FER_SURFACE.php 2021-07-12 09:30:40 +02:00
1a5013ca99 Delete seat_dao-FER_SURFACE.php 2021-07-12 09:30:32 +02:00
ac477d7aad Delete changeCSS-FER_SURFACE.php 2021-07-12 09:30:20 +02:00
902d93f971 Delete config-FER_SURFACE.php 2021-07-12 09:30:04 +02:00
ae72878c5a Delete template-FER_SURFACE.php 2021-07-12 09:29:53 +02:00
2ccfc90926 Delete template-FER_SURFACE-2.php 2021-07-12 09:29:43 +02:00
55d72047de Add files via upload 2021-07-02 18:10:54 +02:00
3811fa2f17 Add files via upload 2021-07-02 18:09:23 +02:00
2b06f5758e Add files via upload 2021-07-02 18:08:16 +02:00
0e56e727bc Delete root directory 2021-07-02 18:01:41 +02:00
7a4594d099 Delete docs directory 2021-07-02 18:01:26 +02:00
724f28f6b9 Add files via upload 2021-07-02 18:00:30 +02:00
57a0ec644b Add files via upload 2021-07-02 17:59:22 +02:00
8a3d41d2d5 Add files via upload 2021-07-02 17:58:01 +02:00
842366141c Delete index.php 2021-07-02 17:55:33 +02:00
897244542c Delete showtimes directory 2021-07-02 17:55:18 +02:00
2d7aaf132d Delete register directory 2021-07-02 17:55:05 +02:00
0ffda6f698 Delete purchase directory 2021-07-02 17:54:59 +02:00
e01c135238 Delete promotions directory 2021-07-02 17:54:51 +02:00
c657675b6c Delete panel_user directory 2021-07-02 17:54:45 +02:00
e1fe17d695 Delete panel_manager directory 2021-07-02 17:54:39 +02:00
f1895fd4f6 Delete panel_admin directory 2021-07-02 17:54:32 +02:00
b08cccf23e Delete logout directory 2021-07-02 17:54:24 +02:00
5f78baded2 Delete login directory 2021-07-02 17:54:15 +02:00
bd86ecdf28 Delete img directory 2021-07-02 17:54:08 +02:00
35203afd0c Delete fdicines directory 2021-07-02 17:53:58 +02:00
abadfa99a2 Delete contacto directory 2021-07-02 17:53:43 +02:00
be2cb4c8aa Delete cinemas directory 2021-07-02 17:53:37 +02:00
d9ca15a065 Delete assets directory 2021-07-02 17:53:29 +02:00
49ba6554f9 Create Readme.md 2021-07-02 17:53:09 +02:00
1756b1d1c0 Create README.md 2021-07-02 17:51:29 +02:00
d51253975c Add files via upload 2021-06-08 20:12:25 +02:00
6b6aab5a61 Add files via upload 2021-06-08 20:11:08 +02:00
125f922844 true/false 2021-06-08 19:58:29 +02:00
9ce0a4045f true/false 2021-06-08 18:56:31 +02:00
9db0c0ce6f Update config.php 2021-06-08 15:43:54 +02:00
8ba8939137 Add files via upload 2021-06-08 15:43:10 +02:00
5921fe6c11 Add files via upload 2021-06-08 15:37:37 +02:00
a53006592c debug 2021-06-08 15:27:37 +02:00
ff7c9d103d Add files via upload 2021-06-08 15:10:08 +02:00
880a74379f Add files via upload 2021-06-08 15:08:28 +02:00
db3cf15098 Add files via upload 2021-06-08 14:46:50 +02:00
60170ca731 Add files via upload 2021-06-08 14:46:12 +02:00
db34538d41 Add files via upload 2021-06-08 14:10:04 +02:00
5dcb995390 Add files via upload 2021-06-08 14:08:28 +02:00
914d2a9325 update 2021-06-08 13:50:33 +02:00
ec0a391745 debug forms 2021-06-08 13:45:44 +02:00
b989468601 debug forms 2021-06-08 13:32:36 +02:00
4f9cd0b581 Add files via upload 2021-06-08 13:26:48 +02:00
8f2d3db7ad Add files via upload 2021-06-08 13:24:14 +02:00
97d271bbee update 2021-06-08 12:44:47 +02:00
5f1b02a3b3 Intento de fix whitescreen #1 2021-06-08 11:30:31 +02:00
84fa1c230c Add files via upload 2021-06-08 11:30:10 +02:00
d770c474bd Add files via upload 2021-06-08 11:29:53 +02:00
f8bee910e0 Add files via upload 2021-06-08 11:27:25 +02:00
17b31a9f04 Add files via upload 2021-06-08 11:27:11 +02:00
9ffe2917de Add files via upload 2021-06-08 11:26:57 +02:00
9fba95b2f4 Add files via upload 2021-06-08 10:14:23 +02:00
f1d674a3f1 Add files via upload 2021-06-08 10:13:02 +02:00
70ae0cb19e Add files via upload 2021-06-08 09:27:24 +02:00
8162f84100 Add files via upload 2021-06-07 23:16:42 +02:00
d78ef81c3e Add files via upload 2021-06-07 23:16:22 +02:00
3ee19f4c5f Add files via upload 2021-06-07 23:15:57 +02:00
0b6faa00eb Update 2021-06-07 16:35:48 +02:00
a43b6281fc Add files via upload 2021-06-07 12:58:50 +02:00
f852fb292c Add files via upload 2021-06-07 12:56:31 +02:00
3e5e670e30 Add files via upload 2021-06-07 12:39:48 +02:00
6bad506670 Add files via upload 2021-06-07 12:32:10 +02:00
69b5ec6534 Add files via upload 2021-06-07 11:16:12 +02:00
c10b90997e Delete cm.jpg 2021-06-07 09:43:21 +02:00
98156e685c Add files via upload 2021-06-07 09:39:10 +02:00
efa3c6e31d Add files via upload 2021-06-07 09:37:40 +02:00
df9f8176d4 Add files via upload 2021-06-06 22:16:15 +02:00
b90cbcd074 Add files via upload 2021-06-06 17:45:38 +02:00
cd7c2ccf38 Add files via upload 2021-06-06 17:43:26 +02:00
119733a174 Full calendar completo 2021-06-06 13:53:07 +02:00
0e91d0fc30 Delete sessionFormProcess.js 2021-06-06 13:52:52 +02:00
a01cfec117 Delete sessionCalendar.js 2021-06-06 13:52:47 +02:00
c6d7a98a85 FullCalendar scripts 2021-06-06 13:52:36 +02:00
a57751e699 FC funcional entero 2021-06-06 13:35:19 +02:00
bb6355fdc1 Delete NewSessionForm.php 2021-06-06 13:35:04 +02:00
7252a1b9e0 Delete EditSessionForm.php 2021-06-06 13:35:00 +02:00
489d9af2df Delete formSession.php 2021-06-06 13:34:55 +02:00
4194b6fef2 Delete eventos.php 2021-06-06 13:34:47 +02:00
d3490d7536 Delete Evento.php 2021-06-06 13:34:43 +02:00
2f5fc9cadc Delete sessionforms.js 2021-06-06 13:34:38 +02:00
8aabcf7482 Delete sessioncalendar.js 2021-06-06 13:34:33 +02:00
c1e88a651f Add files via upload 2021-06-06 13:34:13 +02:00
16e0019231 Add files via upload 2021-06-06 13:33:40 +02:00
162f7c1a8d Add files via upload 2021-06-06 13:31:43 +02:00
6a27caf834 Add files via upload 2021-06-06 13:31:05 +02:00
0820e9476e Delete processSession.php 2021-06-06 11:47:32 +02:00
8638073f7a Add files via upload 2021-06-06 11:45:30 +02:00
bef1bb8038 Editar al clicar funcional 2021-06-06 01:01:34 +02:00
db5c5d79ad Delete processSession.php 2021-06-06 01:01:18 +02:00
1a16619158 moar fullcalendar css things 2021-06-06 00:58:25 +02:00
d0fe499ee3 Add files via upload 2021-06-05 15:15:45 +02:00
a067b8c8b9 Add files via upload 2021-06-05 14:57:19 +02:00
642e8036d8 Visual bug fix 2021-06-05 14:51:54 +02:00
3b71865eaa showtimes de formSessions 2021-06-05 14:29:34 +02:00
d8e08b7c3c Full Calendar Add funcional
Solo falta que el formulario se reinicie una vez se ha completado la operacion
2021-06-05 14:28:52 +02:00
31cb6b3212 Add files via upload 2021-06-05 11:50:04 +02:00
214e5df673 lil list css 2021-06-05 11:49:41 +02:00
fd712e5563 animación en el pop up fullcalendar 2021-06-05 11:27:06 +02:00
accb27c682 fullcalendar css pop up 2021-06-05 11:26:22 +02:00
505fc87698 Add files via upload 2021-06-04 23:59:51 +02:00
c0cbc85ff9 Add files via upload 2021-06-04 23:47:23 +02:00
63d9c9a61d Add files via upload 2021-06-04 23:07:20 +02:00
1475817c6e Add files via upload 2021-06-04 20:43:14 +02:00
2d5cf09b61 Add files via upload 2021-06-04 19:54:32 +02:00
0b2bf81d0a Add files via upload 2021-06-04 19:28:52 +02:00
57f63a2dc3 Ver como usuario y usuario registrado href 2021-06-04 15:11:47 +02:00
13489a0925 fullcalendar css 2021-06-04 15:10:35 +02:00
d13c731297 Update panelAdmin.php
solucion del error de tabla promociones
2021-06-04 15:00:49 +02:00
f9a0a3c5ba Add files via upload 2021-06-04 14:30:48 +02:00
786d28f70c manager.css en desarrollo fullcalendar 2021-06-04 13:10:04 +02:00
8dafa546b6 Add files via upload 2021-06-04 12:38:17 +02:00
22977e8091 update 2021-06-04 11:36:15 +02:00
a45a525e67 debug edit promociones 2021-06-04 10:09:21 +02:00
50ea9b5a67 mejora visula de tablas 2021-06-04 09:54:37 +02:00
a71a7b0df8 update 2021-06-04 09:33:18 +02:00
1f6cd81724 updates 2021-06-04 09:14:36 +02:00
dad530edb4 updates 2021-06-04 09:13:27 +02:00
5dfd0e8895 Add files via upload 2021-06-03 16:53:11 +02:00
3593f13c59 Add files via upload 2021-06-03 14:54:14 +02:00
28bce68335 Add files via upload 2021-06-03 14:53:42 +02:00
7a28aed626 Add files via upload 2021-06-03 14:23:27 +02:00
91177751b4 CALENDAR Sala y cine filtro 2021-06-03 14:09:25 +02:00
7ffb4662bf Add files via upload 2021-06-03 14:07:38 +02:00
ffb94809b5 Add files via upload 2021-06-03 14:07:18 +02:00
5c460bf06f Add files via upload 2021-06-03 13:40:11 +02:00
6326ff3e1e Add files via upload 2021-06-03 12:57:39 +02:00
0d084df6a7 Filtro de salas en sesiones 2021-06-03 12:53:53 +02:00
ade555d392 Delete processForm.php 2021-06-03 12:52:17 +02:00
90f3ce3bd6 Add files via upload 2021-06-03 12:29:18 +02:00
1fac908cd5 Add files via upload 2021-06-03 11:58:10 +02:00
3dc56e4618 Add files via upload 2021-06-03 11:32:27 +02:00
8a65fdb574 Add files via upload 2021-06-03 11:26:35 +02:00
d56c04f076 Update panelAdmin.php 2021-06-03 09:50:35 +02:00
7d56763384 fullcalendar: Se ven sesiones
Solo se ven las sesiones del cine 1 de la sala 1
2021-06-02 23:35:07 +02:00
1ffac90068 Delete processForm.php 2021-06-02 23:33:40 +02:00
68c117d9dc Add files via upload 2021-06-02 23:33:04 +02:00
0494c611b6 Add files via upload 2021-06-02 23:32:13 +02:00
b65220dee8 Add files via upload 2021-06-02 22:54:30 +02:00
616bf85934 Add files via upload 2021-06-02 20:59:02 +02:00
987fc1a641 Add files via upload 2021-06-02 17:42:58 +02:00
85a0ff411d Add files via upload 2021-06-02 14:55:05 +02:00
6efe3fc241 Add files via upload 2021-06-02 13:08:20 +02:00
a211264aa6 Add files via upload 2021-06-02 13:07:48 +02:00
a67e7b9c23 Add files via upload 2021-06-02 13:06:50 +02:00
85c8313c1a Update panelAdmin.php 2021-06-02 12:32:36 +02:00
2f60b8f6e5 Update panelAdmin.php 2021-06-02 12:27:48 +02:00
ebc7d4708c update admin
muestra de mensaje al usar la funciona de ver como
2021-06-02 12:17:18 +02:00
59368957ff Add files via upload 2021-06-02 09:40:30 +02:00
3087940f70 Add files via upload 2021-06-02 09:36:59 +02:00
51032e2630 Delete confirm.php 2021-06-02 09:25:01 +02:00
10e060d4c8 Add files via upload 2021-06-01 17:59:32 +02:00
019872acfb update 2021-06-01 17:46:40 +02:00
668598fef9 update show cinemas 2021-06-01 17:46:11 +02:00
b412c47c8e Update show cinemas admin 2021-06-01 17:44:19 +02:00
b171b76ce5 Add files via upload 2021-06-01 17:33:01 +02:00
fb1cbe2a1c Add files via upload 2021-06-01 17:02:41 +02:00
629cad58e1 Add files via upload 2021-06-01 16:50:28 +02:00
687e7b4672 Add files via upload 2021-06-01 16:37:52 +02:00
b655543224 Add files via upload 2021-06-01 16:18:05 +02:00
3b159ee6f4 Importadas las CSS de manager y Admin
@import url();
2021-06-01 13:06:00 +02:00
0bafdb106a ver como gerente 2021-06-01 12:30:28 +02:00
91d001f29d Corregido el error de subida de ficheros en el VMS
Se ha eliminado la linea "finfo_close();" en todos los formularios. Esta llamada era la que generaba el problema,  no es necesaria, pues la clase finfo hace el trabajo en su destructor.
2021-06-01 12:26:18 +02:00
72b1bab936 Add files via upload 2021-06-01 12:22:08 +02:00
258a7bfd05 Update template.php 2021-06-01 12:14:19 +02:00
c849f31681 tablas a listas 2021-06-01 11:24:37 +02:00
2a5a9a9d12 Add files via upload 2021-06-01 09:52:53 +02:00
7166b91e83 Add files via upload 2021-05-31 20:50:32 +02:00
425af67eb5 Add files via upload 2021-05-31 12:05:22 +02:00
af0d9ccd25 Pequeños pasos con fullcalendar 2021-05-30 23:42:30 +02:00
4692af8ddd Delete _old.index.php 2021-05-30 21:53:35 +02:00
4a7f89bdbe Add files via upload 2021-05-30 21:52:43 +02:00
8d21c86642 Add files via upload 2021-05-30 16:38:26 +02:00
1a88b8d861 Add files via upload 2021-05-30 16:25:45 +02:00
6ebea1c1ae Update deleteConfirm.js 2021-05-29 17:28:44 +02:00
f5ede5cb15 Add files via upload 2021-05-29 17:06:35 +02:00
e12c79d493 Add files via upload 2021-05-29 15:59:19 +02:00
e9ef536815 Add files via upload 2021-05-28 14:28:04 +02:00
b80a9ae1db Add files via upload 2021-05-28 14:21:10 +02:00
12c61a4683 Delete formSelectTicket.php 2021-05-27 22:08:47 +02:00
f9963bbca4 Add files via upload 2021-05-27 22:08:17 +02:00
9b168a97df Add files via upload 2021-05-27 21:55:28 +02:00
79a9b04421 Add files via upload 2021-05-27 21:08:20 +02:00
4addd2c35f Update manager.css 2021-05-27 20:50:03 +02:00
53dbcbe6a6 Add files via upload 2021-05-27 20:41:59 +02:00
157201c2f8 Add files via upload 2021-05-27 20:41:45 +02:00
cfd65e645a la tablelike funciona con un grid 2021-05-27 20:26:58 +02:00
6e18e93fc2 Add files via upload 2021-05-27 18:01:24 +02:00
d9992fde93 Update index.php 2021-05-27 14:29:25 +02:00
4e2aa0ee6b Update panel_manager.php 2021-05-27 14:28:17 +02:00
d108b66468 Add files via upload 2021-05-27 14:18:25 +02:00
c90c450f1c Add files via upload 2021-05-27 14:18:07 +02:00
c5ee1bd4c7 Add files via upload 2021-05-27 12:39:26 +02:00
faec3af6f7 Add files via upload 2021-05-27 12:31:18 +02:00
bb784490e5 debug 2021-05-27 12:21:41 +02:00
05ae838f03 Debug file names BD 2021-05-27 11:02:14 +02:00
f22ddcff66 debug name files bd 2021-05-27 10:56:01 +02:00
fff6f2c6fd Add files via upload 2021-05-27 10:42:24 +02:00
e8f4b88426 Add files via upload 2021-05-27 10:17:57 +02:00
b80f870ca8 Parches en panel_manager 2021-05-27 10:13:12 +02:00
571d28fc19 update template
Comprobaciones por si la base de datos esta vacia
2021-05-27 10:00:13 +02:00
77781827bc limpieza de index 2021-05-27 09:23:11 +02:00
cb82c3eb15 Debug 2021-05-27 09:18:41 +02:00
90f233fca9 Add functions 2021-05-26 11:47:10 +02:00
113a6413a8 Upload images available 2021-05-26 11:46:06 +02:00
11e4339a04 Add files via upload 2021-05-26 10:31:29 +02:00
4d1eb61a1e Add functions 2021-05-26 09:56:54 +02:00
cf3f36c9d4 Add files via upload 2021-05-26 09:03:02 +02:00
a5c8dd4ff8 Delete purchase directory 2021-05-26 09:01:40 +02:00
4ed406793a Delete promotions directory 2021-05-26 09:01:30 +02:00
6955e99e7e Delete assets directory 2021-05-26 09:00:59 +02:00
2c1f8da1c7 Delete index copy.php 2021-05-25 18:03:22 +02:00
9dd93498e4 Add files via upload 2021-05-25 18:03:03 +02:00
bebd7da242 Add files via upload 2021-05-25 18:02:42 +02:00
360920fcd0 Add files via upload 2021-05-25 17:59:09 +02:00
5899b9f983 Add files via upload 2021-05-25 17:57:33 +02:00
5d4eb4390a Add files via upload 2021-05-25 17:55:31 +02:00
a304065e05 Add files via upload 2021-05-25 17:52:56 +02:00
b4f2d17d0e Add files via upload 2021-05-25 17:02:29 +02:00
4e1cdc6522 Add files via upload 2021-05-25 12:21:50 +02:00
bf0bb38838 Add files via upload 2021-05-25 00:51:11 +02:00
045e93198e Add files via upload 2021-05-25 00:50:53 +02:00
ffce51748a Add files via upload 2021-05-25 00:50:31 +02:00
895526114a Add files via upload 2021-05-24 17:02:40 +02:00
7587548296 Add files via upload 2021-05-24 14:07:18 +02:00
6625d9787a Add files via upload 2021-05-24 13:38:19 +02:00
5732adfec9 Add files via upload 2021-05-24 13:28:35 +02:00
7e29154220 Add files via upload 2021-05-24 12:46:52 +02:00
8b86f15a68 Add files via upload 2021-05-24 12:43:25 +02:00
1ad88d42a2 Add files via upload 2021-05-24 10:18:17 +02:00
27c3ee739c Add files via upload 2021-05-23 16:23:25 +02:00
ae8ac3c07a Update panelAdmin.php 2021-05-21 09:27:06 +02:00
0b38e804f5 Add files via upload 2021-05-21 09:19:01 +02:00
038de91627 Add files via upload 2021-05-20 17:01:22 +02:00
fa4769d77b Add files via upload 2021-05-20 15:29:49 +02:00
62d0602d70 Add files via upload 2021-05-20 12:00:33 +02:00
52cc4cb49b Gestion de sesiones usa print->film 2021-05-20 11:45:16 +02:00
a77196d731 print_>films manager 2021-05-20 11:42:30 +02:00
7ff0fc7d3d Add files via upload 2021-05-20 11:42:06 +02:00
e799376cbd en proceso para que admin pueda ver como gerente
por ahora peta esta en proceso, se sube para que mi compañero pueda unir su parte
2021-05-20 10:53:47 +02:00
e93b191100 Edicion del index y el panel
Todavia no estan tocadas las funcionalidades de ver como
2021-05-20 10:45:10 +02:00
4dbefa6860 Add files via upload 2021-05-19 20:41:58 +02:00
a41f1a86ab Add files via upload 2021-05-19 11:58:30 +02:00
fd587dcf22 Add files via upload 2021-05-19 11:23:56 +02:00
4a3631cf09 Add files via upload 2021-05-19 10:10:22 +02:00
3b3bf220c0 Delete img directory 2021-05-19 10:09:31 +02:00
8de7a1d0cb Add files via upload 2021-05-19 10:09:05 +02:00
17cb21683e Add files via upload 2021-05-18 21:37:40 +02:00
94f76e7a82 Add files via upload 2021-05-18 21:37:02 +02:00
0398094c5a Add files via upload 2021-05-18 10:17:46 +02:00
4a8f384ef7 Update template.php 2021-05-18 10:01:43 +02:00
23ed01c8d9 Update and rename reRol.php to resetRol.php 2021-05-18 09:59:53 +02:00
1b39920abd Add files via upload 2021-05-18 09:20:24 +02:00
a9e866ac88 Update template.php 2021-05-17 16:32:15 +02:00
a7f24b2772 Update template.php 2021-05-17 16:01:32 +02:00
78c32a854d Add files via upload 2021-05-17 15:30:27 +02:00
6a9b6cd8a4 Add files via upload 2021-05-17 15:29:29 +02:00
4e92236fab TO-DO: leer 2021-03-11 09:52:10 +01:00
127 changed files with 10461 additions and 1196 deletions

Binary file not shown.

Binary file not shown.

BIN
Proyecto-02-Sales pitch.pdf Normal file

Binary file not shown.

BIN
Proyecto-03-Entrega.pdf Normal file

Binary file not shown.

BIN
Proyecto-04-Criterios.pdf Normal file

Binary file not shown.

View File

@ -1,7 +1,5 @@
# SW 💻
Repositorio para la asignatura de Sistemas Web de Ingeniería de Computadores
***
## Versión 3.0 (Tercera entrega)
***
## Licencia 📄
Educational Community License v2.0 (ECL-2.0).

164
assets/css/admin.css Normal file
View File

@ -0,0 +1,164 @@
.tablelist{
display: grid;
list-style-type: none;
}
.tablelist li {
border-bottom: 1px solid black;
padding: 10px;
font-size: 20px;
text-align: center;
}
.tablelist a {
color: #1f2c3d;
}
.tablelist a:hover li{
color: rgb(211, 235, 255);
background: rgba(31, 44, 61, 1);
}
.tablelist li.title{
font-weight: bold;
}
.col7{
grid-template-columns: repeat(7,1fr);
}
.col7 .odd{
background: rgba(144, 144, 144, 0.25);;
display: grid;
grid-column-start: 1;
grid-column-end: 8;
grid-template-columns: repeat(7,1fr);
}
.col7 .even{
display: grid;
grid-column-start: 1;
grid-column-end: 8;
grid-template-columns: repeat(7,1fr);
}
.tablelist.col7 a.h4long
{
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(4,auto);
}
.tablelist.col7 a
{
display: grid;
grid-column-start: 5;
grid-column-end: 8;
grid-template-columns: auto;
}
.tablelist.col6{
grid-template-columns: repeat(6,1fr);
}
/*.col6 .odd{
background: green;
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(5,auto);
}
.col6 .even{
background: pink;
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(5,auto);
}*/
.col6 .odd{
background: rgba(144, 144, 144, 0.25);
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(6,1fr);
}
.col6 .even{
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(6,1fr);
}
.tablelist.col6 a.h2long{
display: grid;
grid-column-start: 1;
grid-column-end: 5;
grid-template-columns: repeat(4,1fr);
}
.tablelist.col6 a{
display: grid;
grid-column-start: 5;
grid-column-end: 7;
grid-template-columns: repeat(2,1fr);
}
.tablelist.col3{
grid-template-columns: repeat(3,1fr);
}
.col2 .odd{
background: rgba(144, 144, 144, 0.25);
display: grid;
grid-column-start: 1;
grid-column-end: 4;
grid-template-columns: repeat(3,1fr);
}
.col2 .even{
display: grid;
grid-column-start: 1;
grid-column-end: 4;
grid-template-columns: repeat(3,1fr);
}
.tablelist.col2 a.h2long{
display: grid;
grid-column-start: 1;
grid-column-end: 3;
grid-template-columns: repeat(2,1fr);
}
.tablelist.col2 {
display: grid;
grid-column-start: 3;
grid-column-end: 4;
grid-template-columns: repeat(1,1fr);
}
.content-input {
width: 15%;
height: 20px;
border: 1px solid #000000;
margin-top: 10px;
font-size: 15px;
display: inline-block;
}
.efe {
width: 85%;
height: 20px;
margin-bottom: 20px;
text-align: left;
font-size: 22px;
display: inline-block;
}

View File

@ -1,3 +1,7 @@
/* Imports */
@import url('manager.css');
@import url('admin.css');
/* Basic */
* {
box-sizing: border-box;
@ -42,7 +46,7 @@
font-weight: bold;
position: relative;
}
.button.large {
.button.large, button.danger {
width: 95%;
}
button:hover, .button:hover {
@ -50,7 +54,17 @@
background-color:#dadada;
color:#1f2c3d;
border-color: #1f2c3d;
}
}
button.danger{
background-color:#2c0000;
border: 2px solid #d3ebff;
}
button.danger:hover{
background-color:#00020f;
border: 2px solid #791515;
color: #791515;
}
/* Header */
.header {
@ -85,11 +99,19 @@
color :#dadada;
position: relative;
}
.menu nav li.danger{
background-color: #791515;
}
.menu nav li:hover{
background-color:#dadada;
color:#1f2c3d;
border-color: #1f2c3d;
}
}
.menu nav li.danger:hover{
color: #d3ebff;
background-color: #2c0000;
border-color: #d3ebff;
}
.menu nav li>ul{
display: none;
}
@ -159,8 +181,8 @@
color: #dadada;
}
table tbody tr {
color: #dadada;
border: solid 1px #dadada;
color: #1f2c3d;
border: solid 1px #1f2c3d;
border-left: 0;
border-right: 0;
}
@ -171,7 +193,7 @@
padding: 0.75em 0.75em;
}
table th {
color: #dadada;
color: #1f2c3d;
font-size: 0.9em;
font-weight: 600;
padding: 0.85em 0.85em 0.85em 0.85em;
@ -199,6 +221,9 @@
table.alt thead, table.alt tfoot {
border-top: 0;
}
.tablelist a {
color: #dadada;
}
/* Main */
@ -274,64 +299,125 @@
}
/* Code & Blockquote */
.code {
background: #1f2c3d;
border-radius: 3px;
font-size: 0.9em;
margin: 10px;
display: block;
line-height: 1.75em;
padding: 1em 1.5em;
overflow-x: auto;
overflow-y: auto;
}
.code h1, .code h2{
color: #dadada;
}
.code h3, .code h4 {
color: #d3ebff;
}
.code p {
color: #dadada;
}
.code a {
text-decoration: underline;
}
.code ul, .code ol, .code li{
color: #dadada;
}
.code img{
/* width: 80px; height: 80px; */
width: 25%;
}
.code fieldset{
margin: 1px;
border-color: #dadada;
border-style: groove;
}
.code fieldset legend {
text-transform: uppercase;
font-weight: bold;
font-size: 90%;
color: #d3ebff;
}
.code label{
color: #d3ebff;
}
.code.details{
height: 750px;
}
.code.plan {
height: 1150px;
}
.code.info{
text-align: center;
height: 250px;
}
.code.showtimes{
height: 600px;
}
.code {
background: #1f2c3d;
border-radius: 3px;
font-size: 0.9em;
margin: 10px;
display: block;
line-height: 1.75em;
padding: 1em 1.5em;
overflow-x: auto;
overflow-y: auto;
}
.code h1, .code h2{
color: #dadada;
}
.code h3, .code h4 {
color: #d3ebff;
}
.code p {
color: #dadada;
}
.code a {
text-decoration: underline;
}
.code ul, .code ol, .code li {
color: #dadada;
}
.code img{
/* width: 80px; height: 80px; */
width: 25%;
}
.code fieldset{
margin: 1px;
border-color: #dadada;
border-style: groove;
}
.code fieldset legend {
text-transform: uppercase;
font-weight: bold;
font-size: 90%;
color: #d3ebff;
}
.code label{
color: #d3ebff;
}
.code.details{
height: 750px;
}
.code.plan {
height: 1150px;
}
.code.info{
text-align: center;
height: 250px;
}
.code.info img{
width: 75px;
height: 75px;
margin-top: 5px;
border: 1px solid #d3ebff;
border-radius: 5px;
padding: 5px;
transition: .5s ease;
backface-visibility: hidden;
}
.code.showtimes{
height: 600px;
}
.code.showtimes p{
height: 5em;
overflow-x: auto;
overflow-y: auto;
}
.code.showtimes:hover {
filter: drop-shadow(5px 5px 10px #1f2c3d);
}
.code.cinemas {
height: 230px;
}
.code.cinemas img {
margin: 0.7em 0 0.2em 0;
width: 15em;
height: 121px;
display: block;
margin-left: auto;
margin-right: auto;
box-shadow: 0 4px 8px 0 #00020f, 0 6px 20px 0 #00020f;
}
.code.promo img {
margin: 0.1em 0 0.8em 0;
width: 30%;
height: 10%;
display: block;
margin-left: auto;
margin-right: auto;
box-shadow: 0 4px 8px 0 #00020f, 0 6px 20px 0 #00020f;
}
.code.purchase, .code.resume {
text-align: center;
}
.code.purchase h3 {
margin-top: 2em;
}
.code.purchase img {
margin: 0.1em 0 0.8em 0;
width: 100%;
box-shadow: 0 4px 8px 0 #d3ebff, 0 6px 20px 0 #d3ebff;
}
.code.purchase select, .code.purchase select option {
display: block;
width: 100%;
height: 30px;
margin: 0.1em 0.5em 1em 0.5em;
font-weight: bold !important;
color: #1f2c3d !important;
background-color: #d3ebff;
text-transform: uppercase;
}
/* BlockQuotes */
.blockquote {
@ -382,6 +468,63 @@
height: 75%;
}
}
/* Promotions */
.promotions {
max-width: 1000px;
margin: 0 auto;
display: flex;
}
.promotions a {
width: 100%;
height: 150px;
display: block;
margin-left: auto;
margin-right: auto;
background-size: cover;
border-radius: 10px;
border-style: dashed;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(255, 255, 255, 0.19);
}
.promotions button {
margin: 4em 1em 0 1em;
background-repeat: no-repeat;
height: 40px;
width: 40px;
background-position: center;
text-indent: 0px;
}
.controls {
text-align: center;
}
.controls #play {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
text-indent: -1px;
}
.controls #stop {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
text-indent: -5px;
}
/* Responsive layout */
@media (max-width: 750px) {
.promotions button {
width: 10%;
margin: 0.5em 1em 0 1em;
}
.promotions .imagen {
margin-top: 0.2em;
width: 100%;
height: 45px;
}
}
/* Text Box */
.textbox {
@ -572,6 +715,52 @@
.file input{
height: 110%;
}
.card-holder {
width: 75%;
display: inline-block;
}
.input-cart-number, .fieldset-cvv, .select {
width: 70px;
max-width: 100%;
display: inline-block;
}
form select {
display: inline-block;
font-size: 14px;
font-weight: 400px;
color: #1f2c3d;
line-height: 1.3;
padding: 0.2em 0.2em 0.2em 0.2em;
width: 75px;
max-width: 100%;
box-sizing: border-box;
margin: 10px auto;
border: 1px solid #d3ebff;
box-shadow: 0 1px 0 1px #1f2c3d;
border-radius: .3em;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: #fff;
}
form select::-ms-expand {
display: none;
}
form select:hover {
border-color: #d3ebff;
}
form select:focus {
border-color: #d3ebff;
box-shadow: 0 0 1px 3px #1f2c3d;
box-shadow: 0 0 0 3px -moz-mac-focusring;
color: #1f2c3d;
outline: none;
}
form select option {
font-weight: normal;
}
/* Preformatted Text */
pre {
@ -581,6 +770,19 @@
fieldset pre {
color: red;
}
/* Go Up button */
.go-up {
display: none;
padding: 5px;
background:#1f2c3d;
font-size: 20px;
color:#d3ebff;
cursor: pointer;
position: fixed;
bottom: 5px;
right: 20px;
}
/* Footer */
footer {
@ -598,7 +800,7 @@
footer button {
display: inline-block;
margin: 1px;
width: 115px;
width: 120px;
height: 25px;
padding: 0px 0px;
text-align: center;

View File

@ -1,3 +1,7 @@
/* Imports */
@import url('manager.css');
@import url('admin.css');
/* Basic */
* {
box-sizing: border-box;
@ -29,20 +33,20 @@ h4 {
}
/* Buttons */
button, .button.large {
button, .button.large{
display: inline-block;
margin: 10px;
width: 150px;
height: 30px;
padding: 5px 10px;
background-color :#1f2c3d;
background-color:#1f2c3d;
border: 1px solid #d3ebff;
text-align: center;
color :#d3ebff;
color:#d3ebff;
font-weight: bold;
position: relative;
}
.button.large {
.button.large, button.danger {
width: 95%;
}
button:hover, .button:hover {
@ -50,7 +54,17 @@ button:hover, .button:hover {
background-color:#d3ebff;
color:#1f2c3d;
border-color: #1f2c3d;
}
}
button.danger{
background-color:#2c0000;
border: 2px solid #d3ebff;
}
button.danger:hover{
background-color:#d3ebff;
border: 2px solid #791515;
color: #791515;
}
/* Header */
.header {
@ -69,11 +83,11 @@ button:hover, .button:hover {
text-align: right;
font-size: 15px;
}
.menu nav a{
.menu nav a {
text-decoration: none;
color: inherit;
font-size: 15px;
}
}
.menu nav li{
display: inline-block;
width: 150px;
@ -84,12 +98,20 @@ button:hover, .button:hover {
text-align: center;
color :#d3ebff;
position: relative;
}
}
.menu nav li.danger{
background-color: #791515;
}
.menu nav li:hover{
background-color:#d3ebff;
color:#1f2c3d;
border-color: #1f2c3d;
}
.menu nav li.danger:hover{
color: #d3ebff;
background-color: #2c0000;
border-color: #d3ebff;
}
.menu nav li>ul{
display: none;
}
@ -323,13 +345,73 @@ main img {
.code.plan {
height: 1150px;
}
.code.info{
.code.info {
text-align: center;
height: 250px;
}
.code.showtimes{
.code.info img {
width: 75px;
height: 75px;
margin-top: 5px;
border: 1px solid #d3ebff;
border-radius: 5px;
padding: 5px;
transition: .5s ease;
backface-visibility: hidden;
}
.code.showtimes {
height: 600px;
}
.code.showtimes p {
height: 5em;
overflow-x: auto;
overflow-y: auto;
}
.code.showtimes:hover {
filter: drop-shadow(5px 5px 10px #1f2c3d);
}
.code.cinemas {
height: 230px;
}
.code.cinemas img {
margin: 0.7em 0 0.2em 0;
width: 15em;
height: 121px;
display: block;
margin-left: auto;
margin-right: auto;
box-shadow: 0 4px 8px 0 #00020f, 0 6px 20px 0 #00020f;
}
.code.promo img {
margin: 0.1em 0 0.8em 0;
width: 30%;
height: 10%;
display: block;
margin-left: auto;
margin-right: auto;
box-shadow: 0 4px 8px 0 #00020f, 0 6px 20px 0 #00020f;
}
.code.purchase, .code.resume {
text-align: center;
}
.code.purchase h3 {
margin-top: 2em;
}
.code.purchase img {
margin: 0.1em 0 0.8em 0;
width: 100%;
box-shadow: 0 4px 8px 0 #d3ebff, 0 6px 20px 0 #d3ebff;
}
.code.purchase select, .code.purchase select option {
display: block;
width: 100%;
height: 30px;
margin: 0.1em 0.5em 1em 0.5em;
font-weight: bold !important;
color: #1f2c3d !important;
background-color: #d3ebff;
text-transform: uppercase;
}
/* BlockQuotes */
@ -418,6 +500,63 @@ main img {
width: 100%;
}
/* Promotions */
.promotions {
max-width: 1000px;
margin: 0 auto;
display: flex;
}
.promotions a {
width: 100%;
height: 150px;
display: block;
margin-left: auto;
margin-right: auto;
background-size: cover;
border-radius: 10px;
border-style: dashed;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(255, 255, 255, 0.19);
}
.promotions button {
margin: 4em 1em 0 1em;
background-repeat: no-repeat;
height: 40px;
width: 40px;
background-position: center;
text-indent: 0px;
}
.controls {
text-align: center;
}
.controls #play {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
text-indent: -1px;
}
.controls #stop {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
text-indent: -5px;
}
/* Responsive layout */
@media (max-width: 750px) {
.promotions button {
width: 10%;
margin: 0.5em 1em 0 1em;
}
.promotions .imagen {
margin-top: 0.2em;
width: 100%;
height: 45px;
}
}
/* Percentage bar */
.bar {
@ -559,6 +698,7 @@ textarea {
border:#000000;
background-color: #791515;
}
.file{
margin-top: 10px;
}
@ -566,6 +706,53 @@ textarea {
height: 110%;
}
.card-holder {
width: 75%;
display: inline-block;
}
.input-cart-number, .fieldset-cvv, .select {
width: 70px;
max-width: 100%;
display: inline-block;
}
form select {
display: inline-block;
font-size: 14px;
font-weight: 400px;
color: #1f2c3d;
line-height: 1.3;
padding: 0.2em 0.2em 0.2em 0.2em;
width: 75px;
max-width: 100%;
box-sizing: border-box;
margin: 10px auto;
border: 1px solid #d3ebff;
box-shadow: 0 1px 0 1px #1f2c3d;
border-radius: .3em;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: #fff;
}
form select::-ms-expand {
display: none;
}
form select:hover {
border-color: #d3ebff;
}
form select:focus {
border-color: #d3ebff;
box-shadow: 0 0 1px 3px #1f2c3d;
box-shadow: 0 0 0 3px -moz-mac-focusring;
color: #1f2c3d;
outline: none;
}
form select option {
font-weight: normal;
}
/* Preformatted Text */
pre {
font-weight: bold;
@ -575,6 +762,20 @@ fieldset pre {
color: red;
}
/* Go Up button */
.go-up {
display: none;
padding: 5px;
background:#1f2c3d;
font-size: 20px;
color:#d3ebff;
cursor: pointer;
position: fixed;
bottom: 5px;
right: 20px;
}
/* Footer */
footer {
text-align: left;

View File

@ -34,6 +34,18 @@ table.seat td:first-child {
border-right: solid 2px #1f2c3d;
}
.has_error,
.help_block{
color: #a94442;
display: block;
margin-top: 3px;
margin-bottom: 3px;
}
.has_error input{
border-color: #a94442;
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
}
.check_box {
display:none;
}
@ -51,7 +63,7 @@ table.seat td:first-child {
.black.button {
width: 100%;
height: 30px;
height: 35px;
border: 1px solid #dadada;
background-color: #00020f;
color: #dadada;
@ -65,4 +77,390 @@ table.seat td:first-child {
.black.button:hover {
border:#000000;
background-color: #791515;
}
.modal .submit:hover
{
background-color: #d3ebff;
}
.modal .sumbit{
width: 100%;
height: 35px;
border: 1px solid #000000;
padding: 5px;
margin-top: 5px;
font-size: 15px;
font-weight: bold;
box-shadow: 2px 2px #1f2c3d;
filter: brightness(105%);
cursor: pointer
}
.code.welcome {
text-align: center;
}
.code.welcome img {
width: 75px;
height: 75px;
margin-top: 5px;
border: 1px solid #d3ebff;
border-radius: 5px;
padding: 5px;
transition: .5s ease;
backface-visibility: hidden;
}
/*Change inputs*/
.two-inputs-line{
display: grid;
grid-template-columns: repeat(2,auto);
}
.two-inputs-line input,
.two-inputs-line label{
width:90%;
margin: auto;
}
.one-input-line{
display: grid;
grid-template-columns: repeat(1,auto);
margin-top: 1em;
}
.one-input-line input
{
width:50%;
margin:auto;
}
/* pop up window */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 40%;
height: 95%;
overflow: auto;
}
.modal form{
width: 90%;
}
.modal .image{
margin: auto;
text-align: center;
padding-top: 1em;
padding-right: 1em;
}
.modal .code img{
height: 100%;
width: 100%;
max-height: 9em;
margin: auto;
}
.modal .code.showtimes{
height:100%;
}
.modal .code.showtimes p{
height: 100%;
max-height: 9em;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.alert_success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
text-align: center;
border-radius: 1.75em;
}
.alert_danger {
color: #ab2828;
background-color: #f0d8d8;
border-color: #f70000;
}
/*lil film list*/
.film_list{
height: 20em;
overflow-y: scroll;
margin: auto;
}
.film_list button{
margin:auto;
}
.img_desc{
display: grid;
list-style-type: none;
grid-template-columns: repeat(2,1fr);
}
/*Full calendar*/
.fc-container{
padding-left: 5%;
padding-right: 5%;
padding-top: 3em;
}
.fc-container .fc-unthemed th,
.fc-container .fc-unthemed td,
.fc-container .fc-unthemed thead,
.fc-container .fc-unthemed tbody,
.fc-container .fc-unthemed .fc-divider,
.fc-container .fc-unthemed .fc-row,
.fc-container .fc-unthemed .fc-content, /* for gutter border */
.fc-container .fc-unthemed .fc-popover,
.fc-container .fc-unthemed .fc-list-view,
.fc-container .fc-unthemed .fc-list-heading td {
border-color: #1f2c3d;
}
.fc-container .fc-unthemed td.fc-today {
background: #ffd446;
}
.fc-container .fc-event {
position: relative; /* for resize handle and other inner positioning */
display: block; /* make the <a> tag block */
font-size: .85em;
line-height: 1.3;
border-radius: 3px;
border: 1px solid #000000; /* default BORDER color */
font-weight: bold; /* undo jqui's ui-widget-header bold */
}
.fc-container .fc-event,
.fc-container .fc-event-dot {
background-color: #1f2c3d; /* default BACKGROUND color */
}
/* overpower some of bootstrap's and jqui's styles on <a> tags */
.fc-container .fc-event,
.fc-container .fc-event:hover,
.fc-container .ui-widget .fc-event {
color: #d3ebff; /* default TEXT color */
text-decoration: none; /* if <a> has an href */
}
.fc-container .fc-state-default {
background-color: #1f2c3d;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #1f2c3d, #1f2c3d);
background-repeat: repeat-x;
border-color: rgb(211 235 255) rgb(211 235 255) rgb(211 235 255);
padding: 5px 10px ;
display: inline-block;
border-radius: 0px;
color: #d3ebff;
text-shadow: 0 1px 1px rgb(255 255 255 / 75%);
box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%), 0 1px 2px rgb(0 0 0 / 5%);
}
.fc-container .fc-toolbar {
text-align: center;
background-color: #1f2c3d;
}
.fc-container .fc-toolbar h2 {
margin: 0;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
color: #d3ebff;
}
.fc-container .fc-view-container *, .fc-view-container *:before, .fc-view-container *:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
margin: auto;
}
/*td.fc-day.fc-widget-content.fc-mon.fc-other-month.fc-past*/
.fc-container .fc-other-month {
color: #1f2c3d;
background-color: #d3ebff;
}
.fc-container #myModal .modal-content{
border-radius: 1.75em;
background-color: #d3ebff;
}
.fc-container .fc-toolbar .fc-state-active, .fc-toolbar .ui-state-active {
z-index: 0;
}
/*
lists like tables
Example col3 tablelist
<ul class="tablelist col3">
<li class="title"> Tittle1 </li>
<li class="title"> Tittle2 </li>
<li class="title"> Tittle3 </li>
<li> cell 1,1 <li>
<li> cell 1,2 <li>
<li> cell 1,3 <li>
<a class="h2long" href="">
<li> cell 2,1 this one and the next one share the same link <li>
<li> cell 2,2 <li>
</a>
<a href="">
<li> cell 2,3 this one is a link alone </li>
</a>
</ul>
General configuration
*/
.tablelist{
display: grid;
list-style-type: none;
}
.tablelist li {
border-bottom: 1px solid black;
padding: 10px;
font-size: 20px;
text-align: center;
}
.tablelist a {
color: #000000;
}
.tablelist a:hover li{
color: rgb(211, 235, 255);
background: rgba(31, 44, 61, 1);
}
.tablelist li.title{
font-weight: bold;
}
/*3columns*/
.col3{
grid-template-columns: repeat(3,1fr);
}
.col3 .odd{
background: rgba(144, 144, 144, 0.25);
display: grid;
grid-column-start: 1;
grid-column-end: 4;
grid-template-columns: repeat(3,1fr);
}
.col3 .even{
display: grid;
grid-column-start: 1;
grid-column-end: 4;
grid-template-columns: repeat(3,1fr);
}
.tablelist.col3 a.h2long
{
display: grid;
grid-column-start: 1;
grid-column-end: 3;
grid-template-columns: repeat(2,1fr);
}
.tablelist.col3 a
{
display: grid;
grid-column-start: 3;
grid-column-end: 4;
grid-template-columns: repeat(1,1fr);
}
/*5 columns*/
.col5{
grid-template-columns: repeat(5,1fr);
}
.col5 .odd{
background: green;
display: grid;
grid-column-start: 1;
grid-column-end: 6;
grid-template-columns: repeat(5,auto);
}
.col5 .even{
background: pink;
display: grid;
grid-column-start: 1;
grid-column-end: 6;
grid-template-columns: repeat(5,auto);
}
.tablelist.col5 a.h4long
{
display: grid;
grid-column-start: 1;
grid-column-end: 5;
grid-template-columns: repeat(4,auto);
}
.tablelist.col5 a
{
display: grid;
grid-column-start: 5;
grid-column-end: 6;
grid-template-columns: auto;
}

14
assets/css/seat.css Normal file
View File

@ -0,0 +1,14 @@
.check_box+label{
background:url('../../img/seat_green.png') no-repeat;
height: 16px;
width: 16px;
display:inline-block;
}
.check_box:checked+label{
background:url('../../img/seat_grey.png') no-repeat;
}
.check_box:disabled+label{
background:url('../../img/seat_red.png') no-repeat;
}

View File

@ -1,3 +1,22 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
function cambiarCSS(nuevo){
document.getElementById('estilo').setAttribute('href', nuevo);
if(nuevo.includes("main.css")){
var css = "main.css";
} else {
var css = "highContrast.css";
}
var url = "../assets/php/common/changeCSS.php?css=" + css;
$.get(url);
/* La idea era que cambiase todo dinámicamente sin refrescar la página */
document.getElementById('estilo').setAttribute('href', nuevo);
//document.getElementById('cssChange').innerHTML = oldName;
//document.getElementById('cssChange').setAttribute('onClick', 'cambiarCSS('+viejo+')');
location.reload();
}

153
assets/js/checkForms.js Normal file
View File

@ -0,0 +1,153 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
//Expresión regular para comprobar que la contraseña tiene al menos 1 mayúscula y 1 número:
const regExprPass = /^(?=\w*\d)(?=\w*[A-Z])(?=\w*[a-z])\S{4,16}$/;
$(document).ready(function() {
//Iconos para validar el usuario:
$("#userValid").hide();
$("#userInvalid").hide();
$("#userWarning").hide();
//Iconos para validar el email:
$("#emailValid").hide();
$("#emailInvalid").hide();
//Iconos para validar el password:
$("#passValid").hide();
$("#passInvalid").hide();
$("#passWarning").hide();
//Iconos para validar que las contraseñas coindicen:
$("#repassValid").hide();
$("#repassInvalid").hide();
//Comprueba que el nombre de usuario introducido para el login, exista.
$("#name").change(function(){
var url = "../assets/php/common/checkUser.php?user=" + $("#name").val();
$.get(url, userLoginCheck);
});
//Comprueba que el nombre de usuario no esté registrado en la aplicación.
$("#new_name").change(function(){
var url = "../assets/php/common/checkUser.php?user=" + $("#new_name").val();
$.get(url, userCheck);
});
//Comprueba que el email introducido no esté registrado en la aplicación.
$("#new_email").change(function(){
var url = "../assets/php/common/checkEmail.php?email=" + $("#new_email").val();
$.get(url, emailCheck);
});
//Comprueba que la contraseña sea válida en base a los criterios de la aplicación.
$("#new_pass").change(function(){
const fieldPass = $("#new_pass");
fieldPass[0].setCustomValidity("");
const isPassValid = fieldPass[0].checkValidity();
if(fieldPass.val().length < 4){
$("#passValid").hide();
$("#passInvalid").hide();
$("#passWarning").show();
fieldPass[0].setCustomValidity("La contraseña debe contener almenos 4 caracteres.");
}
else if (isPassValid && passCheck(fieldPass.val())) {
$("#passValid").show();
$("#passInvalid").hide();
$("#passWarning").hide();
fieldPass[0].setCustomValidity("");
} else {
$("#passValid").hide();
$("#passInvalid").show();
$("#passWarning").hide();
fieldPass[0].setCustomValidity("La contraseña debe contener al menos 1 mayúscula y 1 número.");
}
});
//Comprueba que las contraseñas sean iguales.
$("#repass").change(function(){
const fieldPass = $("#new_pass");
const fieldRepass = $("#repass");
fieldRepass[0].setCustomValidity("");
if (Object.is(fieldPass.val(), fieldRepass.val())) {
$("#repassValid").show();
$("#repassInvalid").hide();
fieldRepass[0].setCustomValidity("");
} else {
$("#repassValid").hide();
$("#repassInvalid").show();
fieldRepass[0].setCustomValidity("Las contraseñas deben coincidir.");
}
});
//Muestra si el nombre de usuario introducido para el login existe o no.
function userLoginCheck(data, status) {
const fieldLogin = $("#name");
fieldLogin[0].setCustomValidity("");
if(data === "!avaliable") {
fieldLogin[0].setCustomValidity("");
} else {
fieldLogin[0].setCustomValidity("El nombre de usuario no está registrado.");
}
}
//Muestra si el nombre de usuario introducido es válido o no.
function userCheck(data, status) {
const fieldUser = $("#new_name");
fieldUser[0].setCustomValidity("");
if(fieldUser.val().length < 3){
$("#userValid").hide();
$("#userInvalid").hide();
$("#userWarning").show();
fieldUser[0].setCustomValidity("El nombre de usuario debe tener almenos 3 caracteres.");
}
else if(data === "avaliable") {
$("#userValid").show();
$("#userInvalid").hide();
$("#userWarning").hide();
fieldUser[0].setCustomValidity("");
} else {
$("#userValid").hide();
$("#userInvalid").show();
$("#userWarning").hide();
fieldUser[0].setCustomValidity("El nombre de usuario ya está registrado.");
}
}
//Muestra si el email introducido es válido o no.
function emailCheck(data, status) {
const fieldEmail = $("#new_email");
fieldEmail[0].setCustomValidity("");
const isEmailValid = fieldEmail[0].checkValidity();
if(!isEmailValid){
$("#emailValid").hide();
$("#emailInvalid").show();
}
else if (data === "avaliable") {
$("#emailValid").show();
$("#emailInvalid").hide();
fieldEmail[0].setCustomValidity("");
} else {
$("#emailValid").hide();
$("#emailInvalid").show();
fieldEmail[0].setCustomValidity("El email ya está registrado.");
}
}
//Devuelve true si la contraseña cumple los reuqisitos de seguridad, false en caso contrario.
function passCheck(pass) {
return regExprPass.test(pass) ? true : false;
}
})

196
assets/js/checkPay.js Normal file
View File

@ -0,0 +1,196 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
//Expresión regular para validar nombre y apellidos:
const regExpr = /^([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\']+[\s])+([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\'])+[\s]?([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\'])?$/g;
//Expresión regular para validar un código promocional:
const regExprCode = /^0?[xX]?[0-9a-fA-F]*$/;
//Fecha acutal:
const fecha = new Date();
$(document).ready(function() {
//Iconos para validar el titular de la tarjeta:
$("#cardNameValid").hide();
$("#cardNameInvalid").hide();
//Iconos para validar el número de tarjeta:
$("#carNumberValid").hide();
$("#cardNumerInvalid").hide();
//Iconos para validar el CVV:
$("#cvvValid").hide();
$("#cvvInvalid").hide();
//Iconos para validar el código promocional:
$("#codeValid").hide();
$("#codeInvalid").hide();
//Iconos para validar el mes y año de expiración de la tarjeta:
$("#dateValid").hide();
$("#dateInvalid").hide();
//Comprueba que el titular de la tarjeta es válido.
$("#card-holder").change(function(){
const cardHolder = $("#card-holder");
cardHolder[0].setCustomValidity("");
if(cardHolder.val().length > 5 && !holderCheck(cardHolder.val())){
$("#cardNameValid").show();
$("#cardNameInvalid").hide();
cardHolder[0].setCustomValidity("");
} else {
$("#cardNameValid").hide();
$("#cardNameInvalid").show();
cardHolder[0].setCustomValidity("El titular de la tarjeta no es válido.");
}
});
//Comprueba que el NÚMERO de la tarjeta es válido.
$("#card-number-0").change(function(){
const cardNumber0 = $("#card-number-0");
cardNumber0[0].setCustomValidity("");
if(cardNumber0.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber0[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber0[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-1").change(function(){
const cardNumber1 = $("#card-number-1");
cardNumber1[0].setCustomValidity("");
if(cardNumber1.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber1[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber1[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-2").change(function(){
const cardNumber2 = $("#card-number-2");
cardNumber2[0].setCustomValidity("");
if(cardNumber2.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber2[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber2[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-3").change(function(){
const cardNumber3 = $("#card-number-3");
cardNumber3[0].setCustomValidity("");
if(cardNumber3.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber3[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber3[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
//Comprueba que el CVV de la tarjeta es válido.
$("#card-cvv").change(function(){
const cvv = $("#card-cvv");
cvv[0].setCustomValidity("");
if(cvv.val().length === 3){
$("#cvvValid").show();
$("#cvvInvalid").hide();
cvv[0].setCustomValidity("");
} else {
$("#cvvValid").hide();
$("#cvvInvalid").show();
cvv[0].setCustomValidity("El CVV debe tener 3 dígitos.");
}
});
//Comprueba que el mes de expiración de la tarjeta es válido.
$("#card-expiration-month").change(function(){
const month = $("#card-expiration-month");
month[0].setCustomValidity("");
if(parseInt(month.val()) > parseInt(fecha.getMonth())){
$("#dateValid").show();
$("#dateInvalid").hide();
month[0].setCustomValidity("");
} else {
$("#dateValid").hide();
$("#dateInvalid").show();
month[0].setCustomValidity("El mes de expiración no es válido.");
}
});
//Comprueba que el mes de expiración de la tarjeta es válido.
$("#card-expiration-year").change(function(){
const year = $("#card-expiration-year");
year[0].setCustomValidity("");
if(parseInt(year.val()) >= parseInt(fecha.getFullYear())){
$("#dateValid").show();
$("#dateInvalid").hide();
year[0].setCustomValidity("");
} else {
$("#dateValid").hide();
$("#dateInvalid").show();
year[0].setCustomValidity("El año de expiración no es válido.");
}
});
//Comprueba el código promocional introducido:
$("#code").change(function(){
var url = "../assets/php/common/checkPromo.php?code=" + $("#code").val();
$.get(url, codeCheck);
});
//Devuelve true si el nombre y apellidos del titular son válidos, false en caso contrario.
function holderCheck(name) {
return regExpr.test(name) ? true : false;
}
//Devuelve true si el código promocional es válido, false en caso contrario.
function holderCheck(code) {
return regExprCode.test(code) ? true : false;
}
//Muestra si el código promocional introducido existe o no.
function codeCheck(data, status) {
const code = $("#code");
code[0].setCustomValidity("");
if(code.val().length === 8 && data === "avaliable"){
$("#codeValid").show();
$("#codeInvalid").hide();
code[0].setCustomValidity("");
} else if(code.val().length > 0 && data === "!avaliable" ){
$("#codeValid").hide();
$("#codeInvalid").show();
code[0].setCustomValidity("El código promocional no es válido.");
} else if(code.val().length === 0 ){
$("#codeValid").hide();
$("#codeInvalid").hide();
code[0].setCustomValidity("");
}
}
});

View File

@ -0,0 +1,13 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
function confirmDelete(e) {
if(confirm("¿Está seguro de que desea eliminar su cuenta de usuario?\nEsta acción no se puede deshacer.")){
document.getElementById("formDeleteAccount1").submit();
} else {
//location.href = "./";
e.preventDefault();
}
}

7
assets/js/goBack.js Normal file
View File

@ -0,0 +1,7 @@
$(document).ready(function(){
document.getElementById('go-back').addEventListener('click', function(event){
event.preventDefault();
history.back();
//window.history.go(-1);
});
});

17
assets/js/goUp.js Normal file
View File

@ -0,0 +1,17 @@
$(document).ready(function(){
$('.go-up').click(function(){
$('body, html').animate({
scrollTop: '0px'
}, 300);
});
$(window).scroll(function(){
if( $(this).scrollTop() > 0 ){
$('.go-up').slideDown(300);
} else {
$('.go-up').slideUp(300);
}
});
});

4
assets/js/jquery-3.2.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

87
assets/js/promotions.js Normal file
View File

@ -0,0 +1,87 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
window.onload = function () {
//Promociones:
var promos = document.getElementById("promotions").value;
const prefix = "../img/promos/";
const IMAGENES = JSON.parse(promos);
const TIEMPO_INTERVALO_MILESIMAS_SEG = 3500;
let posicionActual = 0;
let $botonRetroceder = document.querySelector('#retroceder');
let $botonAvanzar = document.querySelector('#avanzar');
let $imagen = document.querySelector('.imagen');
let $botonPlay = document.querySelector('#play');
let $botonStop = document.querySelector('#stop');
let intervalo;
// Funciones
/**
* Funcion que cambia la foto en la siguiente posicion
*/
function pasarFoto() {
if(posicionActual >= IMAGENES.length - 1) {
posicionActual = 0;
} else {
posicionActual++;
}
renderizarImagen();
}
/**
* Funcion que cambia la foto en la anterior posicion
*/
function retrocederFoto() {
if(posicionActual <= 0) {
posicionActual = IMAGENES.length - 1;
} else {
posicionActual--;
}
renderizarImagen();
}
/**
* Funcion que actualiza la imagen de imagen dependiendo de posicionActual
*/
function renderizarImagen () {
$imagen.style.backgroundImage = `url(${prefix+IMAGENES[posicionActual]})`;
}
/**
* Activa el autoplay de la imagen
*/
function playIntervalo() {
intervalo = setInterval(pasarFoto, TIEMPO_INTERVALO_MILESIMAS_SEG);
// Desactivamos los botones de control
//$botonAvanzar.setAttribute('disabled', true);
//$botonRetroceder.setAttribute('disabled', true);
$botonPlay.setAttribute('disabled', true);
$botonStop.removeAttribute('disabled');
}
/**
* Para el autoplay de la imagen
*/
function stopIntervalo() {
clearInterval(intervalo);
// Activamos los botones de control
$botonAvanzar.removeAttribute('disabled');
$botonRetroceder.removeAttribute('disabled');
$botonPlay.removeAttribute('disabled');
$botonStop.setAttribute('disabled', true);
}
// Eventos
$botonAvanzar.addEventListener('click', pasarFoto);
$botonRetroceder.addEventListener('click', retrocederFoto);
$botonPlay.addEventListener('click', playIntervalo);
$botonStop.addEventListener('click', stopIntervalo);
// Iniciar
renderizarImagen();
playIntervalo();
}

54
assets/js/selectTicket.js Normal file
View File

@ -0,0 +1,54 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
// Método 1: recargar la página y enviar un GET.
window.onload = function(){
if(!select_cinema()) select_film();
}
function select_cinema(){
var select = document.getElementById("select_cinema");
if(select != undefined){
select.onchange = function(){
location.href += "&cinema=" + $('select[id=cinemas]').val();
}
return true;
} else {
return false;
}
}
function select_film(){
var select_ = document.getElementById("select_film");
select_.onchange = function(){
location.href += "&film=" + $('select[id=films]').val();
}
}
// Método 2: enviar una petición AJAX con POST. ==> (NO FUNCIONA, PERO LA IDEA ERA HACERLO ASÍ PARA EVITAR REFRESCAR LA PÁGINA Y LLENAR LA URL)
/*
$(document).ready(function(){
$("#select_cinema").change(function(){
var cinema = $('select[id=cinemas]').val();
//console.log($('select[id=cinemas]').val());
$.ajax({
url : "index.php",
type : "post",
dataType : "html",
data : "",
success: function(response){
$("#cinemas > option[value="+ cinema +"]").attr("selected", true);
console.log(cinema);
},
error: function(response){
console.log(response + ' ==> Error al seleccionar el cine')
}
});
});
});
*/

View File

@ -0,0 +1,140 @@
$(document).ready(function(){
//Get the data that is going to be used as a filter for events
var selectedFeed = $('#hall_selector').find(':selected').data('feed');
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
var calendar = $('#calendar').fullCalendar({
header:{
left:'prev,next,today',
center:'title',
right:'month,agendaWeek,agendaDay'
},
firstDay: 1,
editable:true,
fixedWeekCount: false,
eventSources: [ selectedFeed ],
selectable:true,
selectHelper:true,
timeFormat: 'H:mm',
slotLabelFormat: 'H:mm',
nowIndicator: true,
allDaySlot: false,
eventDurationEditable: false,
eventOverlap: function(stillEvent, movingEvent) {
return (stillEvent.start_time > movingEvent.start_time && stillEvent.end < movingEvent.start_time)
},
//Add event/session function when u click in any non-event date. Prepares the form to be seen as such
select: function(start, end, allDay)
{
$(modal).fadeIn();
var x = document.getElementById("film_group");
x.style.display = "none";
x = document.getElementById("film_list");
x.style.display = "block";
document.getElementById("hall").value = document.getElementById("hall_selector").value;
document.getElementById("startDate").value = $.fullCalendar.formatDate( start, "Y-MM-DD" );
document.getElementById("endDate").value = $.fullCalendar.formatDate( end, "Y-MM-DD" );
document.getElementById("sumbit_new").style.display = "block";
document.getElementById("edit_inputs").style.display = "none";
},
//Edit only the date/hour start of an event/session when u click,drag and drop an event.
eventDrop:function(event)
{
var e = {
"newDate" : $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss"),
"idhall": document.getElementById("hall").value,
"startHour":event.start_time,
"startDate":event.date,
"price": event.seat_price,
"idfilm": event.film_id,
"format": event.format,
};
console.log(event);
$.ajax({
url:"eventsProcess.php?drop=true",
contentType: 'application/json; charset=utf-8',
dataType: "json",
type:"PUT",
data:JSON.stringify(e),
success: function(data) {
alert("El evento se ha desplazado correctamente");
calendar.fullCalendar('refetchEvents');
},
error: function(data) {
alert("Ha habido un error al desplazar el evento");
},
});
},
//Edit event/session function when u click an event. Prepares the form to be seen as such
eventClick:function(event)
{
$(modal).fadeIn();
console.log(event);
var x = document.getElementById("film_group");
x.style.display = "block";
x = document.getElementById("film_list");
x.style.display = "none";
document.getElementById("hall").value = document.getElementById("hall_selector").value;
document.getElementById("startDate").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" );
document.getElementById("endDate").value = $.fullCalendar.formatDate( event.end, "Y-MM-DD" );
document.getElementById("price").value = event.seat_price;
document.getElementById("format").value = event.format;
document.getElementById("startHour").value = event.start_time;
document.getElementById("original_hall").value = document.getElementById("hall_selector").value;
document.getElementById("original_start_time").value = event.start_time;
document.getElementById("original_date").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" );
document.getElementById("film_title").innerHTML = event.title;
document.getElementById("film_lan").innerHTML = event.film_lan;
document.getElementById("film_dur").innerHTML = event.film_dur+" min";
document.getElementById("film_img").src = "../img/films/"+event.film_img;
document.getElementById("film_id").value = event.film_id;
document.getElementById("sumbit_new").style.display = "none";
document.getElementById("edit_inputs").style.display = "grid";
},
});
//Once the filter changes, do the changes needed so full calendar research the events with the new hall
$('#hall_selector').change(onSelectChangeFeed);
function onSelectChangeFeed() {
var feed = $(this).find(':selected').data('feed');
$('#calendar').fullCalendar('removeEventSource', selectedFeed);
$('#calendar').fullCalendar('addEventSource', feed);
selectedFeed = feed;
};
//When u click on the X the form closes. If the user close it because the operation has been complete. Restart the form correctly
span.onclick = function() {
formout();
}
function formout(){
$(modal).fadeOut(100,function(){
var success = document.getElementById("success");
if(success){
calendar.fullCalendar('refetchEvents');
$(".alert").remove();
document.getElementById("session_form").style.display = "block";
document.getElementById("price").value = "";
document.getElementById("format").value = "";
document.getElementById("film_id").value = "";
document.getElementById("startHour").value ="";
}
$(".form_group").removeClass("has_error");
$(".help_block").remove();
});
}
});

View File

@ -0,0 +1,207 @@
$(document).ready(function () {
//New session
$('#sumbit_new').click( function(e) {
$(".form_group").removeClass("has_error");
$(".help_block").remove();
var formData = {
price: $("#price").val(),
format: $("#format").val(),
hall: $("#hall").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val(),
startHour: $("#startHour").val(),
idFilm: $("#film_id").val(),
};
console.log(formData);
$.ajax({
type: "POST",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (data) {
checkErrors(data,"session_form");
})
.fail(function (jqXHR, textStatus) {
$("form#session_form").html(
'<div class="alert alert_danger">Could not reach server, please try again later. '+textStatus+'</div>'
);
});
e.preventDefault();
});
//Edit session
$('#sumbit_edit').click( function(e) {
$(".form_group").removeClass("has_error");
$(".help_block").remove();
var formData = {
price: $("#price").val(),
format: $("#format").val(),
hall: $("#hall").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val(),
startHour: $("#startHour").val(),
idFilm: $("#film_id").val(),
og_hall: $("#original_hall").val(),
og_date: $("#original_date").val(),
og_start: $("#original_start_time").val(),
};
console.log(formData);
$.ajax({
type: "PUT",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (data) {
checkErrors(data,"session_form");
})
.fail(function (jqXHR, textStatus) {
$("form#session_form").html(
'<div class="alert alert_danger">Could not reach server, please try again later. '+textStatus+'</div>'
);
});
e.preventDefault();
});
//Delete Session
$('#submit_del').click( function(e) {
$(".form_group").removeClass("has_error");
$(".help_block").remove();
if(confirm("¿Seguro que quieres eliminar esta sesión?")){
var formData = {
og_hall: $("#original_hall").val(),
og_date: $("#original_date").val(),
og_start: $("#original_start_time").val(),
};
console.log(formData);
$.ajax({
type: "DELETE",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (data) {
checkErrors(data,"session_form")
})
.fail(function (jqXHR, textStatus) {
$("form#session_form").html(
'<div class="alert alert_danger">Could not reach server, please try again later. '+textStatus+'</div>'
);
});
}
e.preventDefault();
});
function checkErrors(data,formname) {
if (!data.success) {
if (data.errors.price) {
$("#price_group").addClass("has_error");
$("#price_group").append(
'<div class="help_block">' + data.errors.price + "</div>"
);
}
if (data.errors.format) {
$("#format_group").addClass("has_error");
$("#format_group").append(
'<div class="help_block">' + data.errors.format + "</div>"
);
}
if (data.errors.hall) {
$("#hall_group").addClass("has_error");
$("#hall_group").append(
'<div class="help_block">' + data.errors.hall + "</div>"
);
}
if (data.errors.startDate) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.startDate + "</div>"
);
}
if (data.errors.startDate) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.endDate + "</div>"
);
}
if (data.errors.date) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.date + "</div>"
);
}
if (data.errors.startHour) {
$("#hour_group").addClass("has_error");
$("#hour_group").append(
'<div class="help_block">' + data.errors.startHour + "</div>"
);
}
if (data.errors.idfilm) {
$("#film_msg_group").addClass("has_error");
$("#film_msg_group").append(
'<div class="help_block">' + data.errors.idfilm + "</div>"
);
}
if (data.errors.global) {
$("#global_group").addClass("has_error");
$("#global_group").append(
'<div class="help_block">' + data.errors.global + "</div>"
);
}
} else {
$("#operation_msg").addClass("has_no_error");
$("#operation_msg").append(
'<div class="alert alert_success" id="success">' + data.message + "</div>"
);
document.getElementById("session_form").style.display = "none";
}
}
//Change the view from the film list to a concrete film with some data about it
$('.film_button').bind('click', function(e) {
var id = $(this).attr('id');
var x = document.getElementById("film_group");
x.style.display = "block";
var tittle = document.getElementById("title"+id);
document.getElementById("film_title").innerHTML = tittle.innerHTML;
var lan = document.getElementById("lan"+id);
document.getElementById("film_lan").innerHTML = lan.value;
var dur = document.getElementById("dur"+id);
document.getElementById("film_dur").innerHTML = dur.innerHTML;
var img = document.getElementById("img"+id);
document.getElementById("film_img").src = "../img/films/"+img.value;
var idf = document.getElementById("id"+id);
document.getElementById("film_id").value = idf.value;
x = document.getElementById("film_list")
x.style.display = "none";
});
//Change the view from the concrete film data to a film list with all available films
$('#return').click( function() {
var x = document.getElementById("film_group");
x.style.display = "none";
x = document.getElementById("film_list");
x.style.display = "block";
});
});

View File

@ -3,10 +3,11 @@
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 14-05-2021 a las 11:28:23
-- Tiempo de generación: 07-06-2021 a las 12:25:45
-- Versión del servidor: 10.0.28-MariaDB-2+b1
-- Versión de PHP: 7.3.27-1~deb10u1
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
@ -30,6 +31,19 @@ CREATE TABLE `admin` (
`id` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `admin`:
-- `id`
-- `users` -> `id`
--
--
-- Volcado de datos para la tabla `admin`
--
INSERT INTO `admin` (`id`) VALUES
(0);
-- --------------------------------------------------------
--
@ -43,13 +57,19 @@ CREATE TABLE `cinema` (
`phone` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `cinema`:
--
--
-- Volcado de datos para la tabla `cinema`
--
INSERT INTO `cinema` (`id`, `name`, `direction`, `phone`) VALUES
(1, 'Cinema 1st', 'Calle de ejemplo 111', '77777777'),
(3, 'Cinema 2st', 'Calle falsa 123', '123456789');
(3, 'Cinema 2st', 'Calle falsa 123', '123456789'),
(6, 'Cinema 3st', 'Calle falsa 456', '987654321'),
(7, 'Cinema 4st', 'Calle falsa 789', '222222222');
-- --------------------------------------------------------
@ -66,21 +86,25 @@ CREATE TABLE `film` (
`img` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `film`:
--
--
-- Volcado de datos para la tabla `film`
--
INSERT INTO `film` (`id`, `tittle`, `duration`, `language`, `description`, `img`) VALUES
(1, 'iron_man', 120, 'spanish', 'Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo.', ''),
(2, 'iron_man_2', 120, 'spanish', 'Con el mundo ahora consciente de que él es Iron Man, el millonario inventor Tony Stark debe forjar nuevas alianzas y confrontar a un enemigo nuevo y poderoso.', ''),
(3, 'iron_man_3', 120, 'spanish', 'El descarado y brillante Tony Stark, tras ver destruido todo su universo personal, debe encontrar y enfrentarse a un enemigo cuyo poder no conoce límites. Este viaje pondrá a prueba su entereza una y otra vez, y le obligará a confiar en su ingenio.', ''),
(4, 'capitan_america_el_primer_vengador', 120, 'spanish', 'Tras tres meses de someterse a un programa de entrenamiento físico y táctico, encomiendan a Steve Rogers su primera misión como Capitán América. Armado con un escudo indestructible, emprende la guerra contra la perversa organización HYDRA.', ''),
(5, 'capitan_america_el_soldado_de_invierno', 120, 'spanish', 'Capitán América, Viuda Negra y un nuevo aliado, Falcon, se enfrentan a un enemigo inesperado mientras intentan exponer una conspiración que pone en riesgo al mundo.', ''),
(6, 'capitan_america_civil_war', 180, 'spanish', 'Después de que otro incidente internacional, en el que se ven envueltos los Vengadores, produzca daños colaterales, la presión política obliga a poner en marcha un sistema para depurar responsabilidades.', ''),
(7, 'marvel_avengers', 120, 'spanish', 'El director de la Agencia SHIELD decide reclutar a un equipo para salvar al mundo de un desastre casi seguro cuando un enemigo inesperado surge como una gran amenaza para la seguridad mundial.', ''),
(8, 'avengers_age_of_ultron', 120, 'spanish', 'Los Vengadores se reúnen de nuevo y juntan sus fuerzas con las de los recién llegados Quicksilver y Bruja Escarlata para luchar contra un robot maquiavélico llamado Ultrón, el cual Tony Stark creó con el fin de defender la paz, pero resultó defectuoso y ahora pretende exterminar a toda la humanidad.', ''),
(9, 'avengers_inifinity_war', 180, 'spanish', 'Los superhéroes se alían para vencer al poderoso Thanos, el peor enemigo al que se han enfrentado. Si Thanos logra reunir las seis gemas del infinito: poder, tiempo, alma, realidad, mente y espacio, nadie podrá detenerlo.', ''),
(10, 'avengers_end_game', 180, 'spanish', 'Los Vengadores restantes deben encontrar una manera de recuperar a sus aliados para un enfrentamiento épico con Thanos, el malvado que diezmó el planeta y el universo.', '');
(1, 'iron_man', 120, 'Español', 'Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo.', 'iron_man.jpg'),
(2, 'iron_man_2', 120, 'Español', 'Con el mundo ahora consciente de que él es Iron Man, el millonario inventor Tony Stark debe forjar nuevas alianzas y confrontar a un enemigo nuevo y poderoso.', 'iron_man_2.jpg'),
(3, 'iron_man_3', 120, 'Español', 'El descarado y brillante Tony Stark, tras ver destruido todo su universo personal, debe encontrar y enfrentarse a un enemigo cuyo poder no conoce límites. Este viaje pondrá a prueba su entereza una y otra vez, y le obligará a confiar en su ingenio.', 'iron_man_3.jpg'),
(4, 'capitan_america_el_primer_vengador', 120, 'Español', 'Tras tres meses de someterse a un programa de entrenamiento físico y táctico, encomiendan a Steve Rogers su primera misión como Capitán América. Armado con un escudo indestructible, emprende la guerra contra la perversa organización HYDRA.', 'capitan_america_el_primer_vengador.jpg'),
(5, 'capitan_america_el_soldado_de_invierno', 120, 'Español', 'Capitán América, Viuda Negra y un nuevo aliado, Falcon, se enfrentan a un enemigo inesperado mientras intentan exponer una conspiración que pone en riesgo al mundo.', 'capitan_america_el_soldado_de_invierno.jpg'),
(6, 'capitan_america_civil_war', 180, 'Español', 'Después de que otro incidente internacional, en el que se ven envueltos los Vengadores, produzca daños colaterales, la presión política obliga a poner en marcha un sistema para depurar responsabilidades.', 'capitan_america_civil_war.jpg'),
(7, 'marvel_avengers', 120, 'Español', 'El director de la Agencia SHIELD decide reclutar a un equipo para salvar al mundo de un desastre casi seguro cuando un enemigo inesperado surge como una gran amenaza para la seguridad mundial.', 'marvel_avengers.jpg'),
(8, 'avengers_age_of_ultron', 120, 'Español', 'Los Vengadores se reúnen de nuevo y juntan sus fuerzas con las de los recién llegados Quicksilver y Bruja Escarlata para luchar contra un robot maquiavélico llamado Ultrón, el cual Tony Stark creó con el fin de defender la paz, pero resultó defectuoso y ahora pretende exterminar a toda la humanidad.', 'avengers_age_of_ultron.jpg'),
(9, 'avengers_inifinity_war', 180, 'Español', 'Los superhéroes se alían para vencer al poderoso Thanos, el peor enemigo al que se han enfrentado. Si Thanos logra reunir las seis gemas del infinito: poder, tiempo, alma, realidad, mente y espacio, nadie podrá detenerlo.', 'avengers_inifinity_war.jpg'),
(10, 'avengers_end_game', 180, 'Español', 'Los Vengadores restantes deben encontrar una manera de recuperar a sus aliados para un enfrentamiento épico con Thanos, el malvado que diezmó el planeta y el universo.', 'avengers_end_game.jpg');
-- --------------------------------------------------------
@ -96,13 +120,21 @@ CREATE TABLE `hall` (
`total_seats` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `hall`:
-- `idcinema`
-- `cinema` -> `id`
--
--
-- Volcado de datos para la tabla `hall`
--
INSERT INTO `hall` (`number`, `idcinema`, `numrows`, `numcolumns`, `total_seats`) VALUES
(1, 1, 12, 8, 60),
(2, 1, 14, 8, 97);
(1, 3, 12, 8, 88),
(2, 1, 14, 8, 97),
(2, 3, 12, 8, 78);
-- --------------------------------------------------------
@ -115,12 +147,21 @@ CREATE TABLE `manager` (
`idcinema` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `manager`:
-- `idcinema`
-- `cinema` -> `id`
-- `id`
-- `users` -> `id`
--
--
-- Volcado de datos para la tabla `manager`
--
INSERT INTO `manager` (`id`, `idcinema`) VALUES
(1, 1);
(1, 1),
(3, 3);
-- --------------------------------------------------------
@ -133,16 +174,22 @@ CREATE TABLE `promotion` (
`tittle` varchar(30) NOT NULL,
`description` text NOT NULL,
`code` varchar(15) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1'
`active` tinyint(1) NOT NULL DEFAULT '1',
`img` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `promotion`:
--
--
-- Volcado de datos para la tabla `promotion`
--
INSERT INTO `promotion` (`id`, `tittle`, `description`, `code`, `active`) VALUES
(1, '3x2', 'en entradas', '000001A', 0),
(2, 'Promocion de ejemplo', 'Esto es un ejemplo', '1234', 0);
INSERT INTO `promotion` (`id`, `tittle`, `description`, `code`, `active`, `img`) VALUES
(1, 'Promo Palomitas', '3x2 en palomitas.', '0x00001A', 0, 'promo_palomitas.jpg'),
(4, 'Promo Vuelve', 'Promoción vuelve al cine.', '0x00002B', 1, 'promo_vuelve.jpg'),
(5, 'Promo Miercoles', 'Promoción de los miércoles.', '0x00003C', 0, 'promo_miercoles.jpg');
-- --------------------------------------------------------
@ -160,6 +207,33 @@ CREATE TABLE `purchase` (
`time_purchase` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `purchase`:
-- `idhall`
-- `seat` -> `idhall`
-- `idcinema`
-- `seat` -> `idcinema`
-- `numrow`
-- `seat` -> `numrow`
-- `numcolum`
-- `seat` -> `numcolum`
-- `idsession`
-- `session` -> `id`
-- `iduser`
-- `users` -> `id`
--
--
-- Volcado de datos para la tabla `purchase`
--
INSERT INTO `purchase` (`iduser`, `idsession`, `idhall`, `idcinema`, `numrow`, `numcolum`, `time_purchase`) VALUES
(7, 120, 2, 1, 2, 4, '2021-05-28 14:24:58'),
(7, 37, 1, 1, 5, 4, '2021-06-02 09:58:05'),
(7, 93, 2, 1, 9, 5, '2021-06-02 09:58:55'),
(7, 95, 2, 1, 4, 6, '2021-06-02 09:59:28'),
(7, 190, 2, 3, 2, 3, '2021-06-02 14:18:50');
-- --------------------------------------------------------
--
@ -174,203 +248,403 @@ CREATE TABLE `seat` (
`active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `seat`:
-- `idhall`
-- `hall` -> `number`
-- `idcinema`
-- `hall` -> `idcinema`
--
--
-- Volcado de datos para la tabla `seat`
--
INSERT INTO `seat` (`idhall`, `idcinema`, `numrow`, `numcolum`, `active`) VALUES
(1, 1, 1, 1, 0),
(1, 3, 1, 1, 0),
(1, 1, 1, 2, 0),
(1, 3, 1, 2, 0),
(1, 1, 1, 3, 0),
(1, 3, 1, 3, -1),
(1, 1, 1, 4, -1),
(1, 3, 1, 4, -1),
(1, 1, 1, 5, -1),
(1, 3, 1, 5, -1),
(1, 1, 1, 6, 0),
(1, 3, 1, 6, -1),
(1, 1, 1, 7, 0),
(1, 3, 1, 7, 0),
(1, 1, 1, 8, 0),
(1, 3, 1, 8, 0),
(1, 1, 2, 1, 0),
(1, 3, 2, 1, 0),
(1, 1, 2, 2, 0),
(1, 3, 2, 2, 0),
(1, 1, 2, 3, 0),
(1, 3, 2, 3, -1),
(1, 1, 2, 4, -1),
(1, 3, 2, 4, -1),
(1, 1, 2, 5, -1),
(1, 3, 2, 5, -1),
(1, 1, 2, 6, 0),
(1, 3, 2, 6, -1),
(1, 1, 2, 7, 0),
(1, 3, 2, 7, 0),
(1, 1, 2, 8, 0),
(1, 3, 2, 8, 0),
(1, 1, 3, 1, 0),
(1, 3, 3, 1, 0),
(1, 1, 3, 2, 0),
(1, 3, 3, 2, 0),
(1, 1, 3, 3, 0),
(1, 3, 3, 3, 0),
(1, 1, 3, 4, -1),
(1, 3, 3, 4, 0),
(1, 1, 3, 5, -1),
(1, 3, 3, 5, 0),
(1, 1, 3, 6, 0),
(1, 3, 3, 6, 0),
(1, 1, 3, 7, 0),
(1, 3, 3, 7, 0),
(1, 1, 3, 8, 0),
(1, 3, 3, 8, 0),
(1, 1, 4, 1, -1),
(1, 3, 4, 1, 0),
(1, 1, 4, 2, -1),
(1, 3, 4, 2, 0),
(1, 1, 4, 3, -1),
(1, 3, 4, 3, 0),
(1, 1, 4, 4, -1),
(1, 3, 4, 4, 0),
(1, 1, 4, 5, -1),
(1, 3, 4, 5, 0),
(1, 1, 4, 6, -1),
(1, 3, 4, 6, 0),
(1, 1, 4, 7, -1),
(1, 3, 4, 7, 0),
(1, 1, 4, 8, -1),
(1, 3, 4, 8, 0),
(1, 1, 5, 1, -1),
(1, 3, 5, 1, 0),
(1, 1, 5, 2, -1),
(1, 3, 5, 2, 0),
(1, 1, 5, 3, -1),
(1, 3, 5, 3, 0),
(1, 1, 5, 4, -1),
(1, 3, 5, 4, 0),
(1, 1, 5, 5, -1),
(1, 3, 5, 5, 0),
(1, 1, 5, 6, -1),
(1, 3, 5, 6, 0),
(1, 1, 5, 7, -1),
(1, 3, 5, 7, 0),
(1, 1, 5, 8, -1),
(1, 3, 5, 8, 0),
(1, 1, 6, 1, 0),
(1, 3, 6, 1, 0),
(1, 1, 6, 2, 0),
(1, 3, 6, 2, 0),
(1, 1, 6, 3, 0),
(1, 3, 6, 3, 0),
(1, 1, 6, 4, -1),
(1, 3, 6, 4, 0),
(1, 1, 6, 5, -1),
(1, 3, 6, 5, 0),
(1, 1, 6, 6, 0),
(1, 3, 6, 6, 0),
(1, 1, 6, 7, 0),
(1, 3, 6, 7, 0),
(1, 1, 6, 8, 0),
(1, 3, 6, 8, 0),
(1, 1, 7, 1, 0),
(1, 3, 7, 1, 0),
(1, 1, 7, 2, 0),
(1, 3, 7, 2, 0),
(1, 1, 7, 3, 0),
(1, 3, 7, 3, 0),
(1, 1, 7, 4, -1),
(1, 3, 7, 4, 0),
(1, 1, 7, 5, -1),
(1, 3, 7, 5, 0),
(1, 1, 7, 6, 0),
(1, 3, 7, 6, 0),
(1, 1, 7, 7, 0),
(1, 3, 7, 7, 0),
(1, 1, 7, 8, 0),
(1, 3, 7, 8, 0),
(1, 1, 8, 1, 0),
(1, 3, 8, 1, 0),
(1, 1, 8, 2, 0),
(1, 3, 8, 2, 0),
(1, 1, 8, 3, 0),
(1, 3, 8, 3, 0),
(1, 1, 8, 4, -1),
(1, 3, 8, 4, 0),
(1, 1, 8, 5, -1),
(1, 3, 8, 5, 0),
(1, 1, 8, 6, 0),
(1, 3, 8, 6, 0),
(1, 1, 8, 7, 0),
(1, 3, 8, 7, 0),
(1, 1, 8, 8, 0),
(1, 3, 8, 8, 0),
(1, 1, 9, 1, 0),
(1, 3, 9, 1, 0),
(1, 1, 9, 2, 0),
(1, 3, 9, 2, 0),
(1, 1, 9, 3, 0),
(1, 3, 9, 3, 0),
(1, 1, 9, 4, -1),
(1, 3, 9, 4, 0),
(1, 1, 9, 5, -1),
(1, 3, 9, 5, 0),
(1, 1, 9, 6, 0),
(1, 3, 9, 6, 0),
(1, 1, 9, 7, 0),
(1, 3, 9, 7, 0),
(1, 1, 9, 8, 0),
(1, 3, 9, 8, 0),
(1, 1, 10, 1, 0),
(1, 3, 10, 1, 0),
(1, 1, 10, 2, 0),
(1, 3, 10, 2, 0),
(1, 1, 10, 3, 0),
(1, 3, 10, 3, 0),
(1, 1, 10, 4, -1),
(1, 3, 10, 4, 0),
(1, 1, 10, 5, -1),
(1, 3, 10, 5, 0),
(1, 1, 10, 6, 0),
(1, 3, 10, 6, 0),
(1, 1, 10, 7, 0),
(1, 3, 10, 7, 0),
(1, 1, 10, 8, 0),
(1, 3, 10, 8, 0),
(1, 1, 11, 1, 0),
(1, 3, 11, 1, 0),
(1, 1, 11, 2, 0),
(1, 3, 11, 2, 0),
(1, 1, 11, 3, 0),
(1, 3, 11, 3, 0),
(1, 1, 11, 4, -1),
(1, 3, 11, 4, 0),
(1, 1, 11, 5, -1),
(1, 3, 11, 5, 0),
(1, 1, 11, 6, 0),
(1, 3, 11, 6, 0),
(1, 1, 11, 7, 0),
(1, 3, 11, 7, 0),
(1, 1, 11, 8, 0),
(1, 3, 11, 8, 0),
(1, 1, 12, 1, 0),
(1, 3, 12, 1, 0),
(1, 1, 12, 2, 0),
(1, 3, 12, 2, 0),
(1, 1, 12, 3, 0),
(1, 3, 12, 3, 0),
(1, 1, 12, 4, -1),
(1, 3, 12, 4, 0),
(1, 1, 12, 5, -1),
(1, 3, 12, 5, 0),
(1, 1, 12, 6, 0),
(1, 3, 12, 6, 0),
(1, 1, 12, 7, 0),
(1, 3, 12, 7, 0),
(1, 1, 12, 8, 0),
(1, 3, 12, 8, 0),
(2, 1, 1, 1, 1),
(2, 3, 1, 1, -1),
(2, 1, 1, 2, 1),
(2, 3, 1, 2, -1),
(2, 1, 1, 3, 1),
(2, 3, 1, 3, -1),
(2, 1, 1, 4, 1),
(2, 3, 1, 4, 0),
(2, 1, 1, 5, 1),
(2, 3, 1, 5, 0),
(2, 1, 1, 6, 1),
(2, 3, 1, 6, -1),
(2, 1, 1, 7, 1),
(2, 3, 1, 7, -1),
(2, 1, 1, 8, 1),
(2, 3, 1, 8, -1),
(2, 1, 2, 1, 1),
(2, 3, 2, 1, -1),
(2, 1, 2, 2, 1),
(2, 3, 2, 2, -1),
(2, 1, 2, 3, 1),
(2, 3, 2, 3, -1),
(2, 1, 2, 4, 1),
(2, 3, 2, 4, 0),
(2, 1, 2, 5, 1),
(2, 3, 2, 5, 0),
(2, 1, 2, 6, 1),
(2, 3, 2, 6, -1),
(2, 1, 2, 7, 1),
(2, 3, 2, 7, -1),
(2, 1, 2, 8, 1),
(2, 3, 2, 8, -1),
(2, 1, 3, 1, 1),
(2, 3, 3, 1, -1),
(2, 1, 3, 2, -1),
(2, 3, 3, 2, -1),
(2, 1, 3, 3, -1),
(2, 3, 3, 3, -1),
(2, 1, 3, 4, -1),
(2, 3, 3, 4, 0),
(2, 1, 3, 5, 1),
(2, 3, 3, 5, 0),
(2, 1, 3, 6, 1),
(2, 3, 3, 6, -1),
(2, 1, 3, 7, 1),
(2, 3, 3, 7, -1),
(2, 1, 3, 8, 1),
(2, 3, 3, 8, -1),
(2, 1, 4, 1, 1),
(2, 3, 4, 1, 0),
(2, 1, 4, 2, -1),
(2, 3, 4, 2, 0),
(2, 1, 4, 3, -1),
(2, 3, 4, 3, 0),
(2, 1, 4, 4, -1),
(2, 3, 4, 4, 0),
(2, 1, 4, 5, 1),
(2, 3, 4, 5, 0),
(2, 1, 4, 6, 1),
(2, 3, 4, 6, 0),
(2, 1, 4, 7, 1),
(2, 3, 4, 7, 0),
(2, 1, 4, 8, 1),
(2, 3, 4, 8, 0),
(2, 1, 5, 1, 1),
(2, 3, 5, 1, 0),
(2, 1, 5, 2, -1),
(2, 3, 5, 2, 0),
(2, 1, 5, 3, -1),
(2, 3, 5, 3, 0),
(2, 1, 5, 4, -1),
(2, 3, 5, 4, 0),
(2, 1, 5, 5, 1),
(2, 3, 5, 5, 0),
(2, 1, 5, 6, 1),
(2, 3, 5, 6, 0),
(2, 1, 5, 7, 1),
(2, 3, 5, 7, 0),
(2, 1, 5, 8, 1),
(2, 3, 5, 8, 0),
(2, 1, 6, 1, 1),
(2, 3, 6, 1, 0),
(2, 1, 6, 2, 1),
(2, 3, 6, 2, 0),
(2, 1, 6, 3, 1),
(2, 3, 6, 3, 0),
(2, 1, 6, 4, 1),
(2, 3, 6, 4, 0),
(2, 1, 6, 5, 1),
(2, 3, 6, 5, 0),
(2, 1, 6, 6, 1),
(2, 3, 6, 6, 0),
(2, 1, 6, 7, 1),
(2, 3, 6, 7, 0),
(2, 1, 6, 8, 1),
(2, 3, 6, 8, 0),
(2, 1, 7, 1, 1),
(2, 3, 7, 1, 0),
(2, 1, 7, 2, 1),
(2, 3, 7, 2, 0),
(2, 1, 7, 3, 1),
(2, 3, 7, 3, 0),
(2, 1, 7, 4, 1),
(2, 3, 7, 4, 0),
(2, 1, 7, 5, -1),
(2, 3, 7, 5, 0),
(2, 1, 7, 6, -1),
(2, 3, 7, 6, 0),
(2, 1, 7, 7, 1),
(2, 3, 7, 7, 0),
(2, 1, 7, 8, 1),
(2, 3, 7, 8, 0),
(2, 1, 8, 1, 1),
(2, 3, 8, 1, 0),
(2, 1, 8, 2, 1),
(2, 3, 8, 2, 0),
(2, 1, 8, 3, 1),
(2, 3, 8, 3, 0),
(2, 1, 8, 4, 1),
(2, 3, 8, 4, 0),
(2, 1, 8, 5, -1),
(2, 3, 8, 5, 0),
(2, 1, 8, 6, -1),
(2, 3, 8, 6, 0),
(2, 1, 8, 7, 1),
(2, 3, 8, 7, 0),
(2, 1, 8, 8, 1),
(2, 3, 8, 8, 0),
(2, 1, 9, 1, 1),
(2, 3, 9, 1, 0),
(2, 1, 9, 2, 1),
(2, 3, 9, 2, 0),
(2, 1, 9, 3, 1),
(2, 3, 9, 3, 0),
(2, 1, 9, 4, 1),
(2, 3, 9, 4, 0),
(2, 1, 9, 5, -1),
(2, 3, 9, 5, 0),
(2, 1, 9, 6, -1),
(2, 3, 9, 6, 0),
(2, 1, 9, 7, 1),
(2, 3, 9, 7, 0),
(2, 1, 9, 8, 1),
(2, 3, 9, 8, 0),
(2, 1, 10, 1, 1),
(2, 3, 10, 1, 0),
(2, 1, 10, 2, 1),
(2, 3, 10, 2, 0),
(2, 1, 10, 3, 1),
(2, 3, 10, 3, 0),
(2, 1, 10, 4, 1),
(2, 3, 10, 4, 0),
(2, 1, 10, 5, 1),
(2, 3, 10, 5, 0),
(2, 1, 10, 6, 1),
(2, 3, 10, 6, 0),
(2, 1, 10, 7, 1),
(2, 3, 10, 7, 0),
(2, 1, 10, 8, 1),
(2, 3, 10, 8, 0),
(2, 1, 11, 1, 1),
(2, 3, 11, 1, 0),
(2, 1, 11, 2, 1),
(2, 3, 11, 2, 0),
(2, 1, 11, 3, 1),
(2, 3, 11, 3, 0),
(2, 1, 11, 4, 1),
(2, 3, 11, 4, 0),
(2, 1, 11, 5, 1),
(2, 3, 11, 5, 0),
(2, 1, 11, 6, 1),
(2, 3, 11, 6, 0),
(2, 1, 11, 7, 1),
(2, 3, 11, 7, 0),
(2, 1, 11, 8, 1),
(2, 3, 11, 8, 0),
(2, 1, 12, 1, 1),
(2, 3, 12, 1, 0),
(2, 1, 12, 2, 1),
(2, 3, 12, 2, 0),
(2, 1, 12, 3, 1),
(2, 3, 12, 3, 0),
(2, 1, 12, 4, 1),
(2, 3, 12, 4, 0),
(2, 1, 12, 5, 1),
(2, 3, 12, 5, 0),
(2, 1, 12, 6, 1),
(2, 3, 12, 6, 0),
(2, 1, 12, 7, 1),
(2, 3, 12, 7, 0),
(2, 1, 12, 8, 1),
(2, 3, 12, 8, 0),
(2, 1, 13, 1, 1),
(2, 1, 13, 2, 1),
(2, 1, 13, 3, 1),
@ -406,13 +680,193 @@ CREATE TABLE `session` (
`seats_full` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- RELACIONES PARA LA TABLA `session`:
-- `idfilm`
-- `film` -> `id`
-- `idhall`
-- `hall` -> `number`
-- `idcinema`
-- `hall` -> `idcinema`
--
--
-- Volcado de datos para la tabla `session`
--
INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`, `seats_full`) VALUES
(19, 1, 2, 1, '2021-05-14', '19:00:00', 12, '2d', 0),
(20, 1, 2, 1, '2021-05-15', '19:00:00', 12, '2d', 0);
(20, 1, 2, 1, '2021-05-15', '19:00:00', 12, '2d', 0),
(21, 3, 1, 1, '2021-05-24', '15:00:00', 5, '2D', 0),
(22, 3, 1, 1, '2021-05-25', '15:00:00', 5, '2D', 0),
(23, 3, 1, 1, '2021-05-26', '15:00:00', 5, '2D', 0),
(24, 3, 1, 1, '2021-05-27', '15:00:00', 5, '2D', 0),
(25, 3, 1, 1, '2021-05-28', '15:00:00', 5, '2D', 0),
(26, 3, 1, 1, '2021-05-29', '15:00:00', 5, '2D', 0),
(27, 3, 1, 1, '2021-05-30', '15:00:00', 5, '2D', 0),
(28, 3, 1, 1, '2021-05-31', '15:00:00', 5, '2D', 0),
(29, 3, 1, 1, '2021-06-01', '15:00:00', 5, '2D', 0),
(30, 3, 1, 1, '2021-06-02', '15:00:00', 5, '2D', 0),
(31, 3, 1, 1, '2021-06-03', '15:00:00', 5, '2D', 0),
(32, 3, 1, 1, '2021-06-04', '15:00:00', 5, '2D', 0),
(33, 3, 1, 1, '2021-06-05', '15:00:00', 5, '2D', 0),
(34, 3, 1, 1, '2021-06-06', '15:00:00', 5, '2D', 0),
(35, 3, 1, 1, '2021-06-07', '15:00:00', 5, '2D', 0),
(36, 3, 1, 1, '2021-06-08', '15:00:00', 5, '2D', 0),
(37, 3, 1, 1, '2021-06-09', '15:00:00', 5, '2D', 0),
(38, 3, 1, 1, '2021-06-10', '15:00:00', 5, '2D', 0),
(39, 3, 1, 1, '2021-06-11', '15:00:00', 5, '2D', 0),
(40, 3, 1, 1, '2021-06-12', '15:00:00', 5, '2D', 0),
(41, 3, 1, 1, '2021-06-13', '15:00:00', 5, '2D', 0),
(42, 3, 1, 1, '2021-06-14', '15:00:00', 5, '2D', 0),
(43, 3, 1, 1, '2021-06-15', '15:00:00', 5, '2D', 0),
(44, 3, 1, 1, '2021-06-16', '15:00:00', 5, '2D', 0),
(45, 3, 1, 1, '2021-06-17', '15:00:00', 5, '2D', 0),
(46, 3, 1, 1, '2021-06-18', '15:00:00', 5, '2D', 0),
(47, 3, 1, 1, '2021-06-19', '15:00:00', 5, '2D', 0),
(48, 3, 1, 1, '2021-06-20', '15:00:00', 5, '2D', 0),
(49, 3, 1, 1, '2021-06-21', '15:00:00', 5, '2D', 0),
(50, 3, 1, 1, '2021-06-22', '15:00:00', 5, '2D', 0),
(51, 3, 1, 1, '2021-06-23', '15:00:00', 5, '2D', 0),
(52, 2, 1, 1, '2021-05-24', '14:00:00', 5, '3D', 0),
(53, 4, 1, 1, '2021-05-24', '16:00:00', 5, 'o.v.', 0),
(54, 4, 1, 1, '2021-05-25', '16:00:00', 5, 'o.v.', 0),
(55, 4, 1, 1, '2021-05-26', '16:00:00', 5, 'o.v.', 0),
(56, 4, 1, 1, '2021-05-27', '16:00:00', 5, 'o.v.', 0),
(57, 4, 1, 1, '2021-05-28', '16:00:00', 5, 'o.v.', 0),
(58, 4, 1, 1, '2021-05-29', '16:00:00', 5, 'o.v.', 0),
(59, 4, 1, 1, '2021-05-30', '16:00:00', 5, 'o.v.', 0),
(60, 4, 1, 1, '2021-05-31', '16:00:00', 5, 'o.v.', 0),
(61, 4, 1, 1, '2021-06-01', '16:00:00', 5, 'o.v.', 0),
(62, 4, 1, 1, '2021-06-02', '16:00:00', 5, 'o.v.', 0),
(63, 4, 1, 1, '2021-06-03', '16:00:00', 5, 'o.v.', 0),
(64, 4, 1, 1, '2021-06-04', '16:00:00', 5, 'o.v.', 0),
(65, 4, 1, 1, '2021-06-05', '16:00:00', 5, 'o.v.', 0),
(66, 4, 1, 1, '2021-06-06', '16:00:00', 5, 'o.v.', 0),
(67, 4, 1, 1, '2021-06-07', '16:00:00', 5, 'o.v.', 0),
(68, 4, 1, 1, '2021-06-08', '16:00:00', 5, 'o.v.', 0),
(69, 4, 1, 1, '2021-06-09', '16:00:00', 5, 'o.v.', 0),
(70, 4, 1, 1, '2021-06-10', '16:00:00', 5, 'o.v.', 0),
(71, 4, 1, 1, '2021-06-11', '16:00:00', 5, 'o.v.', 0),
(72, 4, 1, 1, '2021-06-12', '16:00:00', 5, 'o.v.', 0),
(73, 4, 1, 1, '2021-06-13', '16:00:00', 5, 'o.v.', 0),
(74, 4, 1, 1, '2021-06-14', '16:00:00', 5, 'o.v.', 0),
(75, 4, 1, 1, '2021-06-15', '16:00:00', 5, 'o.v.', 0),
(76, 4, 1, 1, '2021-06-16', '16:00:00', 5, 'o.v.', 0),
(77, 4, 1, 1, '2021-06-17', '16:00:00', 5, 'o.v.', 0),
(78, 4, 1, 1, '2021-06-18', '16:00:00', 5, 'o.v.', 0),
(79, 4, 1, 1, '2021-06-19', '16:00:00', 5, 'o.v.', 0),
(80, 4, 1, 1, '2021-06-20', '16:00:00', 5, 'o.v.', 0),
(81, 4, 1, 1, '2021-06-21', '16:00:00', 5, 'o.v.', 0),
(82, 4, 1, 1, '2021-06-22', '16:00:00', 5, 'o.v.', 0),
(83, 4, 1, 1, '2021-06-23', '16:00:00', 5, 'o.v.', 0),
(84, 7, 2, 1, '2021-05-24', '17:00:00', 3, 'o.v. con subtitulos', 0),
(85, 7, 2, 1, '2021-05-25', '17:00:00', 3, 'v.o. con subtitulos', 0),
(86, 7, 2, 1, '2021-05-26', '17:00:00', 3, 'v.o. con subtitulos', 0),
(87, 7, 2, 1, '2021-05-27', '17:00:00', 3, 'v.o. con subtitulos', 0),
(88, 7, 2, 1, '2021-05-28', '17:00:00', 3, 'v.o. con subtitulos', 0),
(89, 7, 2, 1, '2021-05-29', '17:00:00', 3, 'v.o. con subtitulos', 0),
(90, 7, 2, 1, '2021-05-30', '17:00:00', 3, 'v.o. con subtitulos', 0),
(91, 7, 2, 1, '2021-05-31', '17:00:00', 3, 'v.o. con subtitulos', 0),
(92, 7, 2, 1, '2021-06-01', '17:00:00', 3, 'v.o. con subtitulos', 0),
(93, 7, 2, 1, '2021-06-02', '17:00:00', 3, 'v.o. con subtitulos', 0),
(94, 7, 2, 1, '2021-06-03', '17:00:00', 3, 'v.o. con subtitulos', 0),
(95, 7, 2, 1, '2021-06-04', '17:00:00', 3, 'v.o. con subtitulos', 0),
(96, 7, 2, 1, '2021-06-05', '17:00:00', 3, 'v.o. con subtitulos', 0),
(97, 7, 2, 1, '2021-06-06', '17:00:00', 3, 'v.o. con subtitulos', 0),
(98, 7, 2, 1, '2021-06-07', '17:00:00', 3, 'v.o. con subtitulos', 0),
(99, 7, 2, 1, '2021-06-08', '17:00:00', 3, 'v.o. con subtitulos', 0),
(100, 7, 2, 1, '2021-06-09', '17:00:00', 3, 'v.o. con subtitulos', 0),
(101, 7, 2, 1, '2021-06-10', '17:00:00', 3, 'v.o. con subtitulos', 0),
(102, 7, 2, 1, '2021-06-11', '17:00:00', 3, 'v.o. con subtitulos', 0),
(103, 7, 2, 1, '2021-06-12', '17:00:00', 3, 'v.o. con subtitulos', 0),
(104, 7, 2, 1, '2021-06-13', '17:00:00', 3, 'v.o. con subtitulos', 0),
(105, 7, 2, 1, '2021-06-14', '17:00:00', 3, 'v.o. con subtitulos', 0),
(106, 7, 2, 1, '2021-06-15', '17:00:00', 3, 'v.o. con subtitulos', 0),
(107, 7, 2, 1, '2021-06-16', '17:00:00', 3, 'v.o. con subtitulos', 0),
(108, 7, 2, 1, '2021-06-17', '17:00:00', 3, 'v.o. con subtitulos', 0),
(109, 7, 2, 1, '2021-06-18', '17:00:00', 3, 'v.o. con subtitulos', 0),
(110, 7, 2, 1, '2021-06-19', '17:00:00', 3, 'v.o. con subtitulos', 0),
(111, 7, 2, 1, '2021-06-20', '17:00:00', 3, 'v.o. con subtitulos', 0),
(112, 7, 2, 1, '2021-06-21', '17:00:00', 3, 'v.o. con subtitulos', 0),
(113, 7, 2, 1, '2021-06-22', '17:00:00', 3, 'v.o. con subtitulos', 0),
(114, 7, 2, 1, '2021-06-23', '17:00:00', 3, 'v.o. con subtitulos', 0),
(115, 7, 2, 1, '2021-06-24', '17:00:00', 3, 'v.o. con subtitulos', 0),
(116, 10, 2, 1, '2021-05-24', '18:00:00', 9, 'estandar', 0),
(117, 10, 2, 1, '2021-05-25', '18:00:00', 9, 'estandar', 0),
(118, 10, 2, 1, '2021-05-26', '18:00:00', 9, 'estandar', 0),
(119, 10, 2, 1, '2021-05-27', '18:00:00', 9, 'estandar', 0),
(120, 10, 2, 1, '2021-05-28', '18:00:00', 9, 'estandar', 0),
(121, 10, 2, 1, '2021-05-29', '18:00:00', 9, 'estandar', 0),
(122, 10, 2, 1, '2021-05-30', '18:00:00', 9, 'estandar', 0),
(123, 10, 2, 1, '2021-05-31', '18:00:00', 9, 'estandar', 0),
(124, 10, 2, 1, '2021-06-01', '18:00:00', 9, 'estandar', 0),
(125, 10, 2, 1, '2021-06-02', '18:00:00', 9, 'estandar', 0),
(126, 10, 2, 1, '2021-06-03', '18:00:00', 9, 'estandar', 0),
(127, 10, 2, 1, '2021-06-04', '18:00:00', 9, 'estandar', 0),
(128, 10, 2, 1, '2021-06-05', '18:00:00', 9, 'estandar', 0),
(129, 10, 2, 1, '2021-06-06', '18:00:00', 9, 'estandar', 0),
(130, 10, 2, 1, '2021-06-07', '18:00:00', 9, 'estandar', 0),
(131, 10, 2, 1, '2021-06-08', '18:00:00', 9, 'estandar', 0),
(132, 10, 2, 1, '2021-06-09', '18:00:00', 9, 'estandar', 0),
(133, 10, 2, 1, '2021-06-10', '18:00:00', 9, 'estandar', 0),
(134, 10, 2, 1, '2021-06-11', '18:00:00', 9, 'estandar', 0),
(135, 10, 2, 1, '2021-06-12', '18:00:00', 9, 'estandar', 0),
(136, 10, 2, 1, '2021-06-13', '18:00:00', 9, 'estandar', 0),
(137, 10, 2, 1, '2021-06-14', '18:00:00', 9, 'estandar', 0),
(138, 10, 2, 1, '2021-06-15', '18:00:00', 9, 'estandar', 0),
(139, 10, 2, 1, '2021-06-16', '18:00:00', 9, 'estandar', 0),
(140, 10, 2, 1, '2021-06-17', '18:00:00', 9, 'estandar', 0),
(141, 10, 2, 1, '2021-06-18', '18:00:00', 9, 'estandar', 0),
(142, 10, 2, 1, '2021-06-19', '18:00:00', 9, 'estandar', 0),
(143, 10, 2, 1, '2021-06-20', '18:00:00', 9, 'estandar', 0),
(144, 10, 2, 1, '2021-06-21', '18:00:00', 9, 'estandar', 0),
(145, 10, 2, 1, '2021-06-22', '18:00:00', 9, 'estandar', 0),
(146, 10, 2, 1, '2021-06-23', '18:00:00', 9, 'estandar', 0),
(147, 10, 1, 3, '2021-06-02', '14:00:00', 3, 'estandar', 0),
(148, 10, 1, 3, '2021-06-03', '14:00:00', 3, 'estandar', 0),
(149, 10, 1, 3, '2021-06-04', '14:00:00', 3, 'estandar', 0),
(150, 10, 1, 3, '2021-06-05', '14:00:00', 3, 'estandar', 0),
(151, 10, 1, 3, '2021-06-06', '14:00:00', 3, 'estandar', 0),
(152, 10, 1, 3, '2021-06-07', '14:00:00', 3, 'estandar', 0),
(153, 10, 1, 3, '2021-06-08', '14:00:00', 3, 'estandar', 0),
(154, 10, 1, 3, '2021-06-09', '14:00:00', 3, 'estandar', 0),
(155, 10, 1, 3, '2021-06-10', '14:00:00', 3, 'estandar', 0),
(156, 10, 1, 3, '2021-06-11', '14:00:00', 3, 'estandar', 0),
(157, 10, 1, 3, '2021-06-12', '14:00:00', 3, 'estandar', 0),
(158, 7, 1, 3, '2021-06-02', '16:00:00', 3, '2D', 0),
(159, 7, 1, 3, '2021-06-03', '16:00:00', 3, '2D', 0),
(160, 7, 1, 3, '2021-06-04', '16:00:00', 3, '2D', 0),
(161, 7, 1, 3, '2021-06-05', '16:00:00', 3, '2D', 0),
(162, 7, 1, 3, '2021-06-06', '16:00:00', 3, '2D', 0),
(163, 7, 1, 3, '2021-06-07', '16:00:00', 3, '2D', 0),
(164, 7, 1, 3, '2021-06-08', '16:00:00', 3, '2D', 0),
(165, 7, 1, 3, '2021-06-09', '16:00:00', 3, '2D', 0),
(166, 7, 1, 3, '2021-06-10', '16:00:00', 3, '2D', 0),
(167, 7, 1, 3, '2021-06-11', '16:00:00', 3, '2D', 0),
(168, 7, 1, 3, '2021-06-12', '16:00:00', 3, '2D', 0),
(169, 6, 2, 3, '2021-06-02', '18:20:00', 2, '6', 0),
(170, 6, 2, 3, '2021-06-03', '18:20:00', 2, '6', 0),
(171, 6, 2, 3, '2021-06-04', '18:20:00', 2, '6', 0),
(172, 6, 2, 3, '2021-06-05', '18:20:00', 2, '6', 0),
(173, 6, 2, 3, '2021-06-06', '18:20:00', 2, '6', 0),
(174, 6, 2, 3, '2021-06-07', '18:20:00', 2, '6', 0),
(175, 6, 2, 3, '2021-06-08', '18:20:00', 2, '6', 0),
(176, 6, 2, 3, '2021-06-09', '18:20:00', 2, '6', 0),
(177, 6, 2, 3, '2021-06-10', '18:20:00', 2, '6', 0),
(178, 6, 2, 3, '2021-06-11', '18:20:00', 2, '6', 0),
(179, 6, 2, 3, '2021-06-12', '18:20:00', 2, '6', 0),
(180, 8, 2, 3, '2021-06-02', '07:00:00', 5, 'Version de Zack Snei', 0),
(181, 8, 2, 3, '2021-06-03', '07:00:00', 5, 'Version de Zack Snei', 0),
(182, 8, 2, 3, '2021-06-04', '07:00:00', 5, 'Version de Zack Snei', 0),
(183, 8, 2, 3, '2021-06-05', '07:00:00', 5, 'Version de Zack Snei', 0),
(184, 8, 2, 3, '2021-06-06', '07:00:00', 5, 'Version de Zack Snei', 0),
(185, 8, 2, 3, '2021-06-07', '07:00:00', 5, 'Version de Zack Snei', 0),
(186, 8, 2, 3, '2021-06-08', '07:00:00', 5, 'Version de Zack Snei', 0),
(187, 8, 2, 3, '2021-06-09', '07:00:00', 5, 'Version de Zack Snei', 0),
(188, 8, 2, 3, '2021-06-10', '07:00:00', 5, 'Version de Zack Snei', 0),
(189, 8, 2, 3, '2021-06-11', '07:00:00', 5, 'Version de Zack Snei', 0),
(190, 8, 2, 3, '2021-06-12', '07:00:00', 5, 'Version de Zack Snei', 0);
-- --------------------------------------------------------
@ -428,16 +882,20 @@ CREATE TABLE `users` (
`rol` varchar(7) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Usuarios';
--
-- RELACIONES PARA LA TABLA `users`:
--
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `username`, `email`, `passwd`, `rol`) VALUES
(0, 'admin', 'admin@complucine.sytes.net', 'shDBCKnEbWZFc', 'admin'),
(0, 'admin', 'admin@complucine.sytes.ne', 'shDBCKnEbWZFc', 'admin'),
(1, 'manager', 'manager@complucine.sytes.net', 'shTS9RK/eJPoQ', 'manager'),
(2, 'user', 'user@complucine.sytes.net', 'shO5etd.DYKWg', 'user'),
(7, 'fernando', 'fer@complucine.sytes.net', '$2y$10$/3yjEh4d7AOY3RyNjXIIkO5H2hg7/kiHiToJa92tCBPd7s3UPtB.G', 'user'),
(63, 'user2', 'user2@ucm.es', '$2y$10$Alopov4Z1HPW9i9PqQ/APedPoU.N/zc3XlRfIfSkwPCQCKI.qTp5u', 'user');
(3, 'manager2', 'manager2@complucine.sytes.net', '$2y$10$IAoCBP5mWz.dEIV7qsy1guyoOpfrfovwDBOEL9wVFn2oM1x9nx2xW', 'manager'),
(7, 'fernando', 'fer@complucine.sytes.net', '$2y$10$/3yjEh4d7AOY3RyNjXIIkO5H2hg7/kiHiToJa92tCBPd7s3UPtB.G', 'user');
--
-- Índices para tablas volcadas
@ -495,7 +953,7 @@ ALTER TABLE `purchase`
-- Indices de la tabla `seat`
--
ALTER TABLE `seat`
ADD PRIMARY KEY (`idhall`,`numrow`,`numcolum`),
ADD PRIMARY KEY (`idhall`,`numrow`,`numcolum`,`idcinema`) USING BTREE,
ADD KEY `FK_HALL` (`idhall`,`idcinema`);
--
@ -523,32 +981,32 @@ ALTER TABLE `users`
-- AUTO_INCREMENT de la tabla `cinema`
--
ALTER TABLE `cinema`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `film`
--
ALTER TABLE `film`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT de la tabla `hall`
--
ALTER TABLE `hall`
MODIFY `number` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
MODIFY `number` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `promotion`
--
ALTER TABLE `promotion`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `session`
--
ALTER TABLE `session`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=191;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=65;
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=114;
--
-- Restricciones para tablas volcadas
--
@ -592,6 +1050,7 @@ ALTER TABLE `seat`
ALTER TABLE `session`
ADD CONSTRAINT `FK_FILM` FOREIGN KEY (`idfilm`) REFERENCES `film` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_HALL_` FOREIGN KEY (`idhall`,`idcinema`) REFERENCES `hall` (`number`, `idcinema`) ON DELETE CASCADE ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS=1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

View File

@ -0,0 +1,319 @@
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 02-06-2021 a las 21:03:55
-- Versión del servidor: 10.0.28-MariaDB-2+b1
-- Versión de PHP: 7.3.27-1~deb10u1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `complucine`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `admin`
--
CREATE TABLE `admin` (
`id` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `cinema`
--
CREATE TABLE `cinema` (
`id` int(15) UNSIGNED NOT NULL,
`name` varchar(10) NOT NULL,
`direction` varchar(120) NOT NULL,
`phone` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `film`
--
CREATE TABLE `film` (
`id` int(15) UNSIGNED NOT NULL,
`tittle` varchar(60) NOT NULL,
`duration` int(3) UNSIGNED NOT NULL,
`language` varchar(30) NOT NULL,
`description` text NOT NULL,
`img` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `hall`
--
CREATE TABLE `hall` (
`number` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrows` int(3) NOT NULL,
`numcolumns` int(3) NOT NULL,
`total_seats` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `manager`
--
CREATE TABLE `manager` (
`id` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `promotion`
--
CREATE TABLE `promotion` (
`id` int(15) UNSIGNED NOT NULL,
`tittle` varchar(30) NOT NULL,
`description` text NOT NULL,
`code` varchar(15) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`img` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `purchase`
--
CREATE TABLE `purchase` (
`iduser` int(15) UNSIGNED NOT NULL,
`idsession` int(15) UNSIGNED NOT NULL,
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrow` int(3) UNSIGNED NOT NULL,
`numcolum` int(3) UNSIGNED NOT NULL,
`time_purchase` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `seat`
--
CREATE TABLE `seat` (
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrow` int(3) UNSIGNED NOT NULL,
`numcolum` int(3) UNSIGNED NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `session`
--
CREATE TABLE `session` (
`id` int(15) UNSIGNED NOT NULL,
`idfilm` int(15) UNSIGNED NOT NULL,
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`date` date NOT NULL,
`start_time` time NOT NULL,
`seat_price` float NOT NULL,
`format` varchar(20) NOT NULL,
`seats_full` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` int(15) UNSIGNED NOT NULL,
`username` varchar(10) NOT NULL,
`email` varchar(30) NOT NULL,
`passwd` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`rol` varchar(7) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Usuarios';
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `admin`
--
ALTER TABLE `admin`
ADD KEY `PK_A_USER` (`id`);
--
-- Indices de la tabla `cinema`
--
ALTER TABLE `cinema`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `film`
--
ALTER TABLE `film`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `U_TITTLE_LANGUAGE` (`tittle`,`language`);
--
-- Indices de la tabla `hall`
--
ALTER TABLE `hall`
ADD PRIMARY KEY (`number`,`idcinema`),
ADD KEY `FK_CINEMA` (`idcinema`);
--
-- Indices de la tabla `manager`
--
ALTER TABLE `manager`
ADD KEY `PK_M_USER` (`id`),
ADD KEY `PK_M_CINEMA` (`idcinema`);
--
-- Indices de la tabla `promotion`
--
ALTER TABLE `promotion`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `purchase`
--
ALTER TABLE `purchase`
ADD KEY `PK_P_SEAT` (`idhall`,`numrow`,`numcolum`),
ADD KEY `FK_P_SESSION` (`idsession`),
ADD KEY `FK_P_USER` (`iduser`),
ADD KEY `FK_P_SEAT` (`idhall`,`idcinema`,`numrow`,`numcolum`);
--
-- Indices de la tabla `seat`
--
ALTER TABLE `seat`
ADD PRIMARY KEY (`idhall`,`numrow`,`numcolum`,`idcinema`) USING BTREE,
ADD KEY `FK_HALL` (`idhall`,`idcinema`);
--
-- Indices de la tabla `session`
--
ALTER TABLE `session`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_FILM` (`idfilm`),
ADD KEY `FK_HALL_` (`idhall`,`idcinema`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `username_2` (`username`),
ADD KEY `username` (`username`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `cinema`
--
ALTER TABLE `cinema`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `film`
--
ALTER TABLE `film`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT de la tabla `hall`
--
ALTER TABLE `hall`
MODIFY `number` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `promotion`
--
ALTER TABLE `promotion`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `session`
--
ALTER TABLE `session`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=191;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=114;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `admin`
--
ALTER TABLE `admin`
ADD CONSTRAINT `PK_A_USER` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `hall`
--
ALTER TABLE `hall`
ADD CONSTRAINT `FK_CINEMA` FOREIGN KEY (`idcinema`) REFERENCES `cinema` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `manager`
--
ALTER TABLE `manager`
ADD CONSTRAINT `PK_M_CINEMA` FOREIGN KEY (`idcinema`) REFERENCES `cinema` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `PK_M_USER` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `purchase`
--
ALTER TABLE `purchase`
ADD CONSTRAINT `FK_P_SEAT` FOREIGN KEY (`idhall`,`idcinema`,`numrow`,`numcolum`) REFERENCES `seat` (`idhall`, `idcinema`, `numrow`, `numcolum`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_P_SESSION` FOREIGN KEY (`idsession`) REFERENCES `session` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_P_USER` FOREIGN KEY (`iduser`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `seat`
--
ALTER TABLE `seat`
ADD CONSTRAINT `FK_HALL` FOREIGN KEY (`idhall`,`idcinema`) REFERENCES `hall` (`number`, `idcinema`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `session`
--
ALTER TABLE `session`
ADD CONSTRAINT `FK_FILM` FOREIGN KEY (`idfilm`) REFERENCES `film` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_HALL_` FOREIGN KEY (`idhall`,`idcinema`) REFERENCES `hall` (`number`, `idcinema`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS complucine DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;

View File

@ -29,6 +29,11 @@
<?php
$template->print_footer();
?>
<!-- Scripts -->
<?php
$template->print_scripts();
?>
</body>
</html>

View File

@ -0,0 +1,6 @@
<?php
include('../../../assets/php/config.php');
if($_GET["css"] === "main.css") $_SESSION["css"] = "main.css";
else if($_GET["css"] === "highContrast.css") $_SESSION["css"] = "highContrast.css";
?>

View File

@ -0,0 +1,15 @@
<?php
include('../../../assets/php/config.php');
include('../includes/user_dao.php');
$bd = new UserDAO('complucine');
if($bd){
$user = $bd->selectUserEmail(strtolower($_GET["email"]));
if ($user->data_seek(0)) {
echo "!avaliable";
}
else{
echo "avaliable";
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
include('../../../assets/php/config.php');
include('../includes/promotion_dao.php');
$bd = new Promotion_DAO('complucine');
if($bd){
$promo = $bd->GetPromotionObj($_GET["code"]);
if ($promo && $promo->getActive()) {
echo "avaliable";
}
else{
echo "!avaliable";
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
include('../../../assets/php/config.php');
include('../includes/user_dao.php');
$bd = new UserDAO('complucine');
if($bd){
$user = $bd->selectUserName(strtolower($_GET["user"]));
if ($user->data_seek(0)) {
echo "!avaliable";
}
else{
echo "avaliable";
}
}
?>

View File

@ -0,0 +1,126 @@
<?php
require_once('../assets/php/form.php');
class FormUploadFiles extends Form {
//Constants:
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() {
$options = array('enctype' => 'multipart/form-data');
parent::__construct('formUploadFiles', $options);
}
protected function generaCamposFormulario($datos, $errores = array()) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorFile = self::createMensajeError($errores, 'archivo', 'span', array('class' => 'error'));
foreach($datos as $key => $value){
$dats = $key." ".$value." ";
}
// Se genera el HTML asociado a los campos del formulario y los mensajes de error.
$html = '
<div class="file">
<label for="file">Imagen:</label><input type="file" name="file" id="file" /><pre>'.$htmlErroresGlobales.'</pre>
</div>
<input type="submit" id="submit" value="Subir" class="primary" /><pre>'.$errorFile.'</pre>
';
return $html;
}
protected function procesaFormulario($datos) {
// Solo se pueden definir arrays como constantes en PHP >= 5.6
global $ALLOWED_EXTENSIONS;
$result = array();
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
/* 1.a) Valida el nombre del archivo */
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
/* 1.b) Sanitiza el nombre del archivo
$ok = sanitize_file_uploaded_name($nombre);
*/
/* 1.c) Utilizar un id de la base de datos como nombre de archivo */
/* 2. comprueba si la extensión está permitida*/
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), $ALLOWED_EXTENSIONS);
/* 3. comprueba el tipo mime del archivo correspode a una imagen image/* */
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
finfo_close($finfo);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
if ( !move_uploaded_file($tmp_name, FILMS_DIR.$nombre) ) {
$result[] = 'Error al mover el archivo';
}
// 4. Si fuese necesario guardar en la base de datos la ruta relativa $nombre del archivo
//return "index.php#img=".urlencode('img/'.$nombre);
} else {
$result["errorFile"] = 'El archivo tiene un nombre o tipo no soportado';
}
} else {
$result[] = 'Error al subir el archivo.';
}
return $result;
}
/**
* Check $_FILES[][name]
*
* @param (string) $filename - Uploaded file name.
* @author Yousef Ismaeil Cliprz
* @See http://php.net/manual/es/function.move-uploaded-file.php#111412
*/
protected function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
}
/**
* Sanitize $_FILES[][name]. Remove anything which isn't a word, whitespace, number
* or any of the following caracters -_~,;[]().
*
* If you don't need to handle multi-byte characters you can use preg_replace
* rather than mb_ereg_replace.
*
* @param (string) $filename - Uploaded file name.
* @author Sean Vieira
* @see http://stackoverflow.com/a/2021729
*/
protected function sanitize_file_uploaded_name($filename) {
/* Remove anything which isn't a word, whitespace, number
* or any of the following caracters -_~,;[]().
* If you don't need to handle multi-byte characters
* you can use preg_replace rather than mb_ereg_replace
* Thanks @Łukasz Rysiak!
*/
$newName = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
// Remove any runs of periods (thanks falstro!)
$newName = mb_ereg_replace("([\.]{2,})", '', $newName);
return $newName;
}
/**
* Check $_FILES[][name] length.
*
* @param (string) $filename - Uploaded file name.
* @author Yousef Ismaeil Cliprz.
* @See http://php.net/manual/es/function.move-uploaded-file.php#111412
*/
protected function check_file_uploaded_length ($filename) {
return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
}
}
?>

View File

@ -0,0 +1,11 @@
<?php
include('../config.php');
function reRol(){
if(isset($_SESSION["lastRol"])){
$_SESSION["rol"] = $_SESSION["lastRol"];
unset($_SESSION["lastRol"]);
}
}
reRol();
header("Location: /");
?>

View File

@ -0,0 +1,13 @@
<?php
include('../config.php');
function reRol(){
if(isset($_SESSION["lastRol"])){
$_SESSION["rol"] = $_SESSION["lastRol"];
unset($_SESSION["lastRol"]);
unset($_SESSION["cinema"]);
}
}
reRol();
$redirect = ROUTE_APP.'panel_'.$_SESSION['rol'];
header("Location: {$redirect}");
?>

View File

@ -98,6 +98,16 @@
return $resul;
}
//Search a user by email.
public function selectUserEmail($email){
$email = $this->mysqli->real_escape_string($email);
$sql = sprintf( "SELECT * FROM users WHERE email = '%s'", $email );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//Change username by id.
public function changeUserName($id, $username){
$id = $this->mysqli->real_escape_string($id);

View File

@ -16,8 +16,14 @@
/**
* Image files directory.
*/
define('FILMS_DIR', dirname(RAIZ_APP).'img/films/tmp');
define('FILMS_DIR_PROTECTED', RAIZ_APP.'img/films/tmp');
define('FILMS_DIR', RAIZ_APP.'/img/films/');
define('FILMS_DIR_PROTECTED', dirname(RAIZ_APP).'/img/films/tmp/');
define('USER_PICS', ROUTE_APP.'img/users/');
/**
* Allowed extensions for image files.
*/
$ALLOWED_EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
/**
* Utf-8 support settings, location (language and country) and time zone.
@ -47,9 +53,4 @@
* @see http://php.net/manual/en/language.types.callable.php
*/
register_shutdown_function(array($app, 'shutdown'));
//Depuración (BORRAR):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>

View File

@ -1,13 +1,12 @@
<?php
class DAO {
//Atributes:
public $mysqli;
//Constructor:
public function __construct($bd_name){
if($bd_name != BD_NAME) {
echo "Está intentando acceder a una base de datos que no existe, puede que la aplicación no funcione correctamente";
echo "Está intentando acceder a una base de datos que no existe, puede que la aplicación no funcione correctamente.";
}
$app = Aplicacion::getSingleton();
$this->mysqli = $app->conexionBd();

View File

@ -38,6 +38,13 @@ abstract class Form {
*/
private $action;
private $printed;
/**
* @var bool Almacena si la interacción con el formulario va a realizarse a través de AJAX <code>true</code> o
* <code>false</code> en otro caso.
*/
private $ajax;
/**
* Crea un nuevo formulario.
*
@ -67,6 +74,11 @@ abstract class Form {
* <td>""</td>
* <td>Valor del parámetro enctype del formulario.</td>
* </tr>
* <tr>
* <td>ajax</td>
* <td><code>false</code></td>
* <td>Configura si el formulario se gestionará a través de AJAX.</td>
* </tr>
* </tbody>
* </table>
* @param string $tipoFormulario Parámetro de la petición utilizado para comprobar que el usuario ha enviado el formulario.
@ -79,14 +91,16 @@ abstract class Form {
$this->tipoFormulario = $tipoFormulario;
$this->formId = $tipoFormulario.$formId;
$opcionesPorDefecto = array( 'action' => null, 'class' => null, 'enctype' => null );
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null, 'enctype' => null );
$opciones = array_merge($opcionesPorDefecto, $opciones);
$this->action = $opciones['action'];
$this->ajax = $opciones['ajax'];
$this->action = $opciones['action'];
$this->classAtt = $opciones['class'];
$this->enctype = $opciones['enctype'];
if ( !$this->action ) {
// Cambiar por << $this->action = htmlentities($_SERVER['REQUEST_URI']); >> para mantener los parámetros de la URL.
$this->action = htmlentities($_SERVER['PHP_SELF']);
}
}
@ -120,13 +134,43 @@ abstract class Form {
// limpia los tokens CSRF que no han sido utilizados en esta petición
self::limpiaCsrfTokens();
$result = $this->procesaFormulario($_POST);
if ( is_array($result) ) {
return $this->generaFormulario($_POST, $result);
} else {
header('Location: '.$result);
exit();
// Sin AJAX.
/**
* $result = $this->procesaFormulario($_POST);
* if ( is_array($result) ) {
* return $this->generaFormulario($_POST, $result);
* } else {
* header('Location: '.$result);
* exit();
* }
*/
// Con AJAX.
if ( $errores !== TRUE ) {
if ( ! $this->ajax ) {
return $this->generaFormulario($_POST, $errores);
} else {
return $this->generaHtmlErrores($errores);
}
} else {
$result = $this->procesaFormulario($_POST);
if ( is_array($result) ) {
// Error al procesar el formulario, volvemos a mostrarlo
if ( ! $this->ajax ) {
return $this->generaFormulario($_POST, $result);
} else {
return $this->generaHtmlErrores($result);
}
} else {
if ( ! $this->ajax ) {
header('Location: '.$result);
exit();
} else {
return $result;
}
}
}
}
}
@ -208,7 +252,7 @@ abstract class Form {
/* <<< Permite definir cadena en múltiples líneas.
* Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
*/
$htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}{$classAtt}{$enctypeAtt}' >
$htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}'{$classAtt}{$enctypeAtt} >
<input type='hidden' name='action' value='{$this->tipoFormulario}' />
".$tokenCSRF.$htmlCamposFormularios."
</form>";

View File

@ -0,0 +1,32 @@
<?php
class Cinema{
//Attributes:
private $_id; //Cinema ID.
private $_name; //Cinema name.
private $_direction; //Cinema direction.
private $_phone; //Cinema phone.
//Constructor:
function __construct($id, $name, $direction, $phone){
$this->_id = $id;
$this->_name = $name;
$this->_direction = $direction;
$this->_phone = $phone;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setName($name){ $this->_name = $name; }
public function getName(){ return $this->_name; }
public function setDirection($direction){ $this->_direction = $direction; }
public function getDirection(){ return $this->_direction; }
public function setPhone($phone){$this->_phone = $phone; }
public function getPhone(){ return $this->_phone; }
}
?>

View File

@ -0,0 +1,132 @@
<?php
include_once('cinema.php');
class Cinema_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createCinema($id, $name, $direction, $phone){
$sql = sprintf( "INSERT INTO `cinema`( `id`, `name`, `direction`, `phone`)
VALUES ( '%d', '%s', '%s', '%s')",
$id, $name, $direction, $phone);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the films.
public function allCinemaData(){
$sql = sprintf( "SELECT * FROM cinema ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$films[] = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]);
}
$resul->free();
return $films;
}
//Returns a film data .
public function GetCinema($name, $direction){
$sql = sprintf( "SELECT * FROM cinema WHERE cinema.name = '%s'AND cinema.direction='%s'", $name,$direction );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a film data .
public function cinemaData($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM cinema WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul->data_seek(0);
$film = null;
while($fila=$resul->fetch_assoc()){
$cinema = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]);
}
$resul->free();
return $cinema;
}
//Returns if exist a cinema with that id
public function existCinema($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM cinema WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted film by "id".
public function deleteCinema($id){
$sql = sprintf( "DELETE FROM cinema WHERE cinema.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a film.
public function editCinema($id, $name, $direction, $phone){
$sql = sprintf( "UPDATE cinema SET name = '%s' , direction = '%s', phone ='%s'
WHERE cinema.id = '%d';",
$name, $direction, $phone, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Get sessions associated with a cinema.
public function getSessions($id){
include_once('session_dao.php');
$session = new SessionDAO("complucine");
$sql = sprintf( " SELECT DISTINCT * FROM session WHERE session.id in
(SELECT session.id FROM session JOIN cinema ON session.idcinema = cinema.id WHERE cinema.id = '%d'); ", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$sessions = null;
while($fila = $resul->fetch_assoc()){
$sessions[] = $session->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
$resul->free();
return $sessions;
}
//Get films associated with a cinema.
public function getFilms($id){
include_once('film_dao.php');
$film = new Film_DAO("complucine");
$sql = sprintf( " SELECT DISTINCT * FROM film WHERE film.id in
(SELECT session.idfilm FROM session JOIN cinema ON session.idcinema = cinema.id WHERE cinema.id = '%d'); ", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$films = null;
while($fila = $resul->fetch_assoc()){
$films[] = $film->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"], $fila["img"]);
}
$resul->free();
return $films;
}
//Create a new film Data Transfer Object.
public function loadCinema($id, $name, $direction, $phone){
return new Cinema($id, $name, $direction, $phone);
}
}
?>

View File

@ -0,0 +1,185 @@
<?php
include_once($prefix.'assets/php/includes/session.php');
//Full calendar only accepts Events objects
class Event implements \JsonSerializable
{
public static function searchAllEvents($idhall, $cinema)
{
$result = [];
$sessions = Session::getListSessions($idhall,$cinema,null);
foreach($sessions as $s){
$e = new Event();
$diccionario = self::session2dictionary($s);
$e = $e->dictionary2event($diccionario);
$result[] = $e;
}
return $result;
}
public static function searchEventsBetween2dates(string $start, string $end = null, $idhall, $cinema)
{
$result = [];
$sessions = Session::getListSessionsBetween2Dates($idhall,$cinema,$start,$end);
if($sessions){
foreach($sessions as $s){
$e = new Event();
$dictionary = self::session2dictionary($s);
$e = $e->dictionary2event($dictionary);
$result[] = $e;
}
}
return $result;
}
private $id;
private $title;
private $start;
private $end;
private $idfilm;
private $start_time;
private $seat_price;
private $format;
private $seats_full;
private function __construct()
{
}
public function getId()
{
return $this->id;
}
public function getIdfilm()
{
return $this->idfilm;
}
//Return an object that allows Event object to be serialized as json because private atributes cant be serialized
public function jsonSerialize()
{
$film = Session::getThisSessionFilm($this->idfilm);
$undesirable = array(
'á','À','Á','Â','Ã','Ä','Å',
'ß','Ç',
'È','É','Ê','Ë',
'Ì','Í','Î','Ï','Ñ',
'Ò','Ó','Ô','Õ','Ö',
'Ù','Ú','Û','Ü',
'ñ'
);
$good = array(
'a','A','A','A','A','A','A',
'B','C',
'E','E','E','E',
'I','I','I','I','N',
'O','O','O','O','O',
'U','U','U','U',
'n'
);
$lan = str_replace($undesirable, $good, $film["language"]);
$o = new \stdClass();
$o->id = $this->id;
$o->title = $this->title;
$o->start = $this->start;
$o->end = $this->end;
$o->start_time = $this->start_time;
$o->seat_price = $this->seat_price;
$o->format = $this->format;
$o->film_dur = $film["duration"];
$o->film_id = $film["idfilm"];
$o->film_lan = $lan;
$o->film_img = $film["img"];
$o->date = $this->start;
return $o;
}
public static function session2dictionary($session){
$extraDurationBetweenFilms = 10;
$film = Session::getThisSessionFilm($session->getIdfilm());
$dur = $film["duration"]+$extraDurationBetweenFilms;
$tittle = \str_replace('_', ' ', $film["tittle"]) ;
$start = $session->getDate()." ".$session->getStartTime();
$end = \date('Y-m-d H:i:s', \strtotime( $start . ' +'.$dur.' minute'));
$dictionary = array(
"id" => $session->getId(),
"title" => $tittle,
"start" => $start,
"end" => $end,
"idfilm" => $session->getIdfilm(),
"start_time" => $session->getStartTime(),
"seat_price" => $session->getSeatPrice(),
"format" => $session->getFormat(),
"seats_full" => $session->getSeatsFull(),
);
return $dictionary;
}
protected function dictionary2event(array $dictionary)
{
if (array_key_exists('id', $dictionary)) {
$id = $dictionary['id'];
$this->id =(int)$id;
}
if (array_key_exists('title', $dictionary)) {
$title = $dictionary['title'];
$this->title = $title;
}
if (array_key_exists('start', $dictionary)) {
$start = $dictionary['start'];
//$start = DateTime::createFromFormat("y-m-d H:i:s", $start);
$this->start = $start;
}
if (array_key_exists('end', $dictionary)) {
$end = $dictionary['end'] ?? null;
$this->end = $end;
}
if (array_key_exists('idfilm', $dictionary)) {
$idfilm = $dictionary['idfilm'] ?? null;
$this->idfilm = $idfilm;
}
if (array_key_exists('start_time', $dictionary)) {
$start_time = $dictionary['start_time'] ?? null;
$this->start_time = $start_time;
}
if (array_key_exists('seat_price', $dictionary)) {
$seat_price = $dictionary['seat_price'] ?? null;
$this->seat_price = $seat_price;
}
if (array_key_exists('format', $dictionary)) {
$format = $dictionary['format'] ?? null;
$this->format = $format;
}
if (array_key_exists('seats_full', $dictionary)) {
$seats_full = $dictionary['seats_full'] ?? null;
$this->seats_full = $seats_full;
}
return $this;
}
}

View File

@ -0,0 +1,39 @@
<?php
class Film{
//Attributes:
private $_id; //Film ID.
private $_tittle; //Film tittle.
private $_duration; //Film duration.
private $_language; //Film language.
private $_description; //Film description.
private $_img; //Film image.
//Constructor:
function __construct($id, $tittle, $duration, $language, $description, $img){
$this->_id = $id;
$this->_tittle = $tittle;
$this->_duration = $duration;
$this->_language = $language;
$this->_description = $description;
$this->_img = $img;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setTittle($tittle) {$this->_tittle = $tittle; }
public function getTittle(){return $this->_tittle;}
public function setDuration($duration){$this->_duration = $duration; }
public function getDuration() {return $this->_duration;}
public function setLanguage($language) {$this->_language = $language; }
public function getLanguage(){return $this->_language;}
public function setDescription($description){ $this->_description = $description;}
public function getDescription(){return $this->_description;}
public function setImg($img){ $this->_img = $img;}
public function getImg(){return $this->_img;}
}
?>

View File

@ -0,0 +1,151 @@
<?php
include_once('film.php');
class Film_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createFilm($id, $tittle, $duration, $language, $description, $img){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`, `img`)
VALUES ( '%d', '%s', '%d', '%s','%s', '%s')",
$id, $tittle, $duration, $language, $description, $img);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a film data .
public function GetFilm($tittle,$language){
$sql = sprintf( "SELECT * FROM film WHERE film.tittle = '%s'AND film.language='%s'", $tittle,$language );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns the film's data by ID.
public function FilmData($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM film WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul->data_seek(0);
$film = null;
while ($fila = $resul->fetch_assoc()) {
if($id === $fila['id']){
$film = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"], $fila["img"]);
}
}
//mysqli_free_result($selectUser);
$resul->free();
return $film;
}
//Returns if exist a Film with this id
public function existFilm($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM film WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the films.
public function allFilmData(){
$sql = sprintf( "SELECT * FROM film ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"], $fila["img"]);
}
$resul->free();
return $films;
}
//Returns a query to get all films tittles.
public function tittleFilmData(){
$sql = sprintf( "SELECT DISTINCT tittle FROM film ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get all films descriptions.
public function descriptionFilmData(){
$sql = sprintf( "SELECT description FROM film ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
/*
public function addFilm($films) {
$resul = mysqli_query($this->mysqli, $this->createFilm($film.getId(), $film.getTittle(), $film.getDuration(), $film.getLanguage(), $film.getDescription())) or die ('Error into query database');
return $resul;
}
*/
//Deleted film by "id".
public function deleteFilm($id){
$sql = sprintf( "DELETE FROM film WHERE film.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a film.
public function editFilm($id, $tittle, $duration, $language,$description,$img){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s', img ='%s'
WHERE film.id = '%d';",
$tittle, $duration, $language, $description, $img, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a film.
public function editFilmNoImg($id, $tittle, $duration, $language,$description){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s'
WHERE film.id = '%d';",
$tittle, $duration, $language, $description, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Get cinemas associated with a movie.
public function getCinemas($id){
include_once('cinema_dao.php');
$cinema = new Cinema_DAO("complucine");
$sql = sprintf( " SELECT DISTINCT * FROM cinema WHERE cinema.id in
(SELECT session.idcinema FROM session JOIN film ON session.idfilm = film.id WHERE film.id = '%d'); ", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$cinemas = null;
while($fila = $resul->fetch_assoc()){
$cinemas[] = $cinema->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]);
}
$resul->free();
return $cinemas;
}
//Create a new film Data Transfer Object.
public function loadFilm($id, $tittle, $duration, $language,$description, $img){
return new Film( $id, $tittle, $duration, $language,$description, $img);
}
}
?>

View File

@ -0,0 +1,109 @@
<?php
include_once('hall_dao.php');
include_once('seat_dao.php');
class Hall{
//Attributes:
private $_number; //Room number.
private $_idcinema; //Cinema Id
private $_numRows; //Num rows.
private $_numCol; //Num columns.
private $_total_seats; //Toal seats.
private $_seats_map; //Seat map.
//Constructor:
function __construct($number, $idcinema, $numRows, $numCol, $total_seats, $seats_map){
$this->_number = $number;
$this->_idcinema = $idcinema;
$this->_numRows = $numRows;
$this->_numCol = $numCol;
$this->_total_seats = $total_seats;
$_seats_map = array();
$_seats_map = $seats_map;
}
//Methods:
public static function getListHalls($cinema){
$bd = new HallDAO('complucine');
if($bd )
return $bd->getAllHalls($cinema);
}
public static function create_hall($number, $cinema, $rows, $cols, $seats, $seats_map){
$bd = new HallDAO('complucine');
if($bd ){
if(!$bd->searchHall($number, $cinema)){
$bd->createHall($number, $cinema, $rows, $cols, $seats, $seats_map);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha creado la sala con exito";
} else {
return "Esta sala ya existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
public static function edit_hall($number, $cinema, $rows, $cols, $seats, $seats_map, $og_number){
$bd = new HallDAO('complucine');
if($bd ){
if($bd->searchHall($og_number, $cinema)){
if($og_number == $number){
Seat::deleteAllSeats($number, $cinema);
$bd->editHall($number, $cinema, $rows, $cols, $seats, $og_number);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha editado la sala con exito";
}else{
if(!$bd->searchHall($number, $cinema)){
Seat::deleteAllSeats($og_number, $cinema);
$bd->editHall($number, $cinema, $rows, $cols, $seats, $og_number);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha editado la sala con exito";
}else
return "El nuevo numero de sala ya existe en otra sala";
}
} else {
return "La sala a editar no existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
public static function delete_hall($number, $cinema, $rows, $cols, $seats, $seats_map, $og_number){
$bd = new HallDAO('complucine');
if($bd ){
if($bd->searchHall($og_number, $cinema)){
$bd->deleteHall($og_number, $cinema);
Seat::deleteAllSeats($og_number, $cinema);
return "La sala se ha eliminado correctamente";
} else {
return "La sala a borrar no existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
public static function search_hall($number,$cinema){
$bd = new HallDAO('complucine');
if($bd )
return $bd->searchHall($number,$cinema);;
}
//Getters && Setters:
public function setNumber($number){ $this->_number = $number; }
public function getNumber(){ return $this->_number; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setNumRows($numRows){ $this->_numRows = $numRows; }
public function getNumRows(){ return $this->_numRows; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setTotalSeats($totalSeat){ $this->_total_seats = $totalSeat; }
public function getTotalSeats(){ return $this->_total_seats; }
public function setSeatsmap($seats_map){ $this->_seats_map = $seats_map; }
public function getSeatsmap(){ return $this->_seats_map; }
}
?>

View File

@ -0,0 +1,116 @@
<?php
include_once('hall.php');
class HallDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new hall taking the new number,cinema, rows, cols, seats and seats map saving in the database
public function createHall($number, $cinema, $rows, $cols, $seats, $seats_map){
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`, `total_seats`)
VALUES ( '%d', '%d', '%d', '%d', '%d')",
$number, $cinema, $rows, $cols, $seats );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
return $sql;
}
//Returns the hall's data by ID.
public function HallData($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM hall WHERE number = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul->data_seek(0);
$hall = null;
while ($fila = $resul->fetch_assoc()) {
$hall = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
}
//mysqli_free_result($selectUser);
$resul->free();
return $hall;
}
//Returns a query to get the halls data.
public function getAllHalls($cinema){
$sql = sprintf( "SELECT * FROM hall WHERE
idcinema = '%s'",
$cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = null;
while($fila=mysqli_fetch_array($resul)){
$hall[] = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
}
mysqli_free_result($resul);
return $hall;
}
//Returns a hall data taking the number and cinema
public function searchHall($number, $cinema){
$sql = sprintf( "SELECT * FROM hall WHERE
number = '%s' AND idcinema = '%s'",
$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = false;
if($resul){
if($resul->num_rows == 1){
$fila = $resul->fetch_assoc();
$hall = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
}
$resul->free();
}
return $hall;
}
//Create a new Hall Data Transfer Object.
public function loadHall($number, $idcinema, $numrows, $numcolumns, $total_seats, $seats_map){
return new Hall($number, $idcinema, $numrows, $numcolumns, $total_seats, $seats_map);
}
//Edit a hall taking the new number, rows, cols ans seats with respect to its origin parameter
public function editHall($number, $cinema, $rows, $cols, $seats, $og_number){
$sql = sprintf( "UPDATE `hall`
SET `number` = '%d' ,`numrows` = '%d' , `numcolumns` = '%d' , `total_seats` = %d
WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",
$number, $rows, $cols, $seats, $og_number, $cinema );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Delete a hall whit the primary key
public function deleteHall($number, $cinema){
$sql = sprintf( "DELETE FROM `hall` WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
}
?>

View File

@ -0,0 +1,35 @@
<?php
class Manager{
//Attributes:
private $_id; //Manager ID.
private $_username; //Manager username.
private $_email; //Email.
private $_roll; //Roll
//Constructor:
function __construct($id, $idcinema, $username, $email, $roll){
$this->_id = $id;
$this->_idcinema = $idcinema;
$this->_username = $username;
$this->_email = $email;
$this->_roll = $roll;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setUsername($username){$this->_username = $username; }
public function getUsername(){ return $this->_username;}
public function setEmail($email){$this->_email = $email;}
public function getEmail(){return $this->_email;}
public function setRoll($roll){$this->_roll = $roll;}
public function getRoll(){return $this->_roll;}
}
?>

View File

@ -0,0 +1,77 @@
<?php
include_once('manager.php');
class Manager_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Returns a query to get all the manager's data.
public function allManagersData(){
$sql = sprintf( "SELECT * FROM `users` JOIN `manager` ON manager.id = users.id");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$managers[] = $this->loadManager($fila["id"], $fila["idcinema"], $fila["username"], $fila["email"], $fila["rol"]);
}
$resul->free();
return $managers;
}
//Returns a manager data taking the id
public function GetManager($id){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a manager data
public function GetManagerCinema($id, $idcinema){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d' AND manager.idcinema ='%d'", $id, $idcinema );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Manager with a new id and id cinema
public function createManager($id, $idcinema){
$sql = sprintf( "INSERT INTO `manager`( `id`, `idcinema`)
VALUES ( '%d', '%d')",
$id, $idcinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted manager by "id".
public function deleteManager($id){
$sql = sprintf( "DELETE FROM `manager` WHERE manager.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit manager by "id" and "idcinema"
public function editManager($id, $idcinema){
$sql = sprintf( "UPDATE `manager` SET manager.idcinema = '%d'
WHERE manager.id = '%d';",
$idcinema, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Manager Data Transfer Object.
public function loadManager($id, $idcinema, $username, $email, $rol){
return new Manager($id, $idcinema, $username, $email, $rol);
}
}
?>

View File

@ -0,0 +1,40 @@
<?php
class Promotion{
//Attributes:
private $_id; //Promotion ID.
private $_tittle; //Promotions name.
private $_description; //Promotion description.
private $_code; //Promotion code.
private $_active; //Promotion is active?
private $_img;
//Constructor:
function __construct($id, $tittle, $description, $code, $active, $img){
$this->_id = $id;
$this->_tittle = $tittle;
$this->_description = $description;
$this->_code = $code;
$this->_active = $active;
$this->_img= $img;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setTittle($tittle){ $this->_tittle = $tittle; }
public function getTittle(){ return $this->_tittle; }
public function setDescription($description){ $this->_description = $description;}
public function getDescription(){return $this->_description;}
public function setCode($code){ $this->_code = $code;}
public function getCode(){return $this->_code;}
public function setActive($active){ $this->_active = $active;}
public function getActive(){return $this->_active;}
public function setImg($img){ $this->_img = $img;}
public function getImg(){return $this->_img;}
}
?>

View File

@ -0,0 +1,102 @@
<?php
include_once('promotion.php');
class Promotion_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createPromotion($id, $tittle, $description, $code, $active, $img){
$sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`, `img`)
VALUES ( '%d', '%s', '%s', '%s', '%s', '%s')",
$id, $tittle, $description, $code, $active, $img);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the promotion.
public function allPromotionData(){
$sql = sprintf( "SELECT * FROM promotion ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"], $fila["img"]);
}
$resul->free();
return $promotions;
}
//Returns a promotion data by code.
public function GetPromotion($code){
$sql = sprintf( "SELECT * FROM promotion WHERE promotion.code = '%s'", $code );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a promotion data by id.
public function promotionData($id){
$sql = sprintf( "SELECT * FROM promotion WHERE promotion.id = '%d'", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted promotion by "id".
public function deletePromotion($id){
$sql = sprintf( "DELETE FROM promotion WHERE promotion.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a promotion with new img.
public function editPromotion($id, $tittle, $description, $code, $active, $img){
$sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s', img = '%s'
WHERE promotion.id = '%d';",
$tittle, $description, $code, $active, $img, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a promotion without new img.
public function editPromotionNoImg($id, $tittle, $description, $code, $active){
$sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s'
WHERE promotion.id = '%d';",
$tittle, $description, $code, $active, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a promotion data as object.
public function GetPromotionObj($code){
$sql = sprintf( "SELECT * FROM promotion WHERE promotion.code = '%s'", $code );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$promo = null;
while($fila = $resul->fetch_assoc()){
$promo = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"], $fila["img"]);
}
$resul->free();
return $promo;
}
//Create a new film Data Transfer Object.
public function loadPromotion($id, $tittle, $description, $code, $active, $img){
return new Promotion($id, $tittle, $description, $code, $active, $img);
}
}
?>

View File

@ -0,0 +1,43 @@
<?php
class Purchase {
//Attributes:
private $_idUser; //User Id.
private $_idSession; //Session Id.
private $_idHall; //Hall Id.
private $_idCinema; //Cinema Id.
private $_numRow; //Number of row seat.
private $_numColumn; //Number of column seat.
private $_timePurchase; //Time of purchase.
//Constructor:
function __construct($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
$this->_idUser = $idUser;
$this->_idSession = $idSession;
$this->_idHall = $idHall;
$this->_idCinema = $idCinema;
$this->_numRow = $row;
$this->_numColumn = $column;
$this->_timePurchase = $time;
}
//Methods:
//Getters && Setters:
public function setUserId($idUser){ $this->_idUser = $id; }
public function getUserId(){ return $this->_idUser; }
public function setSessionId($idSession){ $this->_idSession = $idSession; }
public function getSessionId(){ return $this->_idSession; }
public function setHallId($idHall){ $this->_idHall = $idHall; }
public function getHallId(){ return $this->_idHall; }
public function setCinemaId($idCinema){ $this->_idCinema = $idCinema; }
public function getCinemaId(){ return $this->_idCinema; }
public function setRow($row){ $this->_numRow = $row; }
public function getRow(){ return $this->_numRow; }
public function setColumn($column){ $this->_numColumn = $column; }
public function getColumn(){ return $this->_numColumn; }
public function setTime($time){ $this->_timePurchase = $time; }
public function getTime(){ return $this->_timePurchase; }
}
?>

View File

@ -0,0 +1,46 @@
<?php
include_once('purchase.php');
class PurchaseDAO extends DAO {
//Attributes:
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Purchase.
public function createPurchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
$sql = sprintf( "INSERT INTO purchase( iduser, idsession, idhall, idcinema, numrow, numcolum, time_purchase )
VALUES ( '%d', '%d', '%d', '%d', '%d', '%d', '%s' )",
$idUser, $idSession, $idHall, $idCinema, $row, $column, $time );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//All purchases of one user.
public function allPurchasesData($idUser){
$sql = sprintf( "SELECT * FROM purchase WHERE iduser = '%d' ", $idUser);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$purchases = null;
while($fila=$resul->fetch_assoc()){
$purchases[] = $this->loadPurchase($fila["iduser"], $fila["idsession"], $fila["idhall"], $fila["idcinema"], $fila["numrow"], $fila["numcolum"], $fila["time_purchase"]);
}
$resul->free();
return $purchases;
}
//Create a new User Data Transfer Object.
public function loadPurchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
return new Purchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time);
}
}
?>

View File

@ -0,0 +1,63 @@
<?php
include_once('seat_dao.php');
class Seat{
//Attributes:
private $_idhall; //Hall id.
private $_idcinema; //Cinema id.
private $_numRow; //Number of row.
private $_numCol; //Number of column.
private $_state; //State of the seat-
//Constructor:
function __construct($idhall, $idcinema, $numRow, $numCol, $state){
$this->_number = $idhall;
$this->_idcinema = $idcinema;
$this->_numRow = $numRow;
$this->_numCol = $numCol;
$this->_state = $state;
}
static public function createSeats($hall, $cinema, $rows, $cols, $seats_map){
$bd = new SeatDAO('complucine');
for($i = 1;$i <= $rows;$i++){
for($j = 1; $j <= $cols;$j++){
$bd->createSeat($hall, $cinema, $i, $j, $seats_map[$i][$j]);
}
}
}
static public function getSeatsMap($number, $cinema){
$bd = new SeatDAO('complucine');
if($bd )
return $bd->getAllSeats($number, $cinema);
}
static public function deleteAllSeats($number, $cinema){
$bd = new SeatDAO('complucine');
if($bd)
return $bd->deletemapSeats($number, $cinema);
}
//Getters && Setters:
public function setNumber($number){ $this->_number = $number; }
public function getNumber(){ return $this->_number; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setNumRows($numRow){ $this->_numRow = $numRow; }
public function getNumRows(){ return $this->_numRow; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setState($state){ $this->_state = $state; }
public function getState(){ return $this->_state; }
}
?>

View File

@ -0,0 +1,76 @@
<?php
include_once('seat.php');
class SeatDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Seat taking the new hall,cinema,row,col and state saving in the database
public function createSeat($hall, $cinema, $row, $col, $state){
$sql = sprintf( "INSERT INTO `seat`( `idhall`, `idcinema`, `numrow`, `numcolum`, `active`)
VALUES ( '%d', '%d', '%d', '%d', '%d')",
$hall, $cinema, $row, $col, $state);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createSeat');
return $sql;
}
//Returns a query to get all the seat's data.
public function getAllSeats($number, $cinema){
$sql = sprintf( "SELECT * FROM seat WHERE
idhall = '%d' AND idcinema = '%d'",
$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$seat_map = null;
while($fila=mysqli_fetch_array($resul)){
$seat_map[] = $this->loadSeat($fila["idhall"], $fila["idcinema"], $fila["numrow"], $fila["numcolum"], $fila["active"]);
}
mysqli_free_result($resul);
return $seat_map;
}
//Delete a Seat whit the primary key
public function deletemapSeats($hall, $cinema){
$sql = sprintf( "DELETE FROM `seat` WHERE
idcinema = '%s' AND idhall = '%s'",
$cinema, $hall);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Change state of the seat.
/*
public function changeSeatState($hall, $cinema, $row, $col, $state){
$id = $this->mysqli->real_escape_string($idHall);
$state = $this->mysqli->real_escape_string($state);
$sql = sprintf( "UPDATE seat SET active = '%d' WHERE idhall = '%d' AND idcinema = '%d' AND numrow = '%d' AND numcolum = '%d'",
$state, $hall, $cinema, $row, $col );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
*/
//Create a new Seat Data Transfer Object.
public function loadSeat($idhall, $idcinema, $numRow, $numCol, $state){
return new Seat($idhall, $idcinema, $numRow, $numCol, $state);
}
}
?>

View File

@ -0,0 +1,129 @@
<?php
include_once('session_dao.php');
class Session{
private $_id;
private $_idfilm;
private $_idhall;
private $_idcinema;
private $_date;
private $_startTime;
private $_seatPrice;
private $_format;
private $_seats_full;
function __construct($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
$this->_id = $id;
$this->_idfilm = $idfilm;
$this->_idhall = $idhall;
$this->_idcinema = $idcinema;
$this->_date = $date;
$this->_startTime = $startTime;
$this->_seatPrice = $seatPrice;
$this->_format = $format;
$this->_seats_full = $seats_full;
}
public static function getListSessions($hall,$cinema,$date){
$bd = new SessionDAO('complucine');
if($bd ) {
if($date)
return $bd->getAllSessions($hall, $cinema, $date, null);
else
return $bd->getAllSessions($hall, $cinema, null, null);
}
}
public static function getListSessionsBetween2Dates($hall,$cinema,$start,$end){
$bd = new SessionDAO('complucine');
if($bd ) {
return $bd->getAllSessions($hall, $cinema, $start, $end);
}
}
public static function create_session($cinema, $hall, $start, $date, $film, $price, $format){
$bd = new SessionDAO('complucine');
if($bd ){
if(!$bd->searchSessionActivesAtStartTimeAndFilmDuration($cinema, $hall, $start, $date, $film)){
$bd->createSession(null,$film, $hall, $cinema, $date, $start, $price, $format);
return 'Operación completada';
} else
return 'La session del dia '.$date.' coincide con otra';
} else return 'Error al conectarse a la base de datos';
}
public static function edit_session($cinema, $or_hall, $or_date, $or_start, $hall, $start, $date, $film, $price, $format){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){
if(!$bd->searchSession($cinema,$hall,$start,$date)){
$origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
$bd->editSession($film, $hall, $cinema, $date, $start, $price, $format, $origin);
return "Se ha editado la session con exito";
}else if($or_hall == $hall && $or_start == $start && $or_date == $date){
$origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
$bd->editSession($film, $hall, $cinema, $date, $start, $price, $format, $origin);
return "Se ha editado la session con exito";
}else{
return "Ya existe una sesion con los parametros nuevos";
}
} else
return "La session a editar no existe";
} else return "Error al conectarse a la base de datos";
}
public static function delete_session($cinema, $hall, $start, $date){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($cinema, $hall, $start, $date)){
$bd->deleteSession($hall, $cinema, $date, $start);
return "Se ha eliminado la session con exito";
} else
return "Esta session no existe";
} else return "Error al conectarse a la base de datos";
}
//Esto deberia estar en film.php? seguramente
public static function getThisSessionFilm($idfilm){
$bd = new SessionDAO('complucine');
if($bd ) {
$film = $bd->filmTittle($idfilm);
$film["tittle"] = str_replace('_', ' ',$film["tittle"]);
return $film;
}
}
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setIdfilm($idfilm){ $this->_idfilm = $idfilm; }
public function getIdfilm(){ return $this->_idfilm; }
public function setIdhall($idhall){ $this->_idhall = $idhall; }
public function getIdhall(){ return $this->_idhall; }
public function setIdcinema($cinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setDate($date){ $this->_date = $date; }
public function getDate(){ return $this->_date; }
public function setStartTime($startTime){ $this->_startTime = $startTime; }
public function getStartTime(){ return $this->_startTime; }
public function setSeatPrice($seatPrice){ $this->_seatPrice = $seatPrice; }
public function getSeatPrice(){ return $this->_seatPrice; }
public function setFormat($format){ $this->_format = $format; }
public function getFormat(){ return $this->_format; }
public function setSeatsFull($bool){ $this->_seats_full = $bool; }
public function getSeatsFull(){ return $this->_seats_full; }
}
?>

View File

@ -0,0 +1,175 @@
<?php
include_once('session.php');
class SessionDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Create a new Session taking the new id,film, hall, cinema, date, start time, seat price and format saving in the database
public function createSession($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`, `seats_full`)
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')",
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, "0");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error createSession');
return $sql;
}
//Returns a query to get the session's data.
public function sessionData($id){
$sql = sprintf( "SELECT * FROM `session` WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error accessing to the session with id '. $id);
while($fila=$resul->fetch_assoc()){
$session = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
$resul->free();
return $session;
}
//Look for a film with the id film
public function filmTittle($idfilm){
$sql = sprintf("SELECT * FROM film JOIN session ON film.id = session.idfilm WHERE session.idfilm = '%d' ", $idfilm );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error accessing to the film with id '. $idfilm);
$resul = mysqli_fetch_array($resul);
return $resul;
}
//Look for a session with the primary key
public function searchSession($cinema, $hall, $startTime, $date){
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$cinema, $hall, $date, $startTime);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error searching for a session');
$session = mysqli_fetch_array($resul);
mysqli_free_result($resul);
return $session;
}
public function searchSessionActivesAtStartTimeAndFilmDuration($cinema, $hall, $startTime, $date, $idfilm){
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$sessions = [];
$sql = sprintf("SELECT duration FROM film WHERE id='%s'", $idfilm );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error looking for the film duration of id '. $idfilm);
$duration = ($resul->fetch_assoc())["duration"]+10;
$endHour = date('H:i:s', strtotime( $startTime . ' +'.$duration.' minute'));
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time BETWEEN '%s' AND '%s' ORDER BY start_time ASC;",
$cinema, $hall, $date, $startTime, $endHour);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error looking for sessions between start time and start time + film duration');
while($fila=$resul->fetch_assoc()){
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
mysqli_free_result($resul);
return $sessions;
}
//Returns a query to get all the session's data.
public function getAllSessions($hall, $cinema, $date, $end){
if($end){
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date BETWEEN '%s' AND '%s' ORDER BY start_time ASC;",
$cinema, $hall, $date, $end);
}else if($date && !$end){
$date = date('Y-m-d', strtotime( $date ) );
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' ORDER BY start_time ASC;",
$cinema, $hall, $date);
}else{
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' ORDER BY start_time ASC;",
$cinema, $hall);
}
$resul = mysqli_query($this->mysqli, $sql) or die ('Error geting all sessions');
$sessions = null;
while($fila=$resul->fetch_assoc()){
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
mysqli_free_result($resul);
return $sessions;
}
//Look for a title and cinema
public function getSessions_Film_Cinema($idFiml, $idCinema){
$sql = sprintf( "SELECT * FROM session WHERE session.idfilm = '%d' AND session.idcinema = '%d' ", $idFiml, $idCinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error geting sessions with a idfilm and cinema');
$sessions = null;
while($fila = $resul->fetch_assoc()){
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
$resul->free();
return $sessions;
}
//Edit a session taking the new film, hall, date, start time, seat price and format with respect to its origin parameter
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
$origin["date"] = date('Y-m-d', strtotime( $origin["date"] ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$origin["start"] = date('H:i:s', strtotime( $origin["start"] ) );
$sql = sprintf( "UPDATE `session`
SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
`start_time` = '%s', `seat_price` = '%d', `format` = '%s'
WHERE
idcinema = '%s' AND idhall = '%s' AND session.date = '%s' AND start_time = '%s'",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin["cinema"],$origin["hall"],$origin["date"],$origin["start"]);
mysqli_query($this->mysqli, $sql) or die ('Error editing a session');
}
//Delete a session whit the primary key
public function deleteSession($hall, $cinema, $date, $startTime){
$sql = sprintf( "DELETE FROM `session` WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$cinema, $hall, $date, $startTime);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error deleting a session');
return $resul;
}
//Create a new Session Data Transfer Object.
public function loadSession( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
return new Session( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full);
}
}
?>

View File

@ -0,0 +1,35 @@
<?php
class User {
//Attributes:
private $_id; //User Id.
private $_username; //User name.
private $_email; //User email.
private $_password; //User password.
private $_rol; //Type of user: user | manager | admin.
//Constructor:
function __construct($id, $username, $email, $password, $rol){
$this->_id = $id;
$this->_username = $username;
$this->_email = $email;
$this->_password = $password;
$this->_rol = $rol;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setName($username){ $this->_username = $username; }
public function getName(){ return $this->_username; }
public function setEmail($email){ $this->_email = $email; }
public function getEmail(){ return $this->_email; }
public function setPass($passwd){ $this->_password = $passwd; }
public function getPass(){ return $this->_password; }
public function setRol($rol){ $this->_rol = $rol; }
public function getRol(){ return $this->_rol; }
}
?>

View File

@ -0,0 +1,176 @@
<?php
include_once('user.php');
class UserDAO extends DAO {
//Constants:
private const _USER = "user";
private const _MANAGER = "manager";
private const _ADMIN = "admin";
//Attributes:
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Encrypt password with SHA254.
private function encryptPass($password){
/**
* Por defecto, la función password_hash(), ya genera una contraseña con "SAL",
* aunque este sería un ejemplo de cómo crear unas opciones mejores que las que vienen por defecto,
* aumentando el coste.
* Más info: https://www.php.net/manual/es/faq.passwords.php#faq.passwords.salt
* */
/*
$SALAD = [
'cost' => 11, //Por defecto password_hash lo pone a 10.
'salt' => mcrypt_create_iv(22, MCRYPT_DEV_URANDOM), //Hay que tener activado el módulo mcrypt para usar esta función.
];
*/
$password = password_hash($password, PASSWORD_DEFAULT); //Actualmente en PHP PASSWORD_DEFAULT equivale a PASSWORD_BCRYPT.
return $password;
}
//Returns true if the password and hash match, or false otherwise.
public function verifyPass($password, $passwd){
return password_verify($password, $passwd);
}
//All users
public function allUsersNotM(){
$sql = sprintf( "SELECT * FROM `users` WHERE users.id NOT IN (SELECT id FROM `manager`)");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$users[] = $this->loadUser($fila['id'], $fila['username'], $fila['email'], $fila['passwd'], $fila['rol']);
}
$resul->free();
return $users;
}
//Create a new User.
public function createUser($id, $username, $email, $password, $rol){
$password = $this->encryptPass($password);
$sql = sprintf( "INSERT INTO users ( id, username, email, passwd, rol)
VALUES ( '%d', '%s', '%s', '%s', '%s')",
$id, $username, $email, $password, $rol );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//Returns a query to check if the user name exists.
public function selectUser($username, $password){
$username = $this->mysqli->real_escape_string($username);
$password = $this->mysqli->real_escape_string($password);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
$resul = mysqli_query($this->mysqli, $sql);
$user = null;
while ($fila = $resul->fetch_assoc()) {
if($username === $fila['username'] && $this->verifyPass($password, $fila['passwd'])){
$user = $this->loadUser($fila['id'], $fila['username'], $fila['email'], $fila['passwd'], $fila['rol']);
}
}
mysqli_free_result($resul);
//$resul->free();
return $user;
}
//Returns a query to get the user's data.
public function userData($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Search a user by name.
public function selectUserName($username){
$username = $this->mysqli->real_escape_string($username);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//Search a user by email.
public function selectUserEmail($email){
$email = $this->mysqli->real_escape_string($email);
$sql = sprintf( "SELECT * FROM users WHERE email = '%s'", $email );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//Change username by id.
public function changeUserName($id, $username){
$id = $this->mysqli->real_escape_string($id);
$username = $this->mysqli->real_escape_string($username);
$sql = sprintf( "UPDATE users SET username = '%s' WHERE id = '%d'", $username, $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Change userpass by id.
public function changeUserPass($id, $password){
$id = $this->mysqli->real_escape_string($id);
$password = $this->mysqli->real_escape_string($password);
$password = $this->encryptPass($password);
$sql = sprintf( "UPDATE users SET passwd = '%s' WHERE id = '%d'", $password, $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Change user email by id.
public function changeUserEmail($id, $email){
$id = $this->mysqli->real_escape_string($id);
$email = $this->mysqli->real_escape_string($email);
$sql = sprintf( "UPDATE users SET email = '%s' WHERE id = '%d'", $email, $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Delete user account by id.
public function deleteUserAccount($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "DELETE FROM users WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new User Data Transfer Object.
public function loadUser($id, $username, $email, $password, $rol){
return new User($id, $username, $email, $password, $rol);
}
}
?>

View File

@ -5,13 +5,14 @@
//private const _NUMPAGES = 10; //Constant to page results.
//Attributes:
private $page; //Page Name.
private $prefix; //Page prefix.
private $page; //Page Name.
private $prefix; //Page prefix.
private $session; //"Iniciar Sesión" (if user isn´t logged in), "Cerrar Sesión" (otherwise).
private $session_route; //"login/" (if user isn´t logged in), "logout/" (otherwise).
private $panel; //Button to access the user's dashboard (only displayed if logged in).
private $user_route; //Route of the panel (depends on the type of user).
private $session; //"Iniciar Sesión" (if user isn´t logged in), "Cerrar Sesión" (otherwise).
private $session_route; //"login/" (if user isn´t logged in), "logout/" (otherwise).
private $panel; //Button to access the user's dashboard (only displayed if logged in).
private $user_route; //Route of the panel (depends on the type of user).
private $sessionButtonClass; //Type of button to login or logout.
//Constructor:
function __construct(){
@ -24,6 +25,7 @@
$this->session_route = 'login/'; //Default, the session has not started.
$this->panel = ''; //Default, the session has not started.
$this->user_route = 'panel_user/'; //Default, the type of client is user.
$this->sessionButtonClass = ''; //Default, normal button.
}
//Methods:
@ -38,6 +40,8 @@
case strpos($this->page, 'logout'): $this->page = 'Cerrar Sesión'; break;
case strpos($this->page, 'register'): $this->page = 'Registro de Usuario'; break;
case strpos($this->page, 'showtimes'): $this->page = 'Cartelera'; break;
case strpos($this->page, 'purchase'): $this->page = 'Comprar Entrada'; break;
case strpos($this->page, 'promotions'): $this->page = 'Promociones'; break;
case strpos($this->page, 'cinemas'): $this->page = 'Nuestros Cines'; break;
case strpos($this->page, 'about_us'): $this->page = 'Sobre FDI-Cines'; $this->prefix = '../../'; break;
case strpos($this->page, 'terms'): $this->page = 'Términos y Condiciones'; $this->prefix = '../../'; break;
@ -46,6 +50,7 @@
case strpos($this->page, 'miembros'): $this->page = 'Miembros'; $this->prefix = '../../'; break;
case strpos($this->page, 'planificacion'): $this->page = 'Planificación'; $this->prefix = '../../'; break;
case strpos($this->page, 'contacto'): $this->page = 'Contacto'; break;
case strpos($this->page, 'assets'): $this->prefix = '../../../'; break;
default: $this->page = 'FDI-Cines'; $this->prefix = './'; break;
}
}
@ -65,10 +70,18 @@
$page = $this->page;
$prefix = $this->prefix;
if(!isset($_SESSION["css"])) $_SESSION["css"] = "main.css";
$extraCSS = "";
if($page === "Comprar Entrada") $extraCSS = "\n<link id='estilo' rel='stylesheet' type='text/css' href='{$prefix}assets/css/seat.css'>";
if($page === "Panel de Gerente") $extraCSS = "<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.css' />";
echo"<head>
<title>CompluCine | {$page}</title>
<meta charset='utf-8' />
<link id='estilo' rel='stylesheet' type='text/css' href='{$prefix}assets/css/main.css'>
<link id='estilo' rel='stylesheet' type='text/css' href='{$prefix}assets/css/{$_SESSION['css']}'>{$extraCSS}
<noscript><h1>Esta página requiere JavaScript para su correcto funcionamiento.
Compruebe si JavaScript está deshabilitado en su navegador.</h1></noscript>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='icon' href='{$prefix}img/favicon.png' />
</head>\n";
@ -79,29 +92,38 @@
$page = $this->page;
$prefix = $this->prefix;
$session = $this->session;
$session_route =$this->session_route;
$sessionButtonClass = $this->sessionButtonClass;
$session_route = $this->session_route;
$user_route = $this->user_route;
$panel =$this->panel;
if(isset($_SESSION["nombre"])){
if($_SESSION["rol"] == "admin") $user_route = 'panel_admin/';
else if($_SESSION["rol"] == "manager") $user_route = 'panel_manager/';
if(isset($_SESSION["rol"])){
if($_SESSION["rol"] === "admin") $user_route = 'panel_admin/';
else if($_SESSION["rol"] === "manager") $user_route = 'panel_manager/';
$panel = "<a href='{$prefix}{$user_route}'><li>Mi Panel</li></a>";
$session = 'Cerrar Sesión';
$sessionButtonClass = 'danger';
$session_route = 'logout/';
}
if(isset($_SESSION["lastRol"]) && ($_SESSION["lastRol"] === "admin" || $_SESSION["lastRol"] === "manager" )){
$changeRol = "<a href='{$prefix}assets/php/common/resetRol.php'><li class='danger'>Volver a {$_SESSION["lastRol"]}</li></a>";
} else {
$changeRol = null;
}
echo"<div class='header'>
<a href='{$prefix}'><img src='{$prefix}img/favicon2.png' alt='favicon' /> CompluCine</a> | {$page}
<div class='menu'>
<nav>
<a href='{$prefix}{$session_route}'><li>{$session}</li></a>
<nav>{$changeRol}
<a href='{$prefix}{$session_route}'><li class={$sessionButtonClass}>{$session}</li></a>
{$panel}
<li>Menú
<ul>
<a href='{$prefix}'><li>Inicio</li></a>
<a href='{$prefix}showtimes/'><li>Cartelera</li></a>
<a href='{$prefix}cinemas/'><li>Nuestros Cines</li></a>
<a href='{$prefix}promotions/'><li>Promociones</li></a>
<a href='{$prefix}fdicines/miembros/'><li>Quiénes somos</li></a>
<a href='{$prefix}contacto/'><li>Contacto</li></a>
</ul>
@ -208,11 +230,10 @@
</li>");
break;
case "user": array_push($menus, "<a href='./?option=manage_profile'><li>Cuenta de usuario</li></a>");
array_push($menus, "<a href='./?option=purchases'><li>Historial Compras</li></a>");
array_push($menus, "<a href='./?option=payment'><li>Datos Pago</li></a>");
array_push($menus, "<a href='./?option=delete_user'><li>Eliminar Usuario</li></a>");
break;
case "user": array_push($menus, "<a href='./?option=purchases'><li>Historial Compras</li></a>");
//array_push($menus, "<a href='./?option=payment'><li>Datos Pago</li></a>");
array_push($menus, "<a href='./?option=delete_user'><li>Eliminar Usuario</li></a>");
break;
default: $menus = array(); break;
}
@ -250,7 +271,7 @@
function print_fimls(){
$reply = "";
//List of the movies:
require_once(__DIR__.'/common/film_dao.php');
require_once(__DIR__.'/includes/film_dao.php');
$prefix= $this->get_prefix();
@ -261,17 +282,20 @@
$descriptions = array();
$times = array();
$languages = array();
foreach($films_array as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$times[$key] = $value->getDuration();
$languages[$key] = $value->getLanguage();
$images = array();
if(is_array($films_array)){
foreach($films_array as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$times[$key] = $value->getDuration();
$languages[$key] = $value->getLanguage();
$images[$key] = $value->getImg();
}
}
switch($this->page){
case "Cartelera":
if(is_array($films_array)){
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
@ -288,8 +312,9 @@
}
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<a href='".$prefix."purchase?film=".$ids[$i]."'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<div class='image'><img src='".$prefix."img/films/".$images[$i]."' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<div class='blockquote'>
@ -298,15 +323,18 @@
<li>Duración: ".$times[$i]." minutos</li>
<li>Lenguaje: ".$languages[$i]."</li>
</div>
</a>
</div>
</section>
";
}
}
$reply .= "</div>\n";
break;
case "Panel de Administrador":
$reply .= "<div class='column'>";
if(is_array($films_array)){
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
@ -324,7 +352,7 @@
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<div class='image'><img src='".$prefix."img/films/".$images[$i]."' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<form method='post' action='./index.php?state=mf'>
@ -348,13 +376,63 @@
</section>
";
}
}
$reply .= "</div>\n";
break;
case "Panel de Gerente":
$reply .= "<div class='column'>";
if(is_array($films_array)){
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column side'>
";
}
else{
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column middle'>
";
}
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/films/".$images[$i]."' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<li>Duración: ".$times[$i]." minutos</li>
<li>Lenguaje: ".$languages[$i]."</li>
<form method='post' action='./?state=".$_SESSION["option"]."'>
<input name='film' type='hidden' value='".$ids[$i]."'>
<input name='tittle' type='hidden' value='".$tittles[$i]."'>
<input name='duration' type='hidden' value='".$times[$i]."'>
<input name='language' type='hidden' value='".$languages[$i]."'>
<input name='description' type='hidden' value='".$descriptions[$i]."'>
<input name='hall' type='hidden' value='".$_POST["hall"]."'>
<input name='date' type='hidden' value='".$_POST["date"]."'>
<input name='start' type='hidden' value='".$_POST["start"]."'>
<input name='price' type='hidden' value='".$_POST["price"]."'>
<input name='format' type='hidden' value='".$_POST["format"]."'>
<input name='or_hall' type='hidden' value='".$_POST["or_hall"]."'>
<input name='or_date' type='hidden' value='".$_POST["or_date"]."'>
<input name='or_start' type='hidden' value='".$_POST["or_start"]."'>
<input type='submit' id='submit' value='Seleccionar' name='select_film' class='primary' />
</form>
</div>
</div>
</section>
";
}
}
$reply .= "</div>\n";
break;
default:
if(is_array($films_array)){
$reply .='<div class="column left">
<div class="galery">
<h1>Últimos Estrenos</h1><hr />';
@ -369,7 +447,7 @@
$reply .= "
<div class='zoom'>
<div class='columna'>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div></a>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/films/".$images[$i]."' alt='".$tittles[$i]."' /></div></a>
</div>
</div>";
$count++;
@ -385,10 +463,11 @@
$reply .= "
<h1>{$title}</h1><hr />
<div class='zoom'>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/films/".$tittles[$count].".jpg' alt='".$tittles[$count]."' /></div></a>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/films/".$images[$count]."' alt='".$tittles[$count]."' /></div></a>
</div>
</div>
</div>\n";
}
break;
}
@ -400,7 +479,9 @@
$reply = "";
//List of the cinemas:
require_once(__DIR__.'/common/cinema_dao.php');
require_once(__DIR__.'/includes/cinema_dao.php');
$prefix= $this->get_prefix();
$cine = new Cinema_DAO("complucine");
$cinemas = $cine->allCinemaData();
@ -408,71 +489,174 @@
$names = array();
$directions = array();
$phones = array();
if(is_array($cinemas)){
if(!is_array($cinemas)){
$reply = "<h2>No hay cines actualmente</h2>";
}
else{
foreach($cinemas as $key => $value){
$ids[$key] = $value->getId();
$names[$key] = $value->getName();
$directions[$key] = $value->getDirection();
$phones[$key] = $value->getPhone();
}
switch($this->page){
case "Nuestros Cines":
for($i = 0; $i < count($cinemas); $i++){
if($i%2 === 0){
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column side'>
";
}
else{
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column middle'>
";
}
$reply .= "<section id='".$names[$i]."'>
<div class='zoom'>
<a href='".$prefix."purchase?cinema=".$ids[$i]."'>
<div class='code cinemas'>
<h2>".$names[$i]."</h2>
<hr />
<section class='column left'>
<img src='../img/sala1.jpg' alt='".$names[$i]."' />
</section>
<section class='column right'>
<section class='blockquote'>
<li>Dirección: ".$directions[$i]."</li>
<li>Teléfono: ".$phones[$i]."</li>
</section>
</section>
</div>
</a>
</div>
</section>
";
}
$reply .= "</div>\n";
break;
case "Panel de Administrador":
$reply .= "<div class='row'>
<ul class='tablelist col6'>
<li class='title'>Id</li>
<li class='title'>Nombre</li>
<li class='title'>Dirección</li>
<li class='title'>Teléfono</li>
<li class='title'>Editar</li>
<li class='title'>Eliminar</li>
";
$parity = "odd";
for($i = 0; $i < count($cinemas); $i++){
$reply .= '
<div class="'.$parity.'">
<a class="h2long" href="index.php?state=mc&cinema='.$ids[$i].'">
<li>'. $ids[$i] .'</li>
<li>'. $names[$i] .'</li>
<li>'. $directions[$i] .'</li>
<li>'. $phones[$i] .'</li>
</a>
<li>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
</form>
</li>
<li>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
</form>
</li>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
}
$reply .=' </div>';
break;
default:
break;
}
}
return $reply;
}
function print_promotions(){
$reply = "";
//List of the cinemas:
require_once(__DIR__.'/includes/promotion_dao.php');
$prefix= $this->get_prefix();
$promotion = new Promotion_DAO("complucine");
$promotions = $promotion->allPromotionData();
$ids = array();
$tittles = array();
$descriptions = array();
$codes = array();
$isActive = array();
if(is_array($promotions)){
foreach($promotions as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$codes[$key] = $value->getCode();
if($value->getActive()){
$isActives[$key] = "ACTIVA";
} else {
$isActives[$key] = "CADUCADA";
}
}
}
switch($this->page){
case "Panel de Administrador":
$reply .= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Direccion</th>
<th>Telefono</th>
</tr>
</thead>
<tbody>
";
if(is_array($cinemas)){
for($i = 0; $i < count($cinemas); $i++){
$reply .= '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $names[$i] .'</td>
<td>'. $directions[$i] .'</td>
<td>'. $phones[$i] .'</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
</form>
</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
</form>
</td>
</tr>
';
}
}
$reply .='</tbody>
</table>
</div>
<div class="column side"></div>
';
case "Promociones":
for($i = 0; $i < count($promotions); $i++){
if($i%2 === 0){
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column side'>
";
}
else{
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column middle'>
";
}
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code promo'>
<div class='image'><img src='".$prefix."img/promos/".str_replace(' ', '_', strtolower($tittles[$i])).".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittles[$i]."</h2>
<hr />
<div class='blockquote'>
<p>".$descriptions[$i]."</p>
</div>
<li>Código: ".$codes[$i]."</li>
<li>Estado: ".$isActives[$i]."</li>
</div>
</div>
</section>
";
}
$reply .= "</div>\n";
break;
default:
default:
break;
}
return $reply;
@ -489,28 +673,51 @@
//Print generic Footer:
function print_footer(){
$prefix = $this->prefix;
/* TODO */
$css = "{$prefix}assets/css/highContrast.css";
$nameCSS = "Alto Contraste";
//$css = "{$prefix}assets/css/main.css";
//$nameCSS = "Contraste Normal";
$page = $this->page;
if(!isset($_SESSION["css"]) || $_SESSION["css"] === "main.css"){
$css = "{$prefix}assets/css/highContrast.css";
$nameCSS = "Alto Contraste";
} else {
$css = "{$prefix}assets/css/main.css";
$nameCSS = "Contraste Normal";
}
echo"<footer>
<div class='footer'>
<p>© Práctica 3 | Sistemas Web 2021 </p>
<p>© Práctica Final | Sistemas Web 2021 </p>
</div>
<span class='go-up'>&#x1F51D</span>
<a href='{$prefix}fdicines/about_us/'>Sobre FDI-Cines</a> |
<a href='{$prefix}fdicines/terms_conditions/'>Términos de uso</a> |
<a href='{$prefix}cinemas/'>Nuestros cines</a> |
<a href='{$prefix}contacto/'>Contacto</a> |
<button onclick=\"cambiarCSS('$css');\">$nameCSS</button>
<button id='cssChange' onclick=\"cambiarCSS('$css');\">$nameCSS</button>
</footer>\n";
}
echo"
<!-- Scripts -->
<script src='{$prefix}assets/js/cambiarCSS.js'></script>\n";
//Print JS scripts:
function print_scripts(){
$prefix = $this->prefix;
$page = $this->page;
echo"<script type='text/javascript' src='{$prefix}assets/js/jquery-3.2.1.min.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/cambiarCSS.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/checkForms.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/goUp.js'></script>
";
if($page === "FDI-Cines") echo"<script type='text/javascript' src='{$prefix}assets/js/promotions.js'></script>\n";
if($page === "Panel de Usuario") echo"<script type='text/javascript' src='{$prefix}assets/js/deleteConfirm.js'></script>\n";
if($page === "Comprar Entrada") echo"<script type='text/javascript' src='{$prefix}assets/js/selectTicket.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/checkPay.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/goBack.js'></script>\n";
if($page === "Panel de Gerente") echo"<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/sessionCalendar.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/sessionFormProcess.js'></script>\n";
}
}
?>
?>

View File

@ -2,8 +2,14 @@
//General Config File:
require_once('../assets/php/config.php');
//Specific page content:
$section = '';
//Page-specific content:
$section = '<!-- Cinemas -->
<section id="cinemas">
<div class="row">
'.$template->print_cinemas().'
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';

View File

@ -1,5 +1,6 @@
<?php
require_once($prefix.'assets/php/form.php');
require_once($prefix.'assets/php/includes/user.php');
class FormContact extends Form {
//Constants:
@ -11,6 +12,8 @@ class FormContact extends Form {
}
protected function generaCamposFormulario($datos, $errores = array()) {
if(isset($_SESSION["user"])){ $nameValue = "value=".unserialize($_SESSION['user'])->getName().""; $emailValue = "value=".unserialize($_SESSION['user'])->getEmail().""; }
else { $nameValue = "placeholder='Nombre'"; $emailValue = "placeholder='Email'"; }
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
@ -23,10 +26,10 @@ class FormContact extends Form {
<fieldset id='datos_personales'>
<legend>Datos personales</legend><pre>".$htmlErroresGlobales."</pre>
<div class='_name'>
<input type='text' name='name' id='name' value='' placeholder='Nombre' required/><pre>".$errorNombre."</pre>
<input type='text' name='name' id='name' ".$nameValue." required/><pre>".$errorNombre."</pre>
</div>
<div class='_email'>
<input type='email' name='email' id='email' value='' placeholder='Email' required/><pre>".$errorEmail."</pre>
<input type='email' name='email' id='email' ".$emailValue." required/><pre>".$errorEmail."</pre>
</div>
</fieldset>
<fieldset id='motivo'>
@ -65,8 +68,8 @@ class FormContact extends Form {
$result = array();
$nombre = $this->test_input($datos['name']) ?? null;
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 8 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de más de\n 3 caracteres\n y menos de 8 caracteres.";
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 15 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de más de\n 3 caracteres\n y menos de 15 caracteres.";
}
$email = $this->test_input($datos['email']) ?? null;
@ -80,9 +83,10 @@ class FormContact extends Form {
}
if (count($result) === 0) {
$result = ROUTE_APP;
$result = ROUTE_APP; // DE MOMENTO, NO HACE NADA :)
}
return $result;
}
}
}
?>

View File

@ -10,7 +10,7 @@
//Specific page content:
$section = '<!-- Contact Form -->
<section id="formulario">
<h4>Formulario (EN DESARROLLO)</h4>
<h4>Formulario</h4>
'.$htmlForm.'
</section>
';

View File

@ -33,8 +33,8 @@
<td><a href="mailto:oscarrui@ucm.es">oscarrui@ucm.es</a></td>
</tr>
<tr>
<td><a href="#ARN">Adrian Real del Noval</a></td>
<td><a href="mailto:adrireal@ucm.es">adrireal@ucm.es</td>
<td><a href="#UND">Undefined</a></td>
<td><a href="">undefined@ucm.es</td>
</tr>
</tbody>
</table>
@ -123,15 +123,14 @@
</section>
</div>
<div class="column side">
<!-- Adrian Real -->
<section id="ARN">
<!-- Undefined -->
<section id="UND">
<div class="zoom">
<div class="code">
<img src="../../img/us/arn.jpg" />
<p>~ Adrian Real del Noval (adrireal@ucm.es)</p>
<img src="../../img/seat_grey.png" />
<p>~ Undefined (undefined@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante de 3er año de Ingeniería de Computadores en la Universidad Complutense de Madrid.</p>
<p>Las áreas en las que tiene mayor interés son la electrónica, las GPUs, y los sistemas empotrados.</p>
<p>Este miembro ha abandonado el grupo.</p>
</div>
</div>
</div>

View File

@ -13,22 +13,22 @@
<div class="textbox">
<h2>Implementaciones Generales de la Web</h2>
<ul>
<li>Pantalla de Inicio (incluye promociones y estrenos) [Fer && Adrián]</li>
<li>Pantalla de Inicio (incluye promociones y estrenos) [Fer]</li>
<li>Cartelera Dinámica [Fer --> Marian && Daniel]</li>
<li>Selección Cines (mapa) [Fer]</li>
<li>Listado de Horarios [Fer]</li>
<li>Selección de butacas [Fer --> Marco && Óscar]</li>
<li>Pagar + opción para código promocional [Fer]</li>
<li>Sobre FDI-Cines (About us) [Fer && Adrián]</li>
<li>Sobre FDI-Cines (About us) [Fer ]</li>
<li>Formulario de Contacto [Fer]</li>
<li>Términos y Condiciones [Fer && Adrián]</li>
<li>Términos y Condiciones [Fer]</li>
</ul>
</div>
<div class="textbox">
<h2>Paneles de Usuario Registrado</h2>
<ul>
<li>Registrarse e Iniciar sesión [Adrián]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Adrián]</li>
<li>Registrarse e Iniciar sesión [Fer]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Fer]</li>
</ul>
</div>
<div class="textbox">
@ -76,9 +76,11 @@
<li>Listado de Horarios [General]</li>
<li>Selección de butacas [General]</li>
<li>Pagar + opción para código promocional [General]</li>
<li>Sobre FDI-Cines (About us) [General (de apoyo)]</li>
<li>Formulario de Contacto [General]</li>
<li>Términos y Condiciones [General (de apoyo)]</li>
<li>Registrarse e Iniciar sesión [Usuario Registrado]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Usuario Registrado]</li>
<li>Sobre FDI-Cines (About us) [General]</li>
<li>Términos y Condiciones [General]</li>
</ul>
</div>
<div class="textbox">
@ -113,16 +115,6 @@
<li>Selección de butacas [General (de apoyo)]</li>
</ul>
</div>
<div class="textbox">
<h2>Adrian Real del Noval</h2>
<ul>
<li>Registrarse e Iniciar sesión [Usuario Registrado]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Usuario Registrado]</li>
<li>Sobre FDI-Cines (About us) [General]</li>
<li>Términos y Condiciones [General]</li>
<li>Pantalla de Inicio (incluye promociones y estrenos) [General (de apoyo)]</li>
</ul>
</div>
</div>
</div>
<div class="column side">
@ -145,19 +137,19 @@
<h2>Práctica 2 [HTML + PHP]</h2>
<div class="bar">100%</div>
<ul>
<li>Sobre FDI-Cines (About us) [Fer && Adrián]</li>
<li>Sobre FDI-Cines (About us) [Fer]</li>
<li>Formulario de Contacto [Fer]</li>
<li>Términos y Condiciones [Fer && Adrián]</li>
<li>Términos y Condiciones [Fer ]</li>
<li>Pantalla de inicio de gerente [Marco && Óscar]</li>
</ul>
<div class="bar seventyfive">75%</div>
<ul>
<li>Pantalla de Inicio (incluye promociones y estrenos) [Fer && Adrián]</li>
<li>Pantalla de Inicio (incluye promociones y estrenos) [Fer]</li>
<li>Listado de Horarios [Fer]</li>
</ul>
<div class="bar fifty">50%</div>
<ul>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Adrián]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Fer]</li>
<li>Eliminar sesión de una película [Marco && Óscar]</li>
<li>Deshabilitar salas [Marco && Óscar]</li>
<li>Panel de inicio administrador (ver todas la funcionalidades de admin de un vistazo) [Daniel && Marian]</li>
@ -166,7 +158,7 @@
</ul>
<div class="bar twentyfive">25%</div>
<ul>
<li>Registrarse && Iniciar sesión [Adrián]</li>
<li>Registrarse && Iniciar sesión [Fer]</li>
<li>Deshabilitar asientos en una sala [Marco && Óscar]</li>
<li>Ver como >> Usuario no registrado | Usuario registrado | (Gerente: Añadir si vamos bien de tiempo) [Daniel && Marian]</li>
<li>Panel añadir/editar/eliminar promociones [Marian && Dani]</li>
@ -182,8 +174,8 @@
</ul>
<div class="bar seventyfive">75%</div>
<ul>
<li>Registrarse && Iniciar sesión [Adrián]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Adrián]</li>
<li>Registrarse && Iniciar sesión [Fer]</li>
<li>Menú y panel de Usuario (Historial compras, cambiar contraseña, datos de pago y eliminar usuario) [Fer]</li>
<li>Panel de inicio administrador (ver todas la funcionalidades de admin de un vistazo) [Daniel && Marian]</li>
<li>Panel añadir/editar/eliminar cine [Marian && Dani]</li>
<li>Panel añadir/editar/eliminar películas a la cartelera [Marian && Dani]</li>
@ -246,14 +238,20 @@
<tr>
<td>Práctica 3</td>
<td>14 de Mayo de 2021</td>
<td>EN PROCESO</td>
<td>ENTREGADO</td>
</tr>
<tr>
<td>Entrega Final</td>
<td>28 de Mayo de 2021</td>
<td>PENDIENTE</td>
<td>9 de Junio de 2021</td>
<td>ENTREGADO</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td>100%</td>
</tr>
</tfoot>
</table>
</section>

BIN
img/bocetos/plantilla.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
img/films/tmp/capmarvel.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

BIN
img/promos/promo_vuelve.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

BIN
img/tmp/capmarvel.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
img/tmp/user.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/users/admin.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
img/users/fernando.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/users/manager.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
img/users/user.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/users/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -2,6 +2,15 @@
//General Config File:
require_once(__DIR__.'/assets/php/config.php');
//Promotions:
include_once(__DIR__.'/assets/php/includes/promotion_dao.php');
$promotionsDAO = new Promotion_DAO("complucine");
$promotions = $promotionsDAO->allPromotionData();
foreach($promotions as $key=>$value){
$promotions_img[$key] = $value->getImg();
}
//Page-specific content:
$section = '<!-- Undercard -->
<section id="cartelera">
@ -11,7 +20,22 @@
</div>
</div>
</section>
';
<section id="promociones" class="row">
<div class="code">
<h2>Promociones</h2>
<section class="promotions">
<button id="retroceder">&#x23EA;</button>
<a href="promotions/" class="imagen"></a>
<button id="avanzar">&#x23E9;</button>
</section>
<section class="controls">
<button id="play">&#x25b6;</button>
<button id="stop" disabled>&#9208;</button>
</section>
</div>
</section>
';
$section.="<input type='hidden' id='promotions' value='".json_encode($promotions_img)."' />";
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';

View File

@ -1,6 +1,6 @@
<?php
include_once($prefix.'assets/php/common/user_dao.php');
include_once($prefix.'assets/php/includes/user_dao.php');
include_once($prefix.'assets/php/form.php');
class FormLogin extends Form {
@ -25,7 +25,7 @@ class FormLogin extends Form {
$html = "<div class='row'>
<fieldset id='nombre_usuario'><pre>".$htmlErroresGlobales."</pre>
<legend>Datos Personales</legend>
<input type='text' name='name' id='name' value='' placeholder='Nombre' required/><pre>".$errorNombre."</pre>
<input type='text' name='name' id='name' value='' placeholder='Nombre de Usuario' required/><pre>".$errorNombre."</pre>
<input type='password' name='pass' id='pass' value='' placeholder='Contraseña' required/><pre>".$errorPassword."</pre>
</fieldset>
<div class='actions'>
@ -40,15 +40,15 @@ class FormLogin extends Form {
protected function procesaFormulario($datos){
$result = array();
//$nombre = $this->test_input($datos['name']) ?? null;
$nombre = $datos['name'] ?? null;
$nombre = $this->test_input($datos['name']) ?? null;
//$nombre = $datos['name'] ?? null;
$nombre = strtolower($nombre);
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 8 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 8 caracteres.";
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 15 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 15 caracteres.";
}
//$password = $this->test_input($datos['pass']) ?? null;
$password = $datos['pass'] ?? null;
$password = $this->test_input($datos['pass']) ?? null;
//$password = $datos['pass'] ?? null;
if ( empty($password) || mb_strlen($password) < 4 ) {
$result['pass'] = "El password tiene que tener\n una longitud de al menos\n 4 caracteres.";
}

View File

@ -1,10 +1,11 @@
<?php
/**
* USUARIOS DE PRUEBAS:
* user | userpass
* fernando | ferpass
* manager | managerpass
* admin | adminpass
* user | userpass --> Usuario de pruebas 1.
* fernando | ferpass --> Usuario de pruebas 2.
* manager | managerpass --> Manager asociado al cine 1.
* manager2 | Manager2pass --> Manager asociado al cine 2.
* admin | adminpass --> Administrador de la aplicación.
*/
//General Config File:

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/cinema_dao.php');
include_once('../assets/php/common/cinema.php');
include_once('../assets/php/includes/cinema_dao.php');
include_once('../assets/php/includes/cinema.php');
include_once('../assets/php/form.php');
class formAddCinema extends Form{
@ -14,23 +14,24 @@ class formAddCinema extends Form{
protected function generaCamposFormulario($datos,$errores=array()){
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorName = self::createMensajeError($errores,'name','span',array('class'=>'error'));
$errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
$errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorName = self::createMensajeError($errores,'namecinema','span',array('class'=>'error'));
$errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
$errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
$html = '<div class="row"></div>
<fieldset id = "cinema_form">'.$htmlErroresGlobales.'</pre>
<legend>Añadir cine</legend>
<input type="text" name="name" id="name" placeholder="Nombre" required/><pre>'.$errorName.'</pre>
<input type="text" name="direction" id="direction" placeholder="Direccion" required/><pre>'.$errorDirection.'</pre>
<input type="text" name="phone" id="phone" placeholder="Teléfono" required/><pre>'.$errrorPhone.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir cine" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div> ';
$html = '<div class="row"></div>
<fieldset id = "cinema_form">'.$htmlErroresGlobales.'</pre>
<legend>Añadir cine</legend>
<input type="text" name="namecinema" id="namecinema" placeholder="Nombre" required/><pre>'.$errorName.'</pre>
<input type="text" name="direction" id="direction" placeholder="Direccion" required/><pre>'.$errorDirection.'</pre>
<input type="text" name="phone" id="phone" placeholder="Teléfono" required/><pre>'.$errrorPhone.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir cine" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div> ';
return $html;
}
@ -38,10 +39,10 @@ class formAddCinema extends Form{
public function procesaFormulario($datos) {
$result =array();
$name = $this->test_input($datos['name'])??null;
$name = $this->test_input($datos['namecinema'])??null;
if(empty($name)){
$result['name']= "El nombre no es válido";
$result['namecinema']= "El nombre no es válido";
}
$direction = $this -> test_input($datos['direction']) ?? null;
@ -77,7 +78,7 @@ class formAddCinema extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mc';
//$result = './?state=mc';
}
$exist->free();
}

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/film_dao.php');
include_once('../assets/php/common/film.php');
include_once('../assets/php/includes/film_dao.php');
include_once('../assets/php/includes/film.php');
include_once('../assets/php/form.php');
class formAddFilm extends Form{
@ -16,8 +16,7 @@ class formAddFilm extends Form{
}
protected function generaCamposFormulario($datos, $errores = array()){
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
@ -33,7 +32,7 @@ class formAddFilm extends Form{
<input type="number" name="duration" id="duration" placeholder="Duración" required/><pre>'.$errorDuration.'</pre>
<input type="text" name="language" id="language" placeholder="Idioma" required/><pre>'.$errorLanguage.'</pre>
<input type="text" name="description" id="description" placeholder="Descripción" required/><pre>'.$errorDescription.'</pre>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div><pre>'.$errorImage.'</pre></p>
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /></div><pre>'.$errorImage.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir pelicula" class="primary" />
@ -41,56 +40,15 @@ class formAddFilm extends Form{
</div>
</div>
</div>';
return $html;
}
protected function procesaFormulario($datos){
$result = array();
/* PROCESAR LA SUBIDA DE IMAGEN
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
//1.a) Valida el nombre del archivo
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
// 1.b) Sanitiza el nombre del archivo
//$ok = $this->sanitize_file_uploaded_name($nombre);
//
// 1.c) Utilizar un id de la base de datos como nombre de archivo
// 2. comprueba si la extensión está permitida
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
// 3. comprueba el tipo mime del archivo correspode a una imagen image
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
if ( !move_uploaded_file($tmp_name, "../img/films/{$nombre}") ) {
$result['img'] = 'Error al mover el archivo';
}
//if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
// $result['img'] = 'Error al mover el archivo';
//}
}else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
}
} else {
$result['img'] = 'Error al subir el archivo.';
}
*/
$tittle = $this->test_input($datos['tittle']) ?? null;
$t = $this->test_input($datos['tittle']) ?? null;
$tittle = strtolower(str_replace(" ", "_", $t));
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle)
if ( empty($tittle) ) {
$result['tittle'] = "El título no es válido";
@ -116,25 +74,45 @@ class formAddFilm extends Form{
if (count($result) === 0) {
$bd = new Film_DAO("complucine");
//FALTARIA SUBIR LA IMAGEN
$exist = $bd-> GetFilm($tittle,$language);
if(mysqli_num_rows($exist) != 0){
$result[] = "Ya existe una nueva pelicula con el mismo titulo e idioma.";
}
else{
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
//1.a) Valida el nombre del archivo
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
/* PROCESAR SUBIDA DE IMAGEN
$tmp_name = $_FILES['img']['tmp_name'];
if ( !move_uploaded_file($tmp_name, "../img/films/{$nombre}") ) {
$result[] = 'Error al mover el archivo';
}
//else if ( !copy(DIR_ALMACEN. "/{$nombre}", DIR_ALMACEN_PROTEGIDO. "/{$nombre}") ) {
// $result[] = 'Error al mover el archivo';
//}
*/
//else {
$bd->createFilm(null, $tittle,$duration,$language,$description, null); //Null hasta tener $nombre
// 1.b) Sanitiza el nombre del archivo
//$ok = $this->sanitize_file_uploaded_name($nombre);
//
// 1.c) Utilizar un id de la base de datos como nombre de archivo
// 2. comprueba si la extensión está permitida
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
// 3. comprueba el tipo mime del archivo correspode a una imagen image
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
//finfo_close($finfo);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
$nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
if ( !move_uploaded_file($tmp_name, "../img/films/{$nombreBd}") ) {
$result['img'] = 'Error al mover el archivo';
}
//if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
// $result['img'] = 'Error al mover el archivo';
//}
//$nombreBd = str_replace("_", " ", $nombre);
$bd->createFilm(null, $tittle,$duration,$language,$description, $nombreBd); //Null hasta tener $nombre
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
@ -147,8 +125,14 @@ class formAddFilm extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mf';
//}
//$result = './?state=mf';
}else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
}
} else {
$result['img'] = 'Error al subir el archivo.';
}
}
$exist->free();

View File

@ -1,10 +1,10 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/manager_dao.php');
include_once('../assets/php/common/manager.php');
include_once('../assets/php/common/cinema_dao.php');
include_once('../assets/php/common/user_dao.php');
include_once('../assets/php/includes/manager_dao.php');
include_once('../assets/php/includes/manager.php');
include_once('../assets/php/includes/cinema_dao.php');
include_once('../assets/php/includes/user_dao.php');
include_once('../assets/php/form.php');
class formAddManager extends Form{
@ -17,14 +17,16 @@ class formAddManager extends Form{
}
protected function generaCamposFormulario($datos, $errores = array()){
$html = "";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
$html = '<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
$html .= '<h3>AÑADIR GERENTE</h3>
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Selecciona usuario.</legend><pre>'.$errorId.'</pre>'
.$this->showUsers().
'</fieldset>
@ -38,7 +40,7 @@ class formAddManager extends Form{
</div>
</div>
';
}
return $html;
}
@ -78,7 +80,7 @@ class formAddManager extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mg';
//$result = './?state=mg';
}
$exist->free();
@ -105,7 +107,9 @@ class formAddManager extends Form{
$html='';
for($i = 0; $i < count($users); $i++){
$html .= '
<input type="radio" name="id" value='.$ids[$i].' > <label> '.$ids[$i].', '.$usernames[$i].', '.$usernames[$key].'
<input type="radio" class="content-input" name="id" value="'.$ids[$i].'" id="'.$ids[$i].'"><label class="efe" for="'.$ids[$i].'"> '.$ids[$i].', '.$usernames[$i].
', '.$usernames[$key].
'
</label>
';
}
@ -129,7 +133,7 @@ class formAddManager extends Form{
$html = '';
for($i = 0; $i < count($cinemas); $i++){
$html.= '
<input type="radio" name="idcinema" value='.$ids[$i].' > <label> '.$ids[$i].', '.$names[$i].'
<input type="radio" class="content-input" name="idcinema" value="'.$ids[$i].'" id="'.$ids[$i].'"><label class="efe" for="'.$ids[$i].'"> '.$ids[$i].', '.$names[$i].'
</label>
';
}

View File

@ -1,22 +1,21 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/promotion_dao.php');
include_once('../assets/php/common/promotion.php');
include_once('../assets/php/includes/promotion_dao.php');
include_once('../assets/php/includes/promotion.php');
include_once('../assets/php/form.php');
class formAddPromotion extends Form{
//Constants:
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() {
$op = array("action" => "./?state=mp");
parent::__construct('formAddPromotion', $op);
$options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data');
parent::__construct('formAddPromotion', $options);
}
protected function generaCamposFormulario($datos, $errores = array()){
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
@ -26,13 +25,14 @@ class formAddPromotion extends Form{
//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$html = '<div class="row">
<h3>AÑADIR PROMOCIÓN</h3>
<fieldset id="promotion_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>AÑADIR PROMOCIÓN</legend>
<input type="text" name="tittle" id="tittle" placeholder="Título" required/><pre>'.$errorTittle.'</pre>
<input type="text" name="description" id="description" placeholder="Descripción" required/><pre>'.$errorDescription.'</pre>
<input type="text" name="code" id="code" placeholder="Codigo" required/><pre>'.$errorCode.'</pre>
<input type="text" name="active" id="active" placeholder="Activo" required/><pre>'.$errorActive.'</pre>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
<input type="text" name="active" id="active" placeholder="Activo (si/no)" required/><pre>'.$errorActive.'</pre>
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /></div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir promocion" class="primary" />
@ -40,14 +40,15 @@ class formAddPromotion extends Form{
</div>
</div>
</div>';
return $html;
}
protected function procesaFormulario($datos){
$result = array();
$tittle = $this->test_input($datos['tittle']) ?? null;
$t = $this->test_input($datos['tittle']) ?? null;
$tittle = strtolower(str_replace(" ", "_", $t));
if ( empty($tittle) ) {
$result['tittle'] = "El título no es válido";
@ -65,23 +66,62 @@ class formAddPromotion extends Form{
$result['code'] = "El idioma no es válido";
}
$active = $this->test_input($datos['active']) ?? null;
$active = strtolower($this->test_input($datos['active'])) ?? null;
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
if ( $active>1 ||$active<0 ) {
$result['active'] = "La descripcion no es válida";
if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
if ( strcmp($active,"si") == 0 ) {
$boolean = 1;
}
else {
$boolean = 0;
}
}
else {
$result['active'] = "El valor activo debe ser si/no";
}
if (count($result) === 0) {
$bd = new Promotion_DAO("complucine");
//FALTARIA SUBIR LA IMAGEN
$exist = $bd-> GetPromotion($code);
if(mysqli_num_rows($exist) != 0){
$result[] = "Ya existe una nueva promocion con el mismo codigo.";
}
else{
$bd->createPromotion(null, $tittle,$description,$code,$active);
$_SESSION['message'] = "<div class='row'>
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
//1.a) Valida el nombre del archivo
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
// 1.b) Sanitiza el nombre del archivo
//$ok = $this->sanitize_file_uploaded_name($nombre);
//
// 1.c) Utilizar un id de la base de datos como nombre de archivo
// 2. comprueba si la extensión está permitida
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
// 3. comprueba el tipo mime del archivo correspode a una imagen image
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
//finfo_close($finfo);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
$nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
if ( !move_uploaded_file($tmp_name, "../img/promos/{$nombreBd}") ) {
$result['img'] = 'Error al mover el archivo';
}
//if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
// $result['img'] = 'Error al mover el archivo';
//}
//$nombreBd = str_replace("_", " ", $nombre);
$bd->createPromotion(null, $tittle,$description,$code,$boolean, $nombreBd);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
@ -93,14 +133,29 @@ class formAddPromotion extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mp';
//$result = './?state=mp';
}else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
}
}
else {
$result['img'] = 'Error al subir el archivo.';
}
}
$exist->free();
}
return $result;
}
private function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
}
private function check_file_uploaded_length ($filename) {
return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
}
}

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/cinema_dao.php');
include_once('../assets/php/common/cinema.php');
include_once('../assets/php/includes/cinema_dao.php');
include_once('../assets/php/includes/cinema.php');
include_once('../assets/php/form.php');
class formDeleteCinema extends Form{
@ -13,11 +13,12 @@ class formDeleteCinema extends Form{
}
protected function generaCamposFormulario($datos,$errores=array()){
$html ="";
if (!isset($_SESSION['message'])) {
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$html = '<div class="column side"></div>
$html .= '
<fieldset id = "cinema_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
@ -28,8 +29,8 @@ class formDeleteCinema extends Form{
<div class="actions">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
<input type="submit" id="submit" value="Cancelar" class="primary" />
</div>
</div> ';
</div>';
}
return $html;
}
@ -45,7 +46,7 @@ class formDeleteCinema extends Form{
if(count($result)===0){
$bd = new Cinema_DAO('complucine');
$exist = $bd -> cinemaData($id);
$exist = $bd -> existCinema($id);
if(mysqli_num_rows($exist)==1){
$bd->deleteCinema($id);
$_SESSION['message'] = "<div class='row'>
@ -60,7 +61,7 @@ class formDeleteCinema extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mc';
//$result = './?state=mc';
}
$exist->free();
}

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/film_dao.php');
include_once('../assets/php/common/film.php');
include_once('../assets/php/includes/film_dao.php');
include_once('../assets/php/includes/film.php');
include_once('../assets/php/form.php');
class formDeleteFilm extends Form{
@ -11,11 +11,13 @@ class formDeleteFilm extends Form{
public function __construct() {
$options = array("action" => "./?state=mf");
parent::__construct('formDeleteFilm', $options);
}
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
@ -26,7 +28,7 @@ class formDeleteFilm extends Form{
//$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$html = '<div class="row">
$html .= '<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
@ -41,7 +43,7 @@ class formDeleteFilm extends Form{
<input type="submit" id="submit" value="Cancelar" class="primary" />
</div>
</div>';
}
return $html;
}
@ -54,7 +56,7 @@ class formDeleteFilm extends Form{
if (count($result) === 0) {
$bd = new Film_DAO("complucine");
$exist = $bd-> FilmData($id);
$exist = $bd-> existFilm($id);
if( mysqli_num_rows($exist) == 1){
$bd->deleteFilm($id);
$_SESSION['message'] = "<div class='row'>
@ -69,7 +71,7 @@ class formDeleteFilm extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mf';
//$result = './?state=mf';
}
else{
$result[] = "La pelicula seleccionada no existe.";

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/manager_dao.php');
include_once('../assets/php/common/manager.php');
include_once('../assets/php/includes/manager_dao.php');
include_once('../assets/php/includes/manager.php');
include_once('../assets/php/form.php');
class formDeleteManager extends Form{
@ -15,14 +15,16 @@ class formDeleteManager extends Form{
}
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
//$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
$html = '<div class="row">
$html .= '<div class="row">
<h3>ELIMINAR GERENTE</h3>
<fieldset id="manager_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este gerente?</legend><pre>'.$errorId.'</pre>
<input type="hidden" name="id" value='.$_POST['id'].'/>
@ -37,7 +39,7 @@ class formDeleteManager extends Form{
<input type="submit" id="submit" value="Cancelar" class="primary" />
</div>
</div>';
}
return $html;
}
@ -64,7 +66,7 @@ class formDeleteManager extends Form{
</div>
<div class='column side'></div>
</div>";
$result = './?state=mg';
//$result = './?state=mg';
}
else{
$result[] = "ERROR. No existe un manager con ese ID";

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/promotion_dao.php');
include_once('../assets/php/common/promotion.php');
include_once('../assets/php/includes/promotion_dao.php');
include_once('../assets/php/includes/promotion.php');
include_once('../assets/php/form.php');
class formDeletePromotion extends Form{
@ -15,7 +15,8 @@ class formDeletePromotion extends Form{
}
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
@ -26,7 +27,8 @@ class formDeletePromotion extends Form{
//$errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$html = '<div class="row">
$html .= '<div class="row">
<h3>ELIMINAR PROMOCIÓN</h3>
<fieldset id="promotion_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar esta promocion?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
@ -35,7 +37,6 @@ class formDeletePromotion extends Form{
<p>Description:'.$_POST['description'].'</p>
<p>Codigo: '.$_POST['code'].'</p>
<p>Activa: '.$_POST['active'].'</p>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Eliminar" name="delete_promotion" class="primary" />
@ -43,7 +44,7 @@ class formDeletePromotion extends Form{
</div>
</div>
</div>';
}
return $html;
}
@ -58,7 +59,7 @@ class formDeletePromotion extends Form{
if (count($result) === 0) {
$bd = new Promotion_DAO("complucine");
//FALTARIA SUBIR LA IMAGEN
$exist = $bd-> promotionData($id);
if(mysqli_num_rows($exist) == 1){
$bd->deletePromotion($id);
@ -74,7 +75,7 @@ class formDeletePromotion extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mp';
//$result = './?state=mp';
}
else{

View File

@ -1,8 +1,8 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/cinema_dao.php');
include_once('../assets/php/common/cinema.php');
include_once('../assets/php/includes/cinema_dao.php');
include_once('../assets/php/includes/cinema.php');
include_once('../assets/php/form.php');
class formEditCinema extends Form{
@ -13,28 +13,31 @@ class formEditCinema extends Form{
}
protected function generaCamposFormulario($datos,$errores=array()){
$html ="";
if(!isset($_SESSION['message'])) {
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId= self::createMensajeError($errores,'id','span',array('class'=>'error'));
$errorName = self::createMensajeError($errores,'name','span',array('class'=>'error'));
$errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
$errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId= self::createMensajeError($errores,'id','span',array('class'=>'error'));
$errorName = self::createMensajeError($errores,'name','span',array('class'=>'error'));
$errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
$errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
$html = '<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Datos de cine </legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="text" name="name" value="'.$_POST['name'].'" required/><pre>'.$errorName.'</pre>
<input type="text" name="direction" value="'.$_POST['direction'].'"required/><pre>'.$errorDirection.'</pre>
<input type="text" name="phone" value="'.$_POST['phone'].'"required/><pre>'.$errrorPhone.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
$html .= '<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Datos de cine </legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="text" name="name" value="'.$_POST['name'].'" required/><pre>'.$errorName.'</pre>
<input type="text" name="direction" value="'.$_POST['direction'].'"required/><pre>'.$errorDirection.'</pre>
<input type="text" name="phone" value="'.$_POST['phone'].'"required/><pre>'.$errrorPhone.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</div>
</div>
</div> ';
</div> ';
}
return $html;
}
@ -68,7 +71,7 @@ class formEditCinema extends Form{
if(count($result)===0){
$bd = new Cinema_DAO('complucine');
$exist = $bd -> cinemaData($id);
$exist = $bd -> existCinema($id);
if(mysqli_num_rows($exist)==1){
$bd->editCinema($id,$name,$direction,$phone);
$_SESSION['message'] = "<div class='row'>
@ -83,7 +86,7 @@ class formEditCinema extends Form{
<div class='column side'></div>
</div>
";
$result = './?state=mc';
//$result = './?state=mc';
}
else{
$result[] = "El cine seleccionado no existe.";

View File

@ -1,22 +1,24 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/film_dao.php');
include_once('../assets/php/common/film.php');
include_once('../assets/php/includes/film_dao.php');
include_once('../assets/php/includes/film.php');
include_once('../assets/php/form.php');
class formEditFilm extends Form{
//Constants:
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() {
$options = array("action" => "./?state=mf");
public function __construct() {
$options = array("action" => "./?state=mf", 'enctype' => 'multipart/form-data');
parent::__construct('formEditFilm', $options);
}
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
@ -25,9 +27,9 @@ class formEditFilm extends Form{
$errorDuration = self::createMensajeError($errores, 'duration', 'span', array('class' => 'error'));
$errorLanguage = self::createMensajeError($errores, 'language', 'span', array('class' => 'error'));
$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$errorImage = self::createMensajeError($errores, 'img', 'span', array('class' => 'error'));
$html = '
$html .= '
<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Datos de pelicula</legend>
@ -36,8 +38,8 @@ class formEditFilm extends Form{
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' required/><pre>'.$errorDuration.'</pre>
<input type="text" name="language" id="language" value="'.$_POST['language'].'" required/><pre>'.$errorLanguage.'</pre>
<input type="text" name="description" id="description" value="'.$_POST['description'].'"required/><pre>'.$errorDescription.'</pre>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
</fieldset>
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /></div><pre>'.$errorImage.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="edit_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
@ -47,7 +49,7 @@ class formEditFilm extends Form{
</div>
<div class="column side"></div>
';
}
return $html;
}
@ -59,7 +61,8 @@ class formEditFilm extends Form{
$result[] = "La pelicula seleccionada no existe.";
}
$tittle = $this->test_input($datos['tittle']) ?? null;
$t = $this->test_input($datos['tittle']) ?? null;
$tittle = strtolower(str_replace(" ", "_", $t));
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle)
if ( empty($tittle) ) {
$result['tittle'] = "El título no es válido";
@ -82,26 +85,81 @@ class formEditFilm extends Form{
if ( empty($language)) {
$result['language'] = "La descripcion no es válida";
}
if (count($result) === 0) {
$bd = new Film_DAO("complucine");
$exist = $bd-> FilmData($id);
$exist = $bd-> existFilm($id);
if( mysqli_num_rows($exist) == 1){
$bd->editFilm($id, $tittle, $duration, $language, $description, $img = null /* Cambiar cuando se ñaladan las imágenes */);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha editado la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
//1.a) Valida el nombre del archivo
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
// 1.b) Sanitiza el nombre del archivo
//$ok = $this->sanitize_file_uploaded_name($nombre);
//
// 1.c) Utilizar un id de la base de datos como nombre de archivo
// 2. comprueba si la extensión está permitida
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
// 3. comprueba el tipo mime del archivo correspode a una imagen image
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
//finfo_close($finfo);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
$nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
if ( !move_uploaded_file($tmp_name, "../img/films/{$nombreBd}") ) {
$result['img'] = 'Error al mover el archivo';
}
//if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
// $result['img'] = 'Error al mover el archivo';
//}
//$nombreBd = str_replace("_", " ", $nombre);
$bd->editFilm($id, $tittle, $duration, $language, $description, $nombreBd);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha editado la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
<div class='column side'></div>
</div>
";
$result = './?state=mf';
";
//$result = './?state=mf';
}else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
}
} else {
$bd->editFilmNoImg($id, $tittle, $duration, $language, $description);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha editado la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
//$result = './?state=mf';
}
}
else{
$result[] = "La pelicula seleccionada no existe.";
@ -110,6 +168,13 @@ class formEditFilm extends Form{
}
return $result;
}
private function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
}
private function check_file_uploaded_length ($filename) {
return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
}
}
?>

View File

@ -1,9 +1,9 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/manager_dao.php');
include_once('../assets/php/common/manager.php');
include_once('../assets/php/common/cinema_dao.php');
include_once('../assets/php/includes/manager_dao.php');
include_once('../assets/php/includes/manager.php');
include_once('../assets/php/includes/cinema_dao.php');
include_once('../assets/php/form.php');
class formEditManager extends Form{
@ -17,15 +17,16 @@ class formEditManager extends Form{
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
$html = '<div class="row">
$html .= '
<h1>EDITAR GERENTE ID:'.$_POST['id'].'</h1>
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<fieldset><pre>'.$htmlErroresGlobales.'</pre>
<legend>Selecciona cine.</legend><pre>'.$errorIdCinema.'</pre>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>'
.$this->showCinemas().
@ -34,9 +35,8 @@ class formEditManager extends Form{
<input type="submit" id="submit" value="Seleccionar" name="edit_manager" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</div>';
}
return $html;
}
@ -70,7 +70,7 @@ class formEditManager extends Form{
</div>
<div class='column side'></div>
</div>";
$result = './?state=mg';
//$result = './?state=mg';
}
else{
@ -100,7 +100,7 @@ class formEditManager extends Form{
$html = '';
for($i = 0; $i < count($cinemas); $i++){
$html.= '
<input type="radio" name="idcinema" value='.$ids[$i].' > <label> '.$ids[$i].', '.$names[$i].'
<input type="radio" class="content-input" name="idcinema" value="'.$ids[$i].'" id="'.$ids[$i].'"><label class="efe" for="'.$ids[$i].'"> '.$ids[$i].', '.$names[$i].'
</label>
';
}

View File

@ -1,21 +1,24 @@
<?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/promotion_dao.php');
include_once('../assets/php/common/promotion.php');
include_once('../assets/php/includes/promotion_dao.php');
include_once('../assets/php/includes/promotion.php');
include_once('../assets/php/form.php');
class formEditPromotion extends Form{
//Constants:
//Constants:
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() {
$op = array("action" => "./?state=mp");
parent::__construct('formEditPromotion', $op);
public function __construct() {
$options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data');
parent::__construct('formEditPromotion', $options);
}
protected function generaCamposFormulario($datos, $errores = array()){
$html ="";
if (!isset($_SESSION['message'])) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
@ -24,18 +27,18 @@ class formEditPromotion extends Form{
$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
$errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
$errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$errorImg = self::createMensajeError($errores, 'img', 'span', array('class' => 'error'));
$html = '<div class="row">
<fieldset id="promotion_form"><pre>'.$htmlErroresGlobales.'</pre>
<fieldset id="film_form">
$html .= '<div class="row">
<h3>EDITAR PROMOCIÓN</h3>
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Datos de promocion</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="text" name="tittle" id="tittle"value="'.$_POST['tittle'].'"required/><pre>'.$errorTittle.'</pre>
<input type="text" name="description" id="description" value="'.$_POST['description'].'" required/><pre>'.$errorDescription.'</pre>
<input type="text" name="code" id="code" value="'.$_POST['code'].'" required/><pre>'.$errorCode.'</pre>
<input type="text" name="active" id="active" value="'.$_POST['active'].'"required/><pre>'.$errorActive.'</pre>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /><pre>'.$errorImg.'</pre></div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar promocion" name="edit_promotion" class="primary" />
@ -43,7 +46,7 @@ class formEditPromotion extends Form{
</div>
</div>
</div>';
}
return $html;
}
@ -55,8 +58,8 @@ class formEditPromotion extends Form{
$result['id'] = "La promoción seleccionada no existe.";
}
$tittle = $this->test_input($datos['tittle']) ?? null;
$t = $this->test_input($datos['tittle']) ?? null;
$tittle = strtolower(str_replace(" ", "_", $t));
if ( empty($tittle) ) {
$result['tittle'] = "El título no es válido";
}
@ -73,32 +76,92 @@ class formEditPromotion extends Form{
$result['code'] = "El idioma no es válido";
}
$active = $this->test_input($datos['active']) ?? null;
$active = strtolower($this->test_input($datos['active'])) ?? null;
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
if ( $active>1 ||$active<0 ) {
$result['active'] = "La descripcion no es válida";
if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
if ( strcmp($active,"si") == 0 ) {
$boolean = 1;
}
else {
$boolean = 0;
}
}
else {
$result['active'] = "El valor activo debe ser si/no";
}
if (count($result) === 0) {
$bd = new Promotion_DAO("complucine");
//FALTARIA SUBIR LA IMAGEN
$exist = $bd-> promotionData($id);
if(mysqli_num_rows($exist) == 1){
$bd->editPromotion($id, $tittle,$description,$code,$active);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha modificado la promocion correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mp'><button>Cerrar Mensaje</button></a>
$ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
if ( $ok ) {
$archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name'];
//1.a) Valida el nombre del archivo
$ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
// 1.b) Sanitiza el nombre del archivo
//$ok = $this->sanitize_file_uploaded_name($nombre);
//
// 1.c) Utilizar un id de la base de datos como nombre de archivo
// 2. comprueba si la extensión está permitida
$ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
// 3. comprueba el tipo mime del archivo correspode a una imagen image
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
$ok = preg_match('/image\/*./', $mimeType);
//finfo_close($finfo);
if ( $ok ) {
$tmp_name = $_FILES['archivo']['tmp_name'];
$nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
if ( !move_uploaded_file($tmp_name, "../img/promos/{$nombreBd}") ) {
$result['img'] = 'Error al mover el archivo';
}
//if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
// $result['img'] = 'Error al mover el archivo';
//}
//$nombreBd = str_replace("_", " ", $nombre);
$bd->editPromotion($id, $tittle,$description,$code,$boolean, $nombreBd);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha modificado la promocion correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mp'><button>Cerrar Mensaje</button></a>
</div>
</div>
</div>
<div class='column side'></div>
</div>
";
$result = './?state=mp';
<div class='column side'></div>
</div>
";
//$result = './?state=mp';
}else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
}
} else {
$bd->editPromotionNoImg($id, $tittle,$description,$code,$boolean);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha modificado la promocion correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mp'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
//$result = './?state=mp';
}
}
else{
@ -108,7 +171,12 @@ class formEditPromotion extends Form{
}
return $result;
}
private function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
}
private function check_file_uploaded_length ($filename) {
return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
}
}

View File

@ -4,55 +4,107 @@
require_once($prefix.'panel_admin/panelAdmin.php');
$login=false;
if(isset($_SESSION["login"]) && $_SESSION["rol"] == "admin") $login = true;
if(isset($_GET['state'])) {
$panel = new Panel($_GET['state'], $login);
}
else {
$panel = new Panel('', $login);
}
?>
<!DOCTYPE HTML>
<!--
Práctica - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
$template->print_main();
?>
if(($_SESSION["login"]) && $_SESSION["rol"] == "admin"){
if(!isset($_GET["state"]))
$_GET["state"] =null;
switch($_GET["state"]){
case 'mc': if(isset($_POST['edit_cinema'])) {
$reply=AdminPanel::editCinema();
}
else if(isset($_POST['delete_cinema'])) {
$reply=AdminPanel::deleteCinema();
}
else {
if(isset($_GET["cinema"])){
if(isset($_GET["cinema"])){
if(isset($_GET["number"])) {
$reply = AdminPanel::showSessions($_GET["cinema"]);
}
else {
$reply = AdminPanel::showHalls($_GET["cinema"]);
}
}
}
else {
$reply=AdminPanel::addCinema();
$reply.= ($template->print_cinemas());
}
};
break;
case 'mf': if(isset($_POST['edit_film'])) {
$reply=AdminPanel::editFilm();
}
else if(isset($_POST['delete_film'])) {
$reply=AdminPanel::deleteFilm();
}
else {
$reply=AdminPanel::addFilm();
$reply.= $template->print_fimls();
};
break;
case 'mp':
if(isset($_POST['edit_promotion'])) {
$reply=AdminPanel::editPromotion();
}
else if(isset($_POST['delete_promotion'])) {
$reply=AdminPanel::deletePromotion();
}
else {
$reply=AdminPanel::addPromotion();
$reply.=AdminPanel::print_promotions();
};
break;
case 'mg': if(isset($_POST['edit_manager'])) {
$reply=AdminPanel::editManager();
}
else if(isset($_POST['delete_manager'])) {
$reply=AdminPanel::deleteManager();
}
else if(isset($_POST['add_manager'])) {
$reply=AdminPanel::addManager();
}
else {
$reply=AdminPanel::print_managers();
$reply.=AdminPanel::showAddBotton();
};
break;
case 'un':
$reply=AdminPanel::see_like_user();
break;
case 'ur':
$reply=AdminPanel::see_like_registed_user();
break;
case 'ag':
$reply=AdminPanel::see_like_manager();
break;
default:
$reply=AdminPanel:: panel();
break;
}
}
else{
$reply ='<div class="column side"></div>
<div class="column middle">
<div class="code info">
<h1>No tienes permiso de administrador.</h1><hr />
<p>Inicia Sesión con una cuenta de administtación.</p>
<a href="'.$prefix.'login/"><button>Iniciar Sesión</button></a>
</div>
</div>
<div class="column side"></div>'."\n";
}
$section = '<!-- Manager Admin -->
<section id="admin_panel">
<!-- Contents -->
<div class="row">
'.$reply.'
</div>
</section>';
<!-- Panel -->
<div class="row">
<!-- Panel Menu -->
<?php
$template->print_panelMenu($_SESSION["rol"]);
?>
<!-- Contents -->
<div class="row">
<?php
$template->print_msg();
$panel->showPanel($template);
?>
</div>
</div>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>
require RAIZ_APP.'/HTMLtemplate.php';
?>

View File

@ -1,122 +1,61 @@
<?php
class Panel {
class AdminPanel {
private $state;
private $login;
private $prefix;
function __construct($panel, $login){
$this->state = $panel;
$this->login= $login;
}
function __construct(){}
function showPanel($template) {
$this->prefix = $template->get_prefix();
if($this->login){
switch($this->state) {
case 'mc': if(isset($_POST['edit_cinema'])) {
$this->editCinema();
}
else if(isset($_POST['delete_cinema'])) {
$this->deleteCinema();
}
else {
$this-> addCinema();
echo ($template->print_cinemas());
};
break;
case 'mf': if(isset($_POST['edit_film'])) {
$this->editFilm();
}
else if(isset($_POST['delete_film'])) {
$this->deleteFilm();
}
else {
$this->addFilm();
echo( $template->print_fimls());
};
break;
case 'mp':
if(isset($_POST['edit_promotion'])) {
$this->editPromotion();
}
else if(isset($_POST['delete_promotion'])) {
$this->deletePromotion();
}
else {
$this->addPromotion();
$this->print_promotions();
};
break;
case 'mg': if(isset($_POST['edit_manager'])) {
$this->editManager();
}
else if(isset($_POST['delete_manager'])) {
$this->deleteManager();
}
else if(isset($_POST['add_manager'])) {
$this->addManager();
}
else {
$this->showAddBotton();
$this->print_managers();
};
break;
case 'un': echo"<div class='code info'><h1>En construcción</h1><hr /></div>"; break;
case 'ur': echo"<div class='code info'><h1>En construcción</h1><hr /></div>"; break;
case 'ag': echo"<div class='code info'><h1>En construcción</h1><hr /></div>"; break;
default: echo '<div class="code info">
<h1>Bienvenido al Panel de Administrador.</h1>
<hr />
</div>'."\n"; break;
}
}
else {
echo '<div class="column side"></div>
<div class="column middle">
<div class="code info">
<h1>No tienes permiso de administrador.</h1><hr />
<p>Inicia Sesión con una cuenta de administtación.</p>
<a href="'.$this->prefix.'login/"><button>Iniciar Sesión</button></a>
</div>
</div>
<div class="column side"></div>'."\n";
}
}
function getTemplate(){
return $this->template;
}
static function panel(){
include_once('../assets/php/includes/user.php');
$name = strtoupper(unserialize($_SESSION['user'])->getName());
$email = unserialize($_SESSION['user'])->getEmail();
$userPic = USER_PICS.strtolower($name).".jpg";
return $reply= '<div class="code info">
<h1>Bienvenido al Panel de Administrador.</h1>
<hr />
<img src='.$userPic.' alt="user_profile_picture"/>
<h3>'.strftime("%A %e de %B de %Y | %H:%M").'</h3>
<p>Administrador: '.$name.'</p>
<p>Email empresarial: '.$email.'</p>
</div>'."\n";
}
//Functions FILMS
function addFilm(){
static function addFilm(){
include_once('./includes/formAddFilm.php');
$formAF = new formAddFilm();
$htmlAForm = $formAF->gestiona();
echo '<!-- Add film -->
return $reply= '<!-- Add film -->
<div class="column side"></div>
<div class="column middle">
'.$htmlAForm.'
</div>'."\n";
'.$htmlAForm."\n";
}
function deleteFilm() {
static function deleteFilm() {
include_once('./includes/formDeleteFilm.php');
$formDF = new formDeleteFilm();
$htmlDForm = $formDF->gestiona();
echo '<!-- Add film -->
return $reply= '<!-- Add film -->
<div class="column side"></div>
<div class="column middle">
'.$htmlDForm.'
</div>'."\n";
}
function editFilm() {
static function editFilm() {
include_once('./includes/formEditFilm.php');
$formEF = new formEditFilm();
$htmlDForm = $formEF->gestiona();
echo '<!-- Add film -->
return $reply= '<!-- Add film -->
<div class="column side"></div>
<div class="column middle">
'.$htmlDForm.'
@ -124,44 +63,154 @@
}
//Functions Cinemas
function addCinema(){
static function addCinema(){
include_once('./includes/formAddCinema.php');
$formAC = new formAddCinema();
$htmlAForm = $formAC->gestiona();
echo '<!-- Add cinema -->
return $reply= '<!-- Add cinema -->
<div class="column side"></div>
<div class="column middle">
'.$htmlAForm.'
</div>'."\n";
}
function deleteCinema() {
static function deleteCinema() {
include_once('./includes/formDeleteCinema.php');
$formDC = new formDeleteCinema();
$htmlDForm = $formDC->gestiona();
echo '<!-- Delete cinema -->
return $reply= '<!-- Delete cinema -->
<div class="column side"></div>
<div class="column middle">
'.$htmlDForm.'
</div>'."\n";
}
function editCinema() {
static function editCinema() {
include_once('./includes/formEditCinema.php');
$formEC = new formEditCinema();
$htmlDForm = $formEC->gestiona();
echo '<!-- Edit cinema -->
return $reply= '<!-- Edit cinema -->
<div class="column side"></div>
<div class="column middle">
'.$htmlDForm.'
</div>'."\n";
}
static function showHalls($idCinema) {
include_once('../assets/php/includes/hall.php');
include_once('../assets/php/includes/hall_dao.php');
$panel = '<div class="column side"></div>
<div class="column middle">';
$listhall = Hall::getListHalls($idCinema);
if(!$listhall){
$panel .= "<h2> No hay ninguna sala en este cine";
}else{
$panel .= '
<div class="row">
<ul class="tablelist col3">
<li class="title"> Sala </li>
<li class="title"> Asientos </li>
<li class="title"> Sesión </li>
';
$parity = "odd";
foreach($listhall as $hall){
$panel .='<div class="'.$parity.'">
<li> '. $hall->getNumber().'</li>
<li> '.$hall->getTotalSeats().' </li>
</a>
<a href="?state=mc&cinema='.$idCinema.'&number=1">
<li> Sesiones </li>
</a>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
}
$panel.='
</ul>';
}
$panel.='
</div>
<div class="column side"></div>';
return $panel;
}
static function showSessions($idCinema){
include_once('../assets/php/includes/hall.php');
include_once('../assets/php/includes/hall_dao.php');
include_once('../assets/php/includes/session_dao.php');
include_once('../assets/php/includes/session.php');
//Base filtering values
$date = $_POST['date'] ?? $_GET['date'] ?? date("Y-m-d");
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
//Session filter
$panel='<div class = "column left">
<form method="post" id="filter" action="?state=mc&cinema=1&number=1">
<input type="date" name="date" value="'.$date.'" min="2021-01-01" max="2031-12-31">
<select name="hall" class="button large">';
foreach(Hall::getListHalls($idCinema) as $hll){
if($hll->getNumber() == $hall){
$panel.= '
<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
}else{
$panel.= '
<option value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
}
}
$panel.='
</select>
<input type="submit" name="filter" value="Filtrar" class="button large"/>
</form>
</div>
';
//Session list
$panel .=' <div class = "column right">';
$sessions = Session::getListSessions($hall,$idCinema,$date);
if($sessions) {
$panel .='
<form method="post" action="./?state=edit_session">
<table class="alt">
<thead>
<tr>
<th>Hora</th>
<th>Pelicula</th>
<th>Formato</th>
<th>Precio</th>
</tr>
</thead>
<tbody>';
foreach($sessions as $session){
$film = Session::getThisSessionFilm($session->getIdfilm());
$panel .='
<tr>
<td> '.date("H:i", strtotime( $session->getStartTime())).' </td>
<td> '. str_replace('_', ' ', $film["tittle"]) .' </td>
<td> '.$session->getFormat().' </td>
<td> '.$session->getSeatPrice().' </td>
</tr>';
}
$panel.='
</tbody>
</table>
</form>';
} else {
$panel.=' <h3> No hay ninguna sesion </h3>';
}
$panel.='</div>';
return $panel;
}
//Functions MANAGERS
function print_managers(){
include_once('../assets/php/common/manager_dao.php');
include_once('../assets/php/common/manager.php');
static function print_managers(){
include_once('../assets/php/includes/manager_dao.php');
include_once('../assets/php/includes/manager.php');
$manager = new Manager_DAO("complucine");
$managers = $manager->allManagersData();
$ids = array();
@ -169,7 +218,10 @@
$usernames = array();
$email = array();
$rol = array();
if(is_array($managers)){
if(!is_array($managers)){
$reply = "<h2> No hay ningun manager</h2>";
}
else{
foreach($managers as $key => $value){
$ids[$key] = $value->getId();
$idscinemas[$key] = $value->getIdcinema();
@ -177,38 +229,34 @@
$email[$key] = $value->getEmail();
$rol[$key] = $value->getRoll();
}
}
echo "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>IdCinema</th>
<th>Nombre</th>
<th>Email</th>
<th>Rol</th>
</tr>
</thead>
<tbody>
$reply= "<div class='row'>
<ul class ='tablelist col7'>
<li class='title'>Id</li>
<li class='title'>IdCinema</li>
<li class='title'>Nombre</li>
<li class='title'>Email</li>
<li class='title'>Rol</li>
<li class='title'>Editar</li>
<li class='title'>Eliminar</li>
";
if(is_array($managers)){
$parity = "odd";
for($i = 0; $i < count($managers); $i++){
echo '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $idscinemas[$i] .'</td>
<td>'. $usernames[$i] .'</td>
<td>'. $email[$i] .'</td>
<td>'. $rol[$i] .'</td>
<td>
$reply.= '
<div class="'.$parity.'">
<li>'. $ids[$i] .'</li>
<li>'. $idscinemas[$i] .'</li>
<li>'. $usernames[$i] .'</li>
<li>'. $email[$i] .'</li>
<li>'. $rol[$i] .'</li>
<li>
<form method="post" action="index.php?state=mg">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_manager" class="primary" />
</form>
</td>
<td>
</li>
<li>
<form method="post" action="index.php?state=mg">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
@ -217,20 +265,20 @@
<input name="rol" type="hidden" value="'.$rol[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_manager" class="primary" />
</form>
</td>
</tr>
</li>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
}
}
echo'</tbody>
</table>
$reply.='</ul>
</div>
<div class="column side"></div>
</div>
';
}
return $reply;
}
function showAddBotton() {
echo' <div class="column side"></div>
static function showAddBotton() {
return $reply = '<div class="column side"></div>
<div class="column middle">
<h2>Añadir gerente</h2>
<form method="post" action="index.php?state=mg">
@ -243,39 +291,35 @@
</div>
';
}
function addManager(){
static function addManager(){
include_once('./includes/formAddManager.php');
$formAM = new formAddManager();
$htmlAForm = $formAM->gestiona();
echo '<!-- ADD MANAGER -->
return $reply= '<!-- ADD MANAGER -->
<div class="column side"></div>
<div class="column middle">
<h3>AÑADIR GERENTE</h3>
<div class="column middle">
'.$htmlAForm.'
</div>
<div class="column side"></div>'."\n";
}
function editManager(){
static function editManager(){
include_once('./includes/formEditManager.php');
$formEM = new formEditManager();
$htmlEForm = $formEM->gestiona();
echo '<!-- EDIT MANAGER -->
return $reply= '<!-- EDIT MANAGER -->
<div class="column side"></div>
<div class="column middle">
<h3>EDITAR GERENTE</h3>
'.$htmlEForm.'
</div>
<div class="column side"></div>'."\n";
</div>';
}
function deleteManager(){
static function deleteManager(){
include_once('./includes/formDeleteManager.php');
$formDM = new formDeleteManager();
$htmlDForm = $formDM->gestiona();
echo '<!-- DELETE MANAGER -->
return $reply= '<!-- DELETE MANAGER -->
<div class="column side"></div>
<div class="column middle">
<h3>ELIMINAR GERENTE</h3>
'.$htmlDForm.'
</div>
<div class="column side"></div>'."\n";
@ -283,44 +327,41 @@
//Functions PROMOTIONS
function addPromotion(){
static function addPromotion(){
include_once('./includes/formAddPromotion.php');
$formAP = new formAddPromotion();
$htmlAForm = $formAP->gestiona();
echo '<!-- ADD PROMOTION -->
return $reply= '<!-- ADD PROMOTION -->
<div class="column side"></div>
<div class="column middle">
<h3>AÑADIR PROMOCIÓN</h3>
'.$htmlAForm.'
</div>
<div class="column side"></div>'."\n";
</div>';
}
function editPromotion(){
static function editPromotion(){
include_once('./includes/formEditPromotion.php');
$formEP = new formEditPromotion();
$htmlEForm = $formEP->gestiona();
echo '<!-- EDIT MANAGER -->
return $reply= '<!-- EDIT MANAGER -->
<div class="column side"></div>
<div class="column middle">
<h3>EDITAR PROMOCIÓN</h3>
'.$htmlEForm.'
</div>
<div class="column side"></div>'."\n";
}
function deletePromotion(){
static function deletePromotion(){
include_once('./includes/formDeletePromotion.php');
$formDP = new formDeletePromotion();
$htmlDForm = $formDP->gestiona();
echo '<!-- DELETE MANAGER -->
return $reply= '<!-- DELETE MANAGER -->
<div class="column side"></div>
<div class="column middle">
<h3>ELIMINAR PROMOCIÓN</h3>
'.$htmlDForm.'
</div>'."\n";
}
function print_promotions(){
static function print_promotions(){
$promo = new Promotion_DAO("complucine");
$promos = $promo->allPromotionData();
$ids = array();
@ -329,70 +370,131 @@
$codes = array();
$actives = array();
if(is_array($promos)){
if(!is_array($promos)){
$reply = "<h2> No hay promociones </h2>";
}
else{
foreach($promos as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$codes[$key] = $value->getCode();
$actives[$key] = $value->getActive();
if ($value->getActive() == 0) {
$actives[$key] = "no";
}
else{
$actives[$key] = "si";
}
}
}
echo "
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Título</th>
<th>Descripcion</th>
<th>Código</th>
<th>Activo</th>
</tr>
</thead>
<tbody>
";
if(is_array($promos)){
$reply= "<div class='row'>
<ul class='tablelist col7'>
<li class='title'>Id</li>
<li class='title'>Título</li>
<li class='title'>Descripcion</li>
<li class='title'>Código</li>
<li class='title'>Activo</li>
<li class='title'>Editar</li>
<li class='title'>Eliminar</li>
";
$parity ="odd";
for($i = 0; $i < count($promos); $i++){
echo '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $tittles[$i] .'</td>
<td>'. $descriptions[$i] .'</td>
<td>'. $codes[$i] .'</td>
<td>'. $actives[$i] .'</td>
<td>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
<input name="description" type="hidden" value="'.$descriptions[$i].'">
<input name="code" type="hidden" value="'.$codes[$i].'">
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_promotion" class="primary" />
</form>
</td>
<td>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
<input name="description" type="hidden" value="'.$descriptions[$i].'">
<input name="code" type="hidden" value="'.$codes[$i].'">
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_promotion" class="primary" />
</form>
</td>
</tr>
$reply.= '
<div class="'.$parity.'">
<li>'. $ids[$i] .'</li>
<li>'. $tittles[$i] .'</li>
<li>'. $descriptions[$i] .'</li>
<li>'. $codes[$i] .'</li>
<li>'. $actives[$i] .'</li>
<li>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
<input name="description" type="hidden" value="'.$descriptions[$i].'">
<input name="code" type="hidden" value="'.$codes[$i].'">
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_promotion" class="primary" />
</form>
<li>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
<input name="description" type="hidden" value="'.$descriptions[$i].'">
<input name="code" type="hidden" value="'.$codes[$i].'">
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_promotion" class="primary" />
</form>
</li>
</li>
</div>
';
$parity = ($parity=="odd")? "even":"odd";
}
}
echo'</tbody>
</table>
</div>
<div class="column side"></div>
$reply.='</ul>
</div>
';
}
return $reply ;
}
static function see_like_user(){
$_SESSION["lastRol"] = $_SESSION["rol"];
//unset($_SESSION["rol"]);
$_SESSION["rol"] = null;
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "<div class=''>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> ¡ATENCIÓN! </h1><hr />
<p>Está viendo la web como un Usuario NO Registrado.</p>
<a href='../../'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}
static function see_like_registed_user(){
$_SESSION["lastRol"] = $_SESSION["rol"];
$_SESSION["rol"] = "user";
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> ¡ATENCIÓN! </h1><hr />
<p>Está viendo la web como un Usuario Registrado.</p>
<a href='../../panel_user'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}
static function see_like_manager(){
$_SESSION["lastRol"] = $_SESSION["rol"];
$_SESSION["rol"] = "manager";
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> ¡ATENCIÓN! </h1><hr />
<p>Está viendo la web como un Gerente.</p>
<a href='../../panel_manager'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}
}
?>

616
panel_manager/Evento.php Normal file
View File

@ -0,0 +1,616 @@
<?php
include_once($prefix.'assets/php/includes/session.php');
/**
* Representa un evento de calendario.
*/
class Evento implements \JsonSerializable
{
/**
* Busca todos los eventos de un usuario con id $userId.
*
* @param int $userId Id del usuario a buscar.
*
* @return array[Evento] Lista de eventos del usuario con id $userId.
*/
public static function buscaTodosEventos(int $userId, $idhall, $cinema)
{
if (!$userId) {
// throw new \BadMethodCallException('$userId no puede ser nulo.');
}
$result = [];
$sessions = Session::getListSessions($idhall,$cinema,null);
foreach($sessions as $s){
$e = new Evento();
$diccionario = self::session2dictionary($s);
$e = $e->asignaDesdeDiccionario($diccionario);
$result[] = $e;
}
return $result;
}
/**
* Busca un evento con id $idEvento.
*
* @param int $idEvento Id del evento a buscar.
*
* @return Evento Evento encontrado.
*/
public static function buscaPorId(int $idEvento, $idhall, $cinema)
{
if (!$idEvento) {
throw new \BadMethodCallException('$idEvento no puede ser nulo.');
}
$result = null;
$app = App::getSingleton();
$conn = $app->conexionBd();
$query = sprintf("SELECT E.id, E.title, E.userId, E.startDate AS start, E.endDate AS end FROM Eventos E WHERE E.id = %d", $idEvento);
$rs = $conn->query($query);
if ($rs && $rs->num_rows == 1) {
while($fila = $rs->fetch_assoc()) {
$result = new Evento();
$result->asignaDesdeDiccionario($fila);
}
$rs->free();
} else {
if ($conn->affected_rows == 0) {
throw new EventoNoEncontradoException("No se ha encontrado el evento: ".$idEvento);
}
throw new DataAccessException("Se esperaba 1 evento y se han obtenido: ".$rs->num_rows);
}
return $result;
}
/**
* Busca los eventos de un usuario con id $userId en el rango de fechas $start y $end (si se proporciona).
*
* @param int $userId Id del usuario para el que se buscarán los eventos.
* @param string $start Fecha a partir de la cual se buscarán eventos (@link MYSQL_DATE_TIME_FORMAT)
* @param string|null $end Fecha hasta la que se buscarán eventos (@link MYSQL_DATE_TIME_FORMAT)
*
* @return array[Evento] Lista de eventos encontrados.
*/
public static function buscaEntreFechas(int $userId, string $start, string $end = null, $idhall, $cinema)
{
if (!$userId) {
//throw new \BadMethodCallException('$userId no puede ser nulo.');
}
$startDate = \DateTime::createFromFormat(self::MYSQL_DATE_TIME_FORMAT, $start);
if (!$startDate) {
// throw new \BadMethodCallException('$diccionario[\'start\'] no sigue el formato válido: '.self::MYSQL_DATE_TIME_FORMAT);
}
$endDate = null;
if ($end) {
$endDate = \DateTime::createFromFormat(self::MYSQL_DATE_TIME_FORMAT, $end);
if (!$endDate) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no sigue el formato válido: '.self::MYSQL_DATE_TIME_FORMAT);
}
}
if ($endDate) {
}
$result = [];
$sessions = Session::getListSessionsBetween2Dates($idhall,$cinema,$startDate,$endDate);
foreach($sessions as $s){
$e = new Evento();
$diccionario = self::session2dictionary($s);
$e = $e->asignaDesdeDiccionario($diccionario);
$result[] = $e;
}
return $result;
}
/**
* Guarda o actualiza un evento $evento en la BD.
*
* @param Evento $evento Evento a guardar o actualizar.
*/
public static function guardaOActualiza(Evento $evento)
{
if (!$evento) {
throw new \BadMethodCallException('$evento no puede ser nulo.');
}
$result = false;
$app = App::getSingleton();
$conn = $app->conexionBd();
if (!$evento->id) {
$query = sprintf("INSERT INTO Eventos (userId, title, startDate, endDate) VALUES (%d, '%s', '%s', '%s')"
, $evento->userId
, $conn->real_escape_string($evento->title)
, $evento->start->format(self::MYSQL_DATE_TIME_FORMAT)
, $evento->end->format(self::MYSQL_DATE_TIME_FORMAT));
$result = $conn->query($query);
if ($result) {
$evento->id = $conn->insert_id;
$result = $evento;
} else {
throw new DataAccessException("No se ha podido guardar el evento");
}
} else {
$query = sprintf("UPDATE Eventos E SET userId=%d, title='%s', startDate='%s', endDate='%s' WHERE E.id = %d"
, $evento->userId
, $conn->real_escape_string($evento->title)
, $evento->start->format(self::MYSQL_DATE_TIME_FORMAT)
, $evento->end->format(self::MYSQL_DATE_TIME_FORMAT)
, $evento->id);
$result = $conn->query($query);
if ($result) {
$result = $evento;
} else {
throw new DataAccessException("Se han actualizado más de 1 fila cuando sólo se esperaba 1 actualización: ".$conn->affected_rows);
}
}
return $result;
}
/**
* Borra un evento id $idEvento.
*
* @param int $idEvento Id del evento a borrar.
*
*/
public static function borraPorId(int $idEvento)
{
if (!$idEvento) {
throw new \BadMethodCallException('$idEvento no puede ser nulo.');
}
$result = false;
$app = App::getSingleton();
$conn = $app->conexionBd();
$query = sprintf('DELETE FROM Eventos WHERE id=%d', $idEvento);
$result = $conn->query($query);
if ($result && $conn->affected_rows == 1) {
$result = true;
} else {
if ($conn->affected_rows == 0) {
throw new EventoNoEncontradoException("No se ha encontrado el evento: ".$idEvento);
}
throw new DataAccessException("Se esperaba borrar 1 fila y se han borrado: ".$conn->affected_rows);
}
return $result;
}
/**
* Crear un evento asociado a un usuario $userId y un título $title.
* El comienzo es la fecha y hora actual del sistema y el fin es una hora más tarde.
*
* @param int $userId Id del propietario del evento.
* @param string $title Título del evento.
*
*/
public static function creaSimple(int $userId, string $title)
{
$start = new \DateTime();
$end = $start->add(new \DateInterval('PT1H'));
return self::creaDetallado($userId, $title, $start, $end);
}
/**
* Crear un evento asociado a un usuario $userId, un título $title y una fecha y hora de comienzo.
* El fin es una hora más tarde de la hora de comienzo.
*
* @param int $userId Id del propietario del evento.
* @param string $title Título del evento.
* @param DateTime $start Fecha y horas de comienzo.
*/
public static function creaComenzandoEn(int $userId, string $title, \DateTime $start)
{
if (empty($start)) {
throw new \BadMethodCallException('$start debe ser un timestamp valido no nulo');
}
$end = $start->add(new \DateInterval('PT1H'));
return self::creaDetallado($userId, $title, $start, $end);
}
/**
* Crear un evento asociado a un usuario $userId, un título $title y una fecha y hora de comienzo y fin.
*
* @param int $userId Id del propietario del evento.
* @param string $title Título del evento.
* @param DateTime $start Fecha y horas de comienzo.
* @param DateTime $end Fecha y horas de fin.
*/
public static function creaDetallado(int $userId, string $title, \DateTime $start, \DateTime $end)
{
$e = new Evento();
$e->setUserId($userId);
$e->setTitle($title);
$e->setStart($start);
$e->setEnd($end);
}
/**
* Crear un evento un evento a partir de un diccionario PHP.
* Como por ejemplo array("userId" => (int)1, "title" => "Descripcion"
* , "start" => "2019-04-29 00:00:00", "end" => "2019-04-30 00:00:00")
*
* @param array $diccionario Array / map / diccionario PHP con los datos del evento a crear.
*
* @return Evento Devuelve el evento creado.
*/
public static function creaDesdeDicionario(array $diccionario)
{
$e = new Evento();
$e->asignaDesdeDiccionario($diccionario, ['userId', 'title', 'start', 'end']);
return $e;
}
/**
* Comprueba si $start y $end son fechas y además $start es anterior a $end.
*/
private static function compruebaConsistenciaFechas(\DateTime $start, \DateTime $end)
{
if (!$start) {
throw new \BadMethodCallException('$start no puede ser nula');
}
if (!$end) {
throw new \BadMethodCallException('$end no puede ser nula');
}
if ($start >= $end) {
throw new \BadMethodCallException('La fecha de comienzo $start '.$start->format("Y-m-d H:i:s").' no puede ser posterior a la de fin $end '.$end->format("Y-m-d H:i:s"));
}
}
/**
* @param int Longitud máxima del título de un evento.
*/
const TITLE_MAX_SIZE = 255;
/**
* @param string Formato de fecha y hora compatible con MySQL.
*/
const MYSQL_DATE_TIME_FORMAT= 'Y-m-d H:i:s';
/**
* @param array[string] Nombre de las propiedades de la clase.
*/
const PROPERTIES = ['id', 'userId', 'title', 'start', 'end', 'idfilm'];
//'idfilm','idhall','idcinema','date', 'start_time', 'seat_price', 'format', 'seats_full'];
private $id;
private $userId;
private $title;
private $start;
private $end;
private $idfilm;
/*
private $idhall;
private $idcinema;
private $date;
private $start_time;
private $seat_price;
private $format;
private $seats_full;*/
private function __construct()
{
}
public function getId()
{
return $this->id;
}
public function getUserId()
{
return $this->userId;
}
public function setUserId(int $userId)
{
if (is_null($userId)) {
throw new \BadMethodCallException('$userId no puede ser una cadena vacía o nulo');
}
$this->userId = $userId;
}
public function getTitle()
{
return $this->title;
}
public function setTitle(string $title)
{
if (is_null($title)) {
throw new \BadMethodCallException('$title no puede ser una cadena vacía o nulo');
}
if (mb_strlen($title) > self::TITLE_MAX_SIZE) {
throw new \BadMethodCallException('$title debe tener como longitud máxima: '.self::TITLE_MAX_SIZE);
}
$this->title = $title;
}
public function getStart()
{
return $this->start;
}
public function setStart(\DateTime $start)
{
if (empty($start)) {
throw new \BadMethodCallException('$start debe ser un timestamp valido no nulo');
}
if (! is_null($this->end) ) {
self::compruebaConsistenciaFechas($start, $this->end);
}
$this->start = $start;
}
public function getEnd()
{
if (empty($end)) {
throw new \BadMethodCallException('$end debe ser un timestamp valido no nulo');
}
return $this->end;
}
public function setEnd(\DateTime $end)
{
if (empty($end)) {
throw new \BadMethodCallException('$end debe ser un timestamp valido no nulo');
}
self::compruebaConsistenciaFechas($this->start, $end);
$this->end = $end;
}
public function __get($property)
{
if (property_exists($this, $property)) {
return $this->$property;
}
}
/**
* Método utilizado por la función de PHP json_encode para serializar un objeto que no tiene atributos públicos.
*
* @return Devuelve un objeto con propiedades públicas y que represente el estado de este evento.
*/
public function jsonSerialize()
{
$o = new \stdClass();
$o->id = $this->id;
$o->userId = $this->userId;
$o->title = $this->title;
$o->start = $this->start->format(self::MYSQL_DATE_TIME_FORMAT);
$o->end = $this->end->format(self::MYSQL_DATE_TIME_FORMAT);
return $o;
}
public static function session2dictionary($session){
$extraDurationBetweenFilms = 10;
$film = Session::getThisSessionFilm($session->getIdfilm());
$dur = $film["duration"]+$extraDurationBetweenFilms;
$tittle = str_replace('_', ' ', $film["tittle"]) ;
$start = $session->getDate()." ".$session->getStartTime();
$end = date('Y-m-d H:i:s', strtotime( $start . ' +'.$dur.' minute'));
$dictionary = array(
"id" => $session->getId(),
"userId" => "80",
"title" => $tittle,
"start" => $start,
"end" => $end,
"idfilm" => $session->getIdfilm(),
/*"idcinema" => $session->getIdcinema(),
"idhall" => $session->getIdhall(),
"date" => $session->getDate(),
"start_time" => $session->getStartTime(),
"seat_price" => $session->getSeatPrice(),
"format" => $session->getFormat(),
"seats_full" => $session->getSeatsFull(),*/
);
return $dictionary;
}
/**
* Actualiza este evento a partir de un diccionario PHP. No todas las propiedades tienen que actualizarse.
* Por ejemplo el array("title" => "Nueva descripcion", "end" => "2019-04-30 00:00:00") sólo actualiza las
* propiedades "title" y "end".
*
* @param array $diccionario Array / map / diccionario PHP con los datos del evento a actualizar.
* @param array[string] $propiedadesAIgnorar Nombre de propiedades que se ignorarán, y no se actualizarán, si se
* encuentran en $diccionario.
*
*/
public function actualizaDesdeDiccionario(array $diccionario, array $propiedadesAIgnorar = [])
{
$propiedadesAIgnorar[] = 'id';
foreach($propiedadesAIgnorar as $prop) {
if( isset($diccionario[$prop]) ) {
unset($diccionario[$prop]);
}
}
return $this->asignaDesdeDiccionario($diccionario);
}
/**
* Actualiza este evento a partir de un diccionario PHP. No todas las propiedades tienen que actualizarse, aunque son
* obligatorias las propiedades cuyo nombre se incluyan en $propiedadesRequeridas.
*
* @param array $diccionario Array / map / diccionario PHP con los datos del evento a actualizar.
* @param array[string] $propiedadesRequeridas Nombre de propiedades que se requieren actualizar. Si no existen en
* $diccionario, se lanza BadMethodCallException.
*
*/
protected function asignaDesdeDiccionario(array $diccionario, array $propiedadesRequeridas = [])
{
foreach($diccionario as $key => $val) {
if (!in_array($key, self::PROPERTIES)) {
throw new \BadMethodCallException('Propiedad no esperada en $diccionario: '.$key);
}
}
foreach($propiedadesRequeridas as $prop) {
if( ! isset($diccionario[$prop]) ) {
throw new \BadMethodCallException('El array $diccionario debe tener las propiedades: '.implode(',', $propiedadesRequeridas));
}
}
if (array_key_exists('id', $diccionario)) {
$id = $diccionario['id'];
if (empty($id)) {
throw new \BadMethodCallException('$diccionario[\'id\'] no puede ser una cadena vacía o nulo');
} else if (! ctype_digit($id)) {
throw new \BadMethodCallException('$diccionario[\'id\'] tiene que ser un número entero');
} else {
$this->id =(int)$id;
}
}
if (array_key_exists('userId', $diccionario)) {
$userId = $diccionario['userId'];
if (empty($userId)) {
throw new \BadMethodCallException('$diccionario[\'userId\'] no puede ser una cadena vacía o nulo');
} else if (!is_int($userId) && ! ctype_digit($userId)) {
throw new \BadMethodCallException('$diccionario[\'userId\'] tiene que ser un número entero: '.$userId);
} else {
$this->setUserId((int)$userId);
}
}
if (array_key_exists('title', $diccionario)) {
$title = $diccionario['title'];
if (is_null($title)) {
throw new \BadMethodCallException('$diccionario[\'title\'] no puede ser una cadena vacía o nulo');
} else {
$this->setTitle($title);
}
}
if (array_key_exists('start', $diccionario)) {
$start = $diccionario['start'];
if (empty($start)) {
throw new \BadMethodCallException('$diccionario[\'start\'] no puede ser una cadena vacía o nulo');
} else {
$startDate = \DateTime::createFromFormat(self::MYSQL_DATE_TIME_FORMAT, $start);
if (!$startDate) {
throw new \BadMethodCallException('$diccionario[\'start\']: '.$diccionario['start'].' no sigue el formato válido: '.self::MYSQL_DATE_TIME_FORMAT);
}
$this->start = $startDate;
}
}
if (array_key_exists('end', $diccionario)) {
$end = $diccionario['end'] ?? null;
if (empty($end)) {
throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$endDate = \DateTime::createFromFormat(self::MYSQL_DATE_TIME_FORMAT, $end);
if (!$endDate) {
throw new \BadMethodCallException('$diccionario[\'end\']: '.$diccionario['end'].' no sigue el formato válido: '.self::MYSQL_DATE_TIME_FORMAT);
}
$this->end = $endDate;
}
}
if (array_key_exists('idfilm', $diccionario)) {
$idfilm = $diccionario['idfilm'] ?? null;
if (empty($idfilm)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->idfilm = $idfilm;
}
}
/*
if (array_key_exists('idhall', $diccionario)) {
$idhall = $diccionario['idhall'] ?? null;
if (empty($idhall)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->idhall = $idhall;
}
}
if (array_key_exists('idcinema', $diccionario)) {
$idcinema = $diccionario['idcinema'] ?? null;
if (empty($idcinema)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->idcinema = $idcinema;
}
}
if (array_key_exists('date', $diccionario)) {
$date = $diccionario['date'] ?? null;
if (empty($date)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->date = $date;
}
}
if (array_key_exists('start_time', $diccionario)) {
$start_time = $diccionario['start_time'] ?? null;
if (empty($start_time)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->start_time = $start_time;
}
}
if (array_key_exists('seat_price', $diccionario)) {
$seat_price = $diccionario['seat_price'] ?? null;
if (empty($seat_price)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->seat_price = $seat_price;
}
}
if (array_key_exists('format', $diccionario)) {
$format = $diccionario['format'] ?? null;
if (empty($format)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->format = $format;
}
}
if (array_key_exists('seats_full', $diccionario)) {
$seats_full = $diccionario['seats_full'] ?? null;
if (empty($seats_full)) {
// throw new \BadMethodCallException('$diccionario[\'end\'] no puede ser una cadena vacía o nulo');
} else {
$this->seats_full = $seats_full;
}
}*/
self::compruebaConsistenciaFechas($this->start, $this->end);
return $this;
}
}

View File

@ -0,0 +1,138 @@
<?php
require_once('../assets/php/config.php');
require_once('./Evento.php');
// Procesamos la cabecera Content-Type
$contentType= $_SERVER['CONTENT_TYPE'] ?? 'application/json';
$contentType = strtolower(str_replace(' ', '', $contentType));
// Verificamos corresponde con uno de los tipos soportados
$acceptedContentTypes = array('application/json;charset=utf-8', 'application/json');
$found = false;
foreach ($acceptedContentTypes as $acceptedContentType) {
if (substr($contentType, 0, strlen($acceptedContentType)) === $acceptedContentType) {
$found=true;
break;
}
}
if (!$found) {
// throw new ContentTypeNoSoportadoException('Este servicio REST sólo soporta el content-type application/json');
}
$result = null;
/**
* Las API REST usan la semántica de los métoods HTTP para gestionar las diferentes peticiones:
* https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
*/
switch($_SERVER['REQUEST_METHOD']) {
// Consulta de datos
case 'GET':
$hall = $_GET["hall"];
$cinema = $_SESSION["cinema"];
// Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
if ($idEvento) {
$result = [];
$result[] = Evento::buscaPorId((int)$idEvento,$hall,$cinema);
} else {
// Comprobamos si es una lista de eventos entre dos fechas -> eventos.php?start=XXXXX&end=YYYYY
$start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP, array("options" => array("regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
$end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, array("options" => array("default" => null, "regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
if ($start) {
$startDateTime = $start . ' 00:00:00';
$endDateTime = $end;
if ($end) {
$endDateTime = $end. ' 00:00:00';
}
$result = Evento::buscaEntreFechas(1, $startDateTime, $endDateTime, $hall,$cinema);
} else {
// Comprobamos si es una lista de eventos completa
$result = Evento::buscaTodosEventos(1, $hall,$cinema); // HACK: normalmente debería de ser App::getSingleton()->idUsuario();
}
}
// Generamos un array de eventos en formato JSON
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(200); // 200 OK
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));
echo $json;
break;
// Añadir un nuevo evento
case 'POST':
// 1. Leemos el contenido que nos envían
$entityBody = file_get_contents('php://input');
// 2. Verificamos que nos envían un objeto
$dictionary = json_decode($entityBody);
if (!is_object($dictionary)) {
//throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
}
// 3. Reprocesamos el cuerpo de la petición como un array PHP
$dictionary = json_decode($entityBody, true);
$dictionary['userId'] = 1;// HACK: normalmente debería de ser App::getSingleton()->idUsuario();
$e = Evento::creaDesdeDicionario($dictionary);
// 4. Guardamos el evento en BD
$result = Evento::guardaOActualiza($e);
// 5. Generamos un objecto como salida.
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(201); // 201 Created
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));
echo $json;
break;
case 'PUT':
error_log("PUT");
// 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
// 2. Leemos el contenido que nos envían
$entityBody = file_get_contents('php://input');
// 3. Verificamos que nos envían un objeto
$dictionary = json_decode($entityBody);
if (!is_object($dictionary)) {
//throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
}
// 4. Reprocesamos el cuerpo de la petición como un array PHP
$dictionary = json_decode($entityBody, true);
$e = Evento::buscaPorId($idEvento);
$e->actualizaDesdeDiccionario($dictionary, ['id', 'userId']);
$result = Evento::guardaOActualiza($e);
// 5. Generamos un objecto como salida.
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(200); // 200 OK
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));
echo $json;
break;
case 'DELETE':
// 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
// 2. Borramos el evento
Evento::borraPorId($idEvento);
http_response_code(204); // 204 No content (como resultado)
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: 0');
break;
default:
//throw new MetodoNoSoportadoException($_SERVER['REQUEST_METHOD']. ' no está soportado');
break;
}

179
panel_manager/eventos.php Normal file
View File

@ -0,0 +1,179 @@
<?php
require_once('../assets/php/config.php');
require_once('./Evento.php');
include_once($prefix.'assets/php/includes/session.php');
// Procesamos la cabecera Content-Type
$contentType= $_SERVER['CONTENT_TYPE'] ?? 'application/json';
$contentType = strtolower(str_replace(' ', '', $contentType));
// Verificamos corresponde con uno de los tipos soportados
$acceptedContentTypes = array('application/json;charset=utf-8', 'application/json');
$found = false;
foreach ($acceptedContentTypes as $acceptedContentType) {
if (substr($contentType, 0, strlen($acceptedContentType)) === $acceptedContentType) {
$found=true;
break;
}
}
if (!$found) {
// throw new ContentTypeNoSoportadoException('Este servicio REST sólo soporta el content-type application/json');
}
$result = null;
/**
* Las API REST usan la semántica de los métoods HTTP para gestionar las diferentes peticiones:
* https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
*/
switch($_SERVER['REQUEST_METHOD']) {
// Consulta de datos
case 'GET':
$hall = $_GET["hall"];
$cinema = $_SESSION["cinema"];
// Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
if ($idEvento) {
$result = [];
$result[] = Evento::buscaPorId((int)$idEvento,$hall,$cinema);
} else {
// Comprobamos si es una lista de eventos entre dos fechas -> eventos.php?start=XXXXX&end=YYYYY
$start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP, array("options" => array("regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
$end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, array("options" => array("default" => null, "regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
if ($start) {
$startDateTime = $start . ' 00:00:00';
$endDateTime = $end;
if ($end) {
$endDateTime = $end. ' 00:00:00';
}
$result = Evento::buscaEntreFechas(1, $startDateTime, $endDateTime, $hall,$cinema);
} else {
// Comprobamos si es una lista de eventos completa
$result = Evento::buscaTodosEventos(1, $hall,$cinema); // HACK: normalmente debería de ser App::getSingleton()->idUsuario();
}
}
// Generamos un array de eventos en formato JSON
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(200); // 200 OK
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));
echo $json;
break;
// Añadir un nuevo evento
case 'POST':
$errors = [];
$data = [];
//Testing hacks
$correct_response = 'Operación completada';
$entityBody = file_get_contents('php://input');
$dictionary = json_decode($entityBody);
if (!is_object($dictionary))
$errors['global'] = 'El cuerpo de la petición no es valido';
$price = $dictionary->{"price"} ?? "";
$format = $dictionary->{"format"} ?? "";
$hall = $dictionary->{"hall"} ?? "";
$startDate = $dictionary->{"startDate"} ?? "";
$endDate = $dictionary->{"endDate"} ?? "";
$startHour = $dictionary->{"startHour"} ?? "";
$idfilm = $dictionary->{"idFilm"} ?? "";
if (empty($price) || $price <= 0 )
$errors['price'] = 'El precio no puede ser 0.';
if (empty($format))
$errors['format'] = 'El formato no puede estar vacio. Ej: 3D, 2D, voz original';
if (empty($hall) || $hall<=0 )
$errors['hall'] = 'La sala no puede ser 0 o menor';
if (empty($startDate))
$errors['startDate'] = 'Las sesiones tienen que empezar algun dia.';
else if (empty($endDate))
$errors['endDate'] = 'Las sesiones tienen que teminar algun dia.';
else {
$start = strtotime($startDate);
$end = strtotime($endDate);
$start = date('Y-m-d', $start);
$end = date('Y-m-d', $end);
if($start >= $end)
$errors['date'] = 'La fecha inicial no puede ser antes o el mismo dia que la final.';
}
if (empty($startHour))
$errors['startHour'] = 'Es necesario escoger el horario de la sesion.';
error_log("El valor de idfilm: ".$idfilm);
if (!is_numeric($idfilm) && $idfilm <= 0 )
$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
while($startDate < $endDate && empty($errors)){
$msg = Session::create_session($_SESSION["cinema"], $hall, $startHour, $startDate, $idfilm, $price, $format);
if(strcmp($msg,$correct_response)!== 0)
$errors['price'] = $msg;
else
$data['message'] = $msg;
$startDate = date('Y-m-d H:i:s', strtotime( $startDate . ' +1 day'));
}
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
} else {
$data['success'] = true;
}
echo json_encode($data);
break;
case 'PUT':
error_log("PUT");
// 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
// 2. Leemos el contenido que nos envían
$entityBody = file_get_contents('php://input');
// 3. Verificamos que nos envían un objeto
$dictionary = json_decode($entityBody);
if (!is_object($dictionary)) {
//throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
}
// 4. Reprocesamos el cuerpo de la petición como un array PHP
$dictionary = json_decode($entityBody, true);
$e = Evento::buscaPorId($idEvento);
$e->actualizaDesdeDiccionario($dictionary, ['id', 'userId']);
$result = Evento::guardaOActualiza($e);
// 5. Generamos un objecto como salida.
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(200); // 200 OK
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));
echo $json;
break;
case 'DELETE':
// 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
$idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
// 2. Borramos el evento
Evento::borraPorId($idEvento);
http_response_code(204); // 204 No content (como resultado)
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: 0');
break;
default:
//throw new MetodoNoSoportadoException($_SERVER['REQUEST_METHOD']. ' no está soportado');
break;
}

View File

@ -0,0 +1,258 @@
<?php
require_once('../assets/php/config.php');
include_once($prefix.'assets/php/includes/event.php');
include_once($prefix.'assets/php/includes/session.php');
$contentType= $_SERVER['CONTENT_TYPE'] ?? 'application/json';
$contentType = strtolower(str_replace(' ', '', $contentType));
// Verify the content type is supported
$acceptedContentTypes = array('application/json;charset=utf-8', 'application/json');
$found = false;
foreach ($acceptedContentTypes as $acceptedContentType) {
if (substr($contentType, 0, strlen($acceptedContentType)) === $acceptedContentType) {
$found=true;
break;
}
}
switch($_SERVER['REQUEST_METHOD']) {
// Get Events
case 'GET':
$hall = $_GET["hall"];
$cinema = $_SESSION["cinema"];
$start = $_GET["start"];
$end = $_GET["end"];
if ($start) {
$result = Event::searchEventsBetween2dates($start, $end, $hall,$cinema);
} else {
// Comprobamos si es una lista de eventos completa
$result = Event::searchAllEvents($hall,$cinema);
}
// Generamos un array de eventos en formato JSON
$json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
http_response_code(200); // 200 OK
header('Content-Type: application/json; charset=utf-8');
header('Content-Length: ' . mb_strlen($json));;
echo $json;
break;
// Add Session
case 'POST':
$errors = [];
$data = [];
//Correct reply to verify the session has been correctly added
$correct_response = 'Operación completada';
//Check if the body is ok
$entityBody = file_get_contents('php://input');
$dictionary = json_decode($entityBody);
if (!is_object($dictionary))
$errors['global'] = 'El cuerpo de la petición no es valido';
$price = $dictionary->{"price"} ?? "";
$format = $dictionary->{"format"} ?? "";
$hall = $dictionary->{"hall"} ?? "";
$startDate = $dictionary->{"startDate"} ?? "";
$endDate = $dictionary->{"endDate"} ?? "";
$startHour = $dictionary->{"startHour"} ?? "";
$idfilm = $dictionary->{"idFilm"} ?? "";
//Check errors in inputs
if (empty($price) || $price <= 0 )
$errors['price'] = 'El precio no puede ser 0.';
if (empty($format))
$errors['format'] = 'El formato no puede estar vacio. Ej: 3D, 2D, voz original';
if (empty($hall) || $hall<=0 )
$errors['hall'] = 'La sala no puede ser 0 o menor';
if (empty($startDate))
$errors['startDate'] = 'Las sesiones tienen que empezar algun dia.';
else if (empty($endDate))
$errors['endDate'] = 'Las sesiones tienen que teminar algun dia.';
else {
$start = strtotime($startDate);
$end = strtotime($endDate);
$start = date('Y-m-d', $start);
$end = date('Y-m-d', $end);
if($start > $end)
$errors['date'] = 'La fecha inicial no puede ser antes o el mismo dia que la final.';
}
if (empty($startHour))
$errors['startHour'] = 'Es necesario escoger el horario de la sesion.';
if (!is_numeric($idfilm) && $idfilm <= 0 )
$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
//Create as many sessions as the diference between start and end date tell us. 1 session per day
while($startDate < $endDate && empty($errors)){
$msg = Session::create_session($_SESSION["cinema"], $hall, $startHour, $startDate, $idfilm, $price, $format);
if(strcmp($msg,$correct_response)!== 0)
$errors['global'] = $msg;
else
$data['message'] = $msg;
$startDate = date('Y-m-d H:i:s', strtotime( $startDate . ' +1 day'));
}
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
} else {
$data['success'] = true;
}
echo json_encode($data);
break;
//Edit session
case 'PUT':
//Correct reply to verify the session has been correctly edited
$correct_response = 'Se ha editado la session con exito';
$errors = [];
$data = [];
//Check if the body is ok
$entityBody = file_get_contents('php://input');
$dictionary = json_decode($entityBody);
if (!is_object($dictionary))
$errors['global'] = 'El cuerpo de la petición no es valido';
//Check if the user is droping an event in a new date
if(isset($_GET["drop"]) && $_GET["drop"]){
$or_hall = $dictionary->{"idhall"} ?? "";
$or_date = $dictionary->{"startDate"} ?? "";
$or_start = $dictionary->{"startHour"} ?? "";
$price = $dictionary->{"price"} ?? "";
$idfilm = $dictionary->{"idfilm"} ?? "";
$format = $dictionary->{"format"} ?? "";
$new_date = $dictionary->{"newDate"} ?? "";
$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $or_hall, $new_date, $new_date, $idfilm, $price, $format);
if(strcmp($msg,$correct_response)!== 0)
http_response_code(400);
else
http_response_code(200);
}else{
//Edit session from a form
$price = $dictionary->{"price"} ?? "";
$format = $dictionary->{"format"} ?? "";
$hall = $dictionary->{"hall"} ?? "";
$startDate = $dictionary->{"startDate"} ?? "";
$endDate = $dictionary->{"endDate"} ?? "";
$startHour = $dictionary->{"startHour"} ?? "";
$idfilm = $dictionary->{"idFilm"} ?? "";
$or_hall = $dictionary->{"og_hall"} ?? "";
$or_date = $dictionary->{"og_date"} ?? "";
$or_start = $dictionary->{"og_start"} ?? "";
//Check errors in inputs
if (empty($price) || $price <= 0 )
$errors['price'] = 'El precio no puede ser 0.';
if (empty($format))
$errors['format'] = 'El formato no puede estar vacio. Ej: 3D, 2D, voz original';
if (empty($hall) || $hall<=0 )
$errors['hall'] = 'La sala no puede ser 0 o menor';
if (empty($startDate))
$errors['startDate'] = 'Las sesiones tienen que empezar algun dia.';
else if (empty($endDate))
$errors['endDate'] = 'Las sesiones tienen que teminar algun dia.';
else {
$start = strtotime($startDate);
$end = strtotime($endDate);
$start = date('Y-m-d', $start);
$end = date('Y-m-d', $end);
if($start > $end)
$errors['date'] = 'La fecha inicial no puede ser antes o el mismo dia que la final.';
}
if (empty($startHour))
$errors['startHour'] = 'Es necesario escoger el horario de la sesion.';
if (!is_numeric($idfilm) && $idfilm <= 0 )
$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
if(empty($errors)){
$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $hall, $startHour, $startDate, $idfilm, $price, $format);
if(strcmp($msg,$correct_response)!== 0)
$errors['global'] = $msg;
else
$data['message'] = $msg;
}
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
} else {
$data['success'] = true;
}
}
echo json_encode($data);
break;
//Delete a session
case 'DELETE':
$errors = [];
$data = [];
//Correct reply to verify the session has been correctly edited
$correct_response = 'Se ha eliminado la session con exito';
//Check if the body is ok
$entityBody = file_get_contents('php://input');
$dictionary = json_decode($entityBody);
if (!is_object($dictionary))
$errors['global'] = 'El cuerpo de la petición no es valido';
$or_hall = $dictionary->{"og_hall"} ?? "";
$or_date = $dictionary->{"og_date"} ?? "";
$or_start = $dictionary->{"og_start"} ?? "";
//Check errors in inputs
if(empty($or_hall))
$errors['global'] = 'El nº de sala a borrar no existe';
if(empty($or_date))
$errors['global'] = 'La fecha de donde borrar no existe';
if(empty($or_start))
$errors['global'] = 'La hora de donde borrar no existe';
if(empty($errors)){
$msg = Session::delete_session($_SESSION["cinema"], $or_hall, $or_start, $or_date);
if(strcmp($msg,$correct_response)!== 0)
$errors['global'] = $msg;
else
$data['message'] = $msg;
}
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
} else {
$data['success'] = true;
}
echo json_encode($data);
break;
default:
break;
}

View File

@ -0,0 +1,95 @@
<?php
require_once($prefix.'assets/php/includes/film_dao.php');
class NewSessionForm {
public static function getForm(){
$films = new Film_DAO("complucine");
$filmslist = $films->allFilmData();
$form='
<div id="operation_msg" class="operation_msg"> </div>
<form id="new_session_form" name="new_session_form" action="eventos.php.php" method="POST">
<div id="global_group" class="form_group"></div>
<fieldset>
<legend>Datos</legend>
<div id="price_group" class="form_group">
<input type="number" step="0.01" id="price" name="price" value="" min="0" placeholder="Precio de la entrada" /> <br>
</div>
<div id="format_group" class="form_group">
<input type="text" id="format" name="format" value="" placeholder="Formato de pelicula" /> <br>
</div>
<div id="hall_group" class="form_group">
<select id="hall" name="hall" class="button large">>';
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
$form.= '
<option value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
}
$form.=' </select>
</div>
</fieldset>
<fieldset>
<legend>Horario</legend>
<div id="date_group" class="form_group">
<div class="two-inputs-line">
<label> Fecha inicio </label>
<label> Fecha final </label>
<input type="date" id="startDate" name="startDate" value=""/>
<input type="date" id="endDate" name="endDate" value=""/>
</div>
</div>
<div id="hour_group" class="form_group">
<div class="one-input-line">
<label> Hora sesion </label>
<input type="time" id="startHour" name="startHour" value=""/>
</div>
</div>
</fieldset>
<input type="reset" id="reset" value="Limpiar Campos" >
<input type="submit" id="submit" name="sumbit" class="primary" value="Crear" />
<div id="film_msg_group" class="form_group"> </div>
<div id="film_group" class="form_group">
<div class="code showtimes">
<input type="hidden" id="film_id" name="film_id" value=""/>
<h2 id="film_title"> titulo </h2>
<hr />
<div class="img_desc">
<div class="image"> <img src="../img/films/iron_man.jpg" alt="iron man" id="film_img" /> </div>
<div class="blockquote">
<p id="film_desc">"Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo."</p>
</div>
</div>
<li id="film_dur"> Duración: duracion minutos</li>
<li id="film_lan"> Lenguaje: idioma </li>
</div>
<button type="button" class="button large" id="return"> Cambiar pelicula </button>
</div>
<div class="film_list" id="film_list">
<ul class="tablelist col3">';
$parity = "odd";
$i = 0;
foreach($filmslist as $film){
$form .='<div class="'.$parity.'">
<input type="hidden" value="'.$film->getId().'" id="id'.$i.'"/>
<input type="hidden" value="'.$film->getImg().'" id="img'.$i.'"/>
<input type="hidden" value="'.$film->getLanguage().'" id="lan'.$i.'"/>
<input type="hidden" value="'.$film->getDescription().'" id="desc'.$i.'"/>
<li value="'.$film->getTittle().'"id="title'.$i.'"> '. str_replace('_', ' ',$film->getTittle()).'</li>
<li id="dur'.$i.'"> '.$film->getDuration().' min</li>
<li> <button type="button" class="film_button" id="'.$i.'"> Seleccionar </button> </li>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
$i++;
}
$form.='
</ul>
</div>
</form>';
return $form;
}
}
?>

View File

@ -0,0 +1,103 @@
<?php
require_once($prefix.'assets/php/includes/film_dao.php');
class SessionForm {
public static function getForm(){
$films = new Film_DAO("complucine");
$filmslist = $films->allFilmData();
$form='
<div id="operation_msg" class="operation_msg"> </div>
<form id="session_form" name="session_form" action="eventos.php" method="POST">
<input type="hidden" id="film_id" name="film_id" value=""/>
<input type="hidden" id="original_hall" name="film_id" value=""/>
<input type="hidden" id="original_date" name="film_id" value=""/>
<input type="hidden" id="original_start_time" name="film_id" value=""/>
<div id="global_group" class="form_group"></div>
<fieldset>
<legend>Datos</legend>
<div id="price_group" class="form_group">
<input type="number" step="0.01" id="price" name="price" value="" min="0" placeholder="Precio de la entrada" /> <br>
</div>
<div id="format_group" class="form_group">
<input type="text" id="format" name="format" value="" placeholder="Formato de pelicula" /> <br>
</div>
<div id="hall_group" class="form_group">
<select id="hall" name="hall" class="button large">>';
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
$form.= '
<option value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
}
$form.=' </select>
</div>
</fieldset>
<fieldset>
<legend>Horario</legend>
<div id="date_group" class="form_group">
<div class="two-inputs-line">
<label> Fecha inicio </label>
<label> Fecha final </label>
<input type="date" id="startDate" name="startDate" value=""/>
<input type="date" id="endDate" name="endDate" value=""/>
</div>
</div>
<div id="hour_group" class="form_group">
<div class="one-input-line">
<label> Hora sesion </label>
<input type="time" id="startHour" name="startHour" value=""/>
</div>
</div>
</fieldset>
<input type="reset" id="reset" value="Limpiar Campos" >
<input type="submit" id="sumbit_new" name="sumbit_new" class="sumbit" value="Añadir" />
<div class="two-inputs-line" id="edit_inputs">
<input type="submit" id="sumbit_edit" name="sumbit_edit" class="sumbit" value="Editar" />
<input type="submit" id="submit_del" name="submit_del" class="black button" value="Borrar" />
</div>
<div id="film_msg_group" class="form_group"> </div>
<div id="film_group" class="form_group">
<div class="code showtimes">
<h2 id="film_title"> titulo </h2>
<hr />
<div class="img_desc">
<div class="image"> <img src="../img/films/iron_man.jpg" alt="iron man" id="film_img" /> </div>
<div class="blockquote">
<li id="film_dur"> Duración: duracion minutos</li>
<li id="film_lan"> Lenguaje: idioma </li>
</div>
</div>
</div>
<button type="button" class="button large" id="return"> Cambiar pelicula </button>
</div>
<div class="film_list" id="film_list">
<ul class="tablelist col3">';
$parity = "odd";
$i = 0;
foreach($filmslist as $film){
$form .='<div class="'.$parity.'">
<input type="hidden" value="'.$film->getId().'" id="id'.$i.'"/>
<input type="hidden" value="'.$film->getImg().'" id="img'.$i.'"/>
<input type="hidden" value="'.$film->getLanguage().'" id="lan'.$i.'"/>
<li value="'.$film->getTittle().'"id="title'.$i.'"> '. str_replace('_', ' ',$film->getTittle()).'</li>
<li id="dur'.$i.'"> '.$film->getDuration().' min</li>
<li> <button type="button" class="film_button" id="'.$i.'"> Seleccionar </button> </li>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
$i++;
}
$form.='
</ul>
</div>
</form>
';
return $form;
}
}
?>

View File

@ -0,0 +1,220 @@
<?php
include_once($prefix.'assets/php/includes/hall.php');
include_once($prefix.'assets/php/includes/seat.php');
include_once($prefix.'assets/php/form.php');
class FormHall extends Form {
private $option;
private $cinema;
private $og_hall;
//Constructor:
public function __construct($option, $cinema, $hall) {
$this->option = $option;
$this->cinema = $cinema;
if($hall)
$this->og_hall = $hall;
if($option == "edit_hall")
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing");
else
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."");
parent::__construct('formHall',$options);
}
protected function generaCamposFormulario($data, $errores = array()){
//Prepare the data
$number = $data['number'] ?? $this->og_hall->getNumber() ?? "";
$rows = $data['rows'] ?? $this->og_hall->getNumRows() ?? "12";
$cols = $data['cols'] ?? $this->og_hall->getNumCol() ?? "8";
//Seats_map
$seats = 0;
$seats_map = array();
for($i = 1;$i <= $rows; $i++){
for($j = 1; $j <= $cols; $j++){
$seats_map[$i][$j] = "-1";
}
}
$alltozero = $_POST["alltozero"] ?? 0;
//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form
if($this->option == "edit_hall" && !isset($_GET["editing"])){
$rows = $this->og_hall->getNumRows();
$cols = $this->og_hall->getNumCol();
$seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema);
if($seat_list){
foreach($seat_list as $seat){
$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
if($seat->getState()>=0){
$seats++;
}
}
}
}//Show the checkbox seats_map updated and everything to selected if alltoone was pressed
else if(!$alltozero){
$alltoone = $_POST["alltoone"] ?? 0;
for($i = 1;$i <= $rows; $i++){
for($j = 1; $j <= $cols; $j++){
if($alltoone || isset($data["checkbox".$i.$j])) {
$seats_map[$i][$j] = $data["checkbox".$i.$j] ?? "0";
$seats++;
if($seats_map[$i][$j] == "-1"){
$seats_map[$i][$j] = "0";
}
}else
$seats_map[$i][$j] = "-1";
}
}
}
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error'));
$errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error'));
$errorRows = self::createMensajeError($errores, 'rows', 'span', array('class' => 'error'));
$errorCols = self::createMensajeError($errores, 'cols', 'span', array('class' => 'error'));
$html = '
<div class="column left">'.$htmlErroresGlobales.'
<fieldset>
<legend>Mapa de Asientos</legend>
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" /> <br>
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"/> <br>
<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br>
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" />
';
if($this->option == "edit_hall")
$html .= ' <input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="black button" />';
$html .='
</fieldset><br>
'.$errorNumber.'
<label> Numero de sala: </label>
<input type="number" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
';
if($this->option == "new_hall")
$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />
';
if($this->option == "edit_hall"){
$html .='<input type="submit" id="submit" name="sumbit" value="Editar Sala" class="primary" />
<input type="submit" id="submit" name="delete" onclick="return confirm(\'Seguro que quieres borrar esta sala?\')" value="Eliminar Sala" class="black button" />
';
}
if(!$errorCols && !$errorRows){
$html .='</div>
<div class="column right">
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />
<input type="submit" name="alltozero" value="Desactivar todos los asientos" class="button large" />
<h3 class="table_title"> Pantalla </h3>
<table class="seat">
<thead>
<tr>
<th> </th>
';
for($j = 1; $j<=$cols; $j++){
$html .= '<th>'.$j.'</th>
';
}
$html .= '</tr>
</thead>
<tbody>';
for($i = 1;$i<=$rows;$i++){
$html .= '
<tr>
<td>'.$i.'</td>
';
for($j=1; $j<=$cols; $j++){
if($seats_map[$i][$j]>=0){
$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" checked> <label for="checkbox'.$i.$j.'"> </td>
';}
else {
$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" > <label for="checkbox'.$i.$j.'"> </td>
';}
}
$html .='</tr>';
}
$html .= '
</tbody>
</table>
</div>';
} else
$html .='</div>';
return $html;
}
//Methods:
//Process form:
protected function procesaFormulario($datos){
$result = array();
$rows = $datos['rows'];
$cols = $datos['cols'];
//Prepare the seat_map
$seats_map = array();
$seats = 0;
for($i = 1;$i <= $rows; $i++){
for($j = 1; $j <= $cols; $j++){
if(isset($datos["checkbox".$i.$j])){
$seats_map[$i][$j] = $datos["checkbox".$i.$j];
$seats++;
if($seats_map[$i][$j] == "-1"){
$seats_map[$i][$j] = "0";
}
}else{
$seats_map[$i][$j] = "-1";
}
}
}
if ($seats == 0 && isset($datos["sumbit"]) ) {
$result['seats'] = "<li> No puede haber 0 asientos disponibles. </li> <br>";
}
if ($rows <= 0) {
$result['rows'] = "<li> No puede haber 0 o menos filas. </li> <br>";
}
if ($cols <= 0) {
$result['cols'] = "<li> No puede haber 0 o menos columnas. </li> <br>";
}
$number = $datos['number'] ?? null;
if (empty($number) && isset($datos["sumbit"])) {
$result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>";
}
if(isset($datos["restart"])){
return $result = "./?state=".$this->option."&number=".$this->og_hall->getNumber()."";
}
if (count($result) === 0 && isset($datos["sumbit"]) ) {
if($this->option == "new_hall"){
$_SESSION['msg'] = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map);
return $result = './?state=success';
}
if($this->option == "edit_hall"){
$_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
return $result = './?state=success';
}
}
if (!isset($result['number']) && isset($datos["delete"]) ) {
if($this->option == "edit_hall"){
$_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
return $result = './?state=success';
}
}
return $result;
}
}
?>

View File

@ -1,36 +1,36 @@
<?php
include_once($prefix.'assets/php/common/hall.php');
include_once($prefix.'assets/php/common/seat.php');
include_once($prefix.'assets/php/includes/hall.php');
include_once($prefix.'assets/php/includes/seat.php');
include_once($prefix.'assets/php/form.php');
class FormHall extends Form {
private $option;
private $cinema;
private $og_hall;
//Constructor:
public function __construct($option, $cinema) {
public function __construct($option, $cinema, $hall) {
$this->option = $option;
$this->cinema = $cinema;
$options = array("action" => "./?state=".$option);
if($hall)
$this->og_hall = $hall;
if($option == "edit_hall" && $hall)
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing=true");
else
$options = array("action" => "./?state=".$option."&editing=false");
parent::__construct('formHall',$options);
}
protected function generaCamposFormulario($data, $errores = array()){
//Prepare the data
if($this->option == "new_hall"){
$number = $data['number'] ?? "";
$rows = $data['rows'] ?? '12';
$cols = $data['cols'] ?? '8';
}else {
$number = $data['number'] ?? $_POST["number"];
$rows = $data['rows'] ?? $_POST["rows"];
$cols = $data['cols'] ?? $_POST["cols"];
}
$number = $data['number'] ?? $this->og_hall->getNumber() ?? "";
$rows = $data['rows'] ?? $this->og_hall->getNumRows() ?? "12";
$cols = $data['cols'] ?? $this->og_hall->getNumCol() ?? "8";
$og_number = $data['og_number'] ?? $number;
//Seats_map
//Init Seats_map
$seats = 0;
$seats_map = array();
for($i = 1;$i <= $rows; $i++){
@ -38,10 +38,12 @@ class FormHall extends Form {
$seats_map[$i][$j] = "-1";
}
}
$alltozero = $_POST["alltozero"] ?? 0;
//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form
if(isset($data["restart"]) || isset($_POST["edit_hall"]) ){
$seat_list = Seat::getSeatsMap($og_number, $this->cinema);
if($this->option == "edit_hall" && !isset($_GET["editing"])){
$rows = $this->og_hall->getNumRows();
$cols = $this->og_hall->getNumCol();
$seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema);
if($seat_list){
foreach($seat_list as $seat){
$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
@ -51,7 +53,7 @@ class FormHall extends Form {
}
}
}//Show the checkbox seats_map updated and everything to selected if alltoone was pressed
else{
else if(!$alltozero){
$alltoone = $_POST["alltoone"] ?? 0;
for($i = 1;$i <= $rows; $i++){
for($j = 1; $j <= $cols; $j++){
@ -70,25 +72,24 @@ class FormHall extends Form {
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error'));
$errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error'));
$errorRows = self::createMensajeError($errores, 'rows', 'span', array('class' => 'error'));
$errorCols = self::createMensajeError($errores, 'cols', 'span', array('class' => 'error'));
$html = '
<div class="column left">'.$htmlErroresGlobales.' '.$errorSeats.'
<div class="column left">'.$htmlErroresGlobales.'
<fieldset>
<legend>Mapa de Asientos</legend>
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br>
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br>
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" /> <br>
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"/> <br>
<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br>
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />';
if($this->option == "edit_hall")
$html .= ' <input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="black button" />';
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" />
';
$html .='
</fieldset>
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" /> '.$errorNumber.'
<fieldset>
</fieldset><br>
'.$errorNumber.'
<label> Numero de sala: </label>
<input type="number" min="1" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
<input type="hidden" name="og_number" value="'.$og_number.'" /><br>
</fieldset>
<input type="number" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
';
if($this->option == "new_hall")
$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />
@ -98,8 +99,11 @@ class FormHall extends Form {
<input type="submit" id="submit" name="delete" onclick="return confirm(\'Seguro que quieres borrar esta sala?\')" value="Eliminar Sala" class="black button" />
';
}
if(!$errorCols && !$errorRows){
$html .='</div>
<div class="column right">
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />
<input type="submit" name="alltozero" value="Desactivar todos los asientos" class="button large" />
<h3 class="table_title"> Pantalla </h3>
<table class="seat">
<thead>
@ -133,19 +137,18 @@ class FormHall extends Form {
</tbody>
</table>
</div>';
} else
$html .='</div>';
return $html;
}
//Methods:
//Process form:
protected function procesaFormulario($datos){
$result = array();
$rows = $datos['rows'];
$cols = $datos['cols'];
$og_number = $datos["og_number"];
//Prepare the seat_map
$seats_map = array();
@ -163,38 +166,60 @@ class FormHall extends Form {
}
}
}
//Check input errors
if ($seats == 0 && isset($datos["sumbit"]) ) {
$result['seats'] = "<li> No puede haber 0 asientos disponibles. </li> <br>";
}
if ($rows <= 0) {
$result['rows'] = "<li> No puede haber 0 o menos filas. </li> <br>";
}
if ($cols <= 0) {
$result['cols'] = "<li> No puede haber 0 o menos columnas. </li> <br>";
}
$number = $datos['number'] ?? null;
if (empty($number) && isset($datos["sumbit"])) {
$result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>";
}
if (count($result) === 0 && isset($datos["sumbit"]) ) {
else if (count($result) === 0 && isset($datos["sumbit"]) ) {
if($this->option == "new_hall"){
$_SESSION['msg'] = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map);
$result = './?state=success';
$msg = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map);
FormHall::prepare_message( $msg );
}
if($this->option == "edit_hall"){
$_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $og_number);
$result = './?state=success';
else if($this->option == "edit_hall"){
if($this->og_hall)
$msg = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
else
$msg = "La sala que intentas editar ya no existe";
FormHall::prepare_message( $msg );
}
}
if (!isset($result['number']) && isset($datos["delete"]) ) {
else if (!isset($result['number']) && isset($datos["delete"]) ) {
if($this->option == "edit_hall"){
$_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $og_number);
$result = './?state=success';
$msg = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
FormHall::prepare_message( $msg );
}
}
return $result;
}
public static function prepare_message( $msg ){
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> Operacion Completada </h1><hr />
<p>".$msg."</p>
<a href='./index.php?state=manage_halls'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}
}
?>

View File

@ -1,7 +1,6 @@
<?php
require_once($prefix.'assets/php/common/session_dao.php');
require_once($prefix.'assets/php/common/film_dao.php');
require_once($prefix.'assets/php/common/session.php');
require_once($prefix.'assets/php/includes/session_dao.php');
require_once($prefix.'assets/php/includes/session.php');
require_once($prefix.'assets/php/form.php');
//Receive data from froms and prepare the correct response
@ -9,52 +8,53 @@ class FormSession extends Form {
private $option;
private $cinema;
private $formID;
//Constructor:
public function __construct($option, $cinema) {
$this->option = $option;
$this->cinema = $cinema;
$this->formID = 'formSession1';
$options = array("action" => "./?state=".$option);
parent::__construct('formSession',$options);
}
//TODO Edit session no funciona correctamente con el seleccionar una pelicula distinta, hay que guardar la id de la sesion de alguna forma y usarla o guardar en la sesion
protected function generaCamposFormulario($data, $errores = array()){
$filmList = new Film_DAO('complucine');
$films = $filmList->allFilmData();
if($this->option == "new_session") {
$film = $data['film'] ?? 1;
$hall = $data['hall'] ?? $_POST["hall"];
$date = $data['date'] ?? $_POST["date"];
$start = $data['start'] ?? '';
$price = $data['price'] ?? '';
$format = $data['format'] ?? '';
}
else {
$film = $data['film'] ?? $_POST["film"];
$hall = $data['hall'] ?? $_POST["hall"];
$date = $data['date'] ?? $_POST["date"];
$start = $data['start'] ?? $_POST["start"];
$price = $data['price'] ?? $_POST["price"];
$format = $data['format'] ?? $_POST["format"];
}
$hall = $data['hall'] ?? $_POST["hall"] ?? "";
$date = $data['date'] ?? $_POST["date"] ?? "";
$start = $data['start'] ?? $_POST["start"] ?? "";
$price = $data['price'] ?? $_POST["price"] ?? "";
$format = $data['format'] ?? $_POST["format"] ?? "";
$or_hall = $data["or_hall"] ?? $hall;
$or_date = $data["or_date"] ?? $date;
$or_start = $data["or_start"] ?? $start;
$film = $data['film'] ?? $_POST["film"] ?? "";
$tittle = $data['tittle'] ?? $_POST["tittle"] ?? "";
$duration = $data['duration'] ?? $_POST["duration"] ?? "";
$language = $data['language'] ?? $_POST["language"] ?? "";
$description = $data['description'] ?? $_POST["description"] ?? "";
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorPrice = self::createMensajeError($errores, 'price', 'span', array('class' => 'error'));
$errorFormat = self::createMensajeError($errores, 'format', 'span', array('class' => 'error'));
$errorDate = self::createMensajeError($errores, 'date', 'span', array('class' => 'error'));
$errorStart = self::createMensajeError($errores, 'start', 'span', array('class' => 'error'));
$html = '
<div class="column left">'.$htmlErroresGlobales.' '.$errorPrice.'
<div class="column left">'.$htmlErroresGlobales.'
<fieldset>
<legend>Datos</legend>
<input type="number" step="0.01" name="price" value="'.$price.'" min="0" placeholder="Precio de la entrada" required/> <br>'.$errorFormat.'
<input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" required/> <br>
'.$errorPrice.'
<input type="number" step="0.01" name="price" value="'.$price.'" min="0" placeholder="Precio de la entrada" /> <br>'
.$errorFormat.'
<input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" /> <br>
<input type="hidden" name="film" value="'.$film.'"/>
<input type="hidden" name="option" value="'.$this->option.'"/>
<select name="hall" class="button large">';
foreach(Hall::getListHalls($this->cinema) as $hll){
if($hll->getNumber() == $hall){
@ -71,9 +71,11 @@ class FormSession extends Form {
</fieldset>
<fieldset>
<legend>Horario</legend>
<input type="time" name="start" value="'.$start.'" placeholder="Hora de inicio" required/> <br>
'.$errorStart.'
<input type="time" name="start" value="'.$start.'" placeholder="Hora de inicio"/> <br>
<input type="hidden" name="or_start" value="'.$or_start.'"/>
<input type="date" name="date" value="'.$date.'" placeholder="Fecha de inicio" required/> <br>
'.$errorDate.'
<input type="date" name="date" value="'.$date.'" placeholder="Fecha de inicio" /> <br>
<input type="hidden" name="or_date" value="'.$or_date.'"/>
</fieldset>
';
@ -87,22 +89,29 @@ class FormSession extends Form {
<input type="submit" name="delete" class="black button" onclick="return confirm(\'Seguro que quieres borrar esta sesion?\')" value="Borrar" /><br>';
}
}
$html .= '
<input type="reset" id="reset" value="Limpiar Campos" />
$html .= "
<input type='reset' id='reset' value='Limpiar Campos' >
</form>
</div>
<div class="column rigth">
<select name="film" class="button large">
';
foreach($films as $f){
if($f->getId() == $film){
$html .= "<option value=\"". $f->getId() ." \"selected> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>
";
}else{
$html .= "<option value=\"". $f->getId() ." \"> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>
";
}
<div class='column side'>";
if($film){
$html .= "<section id='".$tittle."'>
<div class='code showtimes'>
<div class='image'><img src='../img/films/".$tittle.".jpg' alt='".$tittle."' /></div>
<h2>".str_replace('_', ' ',$tittle)."</h2>
<hr />
<div class='blockquote'>
<p>".$description."</p>
</div>
<li>Duración: ".$duration." minutos</li>
<li>Duración: ".$language." minutos</li>
</div>
</section>
";
}
$html .= '</select>';
$html .= '<input type="submit" name="select_film" form="'.$this->formID.'" formaction="?state=select_film" class="button large" Value="Seleccionar una Pelicula" /><br>
</div>
';
return $html;
}
//Methods:
@ -122,10 +131,21 @@ class FormSession extends Form {
$or_date = $data["or_date"] ;
$or_start = $data["or_start"] ;
if (($price == 0 || empty($price))&& isset($data["sumbit"]) ) {
$result['price'] = "<li> No puede haber 0 euros. </li> <br>";
if (($price <= 0 || empty($price))&& isset($data["sumbit"]) ) {
$result['price'] = "<li> No puede haber 0 o menos euros. </li> <br>";
}
if ((empty($format))&& isset($data["sumbit"]) ) {
$result['format'] = "<li> El formato no puede estar vacio. </li> <br>";
}
if ((empty($date))&& isset($data["sumbit"]) ) {
$result['date'] = "<li> No hay una fecha seleccionada. </li> <br>";
}
if ((empty($start))&& isset($data["sumbit"]) ) {
$result['start'] = "<li> No hay una hora inicial seleccionada. </li> <br>";
}
if (count($result) === 0 && isset($data["sumbit"]) ) {
if($this->option == "new_session"){

Some files were not shown because too many files have changed in this diff Show More