本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getUser方法的具体用法?PHP MauticFactory::getUser怎么用?PHP MauticFactory::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getUser方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addEventSubscriber(new CleanFormSubscriber(array('body' => 'html')));
$builder->add('subject', 'text', array('label' => 'mautic.email.subject', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
$user = $this->factory->getUser();
$default = empty($options['data']['from']) ? $user->getEmail() : $options['data']['from'];
$builder->add('from', 'text', array('label' => 'mautic.lead.email.from_email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false, 'data' => $default, 'constraints' => array(new NotBlank(array('message' => 'mautic.core.email.required')), new Email(array('message' => 'mautic.core.email.required')))));
$builder->add('body', 'textarea', array('label' => 'mautic.email.form.body', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor-basic-fullpage editor-builder-tokens', 'data-token-callback' => 'email:getBuilderTokens', 'data-token-activator' => '{')));
$builder->add('list', 'hidden');
$builder->add('templates', 'email_list', array('label' => 'mautic.lead.email.template', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.getLeadEmailContent(this)'), 'multiple' => false));
$builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.email.send', 'save_class' => 'btn btn-primary', 'save_icon' => 'fa fa-send', 'cancel_icon' => 'fa fa-times'));
if (!empty($options["action"])) {
$builder->setAction($options["action"]);
}
}
示例2: getTokens
/**
* @param string $tokenRegex Token regex without wrapping regex escape characters. Use (value) or (.*?) where the ID of the
* entity should go. i.e. {pagelink=(value)}
* @param string $filter String to filter results by
* @param string $labelColumn The column that houses the label
* @param string $valueColumn The column that houses the value
* @param CompositeExpression $expr Use $factory->getDatabase()->getExpressionBuilder()->andX()
*
* @return array|void
*/
public function getTokens($tokenRegex, $filter = '', $labelColumn = 'name', $valueColumn = 'id', CompositeExpression $expr = null)
{
//set some permissions
$permissions = $this->factory->getSecurity()->isGranted($this->permissionSet, "RETURN_ARRAY");
if (in_array(false, $permissions)) {
return;
}
$repo = $this->factory->getModel($this->modelName)->getRepository();
$prefix = $repo->getTableAlias();
if (!empty($prefix)) {
$prefix .= '.';
}
$exprBuilder = $this->factory->getDatabase()->getExpressionBuilder();
if ($expr == null) {
$expr = $exprBuilder->andX();
}
if (isset($permissions[$this->viewPermissionBase . ':viewother']) && !$permissions[$this->viewPermissionBase . ':viewother']) {
$expr->add($exprBuilder->eq($prefix . 'createdBy', $this->factory->getUser()->getId()));
}
if (!empty($filter)) {
$expr->add($exprBuilder->like('LOWER(' . $labelColumn . ')', ':label'));
$parameters = array('label' => strtolower($filter) . '%');
} else {
$parameters = array();
}
$items = $repo->getSimpleList($expr, $parameters, $labelColumn, $valueColumn);
$tokens = array();
foreach ($items as $item) {
$token = str_replace(array('(value)', '(.*?)'), $item['value'], $tokenRegex);
$tokens[$token] = $item['label'];
}
return $tokens;
}
示例3: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->em = $factory->getEntityManager();
$this->model = $factory->getModel('page');
$this->canViewOther = $factory->getSecurity()->isGranted('page:pages:viewother');
$this->user = $factory->getUser();
}
示例4: getEntities
/**
* Return a list of entities
*
* @param array $args [start, limit, filter, orderBy, orderByDir]
*
* @return \Doctrine\ORM\Tools\Pagination\Paginator|array
*/
public function getEntities(array $args = array())
{
//set the translator
$repo = $this->getRepository();
if ($repo instanceof CommonRepository) {
$repo->setTranslator($this->translator);
$repo->setCurrentUser($this->factory->getUser());
return $repo->getEntities($args);
}
return array();
}
示例5: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$viewOther = $factory->getSecurity()->isGranted('asset:assets:viewother');
$repo = $factory->getModel('asset')->getRepository();
$repo->setCurrentUser($factory->getUser());
$choices = $repo->getAssetList('', 0, 0, $viewOther);
foreach ($choices as $asset) {
$this->choices[$asset['language']][$asset['id']] = $asset['title'];
}
//sort by language
ksort($this->choices);
}
示例6: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->viewOther = $factory->getSecurity()->isGranted('dynamicContent:dynamicContents:viewother');
$this->repo = $factory->getModel('dynamicContent')->getRepository();
$this->repo->setCurrentUser($factory->getUser());
}
示例7: getUser
/**
* @return mixed
*/
protected function getUser()
{
return $this->factory->getUser();
}
示例8: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->factory = $factory;
$this->user = $factory->getUser();
}
示例9: __construct
public function __construct(MauticFactory $factory)
{
$this->em = $factory->getEntityManager();
$this->currentUser = $factory->getUser();
}