<!DOCTYPE html>
<html>
    <head>
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
        <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/favicon.png">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <?php        
        Yii::app()->bootstrap->register();
        cs()->registerCssFile(Yii::app()->request->baseUrl . '/css/theme_default.css');
        cs()->registerCssFile(Yii::app()->request->baseUrl . '/css/wizard_' . cfg('UI_THEME') . '.css');
        
        if (Yii::app()->params->devMode) {
            cs()->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.contextmenu.js', CClientScript::POS_HEAD);
            cs()->registerScriptFile(Yii::app()->baseUrl . '/js/pl-translator.js', CClientScript::POS_HEAD);
            cs()->registerScript('translation', "
                var translator;
                $(function() {
                    translator = new $.plTranslator({
                        url: '" . url('translation') . "',
                    });
                });

                $(document).ajaxSuccess(function() {
                    translator.update();
                });
            ");
                        
        }
        ?>
    </head>
    <body>

        <style>
            body{
                color: #333333;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }

            .row label{
                display: inline-block;
                min-width: 160px;
                text-align: right;
                padding-right: 10px;
            }

            .wizard-wrapper{
                padding: 50px 100px;
                -webkit-touch-callout: none;
                -webkit-user-select: none;
                -khtml-user-select: none;
                -moz-user-select: none;
                -ms-user-select: none;
                user-select: none;
            }

            .wizard-box{
                margin: 0 auto 20px;
                background-color: #fff;
                border: 1px solid #e5e5e5;
                -webkit-border-radius: 5px;
                -moz-border-radius: 5px;
                border-radius: 5px;
                -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
            }

            .wizard-header li a:hover{
                text-decoration: none;
            }

            .wizard-header .badge {
                margin: 0 5px 0 18px;
                position: relative;
                top: -1px;
            }

            .wizard-header li:first-child a .badge {
                margin-left: 0;
            }

            #wizard-content{
                padding: 5px 15px;
                min-height: 360px;
            }
            
            #showProxyConfigsBtn{
                margin-left: 170px;
            }
        </style>
        <div class="container-fluid wizard-wrapper">
            <div class="wizard-header-container">
                <?php
                
                $topBarItems = array();
                $topBarItems[] = array(
                    'label' => __('WIZARD_LANGUAGE_TAB_TITLE'),
                    'url' => '',
                    'linkOptions' => array(
                        'data-translation-id' => 'WIZARD_LANGUAGE_TAB_TITLE',
                    ),
                    'active' => $this->currentStep == WizardStep::LanguageAndStyle,
                );
                /* FIXME this view needs content
                $topBarItems[] = array(
                            'label' => __('WIZARD_WELCOME_TAB_TITLE'),
                            'url' => '',
                            'linkOptions' => array(
                                'data-translation-id' => 'WIZARD_WELCOME_TAB_TITLE',
                            ),
                            'active' => $this->currentStep == WizardStep::Welcome,
                        );
                */
                $topBarItems[] = array(
                    'label' => __('WIZARD_TOC_TAB_TITLE'),
                    'url' => '',
                    'linkOptions' => array(
                        'data-translation-id' => 'WIZARD_TOC_TAB_TITLE',
                    ),
                    'active' => $this->currentStep == WizardStep::TOC,
                );
                
                $topBarItems[] = array(
                    'label' => __('WIZARD_NETWORK_TAB_TITLE'),
                    'url' => '',
                    'linkOptions' => array(
                        'data-translation-id' => 'WIZARD_NETWORK_TAB_TITLE',
                    ),
                    'active' => $this->currentStep == WizardStep::NetworkSettings,
                );
                $topBarItems[] = array(
                    'label' => __('WIZARD_PROXY_TAB_TITLE'),
                    'url' => '',
                    'linkOptions' => array(
                        'data-translation-id' => 'WIZARD_PROXY_TAB_TITLE',
                    ),
                    'active' => $this->currentStep == WizardStep::ProxySettings,
                );
                $topBarItems[] = array(
                    'label' => __('WIZARD_ADMIN_USER_TAB_TITLE'),
                    'url' => '',
                    'linkOptions' => array(
                        'data-translation-id' => 'WIZARD_ADMIN_USER_TAB_TITLE',
                    ),
                    'active' => $this->currentStep == WizardStep::AdminUser,
                );
                if (!PhonalisaLicenseManager::licenseIsValid()) {
                    $topBarItems[] = array(
                        'label' => __('WIZARD_LICENSE_ACTIVATION_TAB_TITLE'),
                        'url' => '',
                        'linkOptions' => array(
                            'data-translation-id' => 'WIZARD_LICENSE_ACTIVATION_TAB_TITLE',
                        ),
                        'active' => $this->currentStep == WizardStep::LicenseActivation,
                    );
                }
                $this->widget('zii.widgets.CMenu', array(
                    'items' => $topBarItems,
                    'htmlOptions' => array('class' => 'wizard-header'),
                ));
                ?>
            </div>
            <div class="wizard-box">
                <div id="wizard-content">
                    <?php
                    echo $content;

                    $this->widget('bootstrap.widgets.TbAlert', array(
                        'alerts' => array(// configurations per alert type
                            'error' => array('block' => true, 'fade' => true, 'closeText' => '&times;'), // success, info, warning, error or danger
                        ),
                    ));
                    ?>
                </div>
                <div class="modal-footer">
                    <div class="row-fluid">
                        <?php
                        $this->widget('bootstrap.widgets.TbButton', array(
                            'buttonType' => 'button',
                            'label' => __('WIZARD_PREV_BTN'),
                            'htmlOptions' => array(
                                "value" => "back",
                                'id' => 'prevBtn',
                                'class' => 'pull-left',
                                'data-translation-id' => 'WIZARD_PREV_BTN',
                            ),
                        ));
                        $this->widget('bootstrap.widgets.TbButton', array(
                            'buttonType' => 'button',
                            'label' => __('WIZARD_NEXT_BTN'),
                            'type' => 'primary',
                            'htmlOptions' => array(
                                'id' => 'nextBtn',
                                'class' => 'pull-left',
                                'data-translation-id' => 'WIZARD_NEXT_BTN',
                                'data-loading-text' => __('GLOBAL_LOADING_TEXT')
                            ),
                        ));
                        $this->widget('bootstrap.widgets.TbButton', array(
                            'buttonType' => 'button',
                            'label' => __('WIZARD_SKIP_BTN'),
                            'type' => 'primary',
                            'htmlOptions' => array(
                                'id' => 'skipBtn',
                                'class' => 'pull-left',
                                'data-translation-id' => 'WIZARD_SKIP_BTN',
                            ),
                        ));
                        $this->widget('bootstrap.widgets.TbButton', array(
                            'buttonType' => 'link',
                            'icon' => 'icon-question',
                            'url' => Yii::app()->controller->getHelpUrl('wizard', true),
                            'encodeLabel' => false,
                            'htmlOptions' => array(
                                'data-translation-id' => 'GLOBAL_HELP_BTN',
                                'title' => __('GLOBAL_HELP_BTN'),
                                'target' => "_blank",
                                'class' => 'pull-right'
                            ),
                        ));
                        ?>                    
                    </div>

                </div>
            </div>
        </div>
    </body>
</html>