diff --git a/assets/php/common/hall.php b/assets/php/common/hall.php index 9580548..a9f638a 100644 --- a/assets/php/common/hall.php +++ b/assets/php/common/hall.php @@ -1,5 +1,5 @@ searchHall($hall['cinema'], $hall['number'])){ - $bd->createHall($hall['number'], $hall['cinema'], $hall['cols'], $hall['rows']); - return "Se ha creado la sala con exito"; - } else { - return "Esta sala ya existe"; - } - } else { return "Error al conectarse a la base de datos"; } - } - //Getters && Setters: public function setNumber($number){ $this->_number = $number; } public function getNumber(){ return $this->_number; } diff --git a/assets/php/common/session.php b/assets/php/common/session.php index dc6e939..ca8fc2b 100644 --- a/assets/php/common/session.php +++ b/assets/php/common/session.php @@ -1,7 +1,7 @@ searchSession($session['cinema'], $session['origin_hall'],$session['origin_start'],$session['origin_date'])){ - $origin = array("cinema" => $session['cinema'],"hall" => $session['origin_hall'],"start" => $session['origin_start'],"date" => $session['origin_date']); - $bd->editSession($session['film'], $session['hall'], $session['cinema'], $session['date'], - $session['start'], $session['price'], $session['format'],$origin); - return "Se ha editado la session con exito"; - } else - return "Esta session no existe"; - - } else return "Error al conectarse a la base de datos"; - } - - public static function delete_session($session){ - $bd = new SessionDAO('complucine'); - if($bd ){ - if($bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){ - $bd->deleteSession($session['hall'], $session['cinema'], $session['date'], $session['start']); - return "Se ha eliminado la session con exito"; - } else - return "Esta session no existe"; - - } else return "Error al conectarse a la base de datos"; - } - - //Esto deberia estar en film.php? seguramente public static function getFilmTitle($idfilm){ $bd = new Film_DAO('complucine'); diff --git a/assets/php/common/session_dao.php b/assets/php/common/session_dao.php index 8d8abea..6330e5d 100644 --- a/assets/php/common/session_dao.php +++ b/assets/php/common/session_dao.php @@ -67,7 +67,7 @@ return $sessions; } - public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){ + public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){ $format = $this->mysqli->real_escape_string($format); $date = date('Y-m-d', strtotime( $date ) ); $startTime = date('H:i:s', strtotime( $startTime ) ); @@ -77,7 +77,7 @@ `start_time` = '%s', `seat_price` = '%d', `format` = '%s' WHERE idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", - $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin["cinema"],$origin["hall"],$origin["date"],$origin["start"]); + $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); diff --git a/assets/php/config.php b/assets/php/config.php index ebb1e38..670f787 100644 --- a/assets/php/config.php +++ b/assets/php/config.php @@ -7,10 +7,15 @@ define('BD_USER', 'sw'); define('BD_PASS', '_admin_'); + /* + * Configuration parameters used to generate URLs and file paths in the application + */ + define('ROUTE_APP', '/'); //Change if it´s necessary. + /** - * Temprarl files directory. - */ - define('TMP_DIR', __DIR__.'/img/'); + * Image files directory. + */ + define('IMG_DIR', ROUTE_APP.'img/'); /** * Utf-8 support settings, location (language and country) and time zone. diff --git a/assets/php/template.php b/assets/php/template.php index 61c9ee1..10b0c2c 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -186,14 +186,14 @@ case "manager": array_push($menus, "
  • Ver como...
  • "); array_push($menus, "
  • Modificar
  • "); break; diff --git a/panel_admin/includes/formFilm.php b/panel_admin/includes/formFilm.php index 1f1d772..aa0dd80 100644 --- a/panel_admin/includes/formFilm.php +++ b/panel_admin/includes/formFilm.php @@ -91,16 +91,17 @@ class FormFilm extends Form { //Validate promotional film image. $file_name = $_FILES['file']['name']; - $file_type = $_FILES['file']['type']; + //$file_type = $_FILES['file']['type']; $file_size = $_FILES['file']['size']; - if (strpos($file_type, "jpg") && $file_size < 100000) { - $uploadFile = TMP_DIR . basename($_FILES['file'][$_tittle]); + if(isset($file_name) && $file_name != "" + && strpos($file_name, "jpg") && $file_size < 100000){ + $uploadFile = IMG_DIR . basename($_FILES['file'][$_tittle]); if (!move_uploaded_file($file_name, $uploadFile)){ print_r($_FILES); } } else{ - $this->correct =false; + $this->correct = false; } //Habria que validar todo para que encaje en la base de datos diff --git a/panel_admin/manage_films.php b/panel_admin/manage_films.php index c873c99..2b6ddb1 100644 --- a/panel_admin/manage_films.php +++ b/panel_admin/manage_films.php @@ -19,7 +19,7 @@ -
    Imagen promocional:
    +
    Imagen promocional:
    @@ -61,7 +61,7 @@ echo'

    Editar pelicula

    -
    +
    Datos de pelicula @@ -70,7 +70,7 @@ -
    Imagen promocional:
    +
    Imagen promocional:
    diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php index 3a82ef9..c8f3c0b 100644 --- a/panel_admin/panelAdmin.php +++ b/panel_admin/panelAdmin.php @@ -34,9 +34,6 @@ }; break; case 'mf': require_once('manage_films.php'); - //echo $_SERVER['DOCUMENT_ROOT']."/../img"; - echo TMP_DIR; - //echo $_SERVER['PHP_SELF']; if(isset($_POST['edit_film'])) { editFilm(); } diff --git a/panel_manager/includes/formSession.php b/panel_manager/includes/formSession.php index 7f58fc0..1b81bf9 100644 --- a/panel_manager/includes/formSession.php +++ b/panel_manager/includes/formSession.php @@ -3,7 +3,7 @@ require_once($prefix.'assets/php/common/session_dao.php'); require_once($prefix.'assets/php/common/session.php'); require_once($prefix.'assets/php/form.php'); -require_once($prefix.'panel_admin/includes/film.php'); +require_once($prefix.'assets/php/common/film.php'); require_once($prefix.'assets/php/common/film_dao.php'); //Receive data from froms and prepare the correct response @@ -31,7 +31,7 @@ class FormSession extends Form {
    Datos -
    +



    '; if($data['option'] == "edit_session") - $htmlform .= ' - - - -
    + $htmlform .= '

    '; $htmlform .= ' @@ -90,13 +86,8 @@ class FormSession extends Form { if($data["option"] == "new_session"){ $_SESSION['msg'] = Session::create_session($data); header( "Location: ../?state=success" ); - }else if($data["option"] == "edit_session"){ - $_SESSION['msg'] = Session::edit_session($data); - header( "Location: ../?state=success" ); - } - else if($data["option"] == "delete_session") { - $_SESSION['msg'] = Session::delete_session($data); - header( "Location: ../?state=success" ); + }else { + } } } diff --git a/panel_manager/includes/processForm.php b/panel_manager/includes/processForm.php index 2f5148c..c0b9bee 100644 --- a/panel_manager/includes/processForm.php +++ b/panel_manager/includes/processForm.php @@ -16,17 +16,4 @@ ,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]); FormSession::processesForm($data); } - - if(isset($_POST['edit_session'])){ - $data = array("option" => "edit_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"] - ,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"] - , "origin_hall"=> $_POST["origin_hall"],"origin_date"=> $_POST["origin_date"],"origin_start"=> $_POST["origin_start"]); - FormSession::processesForm($data); - } - - if(isset($_POST['delete_session'])){ - $data = array("option" => "delete_session","cinema" => $_SESSION["cinema"], "hall"=> $_POST["origin_hall"] - ,"date"=> $_POST["origin_date"],"start"=> $_POST["origin_start"]); - FormSession::processesForm($data); - } ?> \ No newline at end of file diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index a3f1de1..05f0ffa 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -141,16 +141,7 @@ '. str_replace('_', ' ', Session::getFilmTitle($session->getIdfilm())) .' '.$session->getFormat().' '.$session->getSeatPrice().' - - - - - - - - - '; } $panel.=' @@ -178,9 +169,12 @@ } static function edit_session(){ - $data = array("option" => "edit_session","hall" => $_POST["hall"],"cinema" => $_SESSION["cinema"],"date" => $_POST['date'],"film" => $_POST['film'],"start" => $_POST['start'],"price" => $_POST['price'],"format" => $_POST['format']); - $panel = '

    Editar una sesión.



    - '.FormSession::generaCampoFormulario($data, null); + $panel = '
    +
    +

    Editar una session.



    +

    En desarrollo...

    +
    +
    '."\n"; return $panel; }