debug forms

This commit is contained in:
Daniel Muñoz Garcia 2021-06-08 13:45:44 +02:00 committed by GitHub
parent b989468601
commit ec0a391745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 40 additions and 44 deletions

View File

@ -8,7 +8,7 @@ include_once('../assets/php/form.php');
class formAddCinema extends Form{ class formAddCinema extends Form{
public function __construct(){ public function __construct(){
$op = array("action"=>"./?state=mc"); $op = array("action"=>"./?state=mc&option=a");
parent::__construct('formAddCinema',$op); parent::__construct('formAddCinema',$op);
} }
@ -77,7 +77,7 @@ class formAddCinema extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mc'; $result = './?state=mc';
} }
$exist->free(); $exist->free();
} }

View File

@ -11,7 +11,7 @@ class formAddFilm extends Form{
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mf", 'enctype' => 'multipart/form-data'); $options = array("action" => "./?state=mf&option=a", 'enctype' => 'multipart/form-data');
parent::__construct('formAddFilm', $options); parent::__construct('formAddFilm', $options);
} }
@ -126,7 +126,7 @@ class formAddFilm extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mf'; $result = './?state=mf';
}else { }else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado'; $result['img'] = 'El archivo tiene un nombre o tipo no soportado';

View File

@ -12,7 +12,7 @@ class formAddManager extends Form{
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mg"); $options = array("action" => "./?state=mg&option=a");
parent::__construct('formAddManager', $options); parent::__construct('formAddManager', $options);
} }
@ -78,7 +78,7 @@ class formAddManager extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mg'; $result = './?state=mg';
} }
$exist->free(); $exist->free();

View File

@ -11,7 +11,7 @@ class formAddPromotion extends Form{
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data'); $options = array("action" => "./?state=mp&option=a", 'enctype' => 'multipart/form-data');
parent::__construct('formAddPromotion', $options); parent::__construct('formAddPromotion', $options);
} }
@ -134,7 +134,7 @@ class formAddPromotion extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mp'; $result = './?state=mp';
}else { }else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado'; $result['img'] = 'El archivo tiene un nombre o tipo no soportado';

View File

@ -8,7 +8,7 @@ include_once('../assets/php/form.php');
class formDeleteCinema extends Form{ class formDeleteCinema extends Form{
public function __construct(){ public function __construct(){
$op = array("action"=>"./?state=mc"); $op = array("action"=>"./?state=mc&option=d");
parent::__construct('formAddCinema',$op); parent::__construct('formAddCinema',$op);
} }
@ -59,7 +59,7 @@ class formDeleteCinema extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mc'; $result = './?state=mc';
} }
$exist->free(); $exist->free();
} }

View File

@ -10,7 +10,7 @@ class formDeleteFilm extends Form{
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mf"); $options = array("action" => "./?state=mf&option=d");
parent::__construct('formDeleteFilm', $options); parent::__construct('formDeleteFilm', $options);
} }
@ -69,7 +69,7 @@ class formDeleteFilm extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mf'; $result = './?state=mf';
} }
else{ else{
$result[] = "La pelicula seleccionada no existe."; $result[] = "La pelicula seleccionada no existe.";

View File

@ -10,7 +10,7 @@ class formDeleteManager extends Form{
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mg"); $options = array("action" => "./?state=mg&option=d");
parent::__construct('formDeleteManager', $options); parent::__construct('formDeleteManager', $options);
} }
@ -64,7 +64,7 @@ class formDeleteManager extends Form{
</div> </div>
<div class='column side'></div> <div class='column side'></div>
</div>"; </div>";
//$result = './?state=mg'; $result = './?state=mg';
} }
else{ else{
$result[] = "ERROR. No existe un manager con ese ID"; $result[] = "ERROR. No existe un manager con ese ID";

View File

@ -10,7 +10,7 @@ class formDeletePromotion extends Form{
public function __construct() { public function __construct() {
$op = array("action" => "./?state=mp"); $op = array("action" => "./?state=mp&option=d");
parent::__construct('formEditPromotion', $op); parent::__construct('formEditPromotion', $op);
} }
@ -73,7 +73,7 @@ class formDeletePromotion extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mp'; $result = './?state=mp';
} }
else{ else{

View File

@ -8,7 +8,7 @@ include_once('../assets/php/form.php');
class formEditCinema extends Form{ class formEditCinema extends Form{
public function __construct(){ public function __construct(){
$op = array("action"=>"./?state=mc"); $op = array("action"=>"./?state=mc&option=e");
parent::__construct('formAddCinema',$op); parent::__construct('formAddCinema',$op);
} }
@ -83,7 +83,7 @@ class formEditCinema extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mc'; $result = './?state=mc';
} }
else{ else{
$result[] = "El cine seleccionado no existe."; $result[] = "El cine seleccionado no existe.";

View File

@ -12,7 +12,7 @@ class formEditFilm extends Form{
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mf", 'enctype' => 'multipart/form-data'); $options = array("action" => "./?state=mf&option=e", 'enctype' => 'multipart/form-data');
parent::__construct('formEditFilm', $options); parent::__construct('formEditFilm', $options);
} }
@ -137,7 +137,7 @@ class formEditFilm extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mf'; $result = './?state=mf';
}else { }else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado'; $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
@ -156,7 +156,7 @@ class formEditFilm extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mf'; $result = './?state=mf';
} }
} }

