예제 #1
0
 protected function addUserMenu($menu)
 {
     if (!$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
         return;
     }
     $menu->addChild('User', array('uri' => '#', 'label' => sprintf('<i class="fa fa-shield"></i> %s<i class="fa fa-angle-double-left pull-right"></i></a>', $this->translator->trans('menu.user.title', array(), $this->translationDomain)), 'extras' => array('safe_label' => true), 'attributes' => array('class' => 'treeview')));
     $menu['User']->setChildrenAttribute('class', 'treeview-menu');
     $menu['User']->addChild('Add', array('label' => $this->translator->trans('menu.user.add', array(), $this->translationDomain), 'route' => 'ihsan_simpleadmin_security_user_new', 'attributes' => array('class' => 'treeview')));
     $menu['User']->addChild('List', array('label' => $this->translator->trans('menu.user.list', array(), $this->translationDomain), 'route' => 'ihsan_simpleadmin_security_user_list', 'attributes' => array('class' => 'treeview')));
 }
 /**
  * Sets geolocation options.
  *
  * @param point                                    $latitude    Latitude
  * @param point                                    $longitude   Longitude
  * @param array                                    $geoLocation Geolocation data
  * @param Symfony\Component\Translation\TranslatorInterface $translator  Translator
  *
  * @return void|RedirectResponse
  */
 private function geolocation($latitude, $longitude, $geoLocation, $translator)
 {
     $preferencesService = $this->container->get('system_preferences_service');
     if ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180) {
         $this->get('session')->getFlashBag()->add('error', $translator->trans('newscoop.preferences.error.geolocation', array(), 'system_pref'));
         return $this->redirect($this->generateUrl('newscoop_newscoop_systempref_index'));
     } else {
         $preferencesService->MapCenterLatitudeDefault = $latitude;
         $preferencesService->MapCenterLongitudeDefault = $longitude;
     }
     foreach ($geoLocation as $key => $value) {
         $name = '';
         foreach (explode('_', $key) as $part) {
             $name .= ucfirst($part);
             $preferencesService->{$name} = $value;
         }
     }
 }