<?php
if (!$model->isNewRecord()) {
    ?>
    <script>
        $('h4').text($('h4').text() + ': <?php echo CHtml::encode($model->name); ?> ');
    </script>
    <?php
}

$form = $this->beginWidget('ext.PlGrid.PlActiveForm', array(
    'id' => 'groups-form',
    'gridId' => 'groups-grid',
    'autoRefreshGrid' => false,
    'afterSaveScript' => 'location.reload();',
    'action' => $model->isNewRecord ? array('create') : array()
        ));


$this->widget('bootstrap.widgets.TbTabs', array(
    //'type' => 'tabs', // Menu type. Valid values are tabs, pills and list.
    'tabs' => $this->getTabularFormTabs($form, $model),
    'htmlOptions' => array('data-translation-target' => 'GROUPS_TAB_MENU_HEADER_TRANSLATION'),
));

echo $form->errorSummary($model);

if (Yii::app()->user->translateMode) {
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_GENERAL_DATA"></i>';
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_GROUP_PERMISSIONS"></i>';
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_QUEUE_PERMISSIONS"></i>';

    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_GROUP_MEMBERS"></i>';

    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_ADDRESSBOOK_PERMISSION"></i>';
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_CALENDAR_PERMISSION"></i>';
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_FORWARD_SETS_PERMISSION"></i>';
    echo '<i data-translation-target="GROUPS_TAB_MENU_HEADER_TRANSLATION" data-translation-id="USERGROUPS_MODEL_TAB_MENU_ADVANCED"></i>';

    echo '<i data-translation-target="USERGROUP_MODEL_PROVISIONING_PROFILE_TRANSLATION" data-translation-id="USERGROUP_MODEL_PROVISIONING_PROFILE"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_PROVISIONING_PROFILE_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_PROVISIONING_PROFILE"></i>';

    echo '<i data-translation-target="USERGROUP_MODEL_KEY_PROFILE_TRANSLATION" data-translation-id="USERGROUP_MODEL_KEY_PROFILE"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_KEY_PROFILE_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_KEY_PROFILE"></i>';

    echo '<i data-translation-target="USERGROUP_MODEL_INBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="USERGROUP_MODEL_INBOUND_BLACKLIST"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_INBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_BLACKLIST"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_INBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_WHITELIST"></i>';

    echo '<i data-translation-target="USERGROUP_MODEL_OUTBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="USERGROUP_MODEL_OUTBOUND_BLACKLIST"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_OUTBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_BLACKLIST"></i>';
    echo '<i data-translation-target="USERGROUP_MODEL_OUTBOUND_BLACKLIST_ID_TRANSLATION" data-translation-id="GROUPS_ADVANCED_TAB_CHOOSE_WHITELIST"></i>';
    
    echo '<i data-translation-target="GROUPS_MODEL_SPEED_DIAL_LIST_TRANSLATION" data-translation-id="GROUPS_MODEL_SPEED_DIAL_LIST"></i>';

    echo '<i data-translation-target="TARGET_ON_TIMEOUT_DROPDOWN" data-translation-id="USERS"></i>';
    echo '<i data-translation-target="TARGET_ON_TIMEOUT_DROPDOWN" data-translation-id="GROUPS"></i>';
    echo '<i data-translation-target="TARGET_ON_TIMEOUT_DROPDOWN" data-translation-id="QUEUES"></i>';
    echo '<i data-translation-target="TARGET_ON_TIMEOUT_DROPDOWN" data-translation-id="IVRS"></i>';

    echo '<i data-translation-target="TARGET_ON_BUSY_DROPDOWN" data-translation-id="USERS"></i>';
    echo '<i data-translation-target="TARGET_ON_BUSY_DROPDOWN" data-translation-id="GROUPS"></i>';
    echo '<i data-translation-target="TARGET_ON_BUSY_DROPDOWN" data-translation-id="QUEUES"></i>';
    echo '<i data-translation-target="TARGET_ON_BUSY_DROPDOWN" data-translation-id="IVRS"></i>';

    echo '<i data-translation-target="FAX_SENDING_ALLOWED_TRANSLATION" data-translation-id="USERS_MODEL_FAX_SENDING_ALLOWED"></i>';
    echo '<i data-translation-target="FAX_SENDING_ALLOWED_TRANSLATION" data-translation-id="USER_FAX_SEND_NOT_ALLOWED"></i>';
    echo '<i data-translation-target="FAX_SENDING_ALLOWED_TRANSLATION" data-translation-id="USER_FAX_SEND_ALLOWED"></i>';
    echo '<i data-translation-target="FAX_SENDING_ALLOWED_TRANSLATION" data-translation-id="USER_FAX_SEND_INHERIT_FROM_GROUP"></i>';
    echo '<i data-translation-target="FAX_SENDING_ALLOWED_TRANSLATION" data-translation-id="GROUP_FAX_SEND_INHERIT_FROM_GROUP"></i>';
}

$this->endWidget();