View File

@ -11,7 +11,7 @@ class formEditManager extends Form{
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mg"); $options = array("action" => "./?state=mg&option=e");
parent::__construct('formEditManager', $options); parent::__construct('formEditManager', $options);
} }
@ -69,7 +69,7 @@ class formEditManager extends Form{
</div> </div>
<div class='column side'></div> <div class='column side'></div>
</div>"; </div>";
// $result = './?state=mg'; $result = './?state=mg';
} }
else{ else{

View File

@ -12,7 +12,7 @@ class formEditPromotion extends Form{
const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); const EXTENSIONS = array('gif','jpg','jpe','jpeg','png');
public function __construct() { public function __construct() {
$options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data'); $options = array("action" => "./?state=mp&option=e", 'enctype' => 'multipart/form-data');
parent::__construct('formEditPromotion', $options); parent::__construct('formEditPromotion', $options);
} }
@ -139,7 +139,7 @@ class formEditPromotion extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mp'; $result = './?state=mp';
}else { }else {
$result['img'] = 'El archivo tiene un nombre o tipo no soportado'; $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
@ -158,7 +158,7 @@ class formEditPromotion extends Form{
<div class='column side'></div> <div class='column side'></div>
</div> </div>
"; ";
//$result = './?state=mp'; $result = './?state=mp';
} }
} }
else{ else{

View File

@ -9,10 +9,10 @@
if(!isset($_GET["state"])) if(!isset($_GET["state"]))
$_GET["state"] =null; $_GET["state"] =null;
switch($_GET["state"]){ switch($_GET["state"]){
case 'mc': if(isset($_POST['edit_cinema'])) { case 'mc': if(isset($_POST['edit_cinema']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) {
$reply=AdminPanel::editCinema(); $reply=AdminPanel::editCinema();
} }
else if(isset($_POST['delete_cinema'])) { else if(isset($_POST['delete_cinema']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) {
$reply=AdminPanel::deleteCinema(); $reply=AdminPanel::deleteCinema();
} }
else { else {
@ -26,46 +26,42 @@
} }
} }
} }
else { else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) {
$reply=AdminPanel::addCinema(); $reply=AdminPanel::addCinema();
$reply.= ($template->print_cinemas()); $reply.= ($template->print_cinemas());
} }}; break;
}; case 'mf': if(isset($_POST['edit_film']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) {
break;
case 'mf': if(isset($_POST['edit_film'])) {
$reply=AdminPanel::editFilm(); $reply=AdminPanel::editFilm();
} }
else if(isset($_POST['delete_film'])) { else if(isset($_POST['delete_film']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) {
$reply=AdminPanel::deleteFilm(); $reply=AdminPanel::deleteFilm();
} }
else { else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) {
$reply=AdminPanel::addFilm(); $reply=AdminPanel::addFilm();
$reply.= $template->print_fimls(); $reply.= $template->print_fimls();
}; };
break; break;
case 'mp': case 'mp':
if(isset($_POST['edit_promotion'])) { if(isset($_POST['edit_promotion']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) {
$reply=AdminPanel::editPromotion(); $reply=AdminPanel::editPromotion();
} }
else if(isset($_POST['delete_promotion'])) { else if(isset($_POST['delete_promotion']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) {
$reply=AdminPanel::deletePromotion(); $reply=AdminPanel::deletePromotion();
} }
else { else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) {
$reply=AdminPanel::addPromotion(); $reply=AdminPanel::addPromotion();
$reply.=AdminPanel::print_promotions(); $reply.=AdminPanel::print_promotions();
}; };
break; break;
case 'mg': if(isset($_POST['edit_manager'])) { case 'mg': if(isset($_POST['edit_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) {
$reply=AdminPanel::editManager(); $reply=AdminPanel::editManager();
} }
else if(isset($_POST['delete_manager'])) { else if(isset($_POST['delete_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) {
$reply=AdminPanel::deleteManager(); $reply=AdminPanel::deleteManager();
} }
else if(isset($_POST['add_manager'])) { else if(isset($_POST['add_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'a'))) {
$reply=AdminPanel::addManager(); $reply=AdminPanel::addManager();
} }
else { else {
$reply=AdminPanel::print_managers(); $reply=AdminPanel::print_managers();
$reply.=AdminPanel::showAddBotton(); $reply.=AdminPanel::showAddBotton();