Add files via upload

This commit is contained in:
Daniel Muñoz Garcia 2021-04-15 10:18:50 +02:00 committed by GitHub
parent 3e7378d9d9
commit 79ae1b24db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 36 deletions

View File

@ -39,12 +39,7 @@
public function allFilmData(){ public function allFilmData(){
$sql = sprintf( "SELECT * FROM film "); $sql = sprintf( "SELECT * FROM film ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
while($fila=mysqli_fetch_array($resul)){
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]);
}
$resul->free();
return $films;
} }
//Returns a query to get all films tittles. //Returns a query to get all films tittles.

View File

@ -1,6 +1,7 @@
<?php <?php
include_once('film_dao.php'); include_once('film_dao.php');
include_once('film_dto.php');
include_once('../assets/php/form.php'); include_once('../assets/php/form.php');
class FormFilm extends Form { class FormFilm extends Form {
@ -63,8 +64,10 @@ class FormFilm extends Form {
$this->correct =false; $this->correct =false;
} }
else{ else{
$bd->createFilm(null, $tittle,$duration,$language,$description); $resul=$bd->createFilm(null, $tittle,$duration,$language,$description);
$resul->free();
} }
$exist->free();
} }
else{ else{
$this->correct =false; $this->correct =false;
@ -72,7 +75,7 @@ class FormFilm extends Form {
} else if ($option == "del"){ } else if ($option == "del"){
//Primero comprobar si existe una pelicula con el mismo id //Primero comprobar si existe una pelicula con el mismo id
$exist = $bd-> FilmData($id); $exist = $bd-> FilmData($id);
if( mysqli_num_rows($exist) != 0){ if( mysqli_num_rows($exist) == 1){
$bd->deleteFilm($id); $bd->deleteFilm($id);
} }
else{ else{
@ -83,21 +86,28 @@ class FormFilm extends Form {
if(!empty($tittle)&&$duration>0&&!empty($language)&&!empty($description)){ if(!empty($tittle)&&$duration>0&&!empty($language)&&!empty($description)){
//comprobar si existe una pelicula con el mismo id //comprobar si existe una pelicula con el mismo id
$exist = $bd-> FilmData($id); $exist = $bd-> FilmData($id);
if( mysqli_num_rows($exist) != 0){ if( mysqli_num_rows($exist) == 1){
$bd->editFilm($id,$tittle,$duration,$language,$description); $resul = $bd->editFilm($id,$tittle,$duration,$language,$description);
$resul->free();
} }
else{ else{
$this->correct =false; $this->correct =false;
} }
$exist->free();
} }
else{ else{
$this->correct =false; $this->correct =false;
} }
} else if($this->option == "show") { } else if($this->option == "show") {
$this->array = $bd->allFilmData(); $resul = $bd->allFilmData();
while($fila=mysqli_fetch_assoc($resul)){
$this->array = new FilmDTO($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]);
}
$resul->free();
} }
else {$this->correct = false;} else {$this->correct = false;}
} }
$bd->__destruct();
} }
} }

View File

@ -41,23 +41,18 @@
<!-- Left Sidebar --> <!-- Left Sidebar -->
<div class="sidebar left"> <div class="sidebar left">
<ul> <ul>
<li>Funcionalidad:</li>
<ul>
<li><a href="index.php?state=">Subfuncionalidad </a></li>
<li><a href="index.php?state=">Subfuncionalidad</a></li>
</ul><br />
<li>Ver como:</li> <li>Ver como:</li>
<ul> <ul>
<li><a href="index.php?state=">Usuario no registrado</a></li> <li><a href="index.php?state=un">Usuario no registrado</a></li>
<li><a href="index.php?state=">Usuario registrado</a></li> <li><a href="index.php?state=ur">Usuario registrado</a></li>
<li><a href="index.php?state=">Gerente</a></li> <li><a href="index.php?state=ag">Gerente</a></li>
</ul><br /> </ul><br />
<li>Añadir/Editar/Eliminar:</li> <li>Añadir/Editar/Eliminar:</li>
<ul> <ul>
<li><a href="index.php?state=mc">Cines</a></li> <li><a href="index.php?state=mc">Cines</a></li>
<li><a href="index.php?state=mf">Películas</a></li> <li><a href="index.php?state=mf">Películas</a></li>
<li><a href="index.php?state=">Promociones</a></li> <li><a href="index.php?state=md">Promociones</a></li>
<li><a href="index.php?state=">Gerente</a></li> <li><a href="index.php?state=mg">Gerente</a></li>
</ul> </ul>
</ul> </ul>
</div> </div>

View File

@ -1,6 +1,6 @@
<?php <?php
require('./includes/film_dto.php'); include_once('./includes/film_dto.php');
require('./includes/formFilm.php'); include_once('./includes/formFilm.php');
/*$f1 = new FilmDTO(1000,"Los vengadores",183,"español",""); /*$f1 = new FilmDTO(1000,"Los vengadores",183,"español","");
$f2 = new FilmDTO(2001,"Mecernarios",140,"español",""); $f2 = new FilmDTO(2001,"Mecernarios",140,"español","");
$f3 = new FilmDTO(3022,"Monster hunter",104,"español",""); $f3 = new FilmDTO(3022,"Monster hunter",104,"español","");

View File

@ -1,19 +1,28 @@
<?php <?php
class Panel { class Panel {
public $state; public $state;
public $login;
function __construct($panel){ function __construct($panel, $login){
$this->state = $panel; $this->state = $panel;
$this->login= $login;
} }
function showPanel() { function showPanel() {
switch($this->state) { if($this->login){
case 'uf': require('updateFilm.php');break; switch($this->state) {
case 'mc': require('manage_cinemas.php'); break; case 'uf': require_once('updateFilm.php');break;
case 'mf': require('manage_films.php'); break; case 'mc': /*require_once('manage_cinemas.php')*/;echo"<h1>En construcción</h1>"; break;
case 'md': require('manage_discounts.php'); break; case 'mf': require_once('manage_films.php'); break;
case 'mm': require('manage_managers.php'); break; case 'md': /*require_once('manage_discounts.php')*/;echo"<h1>En construcción</h1>"; break;
default: echo "<h1>BIENVENIDO AL PANEL DE ADMINISTRADOR</h1>"; break; case 'mm': /*require_once('manage_managers.php')*/;echo"<h1>En construcción</h1>"; break;
case 'un': echo"<h1>En construcción</h1>"; break;
case 'ur': echo"<h1>En construcción</h1>";; break;
case 'ag': echo"<h1>En construcción</h1>";; break;
default: echo "<h1>BIENVENIDO AL PANEL DE ADMINISTRADOR</h1>"; break;
}
}
else {
echo "<h1>NO TIENES PERMISOS DE ADMINISTRADOR</h1>";
} }
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
include_once('./includes/film_dto.php'); require_once('../assets/php/dao.php');
include_once('./includes/formFilm.php'); include_once('./includes/formFilm.php');
if(isset($_POST['edit_film'])) { if(isset($_POST['edit_film'])) {
echo'<div class="column size"> echo'<div class="column size">
<h2>Editar pelicula</h2> <h2>Editar pelicula</h2>
@ -30,7 +30,6 @@
</div> </div>
</form> </form>
</div>'; </div>';
} }
else if(isset($_POST['delete_film'])) { else if(isset($_POST['delete_film'])) {
echo'<div class="column size"> echo'<div class="column size">