Add files via upload
This commit is contained in:
parent
d04592392d
commit
b072147e03
@ -1,23 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
require('./includes/room_dto.php');
|
require('./includes/room_dto.php');
|
||||||
require('./includes/session_dto.php');
|
require('./includes/session_dto.php');
|
||||||
|
require('../panel_admin/includes/film_dto.php');
|
||||||
|
|
||||||
|
$r1 = new RoomDTO(1,20,20,30); //Esto se deberia cambiar por una llamada a una lista de salas
|
||||||
|
$r2 = new RoomDTO(2,10,30,30);
|
||||||
|
$rooms = array($r1, $r2);
|
||||||
|
|
||||||
|
require_once('./includes/listFilms.php');
|
||||||
|
$filmList = new ListFilms();
|
||||||
|
$films = $filmList->getArray();
|
||||||
|
|
||||||
|
|
||||||
if(isset($_REQUEST['option']) && $_REQUEST['option'] == 'edit') {
|
if(isset($_REQUEST['option']) && $_REQUEST['option'] == 'edit') {
|
||||||
echo "<p> Este es el panel de editar o eliminar una sesion. Deberia tener el formulario de crear una sesion nueva pero con los datos ya situados y quizas que solo aqui aparezca el boton de eliminar </p>";
|
echo "<p> Este es el panel de editar o eliminar una sesion. Deberia tener el formulario de crear una sesion nueva pero con los datos ya situados y quizas que solo aqui aparezca el boton de eliminar </p>";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo "<h2>Crear Sesion</h2>
|
echo "<h2>Crear Sesion</h2>
|
||||||
<form method=\"post\" action=\"validate.php\">
|
<form method=\"post\" id=\"new_ses\" action=\"validate.php\">
|
||||||
<div class=\"row\">
|
<div class=\"row\">
|
||||||
<fieldset id=\"datos\">
|
<fieldset id=\"datos\">
|
||||||
<legend>Datos</legend>
|
<legend>Datos</legend>
|
||||||
|
<input type=\"hidden\" name=\"cinema\" value =\"1\" />
|
||||||
<div class=\"_price\">
|
<div class=\"_price\">
|
||||||
<input type=\"number\" name=\"price\" id=\"price\" min=\"0\" placeholder=\"Precio de la entrada\" required/>
|
<input type=\"number\" name=\"price\" id=\"price\" min=\"0\" placeholder=\"Precio de la entrada\" required/>
|
||||||
</div>
|
</div>
|
||||||
<div class=\"_film\">
|
<select name=\"hall\" class=\"button large\">";
|
||||||
<input type=\"text\" name=\"film\" id=\"film\" value=\"\" placeholder=\"ID de la pelicula\" required/>
|
foreach($rooms as $r){
|
||||||
</div>
|
if($r->getid() == $_POST['hall']){
|
||||||
<div class=\"_format\">
|
echo "<option value=\"". $r->getid() ." \"selected> Sala ". $r->getid() . "</option>";
|
||||||
|
}else{
|
||||||
|
echo "<option value=\"". $r->getid() ." \"> Sala ". $r->getid() . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<div class=\"_format\">
|
||||||
<input type=\"text\" name=\"format\" id=\"format\" value=\"\" placeholder=\"Formato\" required/>
|
<input type=\"text\" name=\"format\" id=\"format\" value=\"\" placeholder=\"Formato\" required/>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@ -26,15 +42,25 @@
|
|||||||
<div class=\"_start_time\">
|
<div class=\"_start_time\">
|
||||||
<input type=\"time\" name=\"start\" id=\"start_time\" value=\"\" placeholder=\"Hora de inicio\" required/>
|
<input type=\"time\" name=\"start\" id=\"start_time\" value=\"\" placeholder=\"Hora de inicio\" required/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class=\"_date\">
|
||||||
|
<input type=\"date\" name=\"date\" id=\"date\" value=\"". $_POST['date'] . "\"Fecha de inicio\" required/>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class=\"actions\">
|
<div class=\"actions\">
|
||||||
<input type=\"submit\" id=\"submit\" value=\"Añadir\" class=\"primary\" />
|
<input type=\"submit\" id=\"submit\" value=\"Añadir\" class=\"primary\" />
|
||||||
<input type=\"reset\" id=\"reset\" value=\"Borrar\" />
|
<input type=\"reset\" id=\"reset\" value=\"Borrar\" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>";
|
</form>
|
||||||
|
<div>
|
||||||
|
<div class=\"column side\">
|
||||||
|
<select name=\"film\" form=\"new_ses\" class=\"button large\">";
|
||||||
|
foreach($films as $f){
|
||||||
|
echo "<option value=\"". $f->getId() ." \"> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>";
|
||||||
|
}
|
||||||
|
echo "</div>";
|
||||||
}
|
}
|
||||||
echo "</div>"
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,11 +35,8 @@ class FormSession extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Process form:
|
//Process form:
|
||||||
public function processesForm($price, $film, $format, $start) {
|
public function processesForm($film, $hall, $cinema, $date, $start, $price, $format) {
|
||||||
$this->correct = true;
|
$this->correct = true;
|
||||||
$hall = 2;
|
|
||||||
$cinema = 1;
|
|
||||||
$date = "2021-04-10";
|
|
||||||
//Habria que validar todo para que encaje en la base de datos
|
//Habria que validar todo para que encaje en la base de datos
|
||||||
|
|
||||||
$start = date('H:i:s', strtotime( $start ) );
|
$start = date('H:i:s', strtotime( $start ) );
|
||||||
|
53
panel_manager/includes/listFilms.php
Normal file
53
panel_manager/includes/listFilms.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require('../panel_admin/includes/film_dao.php');
|
||||||
|
|
||||||
|
|
||||||
|
class ListFilms{
|
||||||
|
|
||||||
|
//Atributes:
|
||||||
|
private $array;
|
||||||
|
private $size;
|
||||||
|
|
||||||
|
//Constructor:
|
||||||
|
public function __construct() {
|
||||||
|
$this->array = array();
|
||||||
|
$this->updateArray();
|
||||||
|
}
|
||||||
|
//Methods:
|
||||||
|
|
||||||
|
//Returns the whole session array
|
||||||
|
public function getArray() {
|
||||||
|
return $this->array;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Returns the value i from the array
|
||||||
|
public function getiArray($i) {
|
||||||
|
if($i < $size){
|
||||||
|
return $this->array($i);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update the array with new values
|
||||||
|
public function updateArray() {
|
||||||
|
|
||||||
|
$bd = new Film_DAO('complucine');
|
||||||
|
|
||||||
|
if($bd){
|
||||||
|
$selectFilms = $bd->allFilmData();
|
||||||
|
$selectFilms->data_seek(0);
|
||||||
|
$this->size = 0;
|
||||||
|
while ($fila = $selectFilms->fetch_assoc()) {
|
||||||
|
$this->array[]= new Film_DTO($fila['id'], $fila['tittle'], $fila['duration'], $fila['language'], "no hay descripcion en la base de datos");
|
||||||
|
$this->size++;
|
||||||
|
}
|
||||||
|
mysqli_free_result($selectFilms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -8,18 +8,10 @@ class ListSessions{
|
|||||||
//Atributes:
|
//Atributes:
|
||||||
private $array;
|
private $array;
|
||||||
private $size;
|
private $size;
|
||||||
|
|
||||||
private $cinema;
|
|
||||||
private $hall;
|
|
||||||
private $date;
|
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
public function __construct($cinema,$hall,$date) {
|
public function __construct() {
|
||||||
$this->array = array();
|
$this->array = array();
|
||||||
|
|
||||||
$this->cinema = $cinema;
|
|
||||||
$this->hall = $hall;
|
|
||||||
$this->date = $date;
|
|
||||||
}
|
}
|
||||||
//Methods:
|
//Methods:
|
||||||
|
|
||||||
@ -37,24 +29,20 @@ class ListSessions{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Change the patterns of the filter
|
|
||||||
public function setCinema($cinema){$this->cinema = $cinema;}
|
//Update the array with new values
|
||||||
public function setHall($hall){$this->hall = $hall;}
|
public function filterList($cinema, $hall, $date) {
|
||||||
public function setDate($date){$this->date = $date;}
|
|
||||||
|
$date = date('Y-m-d', strtotime( $date ) );
|
||||||
//Update the array with current filter values
|
|
||||||
public function filterList() {
|
|
||||||
|
|
||||||
$this->date = date('Y-m-d', strtotime( $this->date ) );
|
|
||||||
|
|
||||||
$bd = new sessionDAO('complucine');
|
$bd = new sessionDAO('complucine');
|
||||||
|
|
||||||
if($bd){
|
if($bd){
|
||||||
$selectSession = $bd->selectSession($this->cinema, $this->hall, null, $this->date);
|
$selectSession = $bd->selectSession($cinema, $hall, null, $date);
|
||||||
$selectSession->data_seek(0);
|
$selectSession->data_seek(0);
|
||||||
$this->size = 0;
|
$this->size = 0;
|
||||||
while ($fila = $selectSession->fetch_assoc()) {
|
while ($fila = $selectSession->fetch_assoc()) {
|
||||||
$this->array[]= new SessionDTO($fila['id'], $fila['idfilm'], $fila['idhall'], $fila['idcinema'], $fila['date'], date('h:i', strtotime( $fila['start_time'])) , $fila['seat_price'], $fila['format']);
|
$this->array[]= new SessionDTO($fila['id'], $fila['idfilm'], $fila['idhall'], $fila['idcinema'], $fila['date'], date('H:i', strtotime( $fila['start_time'])) , $fila['seat_price'], $fila['format']);
|
||||||
$this->size++;
|
$this->size++;
|
||||||
}
|
}
|
||||||
mysqli_free_result($selectSession);
|
mysqli_free_result($selectSession);
|
||||||
|
@ -53,17 +53,14 @@
|
|||||||
<li>Añadir/Editar/Eliminar:</li>
|
<li>Añadir/Editar/Eliminar:</li>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href='./?state=rooms'>Salas</a></li>
|
<li><a href='./?state=rooms'>Salas</a></li>
|
||||||
<li><a href='./?state=sessions&login=".$this->login."'>Sesiones</a></li>
|
<li><a href='./?state=sessions'>Sesiones</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!--Contents -->
|
<!--Contents -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="column middle">
|
<div class="column middle">
|
||||||
<?php
|
<?php $panel->showPanel(); ?>
|
||||||
$panel->showPanel();
|
|
||||||
?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
|
@ -1,69 +1,84 @@
|
|||||||
<?php
|
<?php
|
||||||
require('./includes/room_dto.php');
|
require('./includes/room_dto.php');
|
||||||
require('./includes/session_dto.php');
|
require('./includes/session_dto.php');
|
||||||
|
require('../panel_admin/includes/film_dto.php');
|
||||||
|
require('../panel_admin/includes/film_dao.php');
|
||||||
|
|
||||||
//Login form validate:
|
|
||||||
require_once('./includes/listSessions.php');
|
require_once('./includes/listSessions.php');
|
||||||
$sessionList = new ListSessions("1", "1", "2021-04-10");
|
$sessionList = new ListSessions();
|
||||||
|
|
||||||
|
$placeholder_date = date("Y-m-d");
|
||||||
|
$placeholder_hall = "1";
|
||||||
|
$filtered = false;
|
||||||
|
|
||||||
?>
|
if(isset($_POST['submit'])) {
|
||||||
<input type="date" name="fecha" min="2021-01-01" max="2031-12-31">
|
$sessionList->filterList(1,$_POST["hall"],$_POST["date"]);
|
||||||
<?php
|
$placeholder_date = $_POST["date"];
|
||||||
$r1 = new RoomDTO(0,20,20,30);
|
$placeholder_hall = $_POST["hall"];
|
||||||
$r2 = new RoomDTO(1,10,30,30);
|
$filtered = true;
|
||||||
$r3 = new RoomDTO(2,30,10,30);
|
}
|
||||||
$r4 = new RoomDTO(3,15,15,30);
|
|
||||||
$rooms = array($r1, $r2, $r3, $r4);
|
$sessions = $sessionList->getArray();
|
||||||
|
|
||||||
function drawRooms($ros){
|
$r1 = new RoomDTO(1,20,20,30); //Esto se deberia cambiar por una llamada a una lista de salas
|
||||||
echo "<table>";
|
$r2 = new RoomDTO(2,10,30,30);
|
||||||
foreach($ros as $r){
|
$rooms = array($r1, $r2);
|
||||||
echo "
|
echo"
|
||||||
|
<form method=\"post\">
|
||||||
|
<input type=\"date\" name=\"date\" value=\"". $placeholder_date . "\" min=\"2021-01-01\" max=\"2031-12-31\">
|
||||||
|
<select name=\"hall\" class=\"button large\">";
|
||||||
|
|
||||||
|
foreach($rooms as $r){
|
||||||
|
if($r->getid() == $placeholder_hall){
|
||||||
|
echo "
|
||||||
|
<option value=\"". $r->getid() ." \"selected> Sala ". $r->getid() . "</option>";
|
||||||
|
}else{
|
||||||
|
echo "
|
||||||
|
<option value=\"". $r->getid() ." \"> Sala ". $r->getid() . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "
|
||||||
|
<input type=\"submit\" name=\"submit\" value=\"Filtrar\" class=\"button large\" />
|
||||||
|
</div>";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="column side"> <?php
|
||||||
|
function drawSessions($ses,$bd){
|
||||||
|
echo "
|
||||||
|
<table class='alt'>
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <button type=\"button\"> Sala ". $r->getId() ."</button> </td>
|
<th>Hora</th>
|
||||||
</tr>";
|
<th>Pelicula</th>
|
||||||
}
|
<th>Formato</th>
|
||||||
echo "
|
<th>Precio</th>
|
||||||
</table>\n";
|
</tr>
|
||||||
}
|
</thead>
|
||||||
drawRooms($rooms);
|
<tbody>";
|
||||||
?>
|
foreach($ses as $s){
|
||||||
</div>
|
$fila = ($bd->FilmData($s->getIdfilm()))->fetch_assoc();
|
||||||
<div class="column side">
|
echo "
|
||||||
<?php
|
<tr>
|
||||||
$sessionList->filterList();
|
<td><a href=\"./?state=edit_session&option=edit\">" . $s->getStartTime() . "</a></td>
|
||||||
$sessions = $sessionList->getArray();
|
<td><a href=\"./?state=edit_session&option=edit\">" .$fila['tittle'] . "</a></td>
|
||||||
|
<td><a href=\"./?state=edit_session&option=edit\">" . $s->getFormat() . "</a></td>
|
||||||
function drawSessions($ses){
|
<td><a href=\"./?state=edit_session&option=edit\">". $s->getSeatPrice() . "</a></td>
|
||||||
|
</tr>";
|
||||||
echo "
|
}
|
||||||
<table class='alt'>
|
echo "
|
||||||
<thead>
|
<tbody>
|
||||||
<tr>
|
</table>";
|
||||||
<th>Hora</th>
|
}
|
||||||
<th>idPelícula</th>
|
if($filtered){
|
||||||
<th>Formato</th>
|
$bd = new Film_DAO('complucine');
|
||||||
<th>Precio</th>
|
if($bd){
|
||||||
</tr>
|
drawSessions($sessions,$bd);
|
||||||
</thead>
|
echo "
|
||||||
<tbody>";
|
<input type=\"submit\" name=\"submit\" value=\"Añadir\" class=\"button large\" formaction=\"./?state=edit_session&option=new\"/>\n";
|
||||||
foreach($ses as $s){
|
}
|
||||||
echo "
|
}
|
||||||
|
echo " </form>
|
||||||
<tr>
|
</div>";
|
||||||
|
?>
|
||||||
<td><a href=\"./?state=edit_session&option=edit\">" . $s->getStartTime() . "</a></td>
|
|
||||||
<td><a href=\"./?state=edit_session&option=edit\">" . $s->getIdfilm() . "</a></td>
|
|
||||||
<td><a href=\"./?state=edit_session&option=edit\">" . $s->getFormat() . "</a></td>
|
|
||||||
<td><a href=\"./?state=edit_session&option=edit\">". $s->getSeatPrice() . "</a></td>
|
|
||||||
|
|
||||||
</tr>"
|
|
||||||
;
|
|
||||||
}
|
|
||||||
echo "<tbody>
|
|
||||||
</table>\n";
|
|
||||||
echo "<a href=\"./?state=edit_session&option=new\" class='button large'>Añadir</a>";
|
|
||||||
}
|
|
||||||
drawSessions($sessions);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
//Login form validate:
|
//Login form validate:
|
||||||
require_once('./includes/formSession.php');
|
require_once('./includes/formSession.php');
|
||||||
$session = new FormSession();
|
$session = new FormSession();
|
||||||
$session->processesForm($_POST["price"], $_POST["film"], $_POST["format"],$_POST["start"]);
|
$session->processesForm($_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"]);
|
||||||
$reply = $session->getReply();
|
$reply = $session->getReply();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user