Se ha eliminado el gerente correctamente en la base de datos.
";
}
} else {
$this->reply = "
ERROR
Ha habido un error en la operacion. Revisa los datos introducidos
";
}
return $this->reply;
}
//Process form:
public function processesForm($_id, $_idcinema, $_option) {
$this->correct = true;
$this->option = $_option;
$id= $this->test_input($_id);
$idcinema=$this->test_input($_idcinema);
//Habria que validar todo para que encaje en la base de datos
$bd = new Manager_DAO('complucine');
if($bd){
if($this->option == "new"){
//Check if any var is empty
if(!is_null($id)&&!empty($idcinema)){
// check if already exist a manager with same name
$exist = $bd->GetManagerCinema($id, $idcinema);
if( mysqli_num_rows($exist) != 0){
$this->correct =false;
}
else{
$bd->createManager($id, $idcinema);
}
$exist->free();
}
else{
$this->correct =false;
}
} else if ($this->option == "del"){
//Check if exist a manager with this id
$exist = $bd-> GetManager($id);
if( mysqli_num_rows($exist) == 1){
$bd->deleteManager($id);
}
else{
$this->correct =false;
}
} else if ($this->option == "edit"){
//Check if any var is empty
if(!empty($idcinema)){
//Check if exist a manager with this id
$exist = $bd-> GetManager($id);
if( mysqli_num_rows($exist) == 1){
$bd->editManager($id,$idcinema);
}
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)));
}
}
?>