当前位置: 首页>>代码示例>>PHP>>正文


PHP JHtml::getJSObject方法代码示例

本文整理汇总了PHP中JHtml::getJSObject方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::getJSObject方法的具体用法?PHP JHtml::getJSObject怎么用?PHP JHtml::getJSObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JHtml的用法示例。


在下文中一共展示了JHtml::getJSObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadBehavior

    /**
     * Load the JavaScript behavior.
     *
     * @param   string  $group   The pane identifier.
     * @param   array   $params  Array of options.
     *
     * @return  void
     *
     * @since   1.6
     * @deprecated  __DEPLOY_VERSION__ These helpers are dependent on the deprecated MooTools support
     */
    protected static function loadBehavior($group, $params = array())
    {
        static $loaded = array();
        if (!array_key_exists((string) $group, $loaded)) {
            // Include MooTools framework
            JHtml::_('behavior.framework', true);
            $opt['onActive'] = isset($params['onActive']) ? '\\' . $params['onActive'] : null;
            $opt['onBackground'] = isset($params['onBackground']) ? '\\' . $params['onBackground'] : null;
            $opt['display'] = isset($params['startOffset']) ? (int) $params['startOffset'] : null;
            $opt['titleSelector'] = "dt.tabs";
            $opt['descriptionSelector'] = "dd.tabs";
            // When use storage is set and value is false - By default we allow to use storage
            $opt['useStorage'] = isset($params['useCookie']) && !$params['useCookie'] ? false : true;
            $options = JHtml::getJSObject($opt);
            $js = '	window.addEvent(\'domready\', function(){
						$$(\'dl#' . $group . '.tabs\').each(function(tabs){
							new JTabs(tabs, ' . $options . ');
						});
					});';
            $document = JFactory::getDocument();
            $document->addScriptDeclaration($js);
            JHtml::_('script', 'system/tabs.js', false, true);
            $loaded[(string) $group] = true;
        }
    }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:36,代码来源:tabs.php

