Register JavaScript code snippet for rendering.

@param string $script
@param bool   $isDynamic
502243
public function addSnippet($script, $isDynamic = false)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $suffix = $isDynamic ? '_dynamic' : '';
        $scriptsParameterName = static::SNIPPETS_PARAMETER_NAME . $suffix;
        $scripts = (array) $config->getGlobalParameter($scriptsParameterName);
        $script = trim($script);
        if (!in_array($script, $scripts)) {
            $scripts[] = $script;
        }
        $config->setGlobalParameter($scriptsParameterName, $scripts);
    }
1293556
protected function setupScript($script)
    {
        $method = 'setupScriptFor'.ucfirst($this->viewMode).'View';

        call_user_func([$this, $method], $script);
    }
782546
protected function registerClientScript()
    {

        $path      = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->clientScript;

        $cs->registerCoreScript('jquery');

        $cs->registerCssFile($assetsUrl . '/css/bootstrap-toggle-buttons.css');
        $cs->registerScriptFile($assetsUrl . '/js/jquery.toggle.buttons.js');

        /* initialize plugin */
        $selector = '#wrapper-' . TbArray::getValue('id', $this->htmlOptions, $this->getId());

        $this->getApi()->registerPlugin(
            'toggleButtons',
            $selector,
            $this->getConfiguration(),
            CClientScript::POS_READY
        );

    }
1284699
public function prepare(Script $script)
    {
        $script->addScriptFunction("uiDropdownFunctions", $this->getScriptDropdown());
        $script->addCustomScriptLabel(ScriptLabel::MouseClick, $this->getScriptMouseClick());
        $script->addCustomScriptLabel(ScriptLabel::OnInit, $this->getScriptInit());
    }
674789
public function render($widget, $forceRender, $isDynamic)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $suffix = $isDynamic ? '_dynamic' : '';
        $output = '';

        if (!$widget || $this->shouldForceRender($forceRender)) {
            $styles = (array) $config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\StyleRegistrator::STYLES_PARAMETER_NAME . $suffix);
            $output .= $this->formStylesOutput($styles);
            $output .= PHP_EOL;
            $conditionalStyles = (array) $config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\StyleRegistrator::CONDITIONAL_STYLES_PARAMETER_NAME . $suffix);
            $output .= $this->formConditionalStylesOutput($conditionalStyles);
        }

        return $output;
    }
1105088
public function appendHeadScript($src, $isFile = true)
    {
        $this->headScripts[] = $this->createScript($src, $isFile);
    }
222845
protected function registerClientScript()
    {
        $view = $this->getView();

        BootstrapTypeAheadAsset::register($view);

        $id = $this->options['id'];

        $options = $this->clientOptions !== false && !empty($this->clientOptions) ? Json::encode($this->clientOptions) : 'null';

        foreach($this->dataSets as $dataSet) {
            if(empty($dataSet)) {
                continue;
            }
            $dataSets[] = Json::encode($dataSet);
        }

        $dataSets = !empty($dataSets) ? implode(", ", $dataSets) : '{}';

        foreach ($this->engines as $bloodhound) {
            if ($bloodhound instanceof BootstrapTypeAheadBloodhound) {
                $js[] = $bloodhound->getClientScript();
            }
        }
        $js[] = "jQuery('#$id').typeahead($options, $dataSets);";
        foreach ($this->clientEvents as $eventName => $handler) {
            $js[] = "jQuery('#$id').on('$eventName', $handler);";
        }
        $view->registerJs(implode("\n", $js));
    }
653099
public function registerClientScript() {
		$id = $this->grid->id;
        $js = '';
        $js .= "$.fn.yiiGridView.initBulkActions('{$id}');";

        foreach ($this->events as $buttonId => $handler) {
            $js .= "\n
            $(document).on('click','#{$buttonId}', function() {
	            var checked = $.fn.yiiGridView.getCheckedRowsIds('$id');
	            if (!checked.length) {
	                alert('".$this->noCheckedMessage."');
	                return false;
	            }
				var fn = $handler;
	            if ($.isFunction(fn)){ fn(checked); } \n
	            return false;
        	}); \n
            ";
        }
        Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), $js);
    }
1368361
public function appendAfterBodyScript($src, $isFile = true)
    {
        $this->afterBodyScripts[] = $this->createScript($src, $isFile);
    }
118621
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);
        $id = TbArray::getValue('id', $this->htmlOptions, $this->getId());

        $jsFile = !empty($this->scales)
            ? 'jQAllRangeSliders-withRuler-min.js'
            : 'jQAllRangeSliders-min.js';

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerCoreScript('jquery');
        $cs->registerCoreScript('jquery.ui');
        $this->getYiiWheels()->registerAssetJs('jquery.mousewheel.min.js', CClientScript::POS_HEAD);

        $cs->registerCssFile($assetsUrl . '/css/' . $this->theme . '.css');
        $cs->registerScriptFile($assetsUrl . '/js/' . $jsFile);

        $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';

        $inputValSet = "$('#{$id}').val(data.values.min+','+data.values.max);";

        //inserting trigger
        if (isset($this->events['valuesChanged'])) {
            $orig = $this->events['valuesChanged'];
            if (strpos($orig, 'js:') === 0) {
                $orig = substr($orig, 3);
            }
            $orig = "\n($orig).apply(this, arguments);";
        } else {
            $orig = '';
        }
        $this->events['valuesChanged'] = "js: function(id, data) {
			$inputValSet $orig
		}";

        ob_start();
        echo "jQuery('#slider_{$id}').{$this->type}Slider({$options})";
        foreach ($this->events as $event => $handler) {
            echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
        }

        $cs->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
    }
