Exemplo n.º 1
1
 public function createQuery($context = 'list')
 {
     /** @var ProxyQuery|QueryBuilder $query */
     $query = parent::createQuery($context);
     if ($context == 'list') {
         $parameters = $this->getFilterParameters();
         $domainValue = isset($parameters['domain']) ? $parameters['domain'] : false;
         list($tableAlias) = $query->getQueryBuilder()->getRootAliases();
         if ($domainValue) {
             $query->where($tableAlias . '.domain = :domain')->setParameter('domain', $domainValue);
         }
         $emptyLocale = !empty($parameters['emptyLocale']['value']) ? $parameters['emptyLocale']['value'] : false;
         if ($emptyLocale) {
             $query->andWhere($tableAlias . '.translations NOT LIKE :emptyLocale')->setParameter('emptyLocale', '%s:2:"' . $emptyLocale . '"%');
         }
         $location = !empty($parameters['location']['value']) ? $parameters['location']['value'] : false;
         if ($location) {
             if ($location == self::FILTER_LOCATION_FRONTEND) {
                 $query->andWhere($tableAlias . '.source NOT LIKE :excludeAdmin')->setParameter('excludeAdmin', '%admin\\.%');
             } elseif ($location == self::FILTER_LOCATION_BACKEND) {
                 $query->andWhere($tableAlias . '.source LIKE :excludeAdmin')->setParameter('excludeAdmin', '%admin\\.%');
             }
         }
     }
     return $query;
 }
 /**
  * return the base template name
  *
  * @param Request $request
  * @param Admin $admin
  * @return string the template name
  */
 protected function getBaseTemplate(Request $request, Admin $admin)
 {
     if ($request->isXmlHttpRequest()) {
         return $admin->getTemplate('ajax');
     }
     return $admin->getTemplate('layout');
 }
Exemplo n.º 3
0
 public function getBatchActions()
 {
     // retrieve the default batch actions (currently only delete)
     $actions = parent::getBatchActions();
     $actions['archive'] = array('label' => $this->trans('Archiver', array(), 'SonataAdminBundle'), 'ask_confirmation' => true);
     return $actions;
 }
Exemplo n.º 4
0
 public function __construct($code, $class, $baseControllerName)
 {
     parent::__construct($code, $class, $baseControllerName);
     if (!$this->hasRequest()) {
         $this->datagridValues = array('_page' => 1, '_per_page' => 25);
     }
 }
Exemplo n.º 5
0
 public function getBatchActions()
 {
     $custom_actions['enable'] = array('label' => $this->trans('Habilitar'), 'ask_confirmation' => FALSE);
     $custom_actions['disable'] = array('label' => $this->trans('Deshabilitar'), 'ask_confirmation' => TRUE);
     $actions = array_merge($custom_actions, parent::getBatchActions());
     return $actions;
 }
Exemplo n.º 6
0
 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.customer', ':my_param'));
     $query->setParameter('my_param', true);
     return $query;
 }
Exemplo n.º 7
0
 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->leftJoin('o.translations', 't');
     $query->addSelect('t');
     return $query;
 }
 /**
  * @return array
  */
 public function getBatchActions()
 {
     $actions = parent::getBatchActions();
     $actions['enabled'] = array('label' => $this->trans('batch_enable_comments'), 'ask_confirmation' => false);
     $actions['disabled'] = array('label' => $this->trans('batch_disable_comments'), 'ask_confirmation' => false);
     return $actions;
 }
Exemplo n.º 9
0
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     $instance->setCoordenadaY(self::__DEFAULT_LAT);
     $instance->setCoordenadaX(self::__DEFAULT_LNG);
     return $instance;
 }
Exemplo n.º 10
0
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     $parent = $this->getRoot()->getSubject();
     $instance->setPdfmerge($parent);
     return $instance;
 }
Exemplo n.º 11
0
 /**
  * Setting default values
  * @inheritdoc
  */
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     $instance->setVisibility('2');
     $instance->setCourseLanguage($this->getTranslator()->getLocale());
     return $instance;
 }
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     $instance->setCreatedOn(new \DateTime("now"));
     $instance->setCreatedBy($this->security->getToken()->getUser());
     return $instance;
 }
Exemplo n.º 13
0
 public function getNewInstance()
 {
     $user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
     $instance = parent::getNewInstance();
     $instance->setUser($user);
     return $instance;
 }
Exemplo n.º 14
0
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     /* @var $instance Employee */
     $instance->getProjects()->add($this->projectRepo->findOneBy(['isInternal' => true]));
     return $instance;
 }