示例2: startAccordion

 /**
  * Add javascript support for Bootstrap accordians and insert the accordian
  *
  * @param   string  $selector  The ID selector for the tooltip.
  * @param   array   $params    An array of options for the tooltip.
  *                             Options for the tooltip can be:
  *                             - parent  selector  If selector then all collapsible elements under the specified parent will be closed when this
  *                                                 collapsible item is shown. (similar to traditional accordion behavior)
  *                             - toggle  boolean   Toggles the collapsible element on invocation
  *                             - active  string    Sets the active slide during load
  *
  * @return  string  HTML for the accordian
  *
  * @since   3.0
  */
 public static function startAccordion($selector = 'myAccordian', $params = array())
 {
     $sig = md5(serialize(array($selector, $params)));
     if (!isset(static::$loaded[__METHOD__][$sig])) {
         // Include Bootstrap framework
         static::framework();
         // Setup options object
         $opt['parent'] = isset($params['parent']) ? (bool) $params['parent'] : false;
         $opt['toggle'] = isset($params['toggle']) ? (bool) $params['toggle'] : true;
         $opt['active'] = isset($params['active']) ? (string) $params['active'] : '';
         $options = JHtml::getJSObject($opt);
         // Attach accordion to document
         JFactory::getDocument()->addScriptDeclaration("(function(\$){\n\t\t\t\$('#{$selector}').collapse({$options});\n\t\t})(jQuery);");
         // Set static array
         static::$loaded[__METHOD__][$sig] = true;
         static::$loaded[__METHOD__]['active'] = $opt['active'];
     }
     return '<div id="' . $selector . '" class="accordion">';
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:34,代码来源:pjslider.php

示例3: _getJSObject

 /**
  * Internal method to get a JavaScript object notation string from an array
  *
  * @param   array  $array  The array to convert to JavaScript object notation
  *
  * @return  string  JavaScript object notation representation of the array
  *
  * @since       1.5
  * @deprecated  13.3 (Platform) & 4.0 (CMS) - Use JHtml::getJSObject() instead.
  */
 protected static function _getJSObject($array = array())
 {
     JLog::add('JHtmlBehavior::_getJSObject() is deprecated. JHtml::getJSObject() instead..', JLog::WARNING, 'deprecated');
     return JHtml::getJSObject($array);
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:15,代码来源:behavior.php

示例4: startAccordion

 /**
  * Add javascript support for Bootstrap accordians and insert the accordian
  *
  * @param   string  $selector  The ID selector for the tooltip.
  * @param   array   $params    An array of options for the tooltip.
  *                             Options for the tooltip can be:
  *                             - parent  selector  If selector then all collapsible elements under the specified parent will be closed when this
  *                                                 collapsible item is shown. (similar to traditional accordion behavior)
  *                             - toggle  boolean   Toggles the collapsible element on invocation
  *                             - active  string    Sets the active slide during load
  * 
  *                             - onShow    function  This event fires immediately when the show instance method is called.
  *                             - onShown   function  This event is fired when a collapse element has been made visible to the user 
  *                                                   (will wait for css transitions to complete).
  *                             - onHide    function  This event is fired immediately when the hide method has been called.
  *                             - onHidden  function  This event is fired when a collapse element has been hidden from the user 
  *                                                   (will wait for css transitions to complete).
  *
  * @return  string  HTML for the accordian
  *
  * @since   3.0
  */
 public static function startAccordion($selector = 'myAccordian', $params = array())
 {
     if (!isset(static::$loaded[__METHOD__][$selector])) {
         // Include Bootstrap framework
         static::framework();
         // Setup options object
         $opt['parent'] = isset($params['parent']) ? $params['parent'] == true ? '#' . $selector : $params['parent'] : false;
         $opt['toggle'] = isset($params['toggle']) ? (bool) $params['toggle'] : ($opt['parent'] === false || isset($params['active']) ? false : true);
         $onShow = isset($params['onShow']) ? (string) $params['onShow'] : null;
         $onShown = isset($params['onShown']) ? (string) $params['onShown'] : null;
         $onHide = isset($params['onHide']) ? (string) $params['onHide'] : null;
         $onHidden = isset($params['onHidden']) ? (string) $params['onHidden'] : null;
         $options = JHtml::getJSObject($opt);
         $opt['active'] = isset($params['active']) ? (string) $params['active'] : '';
         // Build the script.
         $script = array();
         $script[] = "jQuery(document).ready(function(\$){";
         $script[] = "\t\$('#" . $selector . "').collapse(" . $options . ")";
         if ($onShow) {
             $script[] = "\t.on('show', " . $onShow . ")";
         }
         if ($onShown) {
             $script[] = "\t.on('shown', " . $onShown . ")";
         }
         if ($onHide) {
             $script[] = "\t.on('hideme', " . $onHide . ")";
         }
         if ($onHidden) {
             $script[] = "\t.on('hidden', " . $onHidden . ")";
         }
         $script[] = "});";
         // Attach accordion to document
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
         // Set static array
         static::$loaded[__METHOD__][$selector] = $opt;
         return '<div id="' . $selector . '" class="accordion">';
     }
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:60,代码来源:bootstrap.php

示例5: startPane

 /**
  * Creates a tab pane
  *
  * @param   string  $selector  The pane identifier.
  * @param   array   $params    The parameters for the pane
  *
  * @return  string
  *
  * @since   3.0
  */
 public static function startPane($selector = 'myTab', $params = array())
 {
     $sig = md5(serialize(array($selector, $params)));
     if (!isset(self::$loaded[__METHOD__][$sig])) {
         // Include Bootstrap framework
         self::framework();
         // Setup options object
         $opt['active'] = isset($params['active']) && $params['active'] ? (string) $params['active'] : '';
         $options = JHtml::getJSObject($opt);
         // Attach tooltips to document
         JFactory::getDocument()->addScriptDeclaration("(function(\$){\n\t\t\t\t\t\$('#{$selector} a').click(function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\$(this).tab('show');\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);");
         // Set static array
         self::$loaded[__METHOD__][$sig] = true;
         self::$loaded[__METHOD__][$selector]['active'] = $opt['active'];
     }
     return '<div class="tab-content" id="' . $selector . 'Content">';
 }
开发者ID:RuDers,项目名称:JoomlaSQL,代码行数:27,代码来源:bootstrap.php

示例6: startTabSet

 /**
  * Creates a tab pane
  *
  * @param   string  $selector  The pane identifier.
  * @param   array   $params    The parameters for the pane
  *
  * @return  string
  */
 public static function startTabSet($selector = 'myTab', $params = array())
 {
     $sig = md5(serialize(array($selector, $params)));
     if (!isset(static::$loaded[__METHOD__][$sig])) {
         // Include Bootstrap framework
         static::framework();
         // Setup options object
         $opt['active'] = isset($params['active']) && $params['active'] ? (string) $params['active'] : '';
         $options = JHtml::getJSObject($opt);
         // Attach tabs to document
         JFactory::getDocument()->addScriptDeclaration(JLayoutHelper::render('libraries.cms.html.bootstrap.starttabsetscript', array('selector' => $selector)));
         // Set static array
         static::$loaded[__METHOD__][$sig] = true;
         static::$loaded[__METHOD__][$selector]['active'] = $opt['active'];
     }
     $html = JLayoutHelper::render('libraries.cms.html.bootstrap.starttabset', array('selector' => $selector));
     return $html;
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:26,代码来源:rbootstrap.php

示例7: loadBehavior

 /**
  * Load the JavaScript behavior.
  *
  * @param   string  $group   The pane identifier.
  * @param   array   $params  Array of options.
  *
  * @return  void
  *
  * @since   1.6
  * @deprecated  __DEPLOY_VERSION__ These helpers are dependent on the deprecated MooTools support
  */
 protected static function loadBehavior($group, $params = array())
 {
     static $loaded = array();
     if (!array_key_exists($group, $loaded)) {
         // Get the JInput object
         $input = JFactory::getApplication()->input;
         $loaded[$group] = true;
         // Include mootools framework.
         JHtml::_('behavior.framework', true);
         $document = JFactory::getDocument();
         $display = isset($params['startOffset']) && isset($params['startTransition']) && $params['startTransition'] ? (int) $params['startOffset'] : null;
         $show = isset($params['startOffset']) && !(isset($params['startTransition']) && $params['startTransition']) ? (int) $params['startOffset'] : null;
         $opt['onActive'] = "\\function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_" . $group . "',\$\$('div#" . $group . ".pane-sliders > .panel > h3').indexOf(toggler));}";
         $opt['onBackground'] = "\\function(toggler, i) {toggler.addClass('pane-toggler');" . "toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if(\$\$('div#" . $group . ".pane-sliders > .panel > h3').length==\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_" . $group . "',-1);}";
         $opt['duration'] = isset($params['duration']) ? (int) $params['duration'] : 300;
         $opt['display'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $display, 'integer') : $display;
         $opt['show'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $show, 'integer') : $show;
         $opt['opacity'] = isset($params['opacityTransition']) && $params['opacityTransition'] ? 'true' : 'false';
         $opt['alwaysHide'] = isset($params['allowAllClose']) && !$params['allowAllClose'] ? 'false' : 'true';
         $options = JHtml::getJSObject($opt);
         $js = "window.addEvent('domready', function(){ new Fx.Accordion(\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler'), \$\$('div#" . $group . ".pane-sliders > .panel > div.pane-slider'), " . $options . "); });";
         $document->addScriptDeclaration($js);
     }
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:35,代码来源:sliders.php

示例8: typeahead

 /**
  * Add javascript support for Bootstrap typeahead
  *
  * @param   string  $selector  The selector for the typeahead element.
  * @param   array   $params    An array of options for the typeahead element.
  *                             Options for the tooltip can be:
  *                             - source       array, function  The data source to query against. May be an array of strings or a function.
  *                                                             The function is passed two arguments, the query value in the input field and the
  *                                                             process callback. The function may be used synchronously by returning the data
  *                                                             source directly or asynchronously via the process callback's single argument.
  *                             - items        number           The max number of items to display in the dropdown.
  *                             - minLength    number           The minimum character length needed before triggering autocomplete suggestions
  *                             - matcher      function         The method used to determine if a query matches an item. Accepts a single argument,
  *                                                             the item against which to test the query. Access the current query with this.query.
  *                                                             Return a boolean true if query is a match.
  *                             - sorter       function         Method used to sort autocomplete results. Accepts a single argument items and has
  *                                                             the scope of the typeahead instance. Reference the current query with this.query.
  *                             - updater      function         The method used to return selected item. Accepts a single argument, the item and
  *                                                             has the scope of the typeahead instance.
  *                             - highlighter  function         Method used to highlight autocomplete results. Accepts a single argument item and
  *                                                             has the scope of the typeahead instance. Should return html.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function typeahead($selector = '.typeahead', $params = array())
 {
     if (!isset(static::$loaded[__METHOD__][$selector])) {
         // Include Bootstrap framework
         static::framework();
         // Setup options object
         $opt['source'] = isset($params['source']) ? $params['source'] : '[]';
         $opt['items'] = isset($params['items']) ? (int) $params['items'] : 8;
         $opt['minLength'] = isset($params['minLength']) ? (int) $params['minLength'] : 1;
         $opt['matcher'] = isset($params['matcher']) ? (string) $params['matcher'] : null;
         $opt['sorter'] = isset($params['sorter']) ? (string) $params['sorter'] : null;
         $opt['updater'] = isset($params['updater']) ? (string) $params['updater'] : null;
         $opt['highlighter'] = isset($params['highlighter']) ? (int) $params['highlighter'] : null;
         $options = JHtml::getJSObject($opt);
         // Attach tooltips to document
         JFactory::getDocument()->addScriptDeclaration("jQuery(document).ready(function()\n\t\t\t\t{\n\t\t\t\t\tjQuery('" . $selector . "').typeahead(" . $options . ");\n\t\t\t\t});");
         // Set static array
         static::$loaded[__METHOD__][$selector] = true;
     }
     return;
 }
开发者ID:spikart,项目名称:spikart.com.ua,代码行数:47,代码来源:bootstrap.php

示例9: array

            $options['selectors'] = $selectors;
        }
        // get functions
        $extensionsParams->set('module.value', $params->get('function_done_filters'));
        if ($functionDone = trim(FieldsandfiltersExtensionsHelper::getParams('function_done_filters', $extensionsParams))) {
            $fn['done'] = '\\' . $functionDone;
        }
        // hash navigation
        if ($componentParams->get('hash_navigation_enabled')) {
            $options['hashNavigation'] = array('enabled' => true, 'prefix' => $componentParams->get('hash_navigation_prefix', '#!'));
        }
        if (!empty($fn) && is_array($fn)) {
            $options['fn'] = $fn;
        }
        // Import JS && CSS
        JHtml::_('FieldsandfiltersHtml.filters.framework');
        if (FieldsandfiltersFactory::isVersion()) {
            $options = JHtml::getJSObject($options);
        } else {
            $options = JHtml::_('FieldsandfiltersHtml.joomla.getJSObject', $options);
        }
        $script[] = 'jQuery(document).ready(function($) {';
        $script[] = '     $( "#faf-form-' . $module->id . '" ).fieldsandfilters(' . $options . ');';
        if ($params->get('show_random', 0)) {
            $script[] = sprintf('     $( "#faf-form-random-' . $module->id . '" ).fieldsandfilters("random:%s");', $componentParams->get('random_type_filters', 'all'));
        }
        $script[] = '});';
        JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
        require JModuleHelper::getLayoutPath('mod_fieldsandfilters_filters', $params->get('layout', 'default'));
    }
}
开发者ID:fields-and-filters,项目名称:fields-and-filters,代码行数:31,代码来源:mod_fieldsandfilters_filters.php


注:本文中的JHtml::getJSObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。