public static function actionGetEntity() { if (isset($_GET['t']) && $_GET['t']) { $table = $_GET['t']; if (isset($_GET['i']) && $_GET['i'] && $_GET['i'] != null) { $id = $_GET['i']; } else { $id = null; } if ($table == 'customers' && ControleurRights::canAddCustomer()) { return Customer::getEntity($id); } elseif ($table == 'team_member' && ControleurRights::canAddTeamMember()) { $member = TeamMember::getEntity($id); $member->setSkills(Skill::getSkillsForUser($id)); return $member; } elseif ($table == 'users' && ControleurRights::canAddUser()) { $user = User::getEntity($id); $user->setPicture(); return $user; } elseif ($table == 'projects' && ControleurRights::canDisplayProjects()) { $project = Project::getEntity($id); $project->setSkills(Skill::getSkillsForProject($id)); return $project; } elseif ($table == 'plans' && ControleurRights::canDisplayPlans()) { return Plan::getEntity($id); } elseif ($table == 'right' && ControleurRights::canAddUser()) { $right = Right::getEntity($id); $rightClass = new ReflectionClass('RightColumnsLabel'); $right->setLabels($rightClass->getConstants()); return $right; } elseif ($table == 'skills' && ControleurRights::canAddSkills()) { return Skill::getEntity($id); } else { return "Table " . $table . " non configurée dans le CRUD ou interdiction d'accès à l'utilisateur"; } } }