<?php /** * @copyright 2014 Mautic Contributors. All rights reserved * @author Mautic * * @link http://mautic.org * * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ use Mautic\CoreBundle\Helper\InputHelper; $formName = '_' . strtolower(InputHelper::alphanum(InputHelper::transliterate($form->getName())) . '_focus'); $jsFormName = ltrim($formName, '_'); $fields = $form->getFields(); $required = []; if (empty($preview)) { echo $view->render('MauticFormBundle:Builder:script.html.php', ['form' => $form, 'formName' => $formName]); ?> <script> var MauticFocusHandler = function (messageType, message) { // Store the HTML var wrapper = document.getElementById('mauticform_wrapper<?php echo $formName; ?> '); var innerForm = wrapper.getElementsByClassName('mauticform-innerform'); innerForm[0].style.display = "none"; <?php if ($style == 'page') {
/** * Cleans a string to be used as an alias. The returned string will be alphanumeric or underscore, less than 25 characters * and if it is a reserved SQL keyword, it will be prefixed with f_ * * @param string $alias * @param string $prefix Used when the alias is a reserved keyword by the database platform * @param int|bool $maxLength Maximum number of characters used; 0 to disable * @param string $spaceCharacter Character to replace spaces with * @return string * @throws \Doctrine\DBAL\DBALException */ public function cleanAlias($alias, $prefix = '', $maxLength = false, $spaceCharacter = '_') { // Transliterate to latin characters $alias = InputHelper::transliterate(trim($alias)); // Some labels are quite long if a question so cut this short $alias = strtolower(InputHelper::alphanum($alias, false, $spaceCharacter)); // Trim if applicable if ($maxLength) { $alias = substr($alias, 0, $maxLength); } if (substr($alias, -1) == '_') { $alias = substr($alias, 0, -1); } // Check that alias is SQL safe since it will be used for the column name $databasePlatform = $this->em->getConnection()->getDatabasePlatform(); $reservedWords = $databasePlatform->getReservedKeywordsList(); if ($reservedWords->isKeyword($alias) || is_numeric($alias)) { $alias = $prefix . $alias; } return $alias; }
/** * Generate a form name for HTML attributes */ public function generateFormName() { return strtolower(InputHelper::alphanum(InputHelper::transliterate($this->name))); }
$wrapDiv = false; } $count = 0; $firstId = 'mauticform_' . $containerType . '_' . $type . '_' . $field['alias'] . '_' . InputHelper::alphanum(InputHelper::transliterate($list[0])) . '1'; $formButtons = !empty($inForm) ? $view->render('MauticFormBundle:Builder:actions.html.php', ['id' => $id, 'formId' => $formId, 'formName' => $formName]) : ''; $label = !$field['showLabel'] ? '' : <<<HTML <label {$labelAttr} for="{$firstId}">{$view->escape($field['label'])}</label> HTML; $help = empty($field['helpMessage']) ? '' : <<<HTML <span class="mauticform-helpmessage">{$field['helpMessage']}</span> HTML; $options = []; foreach ($list as $counter => $l) { $id = $field['alias'] . '_' . InputHelper::alphanum(InputHelper::transliterate($l)) . $counter; $checked = $field['defaultValue'] == $l ? 'checked="checked"' : ''; $checkboxBrackets = $type == 'checkbox' ? '[]' : ''; $option = <<<HTML <label id="mauticform_{$containerType}_label_{$id}" for="mauticform_{$containerType}_{$type}_{$id}" {$optionLabelAttr}> <input {$inputAttr}{$checked} name="mauticform[{$field['alias']}]{$checkboxBrackets}" id="mauticform_{$containerType}_{$type}_{$id}" type="{$type}" value="{$view->escape($l)}" /> {$view->escape($l)} </label> HTML; if ($wrapDiv) { $option = <<<HTML <div class="mauticform-{$containerType}-row">{$option} </div> HTML;
/** * Generate a form name for HTML attributes */ public function generateFormName() { $name = strtolower(InputHelper::alphanum(InputHelper::transliterate($this->name))); return empty($name) ? 'form-' . $this->id : $name; }
/** * @return array */ public function getAvailableLeadFields($settings = array()) { $zohoFields = array(); $silenceExceptions = isset($settings['silence_exceptions']) ? $settings['silence_exceptions'] : true; try { if ($this->isAuthorized()) { $leadObject = $this->getApiHelper()->getLeadFields(); if ($leadObject == null || isset($leadObject['response']) && isset($leadObject['response']['error'])) { return array(); } $zohoFields = array(); foreach ($leadObject['Leads']['section'] as $optgroup) { //$zohoFields[$optgroup['dv']] = array(); if (!array_key_exists(0, $optgroup['FL'])) { $optgroup['FL'] = array($optgroup['FL']); } foreach ($optgroup['FL'] as $field) { if (!(bool) $field['isreadonly'] || in_array($field['type'], array('Lookup', 'OwnerLookup', 'Boolean'))) { continue; } $key = InputHelper::alphanum(InputHelper::transliterate($field['dv'])); $zohoFields[$key] = array('type' => 'string', 'label' => $field['label'], 'dv' => $field['dv'], 'required' => $field['req'] == 'true'); } } } } catch (ErrorException $exception) { $this->logIntegrationError($exception); if (!$silenceExceptions) { throw $exception; } return false; } return $zohoFields; }