/** * Displays the project commit history for the current branch. * * @Route("/", name="project_log") * @Method("GET") * @Template() * @ProjectAccess(grantType="VIEW") */ public function listAction(Request $request, $id) { $currentPage = $request->query->get('page', 1); $filter = false; $keyword = ''; //Search /*$keyword = $request->query->get('keyword', false); $filter= $request->query->get('filter', false); if($keyword !== false && trim($keyword) !== ''){ if($filter !== false){ if($filter === 'author'){ $this->gitLogCommand->setFilterByAuthor($keyword); }elseif($filter === 'content'){ $this->gitLogCommand->setFilterByContent($keyword); }else{ $this->gitLogCommand->setFilterByMessage($keyword); } } }*/ $searchForm = $this->createSearchForm(); $searchForm->handleRequest($request); if ($searchForm->isValid()) { $data = $searchForm->getData(); $keyword = $data['keyword']; $filter = $data['filter']; $branch = $data['branch']; if ($keyword !== false && trim($keyword) !== '') { if ($filter !== false) { if ($filter === 'author') { $this->gitLogCommand->setFilterByAuthor($keyword); } elseif ($filter === 'content') { $this->gitLogCommand->setFilterByContent($keyword); } else { $this->gitLogCommand->setFilterByMessage($keyword); } } } $this->gitLogCommand->setBranch($branch)->setPage($currentPage - 1); } else { $this->gitLogCommand->setBranch($this->branchName)->setPage($currentPage - 1); } $gitLogs = $this->gitLogCommand->execute()->getResults(); return array_merge($this->viewVariables, array('gitLogs' => $gitLogs, 'totalCount' => $this->gitLogCommand->getTotalCount(), 'limit' => $this->gitLogCommand->getLimit(), 'currentPage' => $this->gitLogCommand->getPage() + 1, 'keyword' => $keyword, 'filter' => $filter, 'searchForm' => $searchForm->createView())); }