作者:octav
项目:cm
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;
}
作者:networkin
项目:init-cms-bundl
/**
* 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');
}
作者:polypode
项目:EuradioNantes.e
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;
}
作者:bordeu
项目:language-bundl
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
}
作者:Quis
项目:Evrik
public function __construct($code, $class, $baseControllerName)
{
parent::__construct($code, $class, $baseControllerName);
if (!$this->hasRequest()) {
$this->datagridValues = array('_page' => 1, '_per_page' => 25);
}
}
作者:jewelhu
项目:smpc
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;
}
作者:Nexota
项目:Ivor
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;
}
作者:kmin
项目:AOTranslationBundl
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->leftJoin('o.translations', 't');
$query->addSelect('t');
return $query;
}
作者:roelveldhuize
项目:SonataNewsBundl
/**
* @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;
}
作者:alexhuma
项目:jc-tesis-servido
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setCoordenadaY(self::__DEFAULT_LAT);
$instance->setCoordenadaX(self::__DEFAULT_LNG);
return $instance;
}
作者:salii
项目:yasmine-prin
public function getNewInstance()
{
$instance = parent::getNewInstance();
$parent = $this->getRoot()->getSubject();
$instance->setPdfmerge($parent);
return $instance;
}
作者:daffe
项目:chamilo-lm
/**
* Setting default values
* @inheritdoc
*/
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setVisibility('2');
$instance->setCourseLanguage($this->getTranslator()->getLocale());
return $instance;
}
作者:c4d3
项目:mcsuite-application-eyeofende
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setCreatedOn(new \DateTime("now"));
$instance->setCreatedBy($this->security->getToken()->getUser());
return $instance;
}
作者:krombo
项目:motio
public function getNewInstance()
{
$user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
$instance = parent::getNewInstance();
$instance->setUser($user);
return $instance;
}
作者:bOmBeL
项目:polcod
public function getNewInstance()
{
$instance = parent::getNewInstance();
/* @var $instance Employee */
$instance->getProjects()->add($this->projectRepo->findOneBy(['isInternal' => true]));
return $instance;
}
作者:TJUSS
项目:ICS
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setApplyLimit(-1);
$instance->setEnded(new \DateTime());
return $instance;
}
作者:Quis
项目:Evrik
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');
}
}
作者:19eugen8
项目:schedro.symfon
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;
}
作者:BookWorld
项目:no
/**
* {@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;
}
作者:stfalcon-studi
项目:lost-and-foun
/**
* {@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;
}