コード例 #1
0
ファイル: ActiveFormStyled.php プロジェクト: Liv1020/cms
    /**
     * Runs the widget.
     * This registers the necessary javascript code and renders the form close tag.
     * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
     */
    public function run()
    {
        $view = $this->getView();
        $view->registerCss(<<<CSS
        .sx-form-fieldset
        {
            border-bottom: 1px dashed silver;
        }
            .sx-form-fieldset .sx-form-fieldset-title
            {
                font-weight: bold;
            }
                .sx-form-fieldset .sx-form-fieldset-title a
                {
                    font-weight: bold;
                    border-bottom: 1px dashed silver;
                    text-decoration: none;
                }

                    .sx-form-fieldset .sx-form-fieldset-title a:hover
                    {
                        text-decoration: none;
                    }

            .sx-form-fieldset .sx-form-fieldset-content
            {
                padding: 0px 20px;
            }
CSS
);
        echo <<<HTML
HTML;
        parent::run();
    }
コード例 #2
0
ファイル: ActiveFormUseTab.php プロジェクト: Liv1020/cms
    /**
     * Runs the widget.
     * This registers the necessary javascript code and renders the form close tag.
     * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
     */
    public function run()
    {
        $view = $this->getView();
        $view->registerJs(<<<JS
        (function(sx, \$, _)
        {
            sx.classes.FormUseTabs = sx.classes.Component.extend({

                _init: function()
                {
                    this.activeTab = window.location.hash.replace("#","");
                },

                _onDomReady: function()
                {
                    var self = this;

                    var counter = 0;
                    \$('.sx-form-tab').each(function(i,s)
                    {
                        counter = counter + 1;

                        var Jcontroll = \$("<a>", {
                            'href' : '#' + \$(this).attr('id'),
                            'aria-controls' : \$(this).attr('id'),
                            'role' : 'tab',
                            'data-toggle' : 'tab',
                        }).append(\$(this).data('name'));

                        Jcontroll.on('click', function()
                        {
                            location.href = \$(this).attr("href");
                        });

                        var Jli = \$("<li>", {
                            'role' : 'presentation',
                            'class' : 'presentation'
                        }).append(Jcontroll);


                        if (self.activeTab)
                        {
                             if (self.activeTab == \$(this).attr('id'))
                            {
                                Jli.addClass("active");
                                \$(this).addClass("active");
                            }
                        } else
                        {
                            if (counter == 1)
                            {
                                Jli.addClass("active");
                                \$(this).addClass("active");
                            }
                        }

                        \$('.sx-form-tab-panel .nav').append(Jli);
                    });



                },

                _onWindowReady: function()
                {}
            });

            new sx.classes.FormUseTabs();

        })(sx, sx.\$, sx._);
JS
);
        //$view->registerJs("jQuery('#$id').yiiActiveForm($attributes, $options);");
        echo <<<HTML
        <!--<div role="tabpanel">

          &lt;!&ndash; Nav tabs &ndash;&gt;
          <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
            <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
            <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
            <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
          </ul>

          &lt;!&ndash; Tab panes &ndash;&gt;
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="home">1</div>
            <div role="tabpanel" class="tab-pane" id="profile">2</div>
            <div role="tabpanel" class="tab-pane" id="messages">3</div>
            <div role="tabpanel" class="tab-pane" id="settings">4</div>
          </div>-->

            </div>
        </div>
HTML;
        parent::run();
    }