template;
}
static function panel(){
include_once('../assets/php/includes/user.php');
$name = strtoupper(unserialize($_SESSION['user'])->getName());
$email = unserialize($_SESSION['user'])->getEmail();
$userPic = USER_PICS.strtolower($name).".jpg";
return $reply= '
'.$htmlAForm."\n";
}
static function deleteFilm() {
include_once('./includes/formDeleteFilm.php');
$formDF = new formDeleteFilm();
$htmlDForm = $formDF->gestiona();
return $reply= '
'.$htmlDForm.'
'."\n";
}
static function editFilm() {
include_once('./includes/formEditFilm.php');
$formEF = new formEditFilm();
$htmlDForm = $formEF->gestiona();
return $reply= '
'.$htmlDForm.'
'."\n";
}
//Functions Cinemas
static function addCinema(){
include_once('./includes/formAddCinema.php');
$formAC = new formAddCinema();
$htmlAForm = $formAC->gestiona();
return $reply= '
'.$htmlAForm.'
'."\n";
}
static function deleteCinema() {
include_once('./includes/formDeleteCinema.php');
$formDC = new formDeleteCinema();
$htmlDForm = $formDC->gestiona();
return $reply= '
'.$htmlDForm.'
'."\n";
}
static function editCinema() {
include_once('./includes/formEditCinema.php');
$formEC = new formEditCinema();
$htmlDForm = $formEC->gestiona();
return $reply= '
'.$htmlDForm.'
'."\n";
}
static function showHalls($idCinema) {
include_once('../assets/php/includes/hall.php');
include_once('../assets/php/includes/hall_dao.php');
$panel = '
';
$listhall = Hall::getListHalls($idCinema);
if(!$listhall){
$panel .= "
No hay ninguna sala en este cine";
}else{
$panel .= '
- Sala
- Asientos
- Sesión
';
$parity = "odd";
foreach($listhall as $hall){
$panel .='
- '. $hall->getNumber().'
- '.$hall->getTotalSeats().'
- Sesiones
';
$parity = ($parity == "odd") ? "even" : "odd";
}
$panel.='
';
}
$panel.='
';
return $panel;
}
static function showSessions($idCinema){
include_once('../assets/php/includes/hall.php');
include_once('../assets/php/includes/hall_dao.php');
include_once('../assets/php/includes/session_dao.php');
include_once('../assets/php/includes/session.php');
//Base filtering values
$date = $_POST['date'] ?? $_GET['date'] ?? date("Y-m-d");
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
//Session filter
$panel='
';
//Session list
$panel .=' ';
$sessions = Session::getListSessions($hall,$idCinema,$date);
if($sessions) {
$panel .='
';
} else {
$panel.='
No hay ninguna sesion
';
}
$panel.='
';
return $panel;
}
//Functions MANAGERS
static function print_managers(){
include_once('../assets/php/includes/manager_dao.php');
include_once('../assets/php/includes/manager.php');
$manager = new Manager_DAO("complucine");
$managers = $manager->allManagersData();
$ids = array();
$idscinemas = array();
$usernames = array();
$email = array();
$rol = array();
if(!is_array($managers)){
$reply = " No hay ningun manager
";
}
else{
foreach($managers as $key => $value){
$ids[$key] = $value->getId();
$idscinemas[$key] = $value->getIdcinema();
$usernames[$key] = $value->getUsername();
$email[$key] = $value->getEmail();
$rol[$key] = $value->getRoll();
}
$reply= "
- Id
- IdCinema
- Nombre
- Email
- Rol
- Editar
- Eliminar
";
for($i = 0; $i < count($managers); $i++){
$reply.= '
- '. $ids[$i] .'
- '. $idscinemas[$i] .'
- '. $usernames[$i] .'
- '. $email[$i] .'
- '. $rol[$i] .'
-
-
';
}
$reply.='
';
}
return $reply;
}
static function showAddBotton() {
return $reply = '
';
}
static function addManager(){
include_once('./includes/formAddManager.php');
$formAM = new formAddManager();
$htmlAForm = $formAM->gestiona();
return $reply= '
AÑADIR GERENTE
'.$htmlAForm.'
'."\n";
}
static function editManager(){
include_once('./includes/formEditManager.php');
$formEM = new formEditManager();
$htmlEForm = $formEM->gestiona();
return $reply= '
'.$htmlEForm.'
';
}
static function deleteManager(){
include_once('./includes/formDeleteManager.php');
$formDM = new formDeleteManager();
$htmlDForm = $formDM->gestiona();
return $reply= '
ELIMINAR GERENTE
'.$htmlDForm.'
'."\n";
}
//Functions PROMOTIONS
static function addPromotion(){
include_once('./includes/formAddPromotion.php');
$formAP = new formAddPromotion();
$htmlAForm = $formAP->gestiona();
return $reply= '
AÑADIR PROMOCIÓN
'.$htmlAForm.'
';
}
static function editPromotion(){
include_once('./includes/formEditPromotion.php');
$formEP = new formEditPromotion();
$htmlEForm = $formEP->gestiona();
return $reply= '
EDITAR PROMOCIÓN
'.$htmlEForm.'
'."\n";
}
static function deletePromotion(){
include_once('./includes/formDeletePromotion.php');
$formDP = new formDeletePromotion();
$htmlDForm = $formDP->gestiona();
return $reply= '
ELIMINAR PROMOCIÓN
'.$htmlDForm.'
'."\n";
}
static function print_promotions(){
$promo = new Promotion_DAO("complucine");
$promos = $promo->allPromotionData();
$ids = array();
$tittles = array();
$descriptions = array();
$codes = array();
$actives = array();
if(!is_array($promos)){
$reply = "
No hay promociones
";
}
else{
foreach($promos as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$codes[$key] = $value->getCode();
if ($value->getActive() == 0) {
$actives[$key] = "si";
}
else{
$actives[$key] = "no";
}
}
$reply= "
- Id
- Título
- Descripcion
- Código
- Activo
- Editar
- Eliminar
";
for($i = 0; $i < count($promos); $i++){
$reply.= '
- '. $ids[$i] .'
- '. $tittles[$i] .'
- '. $descriptions[$i] .'
- '. $codes[$i] .'
- '. $actives[$i] .'
-
-
';
}
$reply.='
';
}
return $reply ;
}
static function see_like_user(){
$_SESSION["lastRol"] = $_SESSION["rol"];
//unset($_SESSION["rol"]);
$_SESSION["rol"] = null;
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "
¡ATENCIÓN!
Está viendo la web como un Usuario NO Registrado.
";
}
static function see_like_registed_user(){
$_SESSION["lastRol"] = $_SESSION["rol"];
$_SESSION["rol"] = "user";
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "
¡ATENCIÓN!
Está viendo la web como un Usuario Registrado.
";
}
static function see_like_manager(){
$_SESSION["lastRol"] = $_SESSION["rol"];
$_SESSION["rol"] = "manager";
//header("Location: {$_SERVER['PHP_SELF']}");
return $reply = "
";
}
}
?>