My User Model have 3 Status options (Active, Deleted, Blocked). When seeing it in the view it shows as numbers 1, 2 or 3. What I can do to show it by the status name?
Model.php
const STATUS_ACTIVE = 1;
const STATUS_DELETED = 2;
const STATUS_BLOCKED = 3;
Controller.php
public function actionAdmin()
{
$model=new Users('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Users']))
$model->attributes=$_GET['Users'];
$this->render('admin',array(
'model'=>$model,
));
}
View.php
<?php $this->widget('bootstrap.widgets.TbGridView',array(
'type'=>'striped bordered condensed',
'id'=>'users-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'name',
'status', // Show 1,2 or 3. I want to get the status name.
),
)); ?>