appKernel = $appKernel; $this->giteaservice = $giteaservice; } public function list($id,Request $request) { set_time_limit(0); $em = $this->getDoctrine()->getManager(); $scrum = $em->getRepository("App:Scrum")->find($id); $repoid = $scrum->getGiteaid(); $repoowner = $scrum->getGiteajson()["owner"]["login"]; $reponame = $scrum->getGiteajson()["name"]; $repo=$this->giteaservice->getRepo($repoid); $issues=$this->giteaservice->getIssues($repoowner,$reponame,"?state=all"); foreach($issues as $keyissue => $issue) { // On ne prend pas les pull request if(!is_null($issue->pull_request)) { unset($issues[$keyissue]); continue; } //$issues[$keyissue]->body = $this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$issues[$keyissue]->body); //$issues[$keyissue]->comments=$this->giteaservice->getIssueComments($repoowner,$reponame,$issue->number); /* Trop lourd foreach($issues[$keyissue]->comments as $keycomment => $comment) { $issues[$keyissue]->comments[$keycomment]->body=$this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$issues[$keyissue]->comments[$keycomment]->body); } */ /* Trop lourd $issues[$keyissue]->timelines=$this->giteaservice->getIssueTimelines($repoowner,$reponame,$issue->number); */ $issues[$keyissue]->timelines=[]; } // Affichage du formulaire return $this->render('Report/list.html.twig', [ 'useheader' => false, 'usesidebar' => false, 'maxwidth' => true, 'repo' => $repo, 'issues' => $issues, ]); } public function csv($id,Request $request) { set_time_limit(0); $em = $this->getDoctrine()->getManager(); $scrum = $em->getRepository("App:Scrum")->find($id); $repoid = $scrum->getGiteaid(); $repoowner = $scrum->getGiteajson()["owner"]["login"]; $reponame = $scrum->getGiteajson()["name"]; $repo=$this->giteaservice->getRepo($repoid); $issues=$this->giteaservice->getIssues($repoowner,$reponame,"?state=all"); $fs = new Filesystem(); $rootdir = $this->appKernel->getProjectDir(); $destdir = $rootdir."/var/log/export.csv"; $csvh = fopen($destdir, 'w'); $d = ';'; // this is the default but i like to be explicit $e = '"'; // this is the default but i like to be explicit $tbcumul=[]; foreach($issues as $issue) { $monthsubmit=new \DateTime($issue->created_at); $monthsubmit=$monthsubmit->format("Ym"); if(!array_key_exists($monthsubmit,$tbcumul)) $tbcumul[$monthsubmit]=["month"=>$monthsubmit,"nbsubmit"=>0,"nbclose"=>0]; $tbcumul[$monthsubmit]["nbsubmit"]=$tbcumul[$monthsubmit]["nbsubmit"]+1; $monthclose=new \DateTime($issue->closed_at); $monthclose=$monthclose->format("Ym"); if(!array_key_exists($monthclose,$tbcumul)) $tbcumul[$monthclose]=["month"=>$monthclose,"nbsubmit"=>0,"nbclose"=>0]; $tbcumul[$monthclose]["nbclose"]=$tbcumul[$monthclose]["nbclose"]+1; } foreach($tbcumul as $cumul) { fputcsv($csvh, $cumul, $d, $e); } fclose($csvh); $response = new BinaryFileResponse($destdir); $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT); return $response; } public function test($id,Request $request) { $em = $this->getDoctrine()->getManager(); $scrum = $em->getRepository("App:Scrum")->find($id); $em = $this->getDoctrine()->getManager(); $scrum = $em->getRepository("App:Scrum")->find($id); $repoid = $scrum->getGiteaid(); $repoowner = $scrum->getGiteajson()["owner"]["login"]; $reponame = $scrum->getGiteajson()["name"]; $repo=$this->giteaservice->getRepo($repoid); dump($repo); dump($repoowner); $labels=$this->giteaservice->getorglabels($repoowner); dump($labels); } }