206967
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerScriptFile($assetsUrl . '/js/jquery.mask.js');

        /* initialize plugin */
        $selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());

        $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '{}';
        $script = "jQuery('{$selector}').mask('{$this->mask}',{$options});";
        Yii::app()->clientScript->registerScript((uniqid(__CLASS__ . '#', true)), $script, CClientScript::POS_END);
    }
1238886
public function registerClientScript($id) {

		Booster::getBooster()->registerPackage('select2');

		$options = !empty($this->options) ? CJavaScript::encode($this->options) : '';

		if (!empty($this->val)) {
			if (is_array($this->val)) {
				$data = CJSON::encode($this->val);
			} else {
				$data = $this->val;
			}

			$defValue = ".select2('val', $data)";
		} else
			$defValue = '';

		if ($this->readonly) {
			$defValue .= ".select2('readonly', true)";
		} elseif ($this->disabled) {
			$defValue .= ".select2('enable', false)";
		}

		ob_start();
		echo "jQuery('select#{$id}').select2({$options})";
		foreach ($this->events as $event => $handler) {
			echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
		}
		echo $defValue;

		Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
	}
1279885
protected function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerScriptFile($assetsUrl . '/js/highcharts.js');

        /* register required files */
        $defaultOptions = array('exporting' => array('enabled' => true));

        $this->pluginOptions = CMap::mergeArray($defaultOptions, $this->pluginOptions);

        if (isset($this->pluginOptions['exporting']) && @$this->pluginOptions['exporting']['enabled']) {
            $cs->registerScriptFile($assetsUrl . '/js/modules/exporting.js');
        }

        if ($theme = TbArray::getValue('theme', $this->pluginOptions)) {
            $cs->registerScriptFile($assetsUrl . '/js/themes/' . $theme . '.js');
        }

        $options = CJavaScript::encode($this->pluginOptions);

        $cs->registerScript(
            __CLASS__ . '#' . $this->getId(),
            "var highchart{$this->getId()} = new Highcharts.Chart({$options});"
        );
    }
366510
public function registerCustomClientScript()
    {
        /* publish assets dir */
        $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /** @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $fixedHeaderJs = '';
        if ($this->fixedHeader) {
            $cs->registerScriptFile(
                $assetsUrl . '/js/jquery.stickytableheaders' . (!YII_DEBUG ? '.min' : '') . '.js',
                CClientScript::POS_END
            );
            $fixedHeaderJs = "$('#{$this->id} table.items').stickyTableHeaders({fixedOffset:{$this->headerOffset}});";
            $this->componentsAfterAjaxUpdate[] = $fixedHeaderJs;
        }

        $cs->registerScript(
            __CLASS__ . '#Wh' . $this->id,
            '$grid = $("#' . $this->id . '");' .
            $fixedHeaderJs . '
			if ($(".' . $this->extendedSummaryCssClass . '", $grid).length)
			{
				$(".' . $this->extendedSummaryCssClass . '", $grid).html($("#' . $this->id . '-extended-summary", $grid).html());
			}
			' . (count($this->componentsReadyScripts) ? implode("\n", $this->componentsReadyScripts) : '') . '
			$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
				var qs = $.deparam.querystring(options.url);
				if (qs.hasOwnProperty("ajax") && qs.ajax == "' . $this->id . '")
				{
					options.realsuccess = options.success;
					options.success = function(data)
					{
						if (options.realsuccess) {
							options.realsuccess(data);
							var $data = $("<div>" + data + "</div>");
							// we need to get the grid again... as it has been updated
							if ($(".' . $this->extendedSummaryCssClass . '", $("#' . $this->id . '")))
							{
								$(".' .
            $this->extendedSummaryCssClass .
            '", $("#' . $this->id .
            '")).html($("#' . $this->id .
            '-extended-summary", $data).html());
        }
        ' .
            (count($this->componentsAfterAjaxUpdate)
                ? implode("\n", $this->componentsAfterAjaxUpdate)
                : '') .
            '
        }
    }
}
});'
        );
    }
1282138
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $min = $this->debugMode
            ? '.min'
            : '';

        $cs->registerCssFile($assetsUrl . '/css/bootstrap-switch.css');
        $cs->registerScriptFile($assetsUrl . '/js/bootstrap-switch' . $min . '.js', CClientScript::POS_END);

        if ($this->events) {
            /* initialize plugin */
            $selector = '#' . TbArray::getValue('id', $this->pluginOptions);

            $this->getApi()->registerEvents($selector, $this->events);
        }
    }
1359852
protected function registerScript()
    {
        $id = $this->options['id'];
        $clientOptions = (count($this->clientOptions)) ? Json::encode($this->clientOptions) : '{}';

        $this->getView()->registerJs("CKEDITOR.replace('$id', $clientOptions);", View::POS_END);
    }
672635
public function addFile($file, $priority, $isDynamic = false)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $suffix = $isDynamic ? '_dynamic' : '';
        $filesParameterName = static::FILES_PARAMETER_NAME . $suffix;
        $includes = (array) $config->getGlobalParameter($filesParameterName);

        if (!preg_match('#^https?://#', $file)) {
            $file = $this->formLocalFileUrl($file);
        }

        if ($file) {
            $includes[$priority][] = $file;
            $includes[$priority] = array_unique($includes[$priority]);
            $config->setGlobalParameter($filesParameterName, $includes);
        }
    }