restructuring and functionality cinemas
This commit is contained in:
parent
d85e933c73
commit
dfbe2877b5
32
panel_admin/includes/cinema.php
Normal file
32
panel_admin/includes/cinema.php
Normal 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; }
|
||||
}
|
||||
?>
|
66
panel_admin/includes/cinema_dao.php
Normal file
66
panel_admin/includes/cinema_dao.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
include_once('cinema_dto.php');
|
||||
$template = new Template();
|
||||
$prefix = $template->get_prefix();
|
||||
include_once($prefix.'assets/php/dao.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;
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//Create a new film Data Transfer Object.
|
||||
public function loadCinema($id, $name, $direction, $phone){
|
||||
return new Cinema($id, $name, $direction, $phone);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
include_once('film_dto_interface.php');
|
||||
|
||||
class Film{
|
||||
|
||||
@ -33,5 +32,7 @@
|
||||
public function getLanguage(){return $this->_language;}
|
||||
public function setDescription($description){ $this->_description = $description;}
|
||||
public function getDescription(){return $this->_description;}
|
||||
|
||||
|
||||
}
|
||||
?>
|
115
panel_admin/includes/formCinema.php
Normal file
115
panel_admin/includes/formCinema.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
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/form.php');
|
||||
|
||||
class FormCinema extends Form {
|
||||
|
||||
//Atributes:
|
||||
private $correct; // Indicates if the session is correct.
|
||||
private $reply; // Validation response
|
||||
private $option;
|
||||
private $array;
|
||||
//Constructor:
|
||||
public function __construct() {
|
||||
parent::__construct('formCinema');
|
||||
$this->reply = array();
|
||||
}
|
||||
|
||||
public function getReply() {
|
||||
if($this->correct){
|
||||
if($this->option == "new"){
|
||||
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
|
||||
<p> Se ha añadido el cine correctamente en la base de datos.</p>
|
||||
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>";
|
||||
}else if($this->option == "edit"){
|
||||
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
|
||||
<p> Se ha editado el cine correctamente en la base de datos.</p>
|
||||
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>";
|
||||
}else if($this->option == "del"){
|
||||
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
|
||||
<p> Se ha eliminado el cine correctamente en la base de datos.</p>
|
||||
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>";
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->reply = "<h1> ERROR </h1><hr />
|
||||
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p>
|
||||
<a href='../panel_admin/index.php?state=mc'><button>Panel Admin</button></a>";
|
||||
|
||||
}
|
||||
return $this->reply;
|
||||
}
|
||||
|
||||
//Process form:
|
||||
public function processesForm($_id, $_name, $_direction, $_phone, $_option) {
|
||||
$this->correct = true;
|
||||
$this->option = $_option;
|
||||
|
||||
$id= $this->test_input($_id);
|
||||
$name=$this->test_input($_name);
|
||||
$direction=$this->test_input($_direction);
|
||||
$phone=$this->test_input($_phone);
|
||||
|
||||
//Habria que validar todo para que encaje en la base de datos
|
||||
|
||||
$bd = new Cinema_DAO('complucine');
|
||||
if($bd){
|
||||
if($this->option == "new"){
|
||||
//Primero comprobar si los campos no son vacios y la duracion es mayor que 0
|
||||
if(!empty($name)&&!empty($direction)&&!empty($phone)){
|
||||
// comprobar si existe una pelicula con el mismo nombre y direccion
|
||||
$exist = $bd->GetCinema($name,$direction);
|
||||
if( mysqli_num_rows($exist) != 0){
|
||||
$this->correct =false;
|
||||
}
|
||||
else{
|
||||
$bd->createCinema(null, $name, $direction, $phone);
|
||||
|
||||
}
|
||||
$exist->free();
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
} else if ($this->option == "del"){
|
||||
//Primero comprobar si existe una pelicula con el mismo id
|
||||
$exist = $bd-> CinemaData($id);
|
||||
if( mysqli_num_rows($exist) == 1){
|
||||
$bd->deleteCinema($id);
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
} else if ($this->option == "edit"){
|
||||
//Primero comprobar si los campos no son vacios y la duracion es mayor que 0
|
||||
if(!empty($name)&&!empty($direction)&&!empty($phone)){
|
||||
//comprobar si existe una pelicula con el mismo id
|
||||
$exist = $bd-> CinemaData($id);
|
||||
if( mysqli_num_rows($exist) == 1){
|
||||
$bd->editCinema($id,$name,$direction,$phone);
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
$exist->free();
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
}
|
||||
else {$this->correct = false;}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function test_input($input){
|
||||
return htmlspecialchars(trim(strip_tags($input)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -18,8 +18,6 @@ class FormFilm extends Form {
|
||||
$this->reply = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getReply() {
|
||||
if($this->correct){
|
||||
if($this->option == "new"){
|
||||
@ -34,8 +32,6 @@ class FormFilm extends Form {
|
||||
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
|
||||
<p> Se ha eliminado la pelicula correctamente en la base de datos.</p>
|
||||
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>";
|
||||
} else if($this->option == "show"){
|
||||
$this->reply= $this->array;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -104,9 +100,7 @@ class FormFilm extends Form {
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
} else if($this->option == "show") {
|
||||
$this->array = $bd->allFilmData();
|
||||
}
|
||||
}
|
||||
else {$this->correct = false;}
|
||||
}
|
||||
|
||||
|
@ -1,67 +1,151 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
$cinema = array(
|
||||
"idCine" => "1234",
|
||||
"name" => "cineJuan",
|
||||
"address"=> "calle..",
|
||||
"phone_number"=>"660099000",
|
||||
);
|
||||
//General Config File:
|
||||
include_once('../assets/php/config.php');
|
||||
|
||||
$delete_cinemas='<!-- delete_cinemas -->
|
||||
<div class="column left">
|
||||
<h2>Lista de cines</h2>
|
||||
<br></br>
|
||||
<div class="row">
|
||||
<table>
|
||||
<tr>
|
||||
<th>idCine</th>
|
||||
<th>nombre</th>
|
||||
<th>Dirección</th>
|
||||
<th>Teléfono</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> '. $cinema['idCine'] .' </td>
|
||||
<td> '. $cinema['name'] .' </td>
|
||||
<td> '. $cinema['address'] .' </td>
|
||||
<td> '. $cinema['phone_number'] .' </td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
include_once('../assets/php/common/cinema.php');
|
||||
include_once(__DIR__.'/includes/formCinema.php');
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
// View functions
|
||||
/*function drawCinema(){
|
||||
$cine = new Cinema_DAO("complucine");
|
||||
$cinemas = $cine->allCinemaData();
|
||||
echo "<div class='column left'>
|
||||
<table class='alt'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nombre</th>
|
||||
<th>Direccion</th>
|
||||
<th>Telefono</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
foreach($cinemas as $f){
|
||||
echo '
|
||||
<tr>
|
||||
<td>'. $f->getId() .'</td>
|
||||
<td>'. $f->getName() .'</td>
|
||||
<td>'. $f->getDirection() .'</td>
|
||||
<td>'. $f->getPhone() .'</td>
|
||||
<td>
|
||||
<form method="post" action="index.php?state=mc">
|
||||
<input name="id" type="hidden" value="'.$f->getId().'">
|
||||
<input name="name" type="hidden" value="'.$f->getName().'">
|
||||
<input name="direction" type="hidden" value="'.$f->getDirection().'">
|
||||
<input name="phone" type="hidden" value="'.$f->getPhone().'">
|
||||
<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="'.$f->getId().'">
|
||||
<input name="name" type="hidden" value="'.$f->getName().'">
|
||||
<input name="direction" type="hidden" value="'.$f->getDirection().'">
|
||||
<input name="phone" type="hidden" value="'.$f->getPhone().'">
|
||||
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo'<tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>'."\n";
|
||||
$add_cinemas='<!-- Add_cinemas -->
|
||||
<div class="column side">
|
||||
<h2>Añadir o modificar cine</h2>
|
||||
<form method="post" action="add_cinema.php">
|
||||
</div>';
|
||||
}*/
|
||||
function addCinema(){
|
||||
echo'<div class="column">
|
||||
<h2>Añadir cine</h2>
|
||||
<form method="post" action="index.php?state=mc">
|
||||
<div class="row">
|
||||
<fieldset id="datos_cine">
|
||||
<legend>Datos del cine</legend>
|
||||
<div class="_idCine">
|
||||
<input type="text" name="idCine" id="idCine" value="" placeholder="IdCine" />
|
||||
</div>
|
||||
<div class="_name">
|
||||
<input type="text" name="name" id="name" value="" placeholder="Nombre" />
|
||||
</div>
|
||||
<div class="_address">
|
||||
<input type="text" name="address" id="address" value="" placeholder="Direccion" />
|
||||
</div>
|
||||
<div class="_phone_number">
|
||||
<input type="number" name="phone_number" id="phone_number" value="" placeholder="Teléfono" />
|
||||
</div>
|
||||
<fieldset id="cinema_form">
|
||||
<legend>Datos del Cine</legend>
|
||||
<div>
|
||||
<input type="text" name="name" id="name" placeholder="Nombre" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="direction" id="direction" placeholder="Direccion" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="phone" id="phone" placeholder="Teléfono" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Añadir cine" class="primary" />
|
||||
<input type="submit" id="submit" value="Añadir cine" name="add_cinema" class="primary" />
|
||||
<input type="reset" id="reset" value="Borrar" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>'."\n";
|
||||
?>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
function deleteCinema() {
|
||||
echo'<div class="column">
|
||||
<h2>Editar cine</h2>
|
||||
<form method="post" action="index.php?state=mc">
|
||||
<div class="row">
|
||||
<fieldset id="cinema_form">
|
||||
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
|
||||
<input type="hidden" name="id" value='.$_POST['id'].'/>
|
||||
<p>Id: '.$_POST['id'].' </p>
|
||||
<p>Nombre: '.$_POST['name'].' </p>
|
||||
<p>Dirección: '.$_POST['direction'].' </p>
|
||||
<p>Teléfono: '.$_POST['phone'].' </p>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
|
||||
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
function editCinema() {
|
||||
echo'<div class="column">
|
||||
<h2>Editar cine</h2>
|
||||
<form method="post" action="index.php?state=mc">
|
||||
<div class="row">
|
||||
<fieldset id="cinema_form">
|
||||
<legend>Datos del cine</legend>
|
||||
<input type="hidden" name="id" value='.$_POST['id'].'/>
|
||||
<div>
|
||||
<input type="text" name="name" value="'.$_POST['name'].'" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="direction" value='.$_POST['direction'].' />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="phone" value='.$_POST['phone'].' />
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" />
|
||||
<input type="reset" id="reset" value="Borrar" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Logic Functions
|
||||
function confirmDelete() {
|
||||
$cine = new FormCinema();
|
||||
$cine->processesForm($_POST['id'],null,null,null,"del");
|
||||
$_SESSION['message'] = $cine->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
function confirmEdit() {
|
||||
$cine = new FormCinema();
|
||||
$cine->processesForm($_POST['id'], $_POST['name'], $_POST['direction'], $_POST['phone'],"edit");
|
||||
$_SESSION['message']= $cine->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
function confirmAdd() {
|
||||
$cine = new FormCinema();
|
||||
$cine->processesForm($_POST['id'], $_POST['name'], $_POST['direction'], $_POST['phone'],"new");
|
||||
$_SESSION['message'] = $cine->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,21 +1,16 @@
|
||||
<?php
|
||||
|
||||
include_once('../assets/php/common/film_dto.php');
|
||||
include_once(__DIR__.'/includes/formFilm.php');
|
||||
/*$f1 = new FilmDTO(1000,"Los vengadores",183,"español","");
|
||||
$f2 = new FilmDTO(2001,"Mecernarios",140,"español","");
|
||||
$f3 = new FilmDTO(3022,"Monster hunter",104,"español","");
|
||||
$f4 = new FilmDTO(4560,"Godzilla vs kong",113,"inglés","");
|
||||
$f5 = new FilmDTO(4260,"Tom y Jerry",131,"inglés","");
|
||||
$f6 = new FilmDTO(4606,"Pequeños Detalles",127,"inglés","");
|
||||
$film= array($f1, $f2, $f3, $f4,$f5,$f6); */
|
||||
|
||||
$film = new FormFilm();
|
||||
$film->processesForm(null, null, null, null, null, "show");
|
||||
|
||||
/*
|
||||
function drawFilms($films){
|
||||
echo "<div class='column'>
|
||||
//General Config File:
|
||||
include_once('../assets/php/config.php');
|
||||
include_once('./includes/formFilm.php');
|
||||
require_once($prefix.'assets/php/common/film_dao.php');
|
||||
|
||||
|
||||
// View functions
|
||||
/*function drawFilms(){
|
||||
$film = new Film_DAO("complucine");
|
||||
$films = $film->allFilmData();
|
||||
echo "<div class='column left'>
|
||||
<table class='alt'>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -36,7 +31,7 @@
|
||||
<td>'. $f->getLanguage() .'</td>
|
||||
<td>'. $f->getDescription().'</td>
|
||||
<td>
|
||||
<form method="post" action="./index.php?state=uf">
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<input name="id" type="hidden" value="'.$f->getId().'">
|
||||
<input name="tittle" type="hidden" value="'.$f->getTittle().'">
|
||||
<input name="duration" type="hidden" value="'.$f->getDuration().'">
|
||||
@ -46,7 +41,7 @@
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="./index.php?state=uf">
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<input name="id" type="hidden" value="'.$f->getId().'">
|
||||
<input name="tittle" type="hidden" value="'.$f->getTittle().'">
|
||||
<input name="duration" type="hidden" value="'.$f->getDuration().'">
|
||||
@ -60,14 +55,11 @@
|
||||
echo'<tbody>
|
||||
</table>
|
||||
</div>';
|
||||
}
|
||||
*/
|
||||
|
||||
}*/
|
||||
function addFilm(){
|
||||
echo'<div class="column side"></div>
|
||||
<div class="column middle">
|
||||
echo'<div class="column">
|
||||
<h2>Añadir pelicula</h2>
|
||||
<form method="post" action="update_film.php">
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<div class="row">
|
||||
<fieldset id="film_form">
|
||||
<legend>Datos de pelicula</legend>
|
||||
@ -90,11 +82,79 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column side"></div>';
|
||||
</div>';
|
||||
}
|
||||
//addFilm();
|
||||
//drawFilms($film->getReply());
|
||||
|
||||
function deleteFilm() {
|
||||
echo'<div class="column">
|
||||
<h2>Editar pelicula</h2>
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<div class="row">
|
||||
<fieldset id="film_form">
|
||||
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
|
||||
<input type="hidden" name="id" value='.$_POST['id'].'/>
|
||||
<p>Id: '.$_POST['id'].' </p>
|
||||
<p>Título: '.$_POST['tittle'].' </p>
|
||||
<p>Duración: '.$_POST['duration'].' </p>
|
||||
<p>Idioma: '.$_POST['language'].' </p>
|
||||
<p>Descripción: '.$_POST['description'].' </p>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
|
||||
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
function editFilm() {
|
||||
echo'<div class="column">
|
||||
<h2>Editar pelicula</h2>
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<div class="row">
|
||||
<fieldset id="film_form">
|
||||
<legend>Datos de pelicula</legend>
|
||||
<input type="hidden" name="id" value='.$_POST['id'].'/>
|
||||
<div>
|
||||
<input type="text" name="tittle" value="'.$_POST['tittle'].'" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="language" id="language" value="'.$_POST['language'].'" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
|
||||
<input type="reset" id="reset" value="Borrar" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Logic Functions
|
||||
function confirmDelete() {
|
||||
$film = new FormFilm();
|
||||
$film->processesForm($_POST['id'],null,null,null,null,"del");
|
||||
$_SESSION['message'] = $film->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
function confirmEdit() {
|
||||
$film = new FormFilm();
|
||||
$film->processesForm($_POST['id'], $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "edit");
|
||||
$_SESSION['message']= $film->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
function confirmAdd() {
|
||||
$film = new FormFilm();
|
||||
$film->processesForm(null, $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "new");
|
||||
$_SESSION['message'] = $film->getReply();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -11,12 +11,55 @@
|
||||
function showPanel($template) {
|
||||
if($this->login){
|
||||
switch($this->state) {
|
||||
case 'uf': require_once('updateFilm.php'); break;
|
||||
case 'mc': /*require_once('manage_cinemas.php')*/;echo"<h1>En construcción</h1>"; break;
|
||||
case 'mc': require_once('manage_cinemas.php');
|
||||
if(isset($_POST['edit_cinema'])) {
|
||||
editCinema();
|
||||
}
|
||||
else if(isset($_POST['delete_cinema'])) {
|
||||
deleteCinema();
|
||||
}
|
||||
else if(isset($_POST['add_cinema'])) {
|
||||
confirmAdd();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
else if(isset($_POST['confirm_delete_cinema'])) {
|
||||
confirmDelete();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
else if(isset($_POST['confirm_edit_cinema'])) {
|
||||
confirmEdit();
|
||||
header('Location: ../panel_admin/index.php?state=mc');
|
||||
}
|
||||
else {
|
||||
addCinema();
|
||||
$template->print_cinemas();
|
||||
|
||||
};
|
||||
break;
|
||||
case 'mf': require_once('manage_films.php');
|
||||
if(isset($_POST['edit_film'])) {
|
||||
editFilm();
|
||||
}
|
||||
else if(isset($_POST['delete_film'])) {
|
||||
deleteFilm();
|
||||
}
|
||||
else if(isset($_POST['add_film'])) {
|
||||
confirmAdd();
|
||||
}
|
||||
else if(isset($_POST['confirm_delete_film'])) {
|
||||
confirmDelete();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
else if(isset($_POST['confirm_edit_film'])) {
|
||||
confirmEdit();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
else {
|
||||
addFilm();
|
||||
$template->print_fimls();
|
||||
break;
|
||||
$template->print_fimls();
|
||||
|
||||
};
|
||||
break;
|
||||
case 'md': /*require_once('manage_discounts.php')*/;echo"<h1>En construcción</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;
|
||||
|
Loading…
Reference in New Issue
Block a user