コード例 #1
0
ファイル: HomeTabManager.php プロジェクト: ngydat/CoreBundle
 public function generateAdminHomeTabConfigsByUser(User $user, array $roleNames = array())
 {
     $adminHTC = array();
     $adminHomeTabConfigs = $this->homeTabConfigRepo->findAdminDesktopHomeTabConfigsByRoles($roleNames);
     foreach ($adminHomeTabConfigs as $adminHomeTabConfig) {
         if ($adminHomeTabConfig->isLocked()) {
             if ($adminHomeTabConfig->isVisible()) {
                 $adminHTC[] = $adminHomeTabConfig;
             }
         } else {
             $existingCustomHTC = $this->homeTabConfigRepo->findOneBy(array('homeTab' => $adminHomeTabConfig->getHomeTab(), 'user' => $user));
             if (is_null($existingCustomHTC)) {
                 $customHTC = $this->createUserVersion($adminHomeTabConfig, $user);
                 $adminHTC[] = $customHTC;
             } else {
                 $adminHTC[] = $existingCustomHTC;
             }
         }
     }
     return $adminHTC;
 }
コード例 #2
0
 public function getAdminDesktopHomeTabConfigsByRoles(array $roleNames)
 {
     return $this->homeTabConfigRepo->findAdminDesktopHomeTabConfigsByRoles($roleNames);
 }