Gets the inline JavaScript required by this radio button cell renderer

@return string the inline JavaScript required by this radio button cell
renderer.
422428
public function getInlineJavaScript()
    {
        $view = $this->getFirstAncestor('SwatView');
        if ($view !== null) {
            $javascript = sprintf(
                "var %s = new SwatRadioButtonCellRenderer('%s', %s);",
                $this->id,
                $this->id,
                $view->id
            );
        } else {
            $javascript = '';
        }

        return $javascript;
    }
1242337
private function getCode()
    {
        $_paq = '';

        foreach ($this->options as $option) {
            $option[0] = "'".$option[0]."'";
            $_paq .= sprintf('_paq.push([%s]);', implode(',', $option));
        }

        return <<<PWK
<script>
    var _paq = _paq || [];
    {$_paq}
    (function() {
        var u="{$this->piwikUrl}";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', {$this->siteId}]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
    })();
</script>
<noscript><p><img src="{$this->piwikUrl}piwik.php?idsite={$this->siteId}" style="border:0;" alt="" /></p></noscript>
PWK;
    }
394555
public String getHtmlCode()
	{
		StringBuffer _buffer = new StringBuffer();

		Object[] _paramsStart =
		{
				getHtmlCodeForIdAttribute(), getHtmlCodeForNameAttribute()
		};
		_buffer.append(FORMAT__START.format(_paramsStart));

		for (RadioButton _radio : getOptions())
		{
			Object[] _paramsItem =
			{
					_radio.getHtmlCode()
			};
			_buffer.append(FORMAT__ITEM.format(_paramsItem));
		}

		Object[] _paramsEnd = {};
		_buffer.append(FORMAT__END.format(_paramsEnd));
		return _buffer.toString();
	}
499929
public function getScript()
    {
        /*
         * JQuery variables sometimes depend on the context where they are used, eg. when their value depends on $(this).
         * When a confirmation question is added, the Jaxon calls are made in a different context,
         * making those variables invalid.
         * To avoid issues related to these context changes, the JQuery selectors values are first saved into
         * local variables, which are then used in Jaxon function calls.
         */
        $sVars = ''; // Javascript code defining all the variables values.
        $nVarId = 1; // Position of the variables, starting from 1.
        // This array will avoid declaring multiple variables with the same value.
        // The array key is the variable value, while the array value is the variable name.
        $aVariables = []; // Array of local variables.
        foreach($this->aParameters as &$xParameter)
        {
            $sParameterStr = $xParameter->getScript();
            if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
            {
                if(!array_key_exists($sParameterStr, $aVariables))
                {
                    // The value is not yet defined. A new variable is created.
                    $sVarName = "jxnVar$nVarId";
                    $aVariables[$sParameterStr] = $sVarName;
                    $sVars .= "$sVarName=$xParameter;";
                    $nVarId++;
                }
                else
                {
                    // The value is already defined. The corresponding variable is assigned.
                    $sVarName = $aVariables[$sParameterStr];
                }
                $xParameter = new Parameter(Jaxon::JS_VALUE, $sVarName);
            }
        }

        $sPhrase = '';
        if(count($this->aMessageArgs) > 0)
        {
            $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question.
            // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes
            if(count($this->aMessageArgs) > 0)
            {
                $nParamId = 1;
                foreach($this->aMessageArgs as &$xParameter)
                {
                    $sParameterStr = $xParameter->getScript();
                    if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
                    {
                        if(!array_key_exists($sParameterStr, $aVariables))
                        {
                            // The value is not yet defined. A new variable is created.
                            $sVarName = "jxnVar$nVarId";
                            $aVariables[$sParameterStr] = $sVarName;
                            $sVars .= "$sVarName=$xParameter;";
                            $nVarId++;
                        }
                        else
                        {
                            // The value is already defined. The corresponding variable is assigned.
                            $sVarName = $aVariables[$sParameterStr];
                        }
                        $xParameter = new Parameter(Jaxon::JS_VALUE, $sVarName);
                    }
                    $xParameter = "'$nParamId':" . $xParameter->getScript();
                    $nParamId++;
                }
                $sPhrase .= '.supplant({' . implode(',', $this->aMessageArgs) . '})';
            }
        }

        $sScript = parent::getScript();
        $xDialog = jaxon()->dialog();
        if($this->sCondition == '__confirm__')
        {
            $sScript = $xDialog->confirm($sPhrase, $sScript, '');
        }
        elseif($this->sCondition !== null)
        {
            $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
            if(($sPhrase))
            {
                $xDialog->getAlert()->setReturn(true);
                $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}';
            }
        }
        return $sVars . $sScript;
    }
