Minggu, 19 Maret 2017

CGridView

 $this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'bookings-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        'id',
        'name',
        'email',
        'telephone',
        'time',
        'employee',
        'appointment_status',
        'client_ip',
        'link' => array(
            'header' => 'Confirmation',
            'type' => 'raw',
            'value' => function ($data) {
                if ($data->appointment_status == 1) {
                    return CHtml::button("$data->appointment_status", array("onclick" => "document.location.href=\'" . Yii::app()->controller->createUrl("controller/action", array("id" => $data->id)) . "\'"));
                } else {

                    return;
                }
            }
                ),
                array(
                    'class' => 'CButtonColumn',
                ),
            ),
        ));