<?php
$this->widget('ext.PlGrid.PlGridView', array(
        'id'=>'FORM_AND_GRID_NAME-grid',
        'headerTitle'=>'Header_title', // optional
        'addButtonTitle'=>'ADD_NEW_FORM_TRANSLATIONTAG', // optional
        'searchButtonTitle'=>'SEARCH_FORM_TRANSLATIONTAG', // optional
        'modalCreateHeader'=>'FORM_TRANSLATIONTAG_HEADER_CREATE', // optional
        'modalUpdateHeader'=>'FORM_TRANSLATIONTAG_HEADER_UPDATE', // optional
        'itemsCssClass'=>'plTable items',
        'dataProvider'=>$dataprovider,
        'hideHeaderButtons'=>true,
//         'type'=>'bordered',
        'customButtons'=>array(
            'label'=>__('CDR_NAVBAR_BACK'),
            'url'=> url('systemCDR/default/index',array('CDR_page'=>$lastPage,'sort'=>$sort)),
            'icon'=>'arrow-left',
            'linkOptions'=>array(
                'id'=>'back_button',
                'data-target'=>'#',
                'data-translation-id'=>'CDR_NAVBAR_BACK'
            ),
        ),
        'rowCssClassExpression'=>'getCssClass($data["type"])',
        'selectableRows'=>0,
        'type'=>'bordered condensed',
        'columns'=>array(
            array(
                'name'=>'date',
                'header'=>__('CDR_LOGMESSAGE_DATE'),
                'headerHtmlOptions'=>array('data-translation-id'=>'CDR_LOGMESSAGE_DATE'),
            ),
            array(
                'name'=>'type',
                'header'=>__('CDR_LOGMESSAGE_TYPE'),
                'headerHtmlOptions'=>array('data-translation-id'=>'CDR_LOGMESSAGE_TYPE'),
            ),
            array(
                'name'=>'message',
                'header'=>__('CDR_LOGMESSAGE_MESSAGE'),
                'headerHtmlOptions'=>array('data-translation-id'=>'CDR_LOGMESSAGE_MESSAGE'),
            ),            
        ),
    )
);

function getCssClass($type) {
    switch ($type) {
        case "WARNING" : 
            return "warning";
        break;
        case "ERROR" : 
            return "error";
        break;
//         case "DEBUG" : 
//             return "info";
//         break;
    } 
}
?>
<style>
.table tbody tr.error td {
    background-color: #FF5959;
}
.table tbody tr.warning td {
    /*background-color: #FCF8B6;*/
    background-color: #FCF876;
}
</style>