2021-05-17 15:29:29 +02:00
|
|
|
<?php
|
2021-05-20 15:29:49 +02:00
|
|
|
require_once($prefix.'assets/php/includes/user.php');
|
2021-05-17 15:29:29 +02:00
|
|
|
|
|
|
|
class UserPanel {
|
|
|
|
//Atributes:
|
|
|
|
|
|
|
|
//Constructor:
|
|
|
|
function __construct(){}
|
|
|
|
|
|
|
|
//Methods:
|
|
|
|
|
|
|
|
//Welcome view.
|
|
|
|
static function panel(){
|
|
|
|
$name = strtoupper(unserialize($_SESSION['user'])->getName());
|
|
|
|
$email = unserialize($_SESSION['user'])->getEmail();
|
2021-05-23 16:23:25 +02:00
|
|
|
$userPic = USER_PICS.strtolower($name).".jpg";
|
|
|
|
|
|
|
|
$forms = self::manage();
|
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
return $reply = '<div class="code info">
|
2021-06-01 13:06:00 +02:00
|
|
|
<h1>Bienvenido, '.$name.', a tu Panel de Usuario.</h1>
|
2021-05-17 15:29:29 +02:00
|
|
|
<hr />
|
2021-05-23 16:23:25 +02:00
|
|
|
<a href="./?option=change_profile_pic"><img src='.$userPic.' alt="user_profile_picture"/></a>
|
2021-05-17 15:29:29 +02:00
|
|
|
<h3>'.strftime("%A %e de %B de %Y | %H:%M").'</h3>
|
|
|
|
<br />
|
|
|
|
<p>Usuario: '.$name.'</p>
|
|
|
|
<p>Email: '.$email.'</p>
|
2021-05-23 16:23:25 +02:00
|
|
|
</div>'."\n".$forms;
|
2021-05-17 15:29:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//Manage the user account.
|
|
|
|
static function manage(){
|
|
|
|
|
|
|
|
require_once('./includes/formChangePass.php');
|
|
|
|
require_once('./includes/formChangeEmail.php');
|
|
|
|
require_once('./includes/formChangeName.php');
|
|
|
|
|
|
|
|
$formCN = new FormChangeName();
|
|
|
|
$htmlFormChangeName = $formCN->gestiona();
|
|
|
|
|
|
|
|
$formCP = new FormChangePass();
|
|
|
|
$htmlFormChangePass = $formCP->gestiona();
|
|
|
|
|
|
|
|
$formCE = new FormChangeEmail();
|
|
|
|
$htmlFormChangeEmail = $formCE->gestiona();
|
|
|
|
|
2021-05-23 16:23:25 +02:00
|
|
|
return $reply = '
|
|
|
|
<!-- Cambiar Información de la Usuario -->
|
|
|
|
<br /><h2>Cambiar información de la cuenta</h2><hr />
|
|
|
|
<!-- Change User Name -->
|
2021-05-17 15:29:29 +02:00
|
|
|
<div class="column side">
|
|
|
|
<h2>Cambiar nombre de usuario</h2>
|
|
|
|
'.$htmlFormChangeName.'
|
|
|
|
</div>
|
|
|
|
<!-- Change User Password -->
|
|
|
|
<div class="column middle">
|
|
|
|
<h2>Cambiar contraseña</h2>
|
|
|
|
'.$htmlFormChangePass.'
|
|
|
|
</div>
|
|
|
|
<!-- Change User Email -->
|
|
|
|
<div class="column side">
|
|
|
|
<h2>Cambiar email de usuario</h2>
|
|
|
|
'.$htmlFormChangeEmail.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
2021-05-23 16:23:25 +02:00
|
|
|
//User purchase history.
|
|
|
|
static function changeUserPic(){
|
|
|
|
|
|
|
|
require_once('./includes/formUploadPic.php');
|
|
|
|
|
|
|
|
$formCP = new FormUploadFiles();
|
|
|
|
$htmlFormChangeUserPic = $formCP->gestiona();
|
|
|
|
|
|
|
|
$name = strtoupper(unserialize($_SESSION['user'])->getName());
|
|
|
|
$userPic = USER_PICS.strtolower($name).".jpg";
|
|
|
|
|
|
|
|
return $reply = '<!-- Form Change User Profile Picture -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<div class="code info">
|
|
|
|
<h1>Cambiar imagen de perfil</h1><hr />
|
|
|
|
<img src='.$userPic.' alt="user_profile_picture"/>
|
|
|
|
'.$htmlFormChangeUserPic.'
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>'."\n";
|
|
|
|
}
|
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
//User purchase history.
|
|
|
|
static function purchases(){
|
2021-05-28 14:21:10 +02:00
|
|
|
require_once('../assets/php/includes/purchase_dao.php');
|
2021-06-01 16:18:05 +02:00
|
|
|
include_once('../assets/php/includes/cinema_dao.php');
|
|
|
|
include_once('../assets/php/includes/hall_dao.php');
|
2021-05-28 14:21:10 +02:00
|
|
|
|
2021-05-28 14:28:04 +02:00
|
|
|
$purchasesHTML = '';
|
|
|
|
|
2021-05-28 14:21:10 +02:00
|
|
|
$purchaseDAO = new PurchaseDAO("complucine");
|
|
|
|
$purchases = $purchaseDAO->allPurchasesData(unserialize($_SESSION['user'])->getId());
|
|
|
|
|
2021-05-28 14:28:04 +02:00
|
|
|
if($purchases){
|
|
|
|
$sessions = array();
|
|
|
|
$halls = array();
|
|
|
|
$cinemas = array();
|
|
|
|
$rows = array();
|
|
|
|
$columns = array();
|
|
|
|
$dates = array();
|
|
|
|
foreach($purchases as $key=>$value){
|
|
|
|
$sessions[$key] = $value->getSessionId();
|
|
|
|
$halls[$key] = $value->getHallId();
|
|
|
|
$cinemas[$key] = $value->getCinemaId();
|
|
|
|
$rows[$key] = $value->getRow();
|
|
|
|
$columns[$key] = $value->getColumn();
|
|
|
|
$dates[$key] = $value->getTime();
|
|
|
|
}
|
2021-06-01 16:18:05 +02:00
|
|
|
|
2021-05-28 14:21:10 +02:00
|
|
|
for($i = 0; $i < count($purchases); $i++){
|
2021-06-01 16:18:05 +02:00
|
|
|
$cinemaDAO = new Cinema_DAO("complucine");
|
|
|
|
$cinema = $cinemaDAO->cinemaData($cinemas[$i]);
|
|
|
|
$hallDAO = new HallDAO("complucine");
|
|
|
|
$hall = $hallDAO->HallData($halls[$i]);
|
|
|
|
|
2021-05-28 14:21:10 +02:00
|
|
|
if($i%2 === 0){
|
|
|
|
if($i != 0) $purchasesHTML .= '</div>
|
|
|
|
';
|
|
|
|
$purchasesHTML .= '<div class="column left">
|
|
|
|
';
|
|
|
|
} else {
|
|
|
|
if($i != 0) $purchasesHTML .= '</div>
|
|
|
|
';
|
|
|
|
$purchasesHTML .= '<div class="column left">
|
|
|
|
';
|
|
|
|
}
|
2021-05-30 16:25:45 +02:00
|
|
|
$purchasesHTML .= '<h1>Compara realizada el: '.$dates[$i].'</h1><hr />
|
2021-06-01 16:18:05 +02:00
|
|
|
<p>Cine: '.$cinema->getName().'</p>
|
|
|
|
<p>Dirección: '.$cinema->getDirection().'</p>
|
|
|
|
<p>Sala: '.$hall->getNumber().'</p>
|
2021-05-30 16:25:45 +02:00
|
|
|
<p>Sesión: '.$sessions[$i].'</p>
|
|
|
|
<p>Asiento(Fila): '.$rows[$i].'</p>
|
|
|
|
<p>Asiento(Columna): '.$columns[$i].'</p>';
|
2021-05-28 14:21:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
return $reply = '<div class="code info">
|
2021-05-28 14:21:10 +02:00
|
|
|
<h2>Historial de compras</h2><hr />
|
|
|
|
'.$purchasesHTML.'
|
2021-05-17 15:29:29 +02:00
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//User payment details
|
|
|
|
static function payment(){
|
|
|
|
return $reply = '<div class="code info">
|
|
|
|
<h2>Aquí los datos de pago</h2><hr />
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//Delete user account.
|
|
|
|
static function delete(){
|
|
|
|
require_once('./includes/formDeleteAccount.php');
|
|
|
|
|
|
|
|
$formDA = new FormDeleteAccount();
|
|
|
|
$htmlFormDeleteAccount = $formDA->gestiona();
|
|
|
|
|
|
|
|
return $reply = '<div class="code">
|
|
|
|
<h2>ELIMINAR CUENTA DE USUARIO</h2><hr />
|
|
|
|
<div class="column side"></div>
|
|
|
|
<!-- Delete User Form -->
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlFormDeleteAccount.'
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|