From 4d59424d029a076dd4cd4ed2c6a3a6305e3e6119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Thu, 13 May 2021 00:10:19 +0200 Subject: [PATCH] Add files via upload --- assets/php/config.php | 5 +++ assets/php/template.php | 68 +++++++++++++++++++++++++---------------- cinemas/index.php | 2 +- index.php | 64 +++++++++----------------------------- showtimes/index.php | 40 ------------------------ 5 files changed, 62 insertions(+), 117 deletions(-) diff --git a/assets/php/config.php b/assets/php/config.php index d52c211..f03a4fb 100644 --- a/assets/php/config.php +++ b/assets/php/config.php @@ -46,4 +46,9 @@ * @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); ?> diff --git a/assets/php/template.php b/assets/php/template.php index 58f0e30..ae2e0bf 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -152,10 +152,20 @@ } /* MAIN */ + if($prefix === "./"){ + if(isset($_SESSION["nombre"])){ + $header = "

Bienvenido {$_SESSION["nombre"]}

\n"; + } else { + $header = "

Bienvenido a CompluCine

\n"; + } + } else { + $header = "

{$page}

\n"; + } + echo"
logo_FDI-Cines
{$sub_header} -

{$page}

+ {$header}
\n"; } @@ -238,6 +248,7 @@ //Print Films Cards: function print_fimls(){ + $reply = ""; //List of the movies: require_once(__DIR__.'/common/film_dao.php'); @@ -264,18 +275,18 @@ for($i = 0; $i < count($films_array); $i++){ $tittle = str_replace('_', ' ', $tittles[$i]); if($i%2 === 0){ - if($i != 0) echo " + if($i != 0) $reply .= " "; - echo "
+ $reply .= "
"; } else{ - if($i != 0) echo "
+ if($i != 0) $reply .= "
"; - echo "
+ $reply .= "
"; } - echo "
+ $reply .= "
".$tittles[$i]."
@@ -290,26 +301,26 @@
"; } - echo "
\n"; + $reply .= "
\n"; break; case "Panel de Administrador": - echo"
"; + $reply .= "
"; for($i = 0; $i < count($films_array); $i++){ $tittle = str_replace('_', ' ', $tittles[$i]); if($i%2 === 0){ - if($i != 0) echo "
+ if($i != 0) $reply .= "
"; - echo "
+ $reply .= "
"; } else{ - if($i != 0) echo "
+ if($i != 0) $reply .= "
"; - echo "
+ $reply .= "
"; } - echo "
+ $reply .= "
".$tittles[$i]."
@@ -336,25 +347,25 @@
"; } - echo "
\n"; + $reply .= "
\n"; break; case "Panel de Gerente": break; default: - echo'
+ $reply .='

Últimos Estrenos


'; $count = 0; for($i = count($tittles)-4; $i < count($tittles); $i++){ if($count%2===0){ - if($count != 0) echo " + if($count != 0) $reply .= "
"; - echo " + $reply .= "
"; } - echo " + $reply .= "
".$tittles[$i]."
@@ -362,7 +373,7 @@
"; $count++; } - echo " + $reply .= "
@@ -370,7 +381,7 @@
"; $count = rand(0, count($tittles)-1); $title = str_replace('_', ' ', $tittles[$count]); - echo " + $reply .= "

{$title}


".$tittles[$count]."
@@ -380,21 +391,23 @@ break; } + return $reply; } //Print Cinemas info: function print_cinemas(){ + $reply = ""; + //List of the cinemas: require_once(__DIR__.'/common/cinema_dao.php'); - $prefix= $this->get_prefix(); - $cine = new Cinema_DAO("complucine"); $cinemas = $cine->allCinemaData(); $ids = array(); $names = array(); $directions = array(); $phones = array(); + if(is_array($cinemas)){ foreach($cinemas as $key => $value){ $ids[$key] = $value->getId(); @@ -406,7 +419,7 @@ switch($this->page){ case "Panel de Administrador": - echo "
+ $reply .= "
@@ -422,7 +435,7 @@ "; if(is_array($cinemas)){ for($i = 0; $i < count($cinemas); $i++){ - echo ' + $reply .= ' @@ -449,16 +462,19 @@ '; } } - echo' + $reply .='
'. $ids[$i] .' '. $names[$i] .' '. $directions[$i] .'
'; break; - default: break; + default: + break; } + + return $reply; } //Print session MSG: diff --git a/cinemas/index.php b/cinemas/index.php index 2eb5d5a..c5e02d5 100644 --- a/cinemas/index.php +++ b/cinemas/index.php @@ -3,7 +3,7 @@ require_once('../assets/php/config.php'); //Specific page content: - $section = ''; + $section = ''; //General page content: require RAIZ_APP.'/HTMLtemplate.php'; diff --git a/index.php b/index.php index f866026..9e00a64 100644 --- a/index.php +++ b/index.php @@ -1,53 +1,17 @@ +
+
+
+ '.$template->print_fimls().' +
+
+
'; + + //General page content: + require RAIZ_APP.'/HTMLtemplate.php'; ?> - - - - - print_head(); - ?> - - - print_header(); - ?> - - -
-
logo_FDI-Cines
- Bienvenido {$_SESSION["nombre"]}\n"; - } - else{ - echo "

Bienvenido a CompluCine

\n"; - } - ?> -
-
- - -
-
-
- print_fimls(); - ?> -
-
-
- - - - print_footer(); - ?> - - - diff --git a/showtimes/index.php b/showtimes/index.php index f804ea9..3d30e03 100644 --- a/showtimes/index.php +++ b/showtimes/index.php @@ -2,7 +2,6 @@ //General Config File: require_once('../assets/php/config.php'); - /* //Page-specific content: $section = '
@@ -13,43 +12,4 @@ //General page content: require RAIZ_APP.'/HTMLtemplate.php'; - */ ?> - - - - - print_head(); - ?> - - - print_header(); - ?> - - - print_main(); - ?> - - -
-
- print_fimls(); - ?> -
-
- - - print_footer(); - ?> - - - -