Exemplo n.º 15
0
 public function getNewInstance()
 {
     $instance = parent::getNewInstance();
     $instance->setApplyLimit(-1);
     $instance->setEnded(new \DateTime());
     return $instance;
 }
Exemplo n.º 16
0
 public function __construct($code, $class, $baseControllerName)
 {
     parent::__construct($code, $class, $baseControllerName);
     if (!$this->hasRequest()) {
         $this->datagridValues = array('_page' => 1, '_per_page' => 25, '_sort_order' => 'ASC', '_sort_by' => 'position');
     }
 }
Exemplo n.º 17
0
 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.type', ':type'));
     $query->setParameter(':type', Department::BRANCH);
     return $query;
 }
Exemplo n.º 18
0
 /**
  * {@inheritdoc}
  */
 public function getBatchActions()
 {
     $actions = parent::getBatchActions();
     $actions['enabled'] = array('label' => $this->trans($this->getLabelTranslatorStrategy()->getLabel('enable', 'batch', 'comment')), 'ask_confirmation' => false);
     $actions['disabled'] = array('label' => $this->trans($this->getLabelTranslatorStrategy()->getLabel('disable', 'batch', 'comment')), 'ask_confirmation' => false);
     return $actions;
 }
 /**
  * {@inheritdoc}
  */
 public function getBatchActions()
 {
     $actions = parent::getBatchActions();
     $actions['enable_action'] = ['label' => 'Enable', 'ask_confirmation' => true];
     $actions['disable_action'] = ['label' => 'Disable', 'ask_confirmation' => true];
     return $actions;
 }
Exemplo n.º 20
0
 public function getBatchActions()
 {
     // retrieve the default batch actions (currently only delete)
     $actions = parent::getBatchActions();
     unset($actions['delete']);
     return $actions;
 }
Exemplo n.º 21
0
 public function getRoutes()
 {
     parent::getRoutes();
     $this->routes->add('upload_images', $this->getRouterIdParameter() . '/upload-images');
     $this->routes->add('order_images', $this->getRouterIdParameter() . '/order-images');
     return $this->routes;
 }
Exemplo n.º 22
0
 /**
  * {@inheritdoc}
  */
 public function getExportFields()
 {
     // avoid security field to be exported
     return array_filter(parent::getExportFields(), function ($v) {
         return !in_array($v, array('password', 'salt'));
     });
 }
Exemplo n.º 23
0
 public function getClassMetaData()
 {
     if ($this->classMetaData) {
         return $this->classMetaData;
     }
     return parent::getClassMetaData();
 }
 /**
  * {@inheritdoc}
  */
 public function getSubject()
 {
     $subject = parent::getSubject();
     if ($subject instanceof Publication) {
         $subject->setPublicationType($this->getPublicationType());
     }
     return $subject;
 }
 public function getBreadcrumbs($action)
 {
     $breadcrumbs = parent::getBreadcrumbs($action);
     if ($action == 'edit' && $this->getRequest()->get('minimized')) {
         $breadcrumbs = array(array_pop($breadcrumbs));
     }
     return $breadcrumbs;
 }
Exemplo n.º 26
0
 protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     !$id && $menu->addChild("Refresh currency values", array('uri' => $admin->generateUrl('refresh')));
     parent::configureTabMenu($menu, $action, $childAdmin);
     // TODO: Change the autogenerated stub
 }
Exemplo n.º 27
0
 public function getBatchActions()
 {
     $actions = parent::getBatchActions();
     if ($this->hasRoute('edit') && $this->isGranted('EDIT') && $this->hasRoute('delete') && $this->isGranted('DELETE')) {
         $actions['deliveredAll'] = array('label' => 'Entregados', 'ask_confirmation' => true);
     }
     return $actions;
 }
Exemplo n.º 28
0
 /**
  * {@inheritdoc}
  */
 public function getNewInstance()
 {
     $gallery = parent::getNewInstance();
     if ($this->hasRequest()) {
         $gallery->setContext($this->getRequest()->get('context'));
     }
     return $gallery;
 }
Exemplo n.º 29
0
 public function postPersist($user) 
 {
     parent::postPersist($user);
     /** @var  $dispatcher EventDispatcher**/
     $dispatcher = $this->getConfigurationPool()->getContainer()->get('event_dispatcher');
     $dispatcher->dispatch(\AppBundle\AppConstants::EMAIL_NEW_USER,  new PasswordEvent($this->password, $user));
     
 }
Exemplo n.º 30
0
 public function getPersistentParameters()
 {
     $parameters = parent::getPersistentParameters();
     if (!$this->hasRequest()) {
         return $parameters;
     }
     return array_merge($parameters, array('context' => $this->getRequest()->get('context', $this->getDefaultContext())));
 }