Add files via upload
This commit is contained in:
		| @@ -16,7 +16,8 @@ | ||||
|  | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|            $template->print_main(); | ||||
|             if(!isset($content)) $content = ""; | ||||
|             $template->print_main($content); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Section --> | ||||
|   | ||||
| @@ -1,7 +1,5 @@ | ||||
| <?php | ||||
| 		$template = new Template(); | ||||
| 		$prefix = $template->get_prefix(); | ||||
| 		include_once($prefix.'assets/php/dao.php'); | ||||
| 	include_once('../dao.php'); | ||||
| 	include_once('manager.php'); | ||||
|  | ||||
|     class Manager_DAO extends DAO { | ||||
|   | ||||
| @@ -46,4 +46,9 @@ | ||||
|      * @see http://php.net/manual/en/language.types.callable.php | ||||
|      */ | ||||
|     register_shutdown_function(array($app, 'shutdown')); | ||||
|  | ||||
|     //Depuración (BORRAR): | ||||
|     ini_set('display_errors', 1); | ||||
|     ini_set('display_startup_errors', 1); | ||||
|     error_reporting(E_ALL); | ||||
| ?> | ||||
|   | ||||
| @@ -130,7 +130,7 @@ | ||||
|     } | ||||
|  | ||||
|     //Print generic Main: | ||||
|     function print_main(){ | ||||
|     function print_main($content = ""){ | ||||
|         $page = $this->page; | ||||
|         $prefix = $this->prefix; | ||||
|  | ||||
| @@ -154,18 +154,18 @@ | ||||
|         /* MAIN */ | ||||
|         if($prefix === "./"){  | ||||
|             if(isset($_SESSION["nombre"])){ | ||||
|                 $header = "<h1>Bienvenido {$_SESSION["nombre"]}</h1>\n"; | ||||
|                 $tittle = "<h1>Bienvenido {$_SESSION["nombre"]}</h1>\n"; | ||||
|             } else { | ||||
|                 $header = "<h1>Bienvenido a CompluCine</h1>\n"; | ||||
|                 $tittle = "<h1>Bienvenido a CompluCine</h1>\n"; | ||||
|             } | ||||
|         } else { | ||||
|             $header = "<h1>{$page}</h1>\n"; | ||||
|             $tittle = "<h1>{$page}</h1>\n"; | ||||
|         } | ||||
|  | ||||
|         echo"<main> | ||||
|             <div class='image'><a href='{$prefix}'><img src='{$prefix}img/logo_trasparente.png' alt='logo_FDI-Cines' /></a></div> | ||||
|             {$sub_header} | ||||
|             {$header} | ||||
|             {$tittle}{$content} | ||||
|             <hr /> | ||||
|         </main>\n"; | ||||
|     } | ||||
|   | ||||
| @@ -12,7 +12,8 @@ | ||||
|         <section id="formulario"> | ||||
|             <h4>Formulario (EN DESARROLLO)</h4> | ||||
|             '.$htmlForm.' | ||||
|             </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|      | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
| @@ -1,29 +1,9 @@ | ||||
| <?php  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php'); | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
|         <?php | ||||
|             $template->print_header(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|             $template->print_main(); | ||||
|         ?> | ||||
|          | ||||
|         <!-- Description --> | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Description --> | ||||
|         <section id="description"> | ||||
|             <div class="code" id="resume"> | ||||
|                 <h1>Descripción</h1> | ||||
| @@ -60,12 +40,8 @@ | ||||
|                 </div> | ||||
|             </div> | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
|             $template->print_footer(); | ||||
|         ?> | ||||
|  | ||||
|     </body> | ||||
|  | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
|   | ||||
| @@ -1,29 +1,9 @@ | ||||
| <?php  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php'); | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
|         <?php | ||||
|             $template->print_header(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|             $template->print_main(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Flow --> | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Flow --> | ||||
|         <section id="flow"> | ||||
|             <div class="code"> | ||||
|                 <h2>FLUJO DE NAVEGACIÓN</h2> | ||||
| @@ -295,12 +275,8 @@ | ||||
|                 </div> | ||||
|             </div> | ||||
|         </section> | ||||
|         '; | ||||
|      | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
|             $template->print_footer(); | ||||
|         ?> | ||||
|  | ||||
|     </body> | ||||
|  | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
|   | ||||
| @@ -1,29 +1,9 @@ | ||||
| <?php  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php'); | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
| 		<?php | ||||
| 			$template->print_header(); | ||||
|         ?> | ||||
| 	 | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|             $template->print_main(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Details --> | ||||
| 	//Specific page content: | ||||
| 	$section = '<!-- Details --> | ||||
| 		<section id="details"> | ||||
| 			<div class = "code"> | ||||
| 				<h1>Detalles</h1> | ||||
| @@ -107,10 +87,8 @@ | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		</section> | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
| 			$template->print_footer(); | ||||
|         ?> | ||||
| 		'; | ||||
|      | ||||
|     </body> | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
|   | ||||
| @@ -1,33 +1,9 @@ | ||||
| <?php  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php'); | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
|         <?php | ||||
|             $template->print_header(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Main --> | ||||
|         <main> | ||||
|             <div class="image"><img src="../../img/logo_trasparente.png" /></div> | ||||
|             <!-- Sub Header --> | ||||
|             <?php | ||||
|                 $template->print_subheader(); | ||||
|             ?> | ||||
|     $content = '<hr /> | ||||
|                 <section id="members_table">  | ||||
|                 <h1>Miembros</h1> | ||||
|                 <hr /> | ||||
|                     <table> | ||||
|                         <thead> | ||||
|                             <tr> | ||||
| @@ -62,10 +38,10 @@ | ||||
|                             </tr> | ||||
|                         </tbody> | ||||
|                     </table> | ||||
|             </section> | ||||
|         </main> | ||||
|                 </section>'; | ||||
|      | ||||
|         <!-- Members --> | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Members --> | ||||
|                 <section id="members"> | ||||
|                     <div class="row"> | ||||
|                         <div class="column side"> | ||||
| @@ -162,16 +138,8 @@ | ||||
|                             </section> | ||||
|                         </div> | ||||
|                     </div> | ||||
|         </section> | ||||
|                 </section>'; | ||||
|  | ||||
|  | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
|             $template->print_footer(); | ||||
|         ?> | ||||
|         | ||||
|     </body> | ||||
|  | ||||
| </html> | ||||
|  | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
|   | ||||
| @@ -1,29 +1,9 @@ | ||||
| <?php  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php');  | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
|         <?php | ||||
|             $template->print_header(); | ||||
|         ?> | ||||
|      | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|             $template->print_main(); | ||||
|         ?> | ||||
|          | ||||
|         <!-- Planning --> | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Planning --> | ||||
|         <section class="planning"> | ||||
|             <div class="row"> | ||||
|                 <div class="column side"> | ||||
| @@ -284,12 +264,9 @@ | ||||
|                 en función de los requisitos de las prácticas y nuestra carga de trabajo. | ||||
|             </p> | ||||
|         </section> | ||||
|         '; | ||||
|      | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
|             $template->print_footer(); | ||||
|         ?> | ||||
|         | ||||
|     </body> | ||||
|  | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| @@ -1,32 +1,9 @@ | ||||
| <?php  | ||||
|     session_start();  | ||||
|     //General Config File: | ||||
|     require_once('../../assets/php/config.php');  | ||||
|      | ||||
|     //HTML template: | ||||
|     require_once('../../assets/php/template.php'); | ||||
|     $template = new Template();     | ||||
| ?> | ||||
| <!DOCTYPE HTML> | ||||
| <!-- | ||||
|     Práctica - Sistemas Web | Grupo D | ||||
|     CompluCine - FDI-cines | ||||
| --> | ||||
| <html lang="es"> | ||||
|     <!-- Head --> | ||||
|     <?php | ||||
|         $template->print_head(); | ||||
|     ?> | ||||
|     <body> | ||||
|         <!-- Header --> | ||||
|         <?php | ||||
|             $template->print_header(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Main --> | ||||
|         <?php | ||||
|             $template->print_main(); | ||||
|         ?> | ||||
|  | ||||
|         <!-- Section --> | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Section --> | ||||
|         <section id="terms_and_conditions"> | ||||
|             <div class="code"> | ||||
|                 <p> | ||||
| @@ -209,12 +186,8 @@ | ||||
|                 </ol> | ||||
|             </div> | ||||
|         </section> | ||||
|         '; | ||||
|      | ||||
|         <!-- Footer --> | ||||
|         <?php | ||||
|             $template->print_footer(); | ||||
|         ?> | ||||
|  | ||||
|     </body> | ||||
|  | ||||
| </html> | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
| @@ -10,7 +10,8 @@ | ||||
|                     '.$template->print_fimls().' | ||||
|                 </div> | ||||
|             </div> | ||||
|                 </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
| @@ -65,7 +65,8 @@ | ||||
|             <div class ="row"> | ||||
|                 '.$form.' | ||||
|             </div>	 | ||||
|                 </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
| @@ -17,7 +17,9 @@ | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="column side"></div>     | ||||
|                     </div>'; | ||||
|             </div> | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
|  | ||||
|     //Specific page content: | ||||
|     $section = '<!-- Reply --> | ||||
|                 <section class="reply"> | ||||
|         <section id="reply"> | ||||
|             <div class ="row"> | ||||
|                 <div class="column side"></div> | ||||
|                 <div class="column middle"> | ||||
| @@ -31,7 +31,8 @@ | ||||
|                 </div> | ||||
|                 <div class="column side"></div>     | ||||
|             </div> | ||||
|                 </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
							
								
								
									
										38
									
								
								panel_admin/includes/film.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								panel_admin/includes/film.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| <?php | ||||
|      | ||||
|     class Film{ | ||||
|  | ||||
|         //Attributes: | ||||
|         private $_id;               //Film ID. | ||||
|         private $_tittle;           //Film tittle. | ||||
|         private $_duration;         //Film duration. | ||||
|         private $_language;         //Film language. | ||||
|         private $_description;      //Film description. | ||||
|        | ||||
|  | ||||
| 		//Constructor: | ||||
|         function __construct($id, $tittle, $duration, $language, $description){ | ||||
|             $this->_id = $id; | ||||
|             $this->_tittle = $tittle; | ||||
|             $this->_duration = $duration; | ||||
|             $this->_language = $language; | ||||
|             $this->_description = $description; | ||||
|         } | ||||
|  | ||||
| 		//Methods: | ||||
|  | ||||
| 		//Getters && Setters: | ||||
|         public function setId($id){	$this->_id = $id; } | ||||
| 		public function getId(){ return $this->_id; } | ||||
|         public function setTittle($tittle) {$this->_tittle = $tittle; } | ||||
| 		public function getTittle(){return $this->_tittle;} | ||||
|         public function setDuration($duration){$this->_duration = $duration; } | ||||
| 		public function getDuration() {return $this->_duration;} | ||||
|         public function setLanguage($language) {$this->_language = $language; } | ||||
| 		public function getLanguage(){return $this->_language;} | ||||
|         public function setDescription($description){  $this->_description = $description;} | ||||
| 		public function getDescription(){return  $this->_description;} | ||||
|  | ||||
|  | ||||
|     } | ||||
| ?> | ||||
							
								
								
									
										166
									
								
								panel_admin/includes/formFilm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								panel_admin/includes/formFilm.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,166 @@ | ||||
| <?php | ||||
|  | ||||
| include_once('../assets/php/config.php'); | ||||
| include_once('../assets/php/common/film_dao.php'); | ||||
| include_once('../assets/php/common/film.php'); | ||||
| include_once('../assets/php/form.php'); | ||||
|  | ||||
| class FormFilm 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('formFilm'); | ||||
|         $this->reply = array(); | ||||
|     } | ||||
|  | ||||
|     public function getReply() { | ||||
| 		if($this->correct){ | ||||
| 			if($this->option == "new"){ | ||||
| 				$this->reply = "<div class='row'> | ||||
| 									<div class='column side'></div> | ||||
| 									<div class='column middle'> | ||||
| 										<div class='code info'> | ||||
| 											<h1> Operacion realizada con exito </h1><hr /> | ||||
| 											<p> Se ha añadido la pelicula correctamente en la base de datos.</p> | ||||
| 											<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a> | ||||
| 										</div> | ||||
| 									</div> | ||||
| 									<div class='column side'></div> | ||||
| 								</div> | ||||
| 								"; | ||||
| 			}else if($this->option == "edit"){ | ||||
| 								$this->reply = "<div class='row'> | ||||
| 													<div class='column side'></div> | ||||
| 													<div class='column middle'> | ||||
| 														<div class='code info'> | ||||
| 															<h1> Operacion realizada con exito </h1><hr /> | ||||
| 															<p> Se ha editado la pelicula correctamente en la base de datos.</p> | ||||
| 															<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a> | ||||
| 														</div> | ||||
| 													</div> | ||||
| 													<div class='column side'></div> | ||||
| 												</div> | ||||
| 												"; | ||||
| 			}else if($this->option == "del"){ | ||||
| 								$this->reply = "<div class='row'> | ||||
| 													<div class='column side'></div> | ||||
| 														<div class='column middle'> | ||||
| 															<div class='code info'> | ||||
| 																<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> | ||||
| 															</div> | ||||
| 														</div> | ||||
| 													<div class='column side'></div> | ||||
| 												</div> | ||||
| 												"; | ||||
| 			} | ||||
|  | ||||
| 		} else { | ||||
| 			$this->reply = "<div class='row'> | ||||
| 								<div class='column side'></div> | ||||
| 								<div class='column middle'> | ||||
| 									<div class='code info'> | ||||
| 										<h1>ERROR</h1><hr /> | ||||
| 										<p> Ha habido un error en la operacion. Revisa los datos introducidos</p> | ||||
| 										<a href='../panel_admin/index.php?state=mf'><button>Panel Admin</button></a> | ||||
| 									</div> | ||||
| 								</div> | ||||
| 								<div class='column side'></div> | ||||
| 							</div>"; | ||||
| 			 | ||||
| 		} | ||||
|         return $this->reply; | ||||
|     } | ||||
|  | ||||
|     //Process form: | ||||
| 	public function processesForm($_id, $_tittle, $_duration, $_language, $_description, $_img, $_option) { | ||||
| 		$this->correct = true; | ||||
| 		$this->option = $_option; | ||||
|  | ||||
| 		$id= $this->test_input($_id); | ||||
| 		$tittle=$this->test_input($_tittle); | ||||
| 		$duration=$this->test_input($_duration); | ||||
| 		$language=$this->test_input($_language); | ||||
| 		$description=$this->test_input($_description); | ||||
|  | ||||
| 		//Validate promotional film image. | ||||
| 		$file_name = $_FILES['file']['name']; | ||||
| 		//$file_type = $_FILES['file']['type']; | ||||
| 		$file_size = $_FILES['file']['size']; | ||||
| 		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; | ||||
| 		} | ||||
| 	 | ||||
| 		//Habria que validar todo para que encaje en la base de datos | ||||
| 			 | ||||
| 		$bd = new Film_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($tittle)&&$duration>0&&!empty($language)&&!empty($description)){ | ||||
| 					// comprobar si existe una pelicula con el mismo titulo e idioma | ||||
| 					$exist = $bd-> GetFilm($tittle,$language); | ||||
| 					if(mysqli_num_rows($exist) != 0){ | ||||
| 						$this->correct =false; | ||||
| 					} | ||||
| 					else{ | ||||
| 						$bd->createFilm(null, $tittle,$duration,$language,$description); | ||||
|  | ||||
| 					} | ||||
| 					$exist->free(); | ||||
| 				} | ||||
| 				else{ | ||||
| 					$this->correct =false; | ||||
| 				}	 | ||||
| 			} else if ($this->option == "del"){ | ||||
| 				//Primero comprobar si existe una pelicula con el mismo id | ||||
| 				$exist = $bd-> FilmData($id); | ||||
| 				if( mysqli_num_rows($exist) == 1){ | ||||
| 					$bd->deleteFilm($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($tittle)&&$duration>0&&!empty($language)&&!empty($description)){ | ||||
| 					//comprobar si existe una pelicula con el mismo id | ||||
| 					$exist = $bd-> FilmData($id); | ||||
| 					if( mysqli_num_rows($exist) == 1){ | ||||
| 						$bd->editFilm($id,$tittle,$duration,$language,$description); | ||||
| 					} | ||||
| 					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))); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| ?> | ||||
							
								
								
									
										107
									
								
								panel_admin/manage_films.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								panel_admin/manage_films.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
| <?php | ||||
|  | ||||
|     //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 addFilm(){ | ||||
|         echo'<div class="column side"></div> | ||||
|                 <div class="column middle"> | ||||
|                     <h2>Añadir pelicula</h2> | ||||
|                     <form method="post" enctype="multipart/form-data" action="index.php?state=mf"> | ||||
|                         <div class="row"> | ||||
|                             <fieldset id="film_form"> | ||||
|                             <legend>Datos de pelicula</legend> | ||||
|                                 <input type="text" name="tittle" id="tittle" placeholder="Título" /> | ||||
|                                 <input type="number" name="duration" id="duration" placeholder="Duración" /> | ||||
|                                 <input type="text" name="language" id="language" placeholder="Idioma" /> | ||||
|                                 <input type="text" name="description" id="description" placeholder="Descripción" /> | ||||
|                                 <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="reset" id="reset" value="Borrar" />        | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </form> | ||||
|                 </div> | ||||
|                 <div class="column side"></div> | ||||
|                 '; | ||||
|     } | ||||
|     function deleteFilm() { | ||||
|         echo'<div class="column side"></div> | ||||
|                 <div class="column middle"> | ||||
|                     <h2>Eliminar 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> | ||||
|                 <div class="column side"></div> | ||||
|                 '; | ||||
|     } | ||||
|     function editFilm() { | ||||
|         echo'<div class="column side"></div> | ||||
|                 <div class="column middle"> | ||||
|                 <h2>Editar pelicula</h2> | ||||
|                 <form method="post" enctype="multipart/form-data" 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'].'/> | ||||
|                             <input type="text" name="tittle" value="'.$_POST['tittle'].'" /> | ||||
|                             <input type="number" name="duration" id="duration" value='.$_POST['duration'].' /> | ||||
|                             <input type="text" name="language" id="language" value="'.$_POST['language'].'" /> | ||||
|                             <input type="text" name="description" id="description" value="'.$_POST['description'].'"/> | ||||
|                             <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="Editar" name="confirm_edit_film" class="primary" /> | ||||
|                             <input type="reset" id="reset" value="Borrar" />        | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </form> | ||||
|                 </div> | ||||
|                 <div class="column side"></div> | ||||
|                 '; | ||||
|     } | ||||
|  | ||||
|     // Logic Functions | ||||
|        function confirmDelete() { | ||||
|         $film = new FormFilm(); | ||||
|         $film->processesForm($_POST['id'],null,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'], $_POST['file'], "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'], $_POST['file'], "new"); | ||||
|         $_SESSION['message'] = $film->getReply(); | ||||
|         header('Location: ../panel_admin/index.php?state=mf'); | ||||
|     } | ||||
|  | ||||
|  | ||||
| ?> | ||||
| @@ -33,18 +33,24 @@ | ||||
|                                     | ||||
|                                 };  | ||||
|                     break; | ||||
|                     case 'mf': if(isset($_POST['edit_film'])) { | ||||
|                                 $this->editFilm(); | ||||
|                     case 'mf': require_once('manage_films.php');  | ||||
|                             if(isset($_POST['edit_film'])) { | ||||
|                                 editFilm(); | ||||
|                             } | ||||
|                             else if(isset($_POST['delete_film'])) { | ||||
|                                 $this->deleteFilm(); | ||||
|                                 deleteFilm(); | ||||
|                             } | ||||
|                             else if(isset($_POST['add_film'])) { | ||||
|                                 $this->addFilm(); | ||||
|                                 $template->print_fimls(); | ||||
|                                 confirmAdd(); | ||||
|                             } | ||||
|                             else if(isset($_POST['confirm_delete_film'])) { | ||||
|                                 confirmDelete();     | ||||
|                             } | ||||
|                             else if(isset($_POST['confirm_edit_film'])) { | ||||
|                                 confirmEdit(); | ||||
|                             } | ||||
|                             else { | ||||
|                                 $this->addFilm(); | ||||
|                                 addFilm(); | ||||
|                                 $template->print_fimls(); | ||||
|                             };   | ||||
|                     break; | ||||
| @@ -113,40 +119,6 @@ | ||||
|         function getTemplate(){ | ||||
|             return $this->template; | ||||
|         } | ||||
|  | ||||
|         //Functions FILMS | ||||
|         function addFilm(){ | ||||
|             include_once('./includes/formAddFilm.php'); | ||||
|             $formAF = new formAddFilm(); | ||||
|             $htmlAForm = $formAF->gestiona(); | ||||
|             echo   '<!-- Add film --> | ||||
|             <div class="column side"></div> | ||||
|                     <div class="column middle"> | ||||
|                     '.$htmlAForm.' | ||||
|                     </div>'."\n"; | ||||
|     } | ||||
|      | ||||
|         function deleteFilm() { | ||||
|             include_once('./includes/formDeleteFilm.php'); | ||||
|             $formDF = new formDeleteFilm(); | ||||
|             $htmlDForm = $formDF->gestiona(); | ||||
|             echo   '<!-- Add film --> | ||||
|             <div class="column side"></div> | ||||
|                     <div class="column middle"> | ||||
|                     '.$htmlDForm.' | ||||
|                     </div>'."\n"; | ||||
|         } | ||||
|         function editFilm() { | ||||
|             include_once('./includes/formEditFilm.php'); | ||||
|             $formEF = new formEditFilm(); | ||||
|             $htmlDForm = $formEF->gestiona(); | ||||
|             echo   '<!-- Add film --> | ||||
|             <div class="column side"></div> | ||||
|                     <div class="column middle"> | ||||
|                     '.$htmlDForm.' | ||||
|                     </div>'."\n"; | ||||
|         } | ||||
|     } | ||||
|     | ||||
| ?> | ||||
|  | ||||
|   | ||||
| @@ -91,9 +91,5 @@ class FormChangeEmail extends Form { | ||||
|         } | ||||
|         return $result; | ||||
|     } | ||||
|  | ||||
|     protected function test_input($input){ | ||||
|         return htmlspecialchars(trim(strip_tags($input))); | ||||
|     } | ||||
| } | ||||
| ?> | ||||
| @@ -6,6 +6,7 @@ | ||||
|     include_once('panelUser.php'); | ||||
|  | ||||
|     if($_SESSION["login"] && $_SESSION["rol"] === "user"){ | ||||
|         if(!isset($_GET["option"])) $_GET["option"] = null; | ||||
|         switch($_GET["option"]){ | ||||
|             case "manage_profile": | ||||
|                 $reply = UserPanel::manage(); | ||||
| @@ -48,7 +49,8 @@ | ||||
|                     '.$reply.' | ||||
|                 </div> | ||||
|             </div> | ||||
|         </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
| @@ -17,7 +17,8 @@ | ||||
|                 </div> | ||||
|                 <div class="column side"></div>     | ||||
|             </div> | ||||
|     </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
| ?> | ||||
| @@ -8,7 +8,8 @@ | ||||
|             <div class="row"> | ||||
|             '.$template->print_fimls().' | ||||
|             </div> | ||||
|             </section>'; | ||||
|         </section> | ||||
|         '; | ||||
|  | ||||
|     //General page content: | ||||
|     require RAIZ_APP.'/HTMLtemplate.php'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user