本文整理汇总了PHP中Sonata\AdminBundle\Admin\Admin类的典型用法代码示例。如果您正苦于以下问题:PHP Admin类的具体用法?PHP Admin怎么用?PHP Admin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Admin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createQuery
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;
}
示例2: getBaseTemplate
/**
* 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');
}
示例3: getBatchActions
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;
}
示例4: __construct
public function __construct($code, $class, $baseControllerName)
{
parent::__construct($code, $class, $baseControllerName);
if (!$this->hasRequest()) {
$this->datagridValues = array('_page' => 1, '_per_page' => 25);
}
}
示例5: getBatchActions
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;
}
示例6: createQuery
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;
}
示例7: createQuery
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->leftJoin('o.translations', 't');
$query->addSelect('t');
return $query;
}
示例8: getBatchActions
/**
* @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;
}
示例9: getNewInstance
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setCoordenadaY(self::__DEFAULT_LAT);
$instance->setCoordenadaX(self::__DEFAULT_LNG);
return $instance;
}
示例10: getNewInstance
public function getNewInstance()
{
$instance = parent::getNewInstance();
$parent = $this->getRoot()->getSubject();
$instance->setPdfmerge($parent);
return $instance;
}
示例11: getNewInstance
/**
* Setting default values
* @inheritdoc
*/
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setVisibility('2');
$instance->setCourseLanguage($this->getTranslator()->getLocale());
return $instance;
}
示例12: getNewInstance
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setCreatedOn(new \DateTime("now"));
$instance->setCreatedBy($this->security->getToken()->getUser());
return $instance;
}
示例13: getNewInstance
public function getNewInstance()
{
$user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
$instance = parent::getNewInstance();
$instance->setUser($user);
return $instance;
}
示例14: getNewInstance
public function getNewInstance()
{
$instance = parent::getNewInstance();
/* @var $instance Employee */
$instance->getProjects()->add($this->projectRepo->findOneBy(['isInternal' => true]));
return $instance;
}
示例15: getNewInstance
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setApplyLimit(-1);
$instance->setEnded(new \DateTime());
return $instance;
}