<?php

$this->widget('ext.PlGrid.PlGridView', array(
    'id' => 'phones-grid',
    'headerTitle' => 'Header_title', // optional
    'modalCreateHeader' => 'PROVISIONING_GENERAL_HEADER_CREATE', // optional
    'modalUpdateHeader' => 'PROVISIONING_GENERAL_HEADER_UPDATE', // optional
    'enableAddButton' => false,
    'itemsCssClass' => 'plTable items',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'customButtons' => array(
        'label' => __("PROVISIONING_GENERAL_NAVBAR_NETWORK_SCAN"),
        'icon' => 'list',
        'url' => url('provisioningGeneral/default/networkScan'),
        "linkOptions" => array("data-translation-id" => "PROVISIONING_GENERAL_NAVBAR_NETWORK_SCAN")
    ),
    'columns' => array(
        array(
            'name' => 'type',
            'header' => $model->getAttributeLabel('type'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_TYPE'),
            'value' => array($this, 'getHumanReadeblePhoneName'),
            'filter' => $model->humanReadableSearchFilterForType(),
            'enableCustomDropdownFilter' => true,
        ),
        array(
            'type' => 'raw',
            'name' => 'ipv4_address',
            'value' => array($this, 'getIPv4Url'),
            'header' => $model->getAttributeLabel('ipv4_address'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_IPV4_ADDR')
        ),
        array(
            'name' => 'mac_addr',
            'header' => $model->getAttributeLabel('mac_addr'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_MAC_ADDR')
        ),
        array(
            'name' => 'descr',
            'header' => $model->getAttributeLabel('descr'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_DESCR')
        ),
        array(
            'name' => 'firmware',
            'type' => 'raw',
            'header' => $model->getAttributeLabel('firmware'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_FIRMEWARE'),
            'value' => array($this, 'renderFirmware')
        ),
        array(
            'name' => 'sip_account_id',
            'value' => array($model, 'renderSipAccount'),
            'header' => $model->getAttributeLabel('sip_account_id'),
            'headerHtmlOptions' => array('data-translation-id' => 'PROVISIONING_MODEL_SIP_ACCOUNT_ID'),
            'filter' => $model->humanReadableSearchFilterForSipAccountID(),
            'enableCustomDropdownFilter' => true,
        ),
        array(
            'name' => 'last_prov_dateTime',
            'value' => array($this, 'renderLastProvDateTime'),
            'header' => $model->getAttributeLabel('last_prov_dateTime'),
            'headerHtmlOptions' => array('data-translation-id' => 'PHONE_MODEL_LAST_PROV_TIMESTAMP'),
            'enableCustomDateTimeSearchFilter' => true,
        ),
        array(
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'htmlOptions' => array('class' => 'buttonColumnIcons'),
            'template' => '{trigger}',
            'buttons' => array(
                'trigger' => array(
                    'label' => '<i class="icon-medkit"></i>',
                    'imageUrl' => false,
                    'options' => array(
                        'title' => __('TRIGGER_PROVISIONING'),
                        'data-translation-id' => 'TRIGGER_PROVISIONING'
                    ),
                    'url' => 'Yii::app()->createUrl("provisioningGeneral/default/trigger", array("id"=>"$data->id"))',
                    'click' => 'js:function(){
                                $.get(this.href, function(data){
                                    return false;
                                });
                            return false;
                            }',
                ),
            ),
        ),
        array(
            'class' => 'ext.PlGrid.PlCButtonColumn',
            'template' => '{ajaxUpdate}{delete}',
        )
    ),
));

if (Yii::app()->user->translateMode) {

    echo '<i data-translation-id="PROVISIONING_MODEL_DUMMY_USER">PROVISIONING_MODEL_DUMMY_USER</i> => ' . __('PROVISIONING_MODEL_DUMMY_USER') . '<br>';
    echo '<i data-translation-id="PROVISIONING_MODEL_PHONE_SIGNED_OUT">PROVISIONING_MODEL_PHONE_SIGNED_OUT</i> => ' . __('PROVISIONING_MODEL_PHONE_SIGNED_OUT') . '<br><br>';

    echo '<i data-translation-id="XML_GLOBAL_SELECT_BTN">XML_GLOBAL_SELECT_BTN</i> => ' . __('XML_GLOBAL_SELECT_BTN') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_NO_ENTRIES_FOUND">XML_GLOBAL_NO_ENTRIES_FOUND</i> => ' . __('XML_GLOBAL_NO_ENTRIES_FOUND') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_EXIT_BTN">XML_GLOBAL_EXIT_BTN</i> => ' . __('XML_GLOBAL_EXIT_BTN') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_DELETE_BTN">XML_GLOBAL_DELETE_BTN</i> => ' . __('XML_GLOBAL_DELETE_BTN') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_SEARCH_BTN">XML_GLOBAL_SEARCH_BTN</i> => ' . __('XML_GLOBAL_SEARCH_BTN') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_DIAL_BTN">XML_GLOBAL_DIAL_BTN</i> => ' . __('XML_GLOBAL_DIAL_BTN') . '<br>';
    echo '<i data-translation-id="XML_GLOBAL_BACK_BTN">XML_GLOBAL_BACK_BTN</i> => ' . __('XML_GLOBAL_BACK_BTN') . '<br><br>';

    echo '<i data-translation-id="XML_VOICEMAIL_APP_MENU_START_TITLE">XML_VOICEMAIL_APP_MENU_START_TITLE</i> => ' . __('XML_VOICEMAIL_APP_MENU_START_TITLE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_NEW_MESSAGES">XML_VOICEMAIL_APP_NEW_MESSAGES</i> => ' . __('XML_VOICEMAIL_APP_NEW_MESSAGES') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_OLD_MESSAGES">XML_VOICEMAIL_APP_OLD_MESSAGES</i> => ' . __('XML_VOICEMAIL_APP_OLD_MESSAGES') . '<br>';

    echo '<i data-translation-id="XML_VOICEMAIL_APP_NEW_MESSAGE_TITLE">XML_VOICEMAIL_APP_NEW_MESSAGE_TITLE</i> => ' . __('XML_VOICEMAIL_APP_NEW_MESSAGE_TITLE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_OLD_MESSAGE_TITLE">XML_VOICEMAIL_APP_OLD_MESSAGE_TITLE</i> => ' . __('XML_VOICEMAIL_APP_OLD_MESSAGE_TITLE') . '<br>';

    echo '<i data-translation-id="XML_VOICEMAIL_APP_DETAILS_BTN">XML_VOICEMAIL_APP_DETAILS_BTN</i> => ' . __('XML_VOICEMAIL_APP_DETAILS_BTN') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_DATE">XML_VOICEMAIL_APP_DATE</i> => ' . __('XML_VOICEMAIL_APP_DATE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_TIME">XML_VOICEMAIL_APP_TIME</i> => ' . __('XML_VOICEMAIL_APP_TIME') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_EXTENSION">XML_VOICEMAIL_APP_EXTENSION</i> => ' . __('XML_VOICEMAIL_APP_EXTENSION') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_CALLER_NAME">XML_VOICEMAIL_APP_CALLER_NAME</i> => ' . __('XML_VOICEMAIL_APP_CALLER_NAME') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_VOICEMAIL_DETAIL_TITLE">XML_VOICEMAIL_APP_VOICEMAIL_DETAIL_TITLE</i> => ' . __('XML_VOICEMAIL_APP_VOICEMAIL_DETAIL_TITLE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_DIAL_BTN">XML_VOICEMAIL_APP_DIAL_BTN</i> => ' . __('XML_VOICEMAIL_APP_DIAL_BTN') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_NEGATE_REQUEST_BTN">XML_VOICEMAIL_APP_NEGATE_REQUEST_BTN</i> => ' . __('XML_VOICEMAIL_APP_NEGATE_REQUEST_BTN') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_DELETE_CONFIRM_MESSAGE">XML_VOICEMAIL_APP_DELETE_CONFIRM_MESSAGE</i> => ' . __('XML_VOICEMAIL_APP_DELETE_CONFIRM_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_CONFIRM_REQUEST_BTN">XML_VOICEMAIL_APP_CONFIRM_REQUEST_BTN</i> => ' . __('XML_VOICEMAIL_APP_CONFIRM_REQUEST_BTN') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_DIAL_CONFIRM_MESSAGE">XML_VOICEMAIL_APP_DIAL_CONFIRM_MESSAGE</i> => ' . __('XML_VOICEMAIL_APP_DIAL_CONFIRM_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_NO_MESSAGES_FOUND">XML_VOICEMAIL_APP_NO_MESSAGES_FOUND</i> => ' . __('XML_VOICEMAIL_APP_NO_MESSAGES_FOUND') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_APP_MESSAGE_DELETED_INFO">XML_VOICEMAIL_APP_MESSAGE_DELETED_INFO</i> => ' . __('XML_VOICEMAIL_APP_MESSAGE_DELETED_INFO') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_DELETE_CONFIRM_TITLE">XML_VOICEMAIL_DELETE_CONFIRM_TITLE</i> => ' . __('XML_VOICEMAIL_DELETE_CONFIRM_TITLE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_DIAL_CONFIRM_TITLE">XML_VOICEMAIL_DIAL_CONFIRM_TITLE</i> => ' . __('XML_VOICEMAIL_DIAL_CONFIRM_TITLE') . '<br>';
    echo '<i data-translation-id="XML_VOICEMAIL_MESSAGE_DELETED_TITLE">XML_VOICEMAIL_MESSAGE_DELETED_TITLE</i> => ' . __('XML_VOICEMAIL_MESSAGE_DELETED_TITLE') . '<br><br>';

    echo '<i data-translation-id="XML_PHONEBOOK_CHOOSE_PHONEBOOK">XML_PHONEBOOK_CHOOSE_PHONEBOOK</i> => ' . __('XML_PHONEBOOK_CHOOSE_PHONEBOOK') . '<br>';
    echo '<i data-translation-id="XML_PHONEBOOK_FOUND_ENTRY">XML_PHONEBOOK_FOUND_ENTRY</i> => ' . __('XML_PHONEBOOK_FOUND_ENTRY') . '<br>';
    echo '<i data-translation-id="XML_PHONEBOOK_FOUND_ENTRIES">XML_PHONEBOOK_FOUND_ENTRIES</i> => ' . __('XML_PHONEBOOK_FOUND_ENTRIES') . '<br>';
    echo '<i data-translation-id="XML_PHONEBOOK_NEXT">XML_PHONEBOOK_NEXT</i> => ' . __('XML_PHONEBOOK_NEXT') . '<br>';
    echo '<i data-translation-id="XML_PHONEBOOK_SEARCH_TEXT">XML_PHONEBOOK_SEARCH_TEXT</i> => ' . __('XML_PHONEBOOK_SEARCH_TEXT') . '<br>';

    echo '<i data-translation-id="XML_CONFIG_APP_SAVE_BTN">XML_CONFIG_APP_SAVE_BTN</i> => ' . __('XML_CONFIG_APP_SAVE_BTN') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_EDIT_BTN">XML_CONFIG_APP_EDIT_BTN</i> => ' . __('XML_CONFIG_APP_EDIT_BTN') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_APPLY_SETTINGS">XML_CONFIG_APP_APPLY_SETTINGS</i> => ' . __('XML_CONFIG_APP_APPLY_SETTINGS') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CONFIRM_BTN">XML_CONFIG_APP_CONFIRM_BTN</i> => ' . __('XML_CONFIG_APP_CONFIRM_BTN') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CALL_FORWARDING_TITLE">XML_CONFIG_APP_CALL_FORWARDING_TITLE</i> => ' . __('XML_CONFIG_APP_CALL_FORWARDING_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CALL_DESTINATION_TITLE">XML_CONFIG_APP_CALL_DESTINATION_TITLE</i> => ' . __('XML_CONFIG_APP_CALL_DESTINATION_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CALL_DESTINATION_INPUT_TEXT">XML_CONFIG_APP_CALL_DESTINATION_INPUT_TEXT</i> => ' . __('XML_CONFIG_APP_CALL_DESTINATION_INPUT_TEXT') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_NOT_EDITABLE_TEXT">XML_CONFIG_APP_NOT_EDITABLE_TEXT</i> => ' . __('XML_CONFIG_APP_NOT_EDITABLE_TEXT') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_SYSTEM_CALL_FORWARDING_ERROR_TEXT">XML_CONFIG_APP_SYSTEM_CALL_FORWARDING_ERROR_TEXT</i> => ' . __('XML_CONFIG_APP_SYSTEM_CALL_FORWARDING_ERROR_TEXT') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CUSTOM_FORWARDING_ERROR_TEXT">XML_CONFIG_APP_CUSTOM_FORWARDING_ERROR_TEXT</i> => ' . __('XML_CONFIG_APP_CUSTOM_FORWARDING_ERROR_TEXT') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_ERROR_TITLE">XML_CONFIG_APP_ERROR_TITLE</i> => ' . __('XML_CONFIG_APP_ERROR_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_SAVED_TITLE">XML_CONFIG_APP_SAVED_TITLE</i> => ' . __('XML_CONFIG_APP_SAVED_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_EMPTY_TARGET_MESSAGE">XML_CONFIG_APP_EMPTY_TARGET_MESSAGE</i> => ' . __('XML_CONFIG_APP_EMPTY_TARGET_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_NEW_DESTINATION_TITLE">XML_CONFIG_APP_NEW_DESTINATION_TITLE</i> => ' . __('XML_CONFIG_APP_NEW_DESTINATION_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_NEW_DESTINATION_INFO_MESSAGE">XML_CONFIG_APP_NEW_DESTINATION_INFO_MESSAGE</i> => ' . __('XML_CONFIG_APP_NEW_DESTINATION_INFO_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_INTERNAL_ERROR_OCCURRED_MESSAGE">XML_CONFIG_APP_INTERNAL_ERROR_OCCURRED_MESSAGE</i> => ' . __('XML_CONFIG_APP_INTERNAL_ERROR_OCCURRED_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CALL_FORWARDING_COULD_NOT_SET__ERROR_MESSAGE">XML_CONFIG_APP_CALL_FORWARDING_COULD_NOT_SET__ERROR_MESSAGE</i> => ' . __('XML_CONFIG_APP_CALL_FORWARDING_COULD_NOT_SET__ERROR_MESSAGE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_CALL_FORWARDING_ACTIVATED">XML_CONFIG_APP_CALL_FORWARDING_ACTIVATED</i> => ' . __('XML_CONFIG_APP_CALL_FORWARDING_ACTIVATED') . '<br>';
    echo '<i data-translation-id="XML_CALL_FORWARDING_CHANGES_ACCEPTED_TITLE">XML_CALL_FORWARDING_CHANGES_ACCEPTED_TITLE</i> => ' . __('XML_CALL_FORWARDING_CHANGES_ACCEPTED_TITLE') . '<br>';
    echo '<i data-translation-id="XML_CONFIG_APP_DIRECT_TO_VOICEMAIL_CALL_FORWARDING_MESSAGE">XML_CONFIG_APP_DIRECT_TO_VOICEMAIL_CALL_FORWARDING_MESSAGE</i> => ' . __('XML_CONFIG_APP_DIRECT_TO_VOICEMAIL_CALL_FORWARDING_MESSAGE') . '<br>';

    echo '<i data-translation-id="PROVISIONING_MODEL_PHONE_SIGNED_OUT">PROVISIONING_MODEL_PHONE_SIGNED_OUT</i> => ' . __('PROVISIONING_MODEL_PHONE_SIGNED_OUT') . '<br>';

    echo '<i data-translation-id="XML_LOGIN_APP_LOGIN_SCREEN">XML_LOGIN_APP_LOGIN_SCREEN</i> => ' . __('XML_LOGIN_APP_LOGIN_SCREEN') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_EXTENSION">XML_LOGIN_APP_EXTENSION</i> => ' . __('XML_LOGIN_APP_EXTENSION') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_PIN">XML_LOGIN_APP_PIN</i> => ' . __('XML_LOGIN_APP_PIN') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_ENTRY_SUCCESFUL">XML_LOGIN_APP_ENTRY_SUCCESFUL</i> => ' . __('XML_LOGIN_APP_ENTRY_SUCCESFUL') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_WRONG_PIN">XML_LOGIN_APP_WRONG_PIN</i> => ' . __('XML_LOGIN_APP_WRONG_PIN') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_WRONG_EXTENSION">XML_LOGIN_APP_WRONG_EXTENSION</i> => ' . __('XML_LOGIN_APP_WRONG_EXTENSION') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_ABC">XML_LOGIN_APP_ABC</i> => ' . __('XML_LOGIN_APP_ABC') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_SEND">XML_LOGIN_APP_SEND</i> => ' . __('XML_LOGIN_APP_SEND') . '<br>';
    echo '<i data-translation-id="XML_LOGIN_APP_NO_SIP">XML_LOGIN_APP_NO_SIP</i> => ' . __('XML_LOGIN_APP_NO_SIP') . '<br>';
}
