Example #1
0
 public static function actionAddProject($data)
 {
     $project = Project::getEntity($data['id']);
     if ($project->getId() != null) {
         // Save skills
         $new_project = Project::fetchEntity($data);
         $skills = $new_project->getSkills();
         if (count($skills) > 0) {
             foreach ($skills as $skill) {
                 if ($skill->isActive == 1) {
                     Skill::addSkillToProject($skill->id, $new_project->getId());
                 } else {
                     Skill::deleteSkillForProject($skill->id, $new_project->getId());
                 }
             }
         }
         // Return to save the team member
         return true;
     }
     return false;
 }
Example #2
0
 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";
         }
     }
 }