127197
protected function getInput() {

        $class       = $this->element['class'] ? ' ' . (string)$this->element['class'] : '';
        $trueLabel   = $this->element['trueLabel'] ? (string)$this->element['trueLabel'] : 'APP_GLOBAL_YES';
        $falseLabel   = $this->element['falseLabel'] ? (string)$this->element['falseLabel'] : 'APP_GLOBAL_NO';
        $buttonClass = $this->element['buttonClass'] ? ' ' . (string)$this->element['buttonClass'] : '';
        $readonly = isset($this->element['readonly']) ? (bool)$this->element['readonly'] : false;

        $checked1 = '';
        $active1  = '';
        $checked0 = '';
        $active0  = '';

        if (isset($this->value)) {

            $value    = (bool)$this->value;
            $checked1 = $value ? ' checked="checked"' : '';
            $active1  = $value ? ' active' : '';
            $checked0 = !$value ? ' checked="checked"' : '';
            $active0  = !$value ? ' active' : '';

        }

        $html = "";

        if ($readonly) {

            $html .= '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '">';

            if (empty($checked0)) {
                $html .= $this->getText()->translate($trueLabel);
            } else {
                $html .= $this->getText()->translate($falseLabel);
            }

        } else {

            $html .= '<div class="btn-group' . $class . '" data-toggle="buttons">
  <label class="btn' . $buttonClass . $active1 . '">
    <input type="radio" name="' . $this->name . '" id="' . $this->id . '1"' . $checked1 . ' value="1"> ' . $this->getText()->translate($trueLabel) . '
  </label>
  <label class="btn' . $buttonClass . $active0 . '">
    <input type="radio" name="' . $this->name . '" id="' . $this->id . '0"' . $checked0 . ' value="0"> ' . $this->getText()->translate($falseLabel) . '
  </label>
</div>';

        }

        return $html;

    }
1335199
protected function getScript()
    {
        if (null === $this->getScriptName()) {
            $request = $this->frontController->getRequest();
            $this->setScriptName($request->getControllerName() . DIRECTORY_SEPARATOR . $request->getActionName());
        }

        return $this->getScriptName() . '.' . $this->getViewSuffix();
    }
217070
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $values = array();
        if ($this->show_blank) {
            $values[] = "''";
        }

        foreach ($this->action_items as $item) {
            if ($item->visible) {
                $values[] = SwatString::quoteJavaScriptString($item->id);
            }
        }

        $selected_value =
            $this->selected === null
                ? 'null'
                : SwatString::quoteJavaScriptString($this->selected->id);

        $javascript .= sprintf(
            "var %s_obj = new SwatActions(%s, [%s], %s);",
            $this->id,
            SwatString::quoteJavaScriptString($this->id),
            implode(', ', $values),
            $selected_value
        );

        if ($this->view !== null && $this->selector !== null) {
            $javascript .= sprintf(
                "\n%s_obj.setViewSelector(%s, '%s');",
                $this->id,
                $this->view->id,
                $this->selector->getId()
            );
        }

        return $javascript;
    }
