giteaservice = $giteaservice; } public function list(Request $request) { $em = $this->getDoctrine()->getManager(); $scrums = $em->getRepository($this->entity)->findByUser($this->getUser()); $this->giteaservice->needrefresh(); $giteacategorys=[]; $gitearepos=[]; foreach($scrums as $key => $scrum) { if(!in_array($scrum->getCategory(),$giteacategorys)) array_push($giteacategorys,$scrum->getCategory()); $gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]); if($gitearepo) { if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) { $scrum->setGiteajson(json_decode(json_encode($gitearepo), true)); $em->persist($scrum); $em->flush(); } array_push($gitearepos,$gitearepo); } } sort($giteacategorys); $filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",0); $filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",0); return $this->render($this->render.'list.html.twig',[ $this->data."s" => $scrums, "giteacategorys" => $giteacategorys, "gitearepos" => $gitearepos, "filtercategorys" => $filtercategorys, "filterrepos" => $filterrepos, "useheader" => true, "usesidebar" => false, ]); } public function submit(Request $request) { // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $data = new Entity(); // Récupérer les repos de gitea $gitearepos=$this->giteaservice->getRepos(); // Création du formulaire $form = $this->createForm(Form::class,$data,array("mode"=>"submit","gitearepos"=>$gitearepos)); // Récupération des data du formulaire $form->handleRequest($request); // Sur erreur $this->getErrorForm(null,$form,$request,$data,"submit"); // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); $gitearepo=$this->giteaservice->getRepo($data->getGiteaid()); $data->setGiteaname($gitearepo->full_name); $data->setGiteajson(json_decode(json_encode($gitearepo), true)); $em->persist($data); $em->flush(); // Retour à la liste return $this->redirectToRoute($this->route); } // Affichage du formulaire return $this->render($this->render.'edit.html.twig', [ 'useheader' => true, 'usesidebar' => false, 'maxwidth' => true, $this->data => $data, 'mode' => 'submit', 'form' => $form->createView() ]); } public function update($id,Request $request) { // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $data=$em->getRepository($this->entity)->find($id); // Récupérer les repos de gitea $gitearepos=$this->giteaservice->getRepos(); // Création du formulaire $form = $this->createForm(Form::class,$data,array("mode"=>"update","gitearepos"=>$gitearepos)); // Récupération des data du formulaire $form->handleRequest($request); // Sur erreur $this->getErrorForm(null,$form,$request,$data,"update"); // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); $gitearepo=$this->giteaservice->getRepo($data->getGiteaid()); $data->setGiteaname($gitearepo->full_name); $data->setGiteajson(json_decode(json_encode($gitearepo), true)); $em->persist($data); $em->flush(); // Retour à la liste return $this->redirectToRoute($this->route); } // Affichage du formulaire return $this->render($this->render.'edit.html.twig', [ 'useheader' => true, 'usesidebar' => false, 'maxwidth' => true, $this->data => $data, 'mode' => 'update', 'form' => $form->createView() ]); } public function delete($id,Request $request) { // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $data=$em->getRepository($this->entity)->find($id); // Controle avant suppression $error=false; if($id<0) $error=true; if($error) return $this->redirectToRoute($this->route."_update",["id"=>$id]); else { $em->remove($data); $em->flush(); // Retour à la liste return $this->redirectToRoute($this->route); } } public function view($id,Request $request) { // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $data=$em->getRepository($this->entity)->find($id); if(!$data) return $this->redirectToRoute($this->route); $firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']); if(!$firstcolumn) return $this->redirectToRoute($this->route); $forcereload=false; if($request->get("forcereload")) $forcereload=$request->get("forcereload"); // Mise à jour des issues par rapport à gitea $em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels,$forcereload); // Création du tableau des issues $issues=$data->getScrumissues(); $tbissues=[]; $tbcols=[]; $tbjals=[]; $tbsprs=[]; $tbestim=[]; $viewclosed = $this->get('session')->get("viewclosed"); foreach($issues as $issue) { // bypass closed if($viewclosed=="false"&&$issue->getGiteastate()=="closed") continue; // Ids $idcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getId():$firstcolumn->getId()); $idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100); $idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100); // Roworders $rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getId()); $rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100); $rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100); // Names $nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getId()); $nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun"); $nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun"); // Idgiteas $gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getId()); $gijal=($issue->getGiteaMilestone()?$issue->getGiteaMilestone():-100); // Liste des colonnes/jalons/sprint avec des issues if(!in_array($idcol,$tbcols)) array_push($tbcols,$idcol); if(!in_array($idcol."|".$idjal,$tbjals)) array_push($tbjals,$idcol."|".$idjal); if(!in_array($idcol."|".$idjal."|".$idspr,$tbsprs)) array_push($tbsprs,$idcol."|".$idjal."|".$idspr); // Initialisation du tableau des estimations if(!array_key_exists($idjal,$tbestim)) { $tbestim[$idjal] = [ "rowjal" => $rowjal, "idjal" => $idjal, "nmjal" => $nmjal, "gijal" => $gijal, "nbjrs" => 0, "sprints" => [] ]; } if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) { $tbestim[$idjal]["sprints"][$idspr] = [ "rowspr" => $rowspr, "idspr" => $idspr, "nmspr" => $nmspr, "nbjrs" => 0, ]; } // Initialisation du tableau des colonnes if(!array_key_exists($idcol,$tbissues)) { $tbissues[$idcol]=[ "rowcol" => $rowcol, "idcol" => $idcol, "nmcol" => $nmcol, "gicol" => $gicol, "nbjrs" => 0, "jalons" => [], ]; } // Initialisation du tableau des jalons de la colonne encours if(!array_key_exists($idjal,$tbissues[$idcol]["jalons"])) { $tbissues[$idcol]["jalons"][$idjal] = [ "rowjal" => $rowjal, "idjal" => $idjal, "nmjal" => $nmjal, "gijal" => $gijal, "nbjrs" => 0, "sprints" => [], ]; } // Initialisation du tableau des sprint de la colonne/jalon encours if(!array_key_exists($idspr,$tbissues[$idcol]["jalons"][$idjal]["sprints"])) { $tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr] = [ "rowspr" => $rowspr, "idspr" => $idspr, "nmspr" => $nmspr, "nbjrs" => 0, "issues" => [], ]; } // On cumule les estimations $tbissues[$idcol]["nbjrs"]+=$issue->getWeight(); $tbissues[$idcol]["jalons"][$idjal]["nbjrs"]+=$issue->getWeight(); $tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight(); $tbestim[$idjal]["nbjrs"]+=$issue->getWeight(); $tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight(); // On sauvegarde l'issue array_push($tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["issues"],$issue); } // On ajoute les colonnes sans issues $columns=$data->getScrumcolumns(); foreach($columns as $column) { if(!in_array($column->getId(),$tbcols)) { $tbissues[$column->getId()] = [ "rowcol" => $column->getRowid(), "idcol" => $column->getId(), "nmcol" => $column->getName(), "gicol" => $column->getGiteaid(), "nbjrs" => 0, "jalons" => [], ]; } // On ajoute les jalons sans issues foreach($giteamilestones as $milestone) { if(!in_array($column->getId()."|".$milestone->id,$tbjals)) { $tbissues[$column->getId()]["jalons"][$milestone->id] = [ "rowjal" => $milestone->title, "idjal" => $milestone->id, "nmjal" => $milestone->title, "gijal" => $milestone->id, "nbjrs" => 0, "sprints" => [], ]; } } // On ajoute le jalon aucun si sans issue if(!in_array($column->getId()."|-100",$tbjals)) { $tbissues[$column->getId()]["jalons"][-100] = [ "rowjal" => -100, "idjal" => -100, "nmjal" => "Aucun", "gijal" => null, "nbjrs" => 0, "sprints" => [], ]; } // On ajoutes les sprints sans issues foreach($tbissues[$column->getId()]["jalons"] as $jalon) { $sprints=$em->getRepository("App:Scrumsprint")->findBy(["scrum"=>$data,"giteamilestone"=>$jalon["idjal"]]); foreach($sprints as $sprint) { if(!in_array($column->getId()."|".$jalon["idjal"]."|".$sprint->getId(),$tbsprs)) { $tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][$sprint->getId()] = [ "rowspr" => $sprint->getRowid(), "idspr" => $sprint->getId(), "nmspr" => $sprint->getName(), "nbjrs" => 0, "issues" => [], ]; } } // On ajoute les sprint aucun sans issue if(!in_array($column->getId()."|".$jalon["idjal"]."|-100",$tbsprs)) { $tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][-100] = [ "rowspr" => -100, "idspr" => -100, "nmspr" => "Aucun", "nbjrs" => 0, "issues" => [], ]; } } } // Tri des issues par colonne/jalon/sprint/issue $rowcol = array_column($tbissues, 'rowcol'); array_multisort($rowcol, SORT_ASC, $tbissues); foreach($tbissues as $keycol=>$column) { $rowjal = array_column($tbissues[$keycol]["jalons"], 'rowjal'); array_multisort($rowjal, SORT_DESC, $tbissues[$keycol]["jalons"]); foreach($tbissues[$keycol]["jalons"] as $keyjal=>$jalon) { $rowspr = array_column($tbissues[$keycol]["jalons"][$keyjal]["sprints"], 'rowspr'); array_multisort($rowspr, SORT_DESC, $tbissues[$keycol]["jalons"][$keyjal]["sprints"]); } } $rowjal = array_column($tbestim, 'rowjal'); array_multisort($rowjal, SORT_DESC, $tbestim); foreach($tbestim as $keyjal=>$jalon) { $rowspr = array_column($tbestim[$keyjal]["sprints"], 'rowspr'); array_multisort($rowspr, SORT_DESC, $tbestim[$keyjal]["sprints"]); } // Préférences utilisateur $viewcondensed = $em->getRepository("App:User")->getUserpreference($this->getUser(),"viewcondensed",$id); $filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id); $filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id); $filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id); $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id); $filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); return $this->render($this->render.'view.html.twig', [ 'useheader' => true, 'usesidebar' => false, 'usetitle' => $data->getName(), 'giteaassignees' => $giteaassignees, 'giteacolumns' => $giteacolumns, 'giteamilestones' => $giteamilestones, 'sprints' => $data->getScrumsprints(), 'giteateams' => $giteateams, 'giteaprioritys' => $giteaprioritys, 'giteatypes' => $giteatypes, 'gitealabels' => $gitealabels, 'viewcondensed' => $viewcondensed, 'filtermilestones' => $filtermilestones, 'filtersprints' => $filtersprints, 'filterteams' => $filterteams, 'filterprioritys' => $filterprioritys, 'filtertypes' => $filtertypes, 'filterlabels' => $filterlabels, 'filterassignees' => $filterassignees, 'filterexcludes' => $filterexcludes, 'showfilters' => $showfilters, 'tbissues' => $tbissues, 'tbestim' => $tbestim, $this->data => $data, ]); } public function table($id, Request $request) { $em = $this->getDoctrine()->getManager(); $fgcsv = $request->get("fgcsv"); // Récupérer les repos de gitea $scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]); $gitearepos=[]; $giteamilestones=[]; $giteacolumns=[]; $giteateams=[]; $giteaprioritys=[]; $giteatypes=[]; $gitealabels=[]; $giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]); $viewclosed = $request->getSession()->get("viewclosed"); $gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]); if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) { $scrum->setGiteajson(json_decode(json_encode($gitearepo), true)); $em->persist($scrum); $em->flush(); } $giteamilestones=$this->giteaservice->getMilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open")); $giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open")); $json=$scrum->getGiteajson(); $json["issues"]=$giteaissues; foreach($json["issues"] as $key => $giteaissue) { $issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]); if($issue) { $json["issues"][$key]->weight=$issue->getWeight(); $json["issues"][$key]->issueid=$issue->getId(); $json["issues"][$key]->scrumid=$issue->getScrum()->getId(); $json["issues"][$key]->sprintid=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100); $json["issues"][$key]->sprintname=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun"); } else { $json["issues"][$key]->weight=0; $json["issues"][$key]->issueid=0; $json["issues"][$key]->scrumid=0; $json["issues"][$key]->sprintid=-100; $json["issues"][$key]->sprintname="Aucun"; } } $tmp=[]; foreach($scrum->getScrumcolumns() as $column) { array_push($tmp,$column->getGiteaid()); if(!in_array($column->getGiteajson()["name"],$giteacolumns)) array_push($giteacolumns,$column->getGiteajson()["name"]); } $json["columns"]=$tmp; array_push($gitearepos,$json); foreach($scrum->getScrumteams() as $team) { if(!in_array($team->getGiteajson()["name"],$giteateams)) array_push($giteateams,$team->getGiteajson()["name"]); } foreach($scrum->getScrumprioritys() as $priority) { if(!in_array($priority->getGiteajson()["name"],$giteaprioritys)) array_push($giteaprioritys,$priority->getGiteajson()["name"]); } foreach($scrum->getScrumtypes() as $type) { if(!in_array($type->getGiteajson()["name"],$giteatypes)) array_push($giteatypes,$type->getGiteajson()["name"]); } foreach($giteaissues as $giteaissue) { foreach($giteaissue->labels as $label) { if(!in_array($label->name,$gitealabels)) array_push($gitealabels,$label->name); } } $keysort = array_column($giteamilestones, 'title'); array_multisort($keysort, SORT_DESC, $giteamilestones); sort($giteacolumns); sort($giteateams); sort($giteaprioritys); sort($giteatypes); sort($gitealabels); // Préférences utilisateur $filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",$id); $filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",$id); $filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id); $filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id); $filtercolumns = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercolumns",$id); $filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id); $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id); $filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); if($fgcsv) { $dir = $this->getParameter('kernel.project_dir') . '/public/uploads/issues/'; $file = "issues-".$id.".csv"; $fs = new Filesystem(); $fs->mkdir($dir); $csvh = fopen($dir.$file, 'w'); $d = ';'; // this is the default but i like to be explicit $e = '"'; // this is the default but i like to be explicit $tmp=["Projet","Jalon","Sprint","Type","Id","Titre","Statut","Label"]; fputcsv($csvh, $tmp, $d, $e); foreach($gitearepos as $gitearepo) { foreach($gitearepo["issues"] as $giteaissue) { $statut=""; $issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]); $type=""; $labels=""; foreach($giteaissue->labels as $label) { if(in_array($label->id,$gitearepo["columns"])) $statut=$label->name; elseif(in_array($label->name,$giteatypes)) $type=$label->name; else $labels=$labels.($labels!=""?"\n":"").$label->name; } $tmp=[ $gitearepo["name"], (isset($giteaissue->milestone->title)?$giteaissue->milestone->title:""), ($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun"), $type, $giteaissue->number, $giteaissue->title, $statut, $labels ]; fputcsv($csvh, $tmp, $d, $e); } } fclose($csvh); $response = new BinaryFileResponse($dir.$file); $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT); return $response; } return $this->render($this->render.'table.html.twig',[ "useheader" => true, "usesidebar" => false, "id" => $id, "gitearepos" => $gitearepos, "giteamilestones" => $giteamilestones, "sprints" => $scrum->getScrumsprints(), "giteacolumns" => $giteacolumns, "giteateams" => $giteateams, "giteaprioritys" => $giteaprioritys, "giteatypes" => $giteatypes, "gitealabels" => $gitealabels, "giteaassignees" => $giteaassignees, "filtercategorys" => $filtercategorys, "filterrepos" => $filterrepos, "filtermilestones" => $filtermilestones, "filtersprints" => $filtersprints, "filtercolumns" => $filtercolumns, "filterteams" => $filterteams, "filterprioritys" => $filterprioritys, "filtertypes" => $filtertypes, "filterlabels" => $filterlabels, "filterexcludes" => $filterexcludes, "filterassignees" => $filterassignees, "showfilters" => $showfilters, ]); } public function stat($id,Request $request) { // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $data=$em->getRepository($this->entity)->find($id); if(!$data) return $this->redirectToRoute($this->route); $firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']); if(!$firstcolumn) return $this->redirectToRoute($this->route); $em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels); // Préférences utilisateur $filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id); $filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); // Création du tableau des issues $issues=$data->getScrumissues(); $tbissues=[]; $tbcols=[]; $tbjals=[]; $tbsprs=[]; $tbestim=[]; $viewclosed = $this->get('session')->get("viewclosed"); foreach($issues as $issue) { // bypass closed if($viewclosed=="false"&&$issue->getGiteastate()=="closed") continue; // Ids $idcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getId():$firstcolumn->getId()); $idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100); $idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100); // Roworders $rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getId()); $rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100); $rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100); // Names $nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getId()); $nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun"); $nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun"); if(!array_key_exists($idjal,$tbestim)) { $tbestim[$idjal] = [ "rowjal" => $rowjal, "idjal" => $idjal, "nmjal" => $nmjal, "nbjrs" => 0, "columns" => [], "sprints" => [], ]; } if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) { $tbestim[$idjal]["sprints"][$idspr] = [ "rowspr" => $rowspr, "idspr" => $idspr, "nmspr" => $nmspr, "nbjrs" => 0, "columns" => [], ]; } if(!array_key_exists($idcol,$tbestim[$idjal]["columns"])) { $tbestim[$idjal]["columns"][$idcol] = [ "rowcol" => $rowcol, "idcol" => $idcol, "nmcol" => $nmcol, "color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]), "nbjrs" => 0, ]; } if(!array_key_exists($idcol,$tbestim[$idjal]["sprints"][$idspr]["columns"])) { $tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol] = [ "rowcol" => $rowcol, "idcol" => $idcol, "nmcol" => $nmcol, "color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]), "nbjrs" => 0, ]; } // On cumule les estimations $tbestim[$idjal]["nbjrs"]+=$issue->getWeight(); $tbestim[$idjal]["columns"][$idcol]["nbjrs"]+=$issue->getWeight(); $tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight(); $tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbjrs"]+=$issue->getWeight(); } return $this->render($this->render.'stat.html.twig', [ 'useheader' => true, 'usesidebar' => false, 'usetitle' => $data->getName(), 'giteamilestones' => $giteamilestones, 'filtermilestones' => $filtermilestones, 'showfilters' => $showfilters, $this->data => $data, 'tbestim' => $tbestim, ]); } public function info($id,Request $request) { $em = $this->getDoctrine()->getManager(); $viewclosed = $request->getSession()->get("viewclosed"); // Rechercher du scrum en cours $scrum=$em->getRepository("App:Scrum")->find($id); if(!$scrum) return new JsonResponse(['message' => 'No Issue'], 403); $giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open")); $weights=[]; foreach($giteaissues as $giteaissue) { $scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]); if($scrumissue) { if($giteaissue->milestone) $milestoneid=$giteaissue->milestone->id; else $milestoneid=-100; if($scrumissue->getScrumsprint()) $sprintid=$milestoneid."-".$scrumissue->getScrumsprint()->getId(); else $sprintid=$milestoneid."-".-100; if(!array_key_exists($milestoneid,$weights)) { $weights[$milestoneid]=[ "id" => $milestoneid, "weight"=>0, "sprints"=>[], ]; } if(!array_key_exists($sprintid,$weights[$milestoneid]["sprints"])) { $weights[$milestoneid]["sprints"][$sprintid]=[ "id" => $sprintid, "weight"=>0 ]; } $weights[$milestoneid]["weight"]+=$scrumissue->getWeight(); $weights[$milestoneid]["sprints"][$sprintid]["weight"]+=$scrumissue->getWeight(); //dump($weights[$milestoneid]["sprints"][$sprintid]["weight"]); } } $output=[]; $output["weights"]=$weights; return new JsonResponse($output); } protected function getErrorForm($id,$form,$request,$data,$mode) { if ($form->get('submit')->isClicked()&&$mode=="delete") { } if ($form->get('submit')->isClicked() && $mode=="submit") { } if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) { } if ($form->get('submit')->isClicked() && !$form->isValid()) { $this->get('session')->getFlashBag()->clear(); $errors = $form->getErrors(); foreach( $errors as $error ) { $request->getSession()->getFlashBag()->add("error", $error->getMessage()); } } } }