How Do I Show In Cgridview Blood Group Names.

Hi I’m English bad. Blood group was not cgridview id number corresponds to the number of blood group I want to show the name. How to do it.


View file


<?php

$this->breadcrumbs=array(

'Arama',);

$cinsiyetegore = array('1'=>'Erkek', '2'=>'Kadın');

$kangrubunagore = array('1'=>'A Rh (+)','2'=>'A Rh (-)','3'=>'B Rh (+)','4'=>'B Rh (-)','5'=>'AB Rh (+)','6'=>'AB Rh (-)','7'=>'0 Rh (+)','8'=>'0 Rh (-)');

$uyegorevinegore = array('1'=>'Üye','2'=>'Başkan','3'=>'Başkan Yardımcısı','4'=>'Muhasip','5'=>'Sekreter','6'=>'Yedek Üye');

$uyelikdurumunagore = array('1'=>'Aktif','2'=>'Pasif');

switch ($kriter){

    case "nufus":


$this->widget('zii.widgets.grid.CGridView', array(

    'dataProvider' => $aramasonucu->search(),

    'filter' => $aramasonucu,

    'columns' => array(

        array(

            'name' => 'id',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->id)'

        ),

        array(

            'name' => 'uye_id',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->uye_id)'

        ),

        array(

            'name' => 'adi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->adi)',

        ),

        array(

            'name' => 'soyadi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->soyadi)',

        ),

        array(

            'name' => 'anne_adi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->anne_adi)',

        ),

        array(

            'name' => 'baba_adi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->baba_adi)',

        ),

        array(

            'name' => 'dogum_yeri',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->dogum_yeri)',

        ),

        array(

            'name' => 'dogum_tarihi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->dogum_tarihi)',

        ),

        array(

            'name' => 'nufus_ili',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->nufus_ili)',

        ),

        array(

            'name' => 'nufus_ilcesi',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->nufus_ilcesi)',

        ),

        array(

            'class'=>'CButtonColumn',

        ),

    ),

));

        break;


    case "kisisel":

        $this->widget('zii.widgets.grid.CGridView', array(

            'dataProvider' => $aramasonucu->search(),

            'filter' => $aramasonucu,

            'columns' => array(

                array(

                    'header'=>'Satır No',

                    'value'=>'$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1',  // satır numarasını gösteriyor     //  row is zero based

                ),

                array(

                    'name' => 'id',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->id)'

                ),

                array(

                    'name' => 'tel',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->tel)'

                ),

                array(

                    'name' => 'e_posta',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->e_posta)',

                ),

                array(

                    'name' => 'kan_grubu',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->kan_grubu)',

                    'filter'=> $kangrubunagore,

                ),

                array(

                    'name' => 'cinsiyet',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->cinsiyet=="1")?("Erkek")<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/sad.gif' class='bbc_emoticon' alt=':(' />"Kadın")',

                    'filter'=> $cinsiyetegore,

                ),

                array(

                    'name' => 'adres_ili',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->adres_ili)',

                    'filter'=> CHtml::listData(Iller::model()->findAll(array('order' => 'ilID')),'ilID','ad'),


                ),

                array(

                    'name' => 'adres_ilcesi',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->adres_ilcesi)',

                ),


                array(

                    'name' => 'uye_gorevi',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->uye_gorevi)',

                    'filter'=> $uyegorevinegore,

                ),

                array(

                    'name' => 'uye_kayit_tarihi',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->uye_kayit_tarihi)',

                ),

                array(

                    'name' => 'uye_durumu',

                    'type' => 'raw',

                    'value' => 'CHtml::encode($data->uye_durumu=="1")?("Aktif")<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/sad.gif' class='bbc_emoticon' alt=':(' />"Pasif")',

                    'filter'=> $uyelikdurumunagore,

                ),

                array(

                    'class'=>'CButtonColumn',

                ),


            ),

        ));

        break;

        header('Refresh:3; url='. $this->createUrl('uye/index'));

        throw new CHttpException(404,'The specified post cannot be found.');

      //  $this->render('mesaj',Yii::app()->user->setFlash('error', "Hata! Lütfen arama kriteri seçiniz."));


}

echo "<code><br> Bu sayfa<b> ". Yii::getLogger()->getExecutionTime() . "</b> saniyede oluşturuldu.</code>";




?>

In model do like




public function getBloodType(){


if($this->bloodtype==1){

return "B+";

}

}




in view 




 array(

            'name' => 'id',

            'type' => 'raw',

            'value' => 'CHtml::encode($data->getBloodType())'

        ),






You can use static members to define bloodtypes in the model

Hi @jwoww solved thank you