| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | use Phalcon\Mvc\View; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | use Phalcon\Mvc\Url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | class ProjetsController extends \ControllerBase | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |     protected $model; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |     protected $title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |     protected $controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     public function initialize() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |         $this->model = "Projet"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         $this->title = "Projets"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         $this->controller = "Projets"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     public function indexAction($message = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |         $projets = Projet::find(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         $this->view->setVar("projets", $projets); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $dialog = $this->jquery->bootstrap()->htmlModal("modal", "Ajouter un nouveau projet", "test"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $buttonFrm = $this->jquery->bootstrap()->htmlButton("btFrm", "Nouveau"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $dialog->addCancelButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $clients = User::find(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $dialog->renderContent($this->view, "projets", "frm", array("clients" => $clients)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         $buttonFrm->onClick($dialog->jsShow()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     public function updateAction() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         parent::updateAction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         //Retrouve l'id du dernier projet créer (En theorie celui qui vient d'être créé) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         $projet = Projet::findFirst(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |             "order" => "id DESC" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $idproj = $projet->getId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $this->response->redirect("Projets/read/$idproj"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     public function readAction($id = null, $redirect = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         $projet = Projet::findFirst($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $usecases = Usecase::find("idProjet = $id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $messages = Message::find("idProjet = $id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $colorTexte = "black"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $color = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $color["r"] = 245; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $color["g"] = 245; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $color["b"] = 247; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $avancementReel = $this->avancementReel($usecases); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         //Passage des différentes variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $this->view->setVar("colorTexte", $colorTexte); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $this->view->setVar("color", $color); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $this->view->setVar("projet", $projet); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $this->view->setVar("messages", $messages); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->view->setVar("usecases", $usecases); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         $this->view->setVar("avancement", $avancementReel); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         //Création de la progressbar | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $progress = $this->jquery->bootstrap()->htmlProgressbar("progress", "info", $avancementReel); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         $progress->showcaption(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         $this->jquery->get("Projets/resume/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         //Creation des évenements onClick et des éléments sur le menu | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $this->jquery->getOnClick("#menu1", "Projets/resume/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         $this->jquery->getOnClick("#menu2", "Projets/contributors/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $this->jquery->getOnClick("#menu3", "Projets/usecases/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $this->jquery->getOnClick("#menu5", "Projets/messages/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         if($redirect != null){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             switch($redirect){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |                 case(1): | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |                     $this->jquery->get("Projets/contributors/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |                 case(2): | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |                     $this->jquery->get("Projets/usecases/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |                 case(3): | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |                     $this->jquery->get("Projets/messages/$id", "#contentProjet"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         //Xeditable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         $this->jquery->exec("$('#nom').editable()", true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         $this->jquery->exec("$('#image').editable()", true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         //Compilation de Jquery dans la vue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     public function messagesAction($id = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         $messages = Message::find("idProjet = $id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         $this->jquery->postFormOnClick("#submitMsg", "Messages/update", "newMsgForm", null, array("jsCallback" => $this->jquery->getDeferred("Projets/messages/$id", "#contentProjet"))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $this->view->setVar("msg", $messages); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         $this->view->setVar("idProj", $id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         $this->view->render("projets", "messages"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |     public function resumeAction($id = null) | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |         $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); | 
            
                                                                        
                            
            
                                    
            
            
                | 118 |  |  |         $projet = Projet::findFirst($id); | 
            
                                                                        
                            
            
                                    
            
            
                | 119 |  |  |         $usecases = Usecase::find("idProjet = $id"); | 
            
                                                                        
                            
            
                                    
            
            
                | 120 |  |  |         $messages = Message::find("idProjet = $id"); | 
            
                                                                        
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |         //Créer un array en javascript contenant la liste des utilisateurs pour la liste des clients sur Xeditable | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |         $client = '['; | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |         $i = 0; | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |         foreach (User::find() as $c) { | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |             $i += 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  |             if ($id != 1) { | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  |                 $client .= ','; | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 130 |  |  |             $client .= '{value: ' . $c->getId() . ', text:"' . $c->getIdentite() . '"}'; | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  |         $client .= ']'; | 
            
                                                                        
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 135 |  |  |         //Select Xeditable | 
            
                                                                        
                            
            
                                    
            
            
                | 136 |  |  |         $this->jquery->exec("$('#idClient').editable({ | 
            
                                                                        
                            
            
                                    
            
            
                | 137 |  |  |                                 type: 'select', | 
            
                                                                        
                            
            
                                    
            
            
                | 138 |  |  |                                 pk: $id, | 
            
                                                                        
                            
            
                                    
            
            
                | 139 |  |  |                                 title: 'Enter username', | 
            
                                                                        
                            
            
                                    
            
            
                | 140 |  |  |                                 source: $client | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |         })", true); | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |         //Xeditable | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |         $this->jquery->exec("$('#description').editable()", true); | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |         $this->jquery->exec("$('#dateLancement').editable()", true); | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |         $this->jquery->exec("$('#dateFinPrevue').editable()", true); | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |         //Passage des variables à la vue | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |         $this->view->setVar("projet", $projet); | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |         $this->view->setVar("messages", $messages); | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |         $this->view->setVar("usecases", $usecases); | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |         //Compilation de Jquery dans la vue | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     public function usecasesAction($id = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |         $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         $taches = Tache::find(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         $usecases = Usecase::find(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             "idProjet = '$id'", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |             "order" => "poids DESC" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         $this->view->setVar("usecases", $usecases); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $this->view->setVar("taches", $taches); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         $dialog = $this->jquery->bootstrap()->htmlModal("modal", "Ajouter un nouveau projet", "test"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |         $buttonFrm = $this->jquery->bootstrap()->htmlButton("btFrm", "Nouveau"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         $dialog->addCancelButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |         $users = User::find(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         $dialog->renderContent($this->view, "usecases", "frm", array("users" => $users,"id"=> $id)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         $buttonFrm->onClick($dialog->jsShow()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |         //$this->jquery->exec("$('#poids').editable()", true); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         $this->jquery->compile($this->view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     public function contributorsAction($id = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         $contributor = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         $usecases = Usecase::find("idProjet = $id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         foreach ($usecases as $uc) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |             $contributor[] = $uc->getUser(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |         $contributor = array_unique($contributor, SORT_REGULAR); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         $this->view->setVar("contributors", $contributor); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         $this->view->setVar("usecases", $usecases);; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     //Calcule le taux d'avancement total d'un projet | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     public function avancementReel($usecases) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         //Calcul le taux de finition du projet en fonction du nombre d'usecases total et du taux d'avancement sur chaque usecases. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         $countUsecases = count($usecases); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         $totalAvancementFini = $countUsecases * 100; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         $totalAvancementReel = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         foreach ($usecases as $u) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |             $totalAvancementReel = $totalAvancementReel + $u->getAvancement(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $avancementReel = ($totalAvancementReel / $totalAvancementFini) * 100; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         return number_format($avancementReel, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 219 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 220 |  |  |  | 
            
                        
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.