917010
protected function getInlineJavaScript()
    {
        $base_href = 'editor_base_' . $this->id;
        ob_start();

        if ($this->base_href === null) {
            echo "var {$base_href} = " .
                "document.getElementsByTagName('base');\n";

            echo "if ({$base_href}.length) {\n";
            echo "\t{$base_href} = {$base_href}[0];\n";
            echo "\t{$base_href} = {$base_href}.href;\n";
            echo "} else {\n";
            echo "\t{$base_href} = location.href.split('#', 2)[0];\n";
            echo "\t{$base_href} = {$base_href}.split('?', 2)[0];\n";
            echo "\t{$base_href} = {$base_href}.substring(\n";
            echo "\t\t0, {$base_href}.lastIndexOf('/') + 1);\n";
            echo "}\n";
        } else {
            echo "var {$base_href} = " .
                SwatString::quoteJavaScriptString($this->base_href) .
                ";\n";
        }

        echo "tinyMCE.init({\n";

        $lines = array();
        foreach ($this->getConfig() as $name => $value) {
            if (is_string($value)) {
                $value = SwatString::quoteJavaScriptString($value);
            } elseif (is_bool($value)) {
                $value = $value ? 'true' : 'false';
            }
            $lines[] = "\t" . $name . ": " . $value;
        }

        $lines[] = "\tdocument_base_url: {$base_href}";

        echo implode(",\n", $lines);

        // Make removeformat button also clear inline alignments, styles,
        // colors and classes.
        echo ",\n" .
            "\tformats: {\n" .
            "\t\tremoveformat : [\n" .
            "\t\t\t{\n" .
            "\t\t\t\tselector     : 'b,strong,em,i,font,u,strike',\n" .
            "\t\t\t\tremove       : 'all',\n" .
            "\t\t\t\tsplit        : true,\n" .
            "\t\t\t\texpand       : false,\n" .
            "\t\t\t\tblock_expand : true,\n" .
            "\t\t\t\tdeep         : true\n" .
            "\t\t\t},\n" .
            "\t\t\t{\n" .
            "\t\t\t\tselector     : 'span',\n" .
            "\t\t\t\tattributes   : [\n" .
            "\t\t\t\t\t'style',\n" .
            "\t\t\t\t\t'class',\n" .
            "\t\t\t\t\t'align',\n" .
            "\t\t\t\t\t'color',\n" .
            "\t\t\t\t\t'background'\n" .
            "\t\t\t\t],\n" .
            "\t\t\t\tremove       : 'empty',\n" .
            "\t\t\t\tsplit        : true,\n" .
            "\t\t\t\texpand       : false,\n" .
            "\t\t\t\tdeep         : true\n" .
            "\t\t\t},\n" .
            "\t\t\t{\n" .
            "\t\t\t\tselector     : '*',\n" .
            "\t\t\t\tattributes   : [\n" .
            "\t\t\t\t\t'style',\n" .
            "\t\t\t\t\t'class',\n" .
            "\t\t\t\t\t'align',\n" .
            "\t\t\t\t\t'color',\n" .
            "\t\t\t\t\t'background'\n" .
            "\t\t\t\t],\n" .
            "\t\t\t\tsplit        : false,\n" .
            "\t\t\t\texpand       : false,\n" .
            "\t\t\t\tdeep         : true\n" .
            "\t\t\t}\n" .
            "\t\t]\n" .
            "\t}";

        echo "\n});";

        return ob_get_clean();
    }
885247
public function getJs()
    {
        $html = '<script type="text/javascript">';
        $js = file_get_contents(__DIR__.'/Js/formidable.js');
        $html .= str_replace("\n", '', str_replace('{remove}', $this->factory->getLanguage()->translate('remove'), $js));
        $html .= '</script>';

        return $html;
    }
1093766
public function getHTML()
    {
        $details = $this->getHTMLDetails();
        extract($details);

        $label = isset($this['label'])
            ? " value='{$this['label']}'"
            : null;
        $classSubmit = isset($this['class-submit'])
            ? " class='{$this['class-submit']}'"
            : null;

        return <<<EOD
<{$wrapperElement}{$wrapperClass}>
<input id='$id' type='search'{$class}{$name}{$value}{$autofocus}{$required}{$readonly}{$placeholder}/>
<input id='do-{$id}' type='submit'{$classSubmit}{$label}{$readonly}{$title}/>
</{$wrapperElement}>
<p class='cf-desc'>{$description}</p>
EOD;
    }
671006
public function getFormInitializationJavaScriptCode()
    {
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $formConfigurationJson = $this->handleFormConfiguration($this->getFormConfiguration());

        $javaScriptCode = <<<JS
(function() {
    Fz.Form.register($formName, $formConfigurationJson);
})();
JS;

        return $javaScriptCode;
    }
1151732
protected function getKeyPressScriptText()
    {
        $scriptText  = null;
        $keyProperty = null;
        $keyValue    = null;
        if ($this->keyName) {
            $keyProperty = "KeyName";
            $keyValue    = Builder::getText($this->keyName);
        } else if ($this->keyCode) {
            $keyProperty = "KeyCode";
            $keyValue    = Builder::getInteger($this->keyCode);
        }
        $scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
";
        if ($this->control) {
            $controlId  = Builder::escapeText($this->control->getId());
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
        } else {
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.MainFrame;";
        }
        $scriptText .= "
    ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;";
        if ($this->rememberState) {
            $stateVariableName = static::VAR_STATE;
            $scriptText        .= "
    declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
    CurrentState = ToggleInterfaceControl.Visible;
";
        }
        return $scriptText . "
}";
    }
386755
public function get_inline_css() {
		if ( $this->get_pre_selectors() ) {
			$inline_css = sprintf(
				'%1$s { %2$s }',
				implode( ',', $this->get_selectors() ),
				$this->get_properties()
			);
			foreach ( $this->get_pre_selectors() as $pre_selector ) {
				$inline_css = sprintf(
					'%1$s { %2$s }',
					$pre_selector,
					$inline_css
				);
			}
			return $inline_css;
		}

		return sprintf(
			'%1$s { %2$s }',
			implode( ',', $this->get_selectors() ),
			$this->get_properties()
		);
	}
