3 namespace Mixstore\UserBundle\Controller
;
5 use Symfony\Component\HttpFoundation\Response
;
6 use Symfony\Bundle\FrameworkBundle\Controller\Controller
;
8 class BoardController
extends Controller
10 public function indexAction()
12 if (is_null($this->getUser()))
13 //TODO: nice error page
14 return $this->redirect($this->generateUrl('mixstore_static_home'));
21 ->getRepository('MixstoreStoreBundle:Usecase');
23 $usecases = $ucsRepository
24 ->findByUser($this->getUser()->getId());
26 for ($i=0; $i<count($usecases); $i++
)
27 $usecases[$i]->software
= $usecases[$i]->getPackage()->getName();
30 ->getRepository('MixstoreStoreBundle:Package')
31 ->findByUser($this->getUser()->getId());
33 //TODO: fix code redundancy (see PackageController.php)
34 for ($i=0; $i<count($packages); $i++
)
36 $countAndRating = $ucsRepository->countByPkgId($packages[$i]->getId());
37 if (is_null($countAndRating['rating']) || $countAndRating['rating'] == '')
38 $countAndRating['rating'] = 'NA';
39 $packages[$i]->ucscount
= $countAndRating['ucscount'];
40 $packages[$i]->rating
= $countAndRating['rating'];
43 return $this->render('MixstoreUserBundle:Board:index.html.twig', array(
44 'packages' => $packages,
45 'usecases' => $usecases,