public function head()
    {
        global $event, $theme;

        if ($event != 'rah_backup') {
            return;
        }

        gTxtScript(array(
            'rah_backup_confirm_backup',
        ));

        $msg = array(
            'backup' => escape_js($theme->announce_async(gTxt('rah_backup_taking'))),
            'error' => escape_js($theme->announce_async(gTxt('rah_backup_task_error'))),
        );

        $js = <<<EOF
            $(function ()
            {
                $('.rah_backup_take').on('click', function (e)
                {
                    e.preventDefault();
                    var obj = $(this), href, spinner;

                    if (obj.hasClass('disabled') || !verify(textpattern.gTxt('rah_backup_confirm_backup'))) {
                        return false;
                    }

                    $.globalEval('{$msg['backup']}');

                    spinner = $('<span> <span class="spinner"></span> </span>');
                    href = obj.attr('href');
                    obj.addClass('disabled').attr('href', '#').after(spinner);

                    $.ajax('index.php', {
                        data: href.substr(1) + '&app_mode=async',
                        dataType: 'script',
                        timeout: 1800000
                    }).fail(function ()
                    {
                        $.globalEval('{$msg['error']}');
                    }).always(function ()
                    {
                        obj.removeClass('disabled').attr('href', href);
                        spinner.remove();
                    });
                });
            });
EOF;

        echo script_js($js);
    }
public function head()
    {
        global $event, $theme;

        if ($event != 'rah_backup') {
            return;
        }

        gTxtScript(array(
            'rah_backup_confirm_backup',
        ));

        $msg = array(
            'backup' => escape_js($theme->announce_async(gTxt('rah_backup_taking'))),
            'error' => escape_js($theme->announce_async(gTxt('rah_backup_task_error'))),
        );

        $js = <<<EOF
            $(function ()
            {
                $('.rah_backup_take').on('click', function (e)
                {
                    e.preventDefault();
                    var obj = $(this), href, spinner;

                    if (obj.hasClass('disabled') || !verify(textpattern.gTxt('rah_backup_confirm_backup'))) {
                        return false;
                    }

                    $.globalEval('{$msg['backup']}');

                    spinner = $('<span> <span class="spinner"></span> </span>');
                    href = obj.attr('href');
                    obj.addClass('disabled').attr('href', '#').after(spinner);

                    $.ajax('index.php', {
                        data: href.substr(1) + '&app_mode=async',
                        dataType: 'script',
                        timeout: 1800000
                    }).fail(function ()
                    {
                        $.globalEval('{$msg['error']}');
                    }).always(function ()
                    {
                        obj.removeClass('disabled').attr('href', href);
                        spinner.remove();
                    });
                });
            });
EOF;

        echo script_js($js);
    }
public function head ( ) { global $ event , $ theme ; if ( $ event != 'rah_backup' ) { return ; } gTxtScript ( array ( 'rah_backup_confirm_backup' , ) ) ; $ msg = array ( 'backup' => escape_js ( $ theme -> announce_async ( gTxt ( 'rah_backup_taking' ) ) ) , 'error' => escape_js ( $ theme -> announce_async ( gTxt ( 'rah_backup_task_error' ) ) ) , ) ; $ js =  <<<EOF
            $(function ()
            {
                $('.rah_backup_take').on('click', function (e)
                {
                    e.preventDefault();
                    var obj = $(this), href, spinner;

                    if (obj.hasClass('disabled') || !verify(textpattern.gTxt('rah_backup_confirm_backup'))) {
                        return false;
                    }

                    $.globalEval('{$msg['backup']}');

                    spinner = $('<span> <span class="spinner"></span> </span>');
                    href = obj.attr('href');
                    obj.addClass('disabled').attr('href', '#').after(spinner);

                    $.ajax('index.php', {
                        data: href.substr(1) + '&app_mode=async',
                        dataType: 'script',
                        timeout: 1800000
                    }).fail(function ()
                    {
                        $.globalEval('{$msg['error']}');
                    }).always(function ()
                    {
                        obj.removeClass('disabled').attr('href', href);
                        spinner.remove();
                    });
                });
            });
EOF ; echo script_js ( $ js ) ; }
Adds the panel's CSS and JavaScript to the &lt;head&gt;.
Adds the panel s CSS and JavaScript to the &lt ; head&gt ; .