I’m not tired of your questions. However, most of your questions are covered in the reference book:
If you want to have uah computed in your model, it’s very simple, just
-
Define the property "uah" in your model
-
Define a label for it
-
Override the afterFind() function of the model. As the name suggests, afterFind() gets run after you run find() on any active record:
/** Public property, set by afterFind() */
public $uah = null;
public function attributeLabels() {
return array(
'id' => 'ID',
'usd' = 'USD',
'uah' = 'UAH',
// etc.
);
}
public function afterFind() {
$this->uah = $this->usd * 8;
return true;
}
Once you do that you can now refer to "uah" more simply in the view, as you figured out:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'gelen-kasa-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'tarih',
'aciklama',
'uah',
'usd',
array('class'=>'CButtonColumn'),
),
));