本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getTemplating方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getTemplating方法的具体用法?PHP MauticFactory::getTemplating怎么用?PHP MauticFactory::getTemplating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getTemplating方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: __construct
/**
* @param MatcherInterface $matcher
* @param MauticFactory $factory
* @param string $charset
* @param array $defaultOptions
*/
public function __construct(MatcherInterface $matcher, MauticFactory $factory, $charset, array $defaultOptions = array())
{
$this->engine = $factory->getTemplating();
$this->matcher =& $matcher;
$this->defaultOptions = array_merge(array('depth' => null, 'matchingDepth' => null, 'currentAsLink' => true, 'currentClass' => 'active', 'ancestorClass' => 'open', 'firstClass' => 'first', 'lastClass' => 'last', 'template' => 'MauticCoreBundle:Menu:main.html.php', 'compressed' => false, 'allow_safe_labels' => false, 'clear_matcher' => true), $defaultOptions);
$this->charset = $charset;
}
示例3: __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();
}
示例4: downloadFile
/**
* @param Form $form
* @param Asset $asset
* @param MauticFactory $factory
* @param $message
* @param $messageMode
*
* @return RedirectResponse|Response
*/
public static function downloadFile(Form $form, Asset $asset, MauticFactory $factory, $message, $messengerMode)
{
/** @var \Mautic\AssetBundle\Model\AssetModel $model */
$model = $factory->getModel('asset');
$url = $model->generateUrl($asset, true, array('form', $form->getId()));
if ($messengerMode) {
return array('download' => $url);
}
$msg = $message . $factory->getTranslator()->trans('mautic.asset.asset.submitaction.downloadfile.msg', array('%url%' => $url));
$content = $factory->getTemplating()->renderResponse('MauticCoreBundle::message.html.php', array('message' => $msg, 'type' => 'notice', 'template' => $factory->getParameter('theme')))->getContent();
return new Response($content);
}
示例5: setTemplate
/**
* Use a template as the body
*
* @param string $template
* @param array $vars
* @param bool $returnContent
* @param null $charset
*
* @return void
*/
public function setTemplate($template, $vars = array(), $returnContent = false, $charset = null)
{
if ($this->templating == null) {
$this->templating = $this->factory->getTemplating();
}
$content = $this->templating->renderResponse($template, $vars)->getContent();
unset($vars);
if ($returnContent) {
return $content;
}
$this->setBody($content, 'text/html', $charset);
unset($content);
}
示例6: setFormTheme
/**
* Sets a specific theme for the form
*
* @param Form $form
* @param string $template
* @param mixed $theme
*
* @return \Symfony\Component\Form\FormView
*/
protected function setFormTheme(Form $form, $template, $theme = null)
{
$formView = $form->createView();
if (empty($theme)) {
return $formView;
}
$templating = $this->factory->getTemplating();
if ($templating instanceof DelegatingEngine) {
$templating->getEngine($template)->get('form')->setTheme($formView, $theme);
} else {
$templating->get('form')->setTheme($formView, $theme);
}
return $formView;
}
示例7: 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)));
}
示例8: downloadFile
/**
* @param Form $form
* @param Asset $asset
* @param MauticFactory $factory
* @param $message
* @param $messageMode
*
* @return RedirectResponse|Response
*/
public static function downloadFile(Form $form, Asset $asset, MauticFactory $factory, $message, $messengerMode)
{
/** @var \Mautic\AssetBundle\Model\AssetModel $model */
$model = $factory->getModel('asset');
$url = $model->generateUrl($asset, true, ['form', $form->getId()]);
if ($messengerMode) {
return ['download' => $url];
}
$msg = $message . $factory->getTranslator()->trans('mautic.asset.asset.submitaction.downloadfile.msg', ['%url%' => $url]);
$analytics = $factory->getHelper('template.analytics')->getCode();
if (!empty($analytics)) {
$factory->getHelper('template.assets')->addCustomDeclaration($analytics);
}
$logicalName = $factory->getHelper('theme')->checkForTwigTemplate(':' . $factory->getParameter('theme') . ':message.html.php');
$content = $factory->getTemplating()->renderResponse($logicalName, ['message' => $msg, 'type' => 'notice', 'template' => $factory->getParameter('theme')])->getContent();
return new Response($content);
}
示例9: getShareButtons
/**
* Gets an array of the HTML for share buttons
*/
public function getShareButtons()
{
static $shareBtns = array();
if (empty($shareBtns)) {
$socialIntegrations = $this->getIntegrationObjects(null, array('share_button'), true);
$templating = $this->factory->getTemplating();
/**
* @var string $integration
* @var \Mautic\PluginBundle\Integration\AbstractIntegration $details
*/
foreach ($socialIntegrations as $integration => $details) {
/** @var \Mautic\PluginBundle\Entity\Integration $settings */
$settings = $details->getIntegrationSettings();
$featureSettings = $settings->getFeatureSettings();
$apiKeys = $details->decryptApiKeys($settings->getApiKeys());
$plugin = $settings->getPlugin();
$shareSettings = isset($featureSettings['shareButton']) ? $featureSettings['shareButton'] : array();
//add the api keys for use within the share buttons
$shareSettings['keys'] = $apiKeys;
$shareBtns[$integration] = $templating->render($plugin->getBundle() . ":Integration/{$integration}:share.html.php", array('settings' => $shareSettings));
}
}
return $shareBtns;
}
示例10: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->templating = $factory->getTemplating();
$this->translator = $factory->getTranslator();
}