793899
protected function getInlineJavaScript()
    {
        $use_current_date = $this->use_current_date ? 'true' : 'false';

        $javascript = sprintf(
            "var %s_obj = new SwatDateEntry('%s', %s);",
            $this->id,
            $this->id,
            $use_current_date
        );

        if ($this->display_parts & self::DAY) {
            $day_flydown = $this->getCompositeWidget('day_flydown');

            $lookup_days = array();
            foreach ($day_flydown->options as $key => $option) {
                $lookup_days[] = sprintf(
                    '%s: %s',
                    $option->value,
                    $day_flydown->show_blank ? $key + 1 : $key
                );
            }

            $javascript .= sprintf(
                "\n%s_obj.addLookupTable('day', {%s});",
                $this->id,
                implode(', ', $lookup_days)
            );
        }

        if ($this->display_parts & self::MONTH) {
            $month_flydown = $this->getCompositeWidget('month_flydown');

            $lookup_months = array();
            foreach ($month_flydown->options as $key => $option) {
                $lookup_months[] = sprintf(
                    '%s: %s',
                    $option->value,
                    $month_flydown->show_blank ? $key + 1 : $key
                );
            }

            $javascript .= sprintf(
                "\n%s_obj.addLookupTable('month', {%s});",
                $this->id,
                implode(', ', $lookup_months)
            );
        }

        if ($this->display_parts & self::YEAR) {
            $year_flydown = $this->getCompositeWidget('year_flydown');

            $lookup_years = array();
            foreach ($year_flydown->options as $key => $option) {
                $lookup_years[] = sprintf(
                    '%s: %s',
                    $option->value,
                    $year_flydown->show_blank ? $key + 1 : $key
                );
            }

            $javascript .= sprintf(
                "\n%s_obj.addLookupTable('year', {%s});",
                $this->id,
                implode(', ', $lookup_years)
            );
        }

        if ($this->display_parts & self::TIME) {
            $javascript .= sprintf(
                "\n%s_obj.setTimeEntry(%s_time_entry_obj);",
                $this->id,
                $this->id
            );
        }

        if ($this->display_parts & self::CALENDAR) {
            $javascript .= sprintf(
                "\n%s_obj.setCalendar(%s_calendar_obj);",
                $this->id,
                $this->id
            );
        }

        return $javascript;
    }
540981
protected function getScriptText()
    {
        $togglingControlId = Builder::escapeText($this->togglingControl->getId());
        $toggledControlId  = Builder::escapeText($this->toggledControl->getId());
        $visibility        = "!ToggleControl.Visible";
        if ($this->onlyShow) {
            $visibility = "True";
        } else if ($this->onlyHide) {
            $visibility = "False";
        }
        return "
if (Event.Control.ControlId == {$togglingControlId}) {
	declare ToggleControl = Page.GetFirstChild({$toggledControlId});
	ToggleControl.Visible = {$visibility};
}";
    }
274642
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        if (isset($this->valid_range_start)) {
            $start_date = $this->valid_range_start->formatLikeIntl(
                'MM/dd/yyyy'
            );
        } else {
            $start_date = '';
        }

        if (isset($this->valid_range_end)) {
            // JavaScript calendar is inclusive, subtract one second from range
            $tmp = clone $this->valid_range_end;
            $tmp->subtractSeconds(1);
            $end_date = $tmp->formatLikeIntl('MM/dd/yyyy');
        } else {
            $end_date = '';
        }

        $javascript .= sprintf(
            "var %s_obj = new SwatCalendar('%s', '%s', '%s');",
            $this->id,
            $this->id,
            $start_date,
            $end_date
        );

        return $javascript;
    }
846074
public function getInputHtml()
    {
        $this->rule->setElementName($this->element->getName());

        if ($this->element->getValue()) {
            /* Hack : reload in a new instance to have element name set.
             *        can not be done in afterLoad of the backend model
             *        since we do not know yet the form structure
             */
            $conditions = $this->element->getValue();
            if (!is_array($conditions)) {
                $conditions = $conditions->getConditions()->asArray();
            }
            $this->rule->getConditions()->loadArray($conditions);
            $this->element->setRule($this->rule);
        }

        $this->input = $this->elementFactory->create('text');
        $this->input->setRule($this->rule)->setRenderer($this->conditions);

        $this->setConditionFormName($this->rule->getConditions(), $this->getElement()->getContainer()->getHtmlId());

        if (is_array($this->getData('url_params'))) {
            $this->setConditionUrlParams($this->rule->getConditions(), $this->getData('url_params'));
        }

        return $this->input->toHtml();
    }