本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getRequest方法的具体用法?PHP MauticFactory::getRequest怎么用?PHP MauticFactory::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTokenContent
/**
* @param int $page
*
* @return string
*/
public function getTokenContent($page = 1)
{
if (!$this->factory->getSecurity()->isGranted('lead:fields:full')) {
return;
}
$session = $this->factory->getSession();
//set limits
$limit = 5;
$start = $page === 1 ? 0 : ($page - 1) * $limit;
if ($start < 0) {
$start = 0;
}
$request = $this->factory->getRequest();
$search = $request->get('search', $session->get('mautic.lead.emailtoken.filter', ''));
$session->set('mautic.lead.emailtoken.filter', $search);
$filter = array('string' => $search, 'force' => array(array('column' => 'f.isPublished', 'expr' => 'eq', 'value' => true)));
$fields = $this->factory->getModel('lead.field')->getEntities(array('start' => $start, 'limit' => $limit, 'filter' => $filter, 'orderBy' => 'f.label', 'orderByDir' => 'ASC', 'hydration_mode' => 'HYDRATE_ARRAY'));
$count = count($fields);
if ($count && $count < $start + 1) {
//the number of entities are now less then the current page so redirect to the last page
if ($count === 1) {
$page = 1;
} else {
$page = ceil($count / $limit) ?: 1;
}
$session->set('mautic.lead.emailtoken.page', $page);
}
return $this->factory->getTemplating()->render('MauticLeadBundle:SubscribedEvents\\EmailToken:list.html.php', array('items' => $fields, 'page' => $page, 'limit' => $limit, 'totalCount' => $count, 'tmpl' => $request->get('tmpl', 'index'), 'searchValue' => $search));
}
示例2: getTokenContent
/**
* @param int $page
* @param array $entityArguments
* @param array $viewParameters
*
* @return string
*/
public function getTokenContent($page = 1, $entityArguments = array(), $viewParameters = array())
{
if (is_array($page)) {
// Laziness
$entityArguments = $page;
$page = 1;
}
//set some permissions
$permissions = $this->factory->getSecurity()->isGranted($this->permissionSet, "RETURN_ARRAY");
if (in_array(false, $permissions)) {
return;
}
$session = $this->factory->getSession();
//set limits
$limit = 5;
$start = $page === 1 ? 0 : ($page - 1) * $limit;
if ($start < 0) {
$start = 0;
}
$request = $this->factory->getRequest();
$search = $request->get('search', $session->get('mautic' . $this->langVar . 'buildertoken.filter', ''));
$session->set('mautic' . $this->langVar . 'buildertoken.filter', $search);
$model = $this->factory->getModel($this->modelName);
$repo = $model->getRepository();
$prefix = $repo->getTableAlias();
if (!empty($prefix)) {
$prefix .= '.';
}
$filter = array('string' => $search);
$filter['force'] = isset($entityArguments['filter']['force']) ? $entityArguments['filter']['force'] : array();
if (isset($permissions[$this->viewPermissionBase . ':viewother']) && !$permissions[$this->viewPermissionBase . ':viewother']) {
$filter['force'][] = array('column' => $prefix . 'createdBy', 'expr' => 'eq', 'value' => $this->factory->getUser()->getId());
}
$entityArguments['filter'] = $filter;
$entityArguments = array_merge(array('start' => $start, 'limit' => $limit, 'orderByDir' => 'DESC'), $entityArguments);
$items = $model->getEntities($entityArguments);
$count = count($items);
if ($count && $count < $start + 1) {
//the number of entities are now less then the current page so redirect to the last page
if ($count === 1) {
$page = 1;
} else {
$page = ceil($count / $limit) ?: 1;
}
$session->set('mautic' . $this->langVar . 'buildertoken.page', $page);
}
return $this->factory->getTemplating()->render($this->bundleName . ':SubscribedEvents\\BuilderToken:list.html.php', array_merge($viewParameters, array('items' => $items, 'page' => $page, 'limit' => $limit, 'totalCount' => $count, 'tmpl' => $request->get('tmpl', 'index'), 'searchValue' => $search)));
}
示例3: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->defaultTheme = $factory->getParameter('theme');
$this->em = $factory->getEntityManager();
$this->request = $factory->getRequest();
}
示例4: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->validator = $factory->getValidator();
$this->apiMode = $factory->getRequest()->get('api_mode', $factory->getSession()->get('mautic.client.filter.api_mode', 'oauth1a'));
$this->router = $factory->getRouter();
}
示例5: parsePlainText
/**
* Parses html into basic plaintext
*
* @param string $content
*/
public function parsePlainText($content = null)
{
if ($content == null) {
$content = $this->message->getBody();
}
$request = $this->factory->getRequest();
$parser = new PlainTextHelper(array('base_url' => $request->getSchemeAndHttpHost() . $request->getBasePath()));
$this->plainText = $parser->setHtml($content)->getText();
}
示例6: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->devMode = $factory->getEnvironment() == 'dev';
$this->imageDir = $factory->getSystemPath('images');
$this->assetHelper = $factory->getHelper('template.assets');
$this->avatarHelper = $factory->getHelper('template.avatar');
$this->request = $factory->getRequest();
$this->devHosts = (array) $factory->getParameter('dev_hosts');
}
示例7: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->path = $factory->getParameter('cookie_path');
$this->domain = $factory->getParameter('cookie_domain');
$this->secure = $factory->getParameter('cookie_secure');
if ($this->secure == '' || $this->secure == null) {
$this->secure = $factory->getRequest()->server->get('HTTPS', false);
}
$this->httponly = $factory->getParameter('cookie_httponly');
}
示例8: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->factory = $factory;
$this->templating = $factory->getTemplating();
$this->request = $factory->getRequest();
$this->security = $factory->getSecurity();
$this->serializer = $factory->getSerializer();
$this->params = $factory->getSystemParameters();
$this->dispatcher = $factory->getDispatcher();
$this->translator = $factory->getTranslator();
$this->init();
}
示例9: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
/** @var \Mautic\LeadBundle\Model\ListModel $listModel */
$listModel = $factory->getModel('lead.list');
$operatorChoices = $listModel->getFilterExpressionFunctions();
$this->operatorChoices = array();
foreach ($operatorChoices as $key => $value) {
if (empty($value['hide'])) {
$this->operatorChoices[$key] = $value['label'];
}
}
$this->translator = $factory->getTranslator();
$this->currentListId = $factory->getRequest()->attributes->get('objectId', false);
}
示例10: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->defaultTheme = $factory->getParameter('theme');
$this->em = $factory->getEntityManager();
$this->request = $factory->getRequest();
$this->countryChoices = FormFieldHelper::getCountryChoices();
$this->regionChoices = FormFieldHelper::getRegionChoices();
$this->timezoneChoices = FormFieldHelper::getTimezonesChoices();
$this->localeChoices = FormFieldHelper::getLocaleChoices();
$stages = $factory->getModel('stage')->getRepository()->getSimpleList();
foreach ($stages as $stage) {
$this->stageChoices[$stage['value']] = $stage['label'];
}
}
示例11: getBaseUrl
/**
* Get base URL
*
* @return string
*/
public function getBaseUrl()
{
return $this->factory->getRequest()->getSchemeAndHttpHost();
}
示例12: getUserAgent
/**
* Generate a user agent string
*
* @return string
*/
protected function getUserAgent()
{
$request = $this->factory->getRequest();
return $request->server->get('HTTP_USER_AGENT');
}
示例13: getRequest
/**
* @return Request
*/
protected function getRequest()
{
return $this->factory->getRequest();
}
示例14: getRefererUrl
/**
* Generates current URL to set as referer for curl calls
*
* @return string
*/
protected function getRefererUrl()
{
$request = $this->factory->getRequest();
return $request->getRequestUri();
}
示例15: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->em = $factory->getEntityManager();
$this->request = $factory->getRequest();
}