This commit is contained in:
Daniel Muñoz Garcia 2021-05-13 17:37:09 +02:00 committed by GitHub
parent 58e8f0a17f
commit 7a52e6a6a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 64 deletions

View File

@ -27,7 +27,7 @@ class formAddCinema extends Form{
<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" name="add_cinema" class="primary" />
<input type="submit" id="submit" value="Añadir cine" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div> ';

View File

@ -35,7 +35,7 @@ class formAddFilm extends Form{
<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="Añadir pelicula" name="add_film" class="primary" />
<input type="submit" id="submit" value="Añadir pelicula" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>

View File

@ -35,7 +35,7 @@ class formAddPromotion extends Form{
<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="Añadir promocion" name="add_promotion" class="primary" />
<input type="submit" id="submit" value="Añadir promocion" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>

View File

@ -8,19 +8,19 @@ include_once('../assets/php/form.php');
class formDeleteCinema extends Form{
public function __construct(){
$op = array("action"=>"./?state=mc">);
$op = array("action"=>"./?state=mc");
parent::__construct('formAddCinema',$op);
}
protected function generaCamposFormulario($datos,$errores=array()){
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$html = '<div class="column side"></div>
<fieldset id = "cinema_form">'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<input type="hidden" name="id" value='.$_POST['name'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Name: '.$_POST['name'].' </p>
<p>Dirección: '.$_POST['direction'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p>
@ -39,15 +39,15 @@ class formDeleteCinema extends Form{
$id = $this->test_input($datos['id'])??null;
if(empty($id)){
$result['name']= "El nombre no es válido";
if(is_null($id)){
$result['id']= "El nombre no es válido";
}
if(count($result)===0){
$bd = new Cinema_DAO('complucine');
$exist = $bd -> cinemaData($id);
if(mysqli_num_rows($exist)==1){
$bd->deleteFilm($id);
$bd->deleteCinema($id);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
@ -62,7 +62,7 @@ class formDeleteCinema extends Form{
";
$result = './?state=mc';
}
$exist->free()
$exist->free();
}
else{
$result[] = "El cine seleccionado no existe.";

View File

@ -47,8 +47,8 @@ class formDeleteFilm extends Form{
protected function procesaFormulario($datos){
$result = array();
$id = $this->test_input($_POST['id']) ?? null;
if ( empty($id)) {
$id = $this->test_input($datos['id']) ?? null;
if ( is_null($id)) {
$result['id'] = "La pelicula seleccionada no existe.";
}

View File

@ -23,7 +23,7 @@ class formDeleteManager extends Form{
//$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
$html = '<div class="row">
<fieldset id="promotion_form"><pre>'.$htmlErroresGlobales.'</pre>
<fieldset id="manager_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este gerente?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>

View File

@ -19,6 +19,7 @@ class formDeletePromotion extends Form{
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
//$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
//$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
//$errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
@ -26,14 +27,14 @@ class formDeletePromotion extends Form{
//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
$html = '<div class="row">
<fieldset id= "promotion_form">
<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'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>Nombre: '.$_POST['tittle']'</p>
<p>Description:'.$_POST['description']'</p>
<p>Codigo: '.$_POST['code']'</p>
<p>Activa: '.$_POST['active']'</p>
<p>Nombre: '.$_POST['tittle'].'</p>
<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">
@ -51,7 +52,7 @@ class formDeletePromotion extends Form{
$id = $this->test_input($_POST['id']) ?? null;
if ( is_null($id)) {
$result[] = "La promoción seleccionada no existe.";
$result['id'] = "La promoción seleccionada no existe.";
}
if (count($result) === 0) {

View File

@ -8,23 +8,20 @@ include_once('../assets/php/form.php');
class formEditCinema extends Form{
public function __construct(){
$op = array("action"=>"./?state=mc">);
$op = array("action"=>"./?state=mc");
parent::__construct('formAddCinema',$op);
}
protected function generaCamposFormulario($datos,$errores=array()){
$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="column side"></div>
<div class="column middle">
<legend>Editar cines cine</legend>
<form method="post" enctype="multipart/form-data" action="index.php?state=mc">
<div class="row">
<fieldset id="film_form">
$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>
@ -32,7 +29,7 @@ class formEditCinema extends Form{
<input type="text" name="phone" value="'.$_POST['phone'].'"required/><pre>'.$errrorPhone.'</pre>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir cine" name="add_cinema" class="primary" />
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
@ -46,10 +43,10 @@ class formEditCinema extends Form{
$result =array();
$id = $this->test_input($_POST['id']) ?? null;
if ( empty($id)) {
$result[] = "El cine seleccionado no existe.";
}
$id = $this->test_input($datos['id']) ?? null;
// if (is_null($id)) {
// $result['id'] = "El cine seleccionado no existe.";
//}
$name = $this->test_input($datos['name'])??null;
@ -57,7 +54,7 @@ class formEditCinema extends Form{
$result['name']= "El nombre no es válido";
}
$direction = $this -> test_input($datos['direction']) ?? null;
$direction = $this->test_input($datos['direction']) ?? null;
if(empty($direction)){
$result['direction'] = "La dirección no es valida";
@ -70,11 +67,9 @@ class formEditCinema extends Form{
}
if(count($result)===0){
$bd = new Cinema_DAO('complucine');
$exist = $bd -> GetCinema($name,$direction);
$exist = $bd -> cinemaData($id);
if(mysqli_num_rows($exist)==1){
$bd->editCinema($id,$name,$direction,$phone);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>

View File

@ -54,8 +54,8 @@ class formEditFilm extends Form{
protected function procesaFormulario($datos){
$result = array();
$id = $this->test_input($_POST['id']) ?? null;
if ( empty($id)) {
$id = $this->test_input($datos['id']) ?? null;
if (is_null($id)) {
$result[] = "La pelicula seleccionada no existe.";
}

View File

@ -19,6 +19,7 @@ class formEditPromotion extends Form{
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
$errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
@ -50,8 +51,8 @@ class formEditPromotion extends Form{
$result = array();
$id = $this->test_input($_POST['id']) ?? null;
if ( is_null($id)) {
$result[] = "La promoción seleccionada no existe.";
if (is_null($id)) {
$result['id'] = "La promoción seleccionada no existe.";
}
$tittle = $this->test_input($datos['tittle']) ?? null;

View File

@ -17,10 +17,6 @@
else if(isset($_POST['delete_cinema'])) {
$this->deleteCinema();
}
else if(isset($_POST['add_cinema'])) {
$this->addCinema();
echo ($template->print_cinemas());
}
else {
$this-> addCinema();
echo ($template->print_cinemas());
@ -33,10 +29,6 @@
else if(isset($_POST['delete_film'])) {
$this->deleteFilm();
}
else if(isset($_POST['add_film'])) {
$this->addFilm();
echo ( $template->print_fimls());
}
else {
$this->addFilm();
echo( $template->print_fimls());
@ -49,9 +41,6 @@
else if(isset($_POST['delete_promotion'])) {
$this->deletePromotion();
}
else if(isset($_POST['add_promotion'])) {
$this->addPromotion();
}
else {
$this->addPromotion();
$this->print_promotions();
@ -145,8 +134,8 @@
}
function editCinema() {
include_once('./includes/formEditFilm.php');
$formEF = new formEditCinema();
include_once('./includes/formEditCinema.php');
$formEC = new formEditCinema();
$htmlDForm = $formEC->gestiona();
echo '<!-- Edit cinema -->
<div class="column side"></div>
@ -186,7 +175,6 @@
<th>IdCinema</th>
<th>Nombre</th>
<th>Email</th>
<th>password</th>
<th>Rol</th>
</tr>
</thead>
@ -274,6 +262,8 @@
</div>'."\n";
}
//Functions PROMOTIONS
function addPromotion(){
include_once('./includes/formAddPromotion.php');
$formAP = new formAddPromotion();