Q:

Prepare data in controller, not in view (yii)

I made "gearbox"-dropDownList in my Yii webapp, all works perfect, it stores in DB with next values ( 1=> Manual, 2=> Manual-Automat(tiptronick), 3=> Automat), and now i display it in template (view.php) with such not beautiful if-block:
Gearbox:
" 
    if ($model->gearbox == 1) {
        echo 'Manual';
    } elseif($model->gearbox == 2) {
        echo 'Manual-Automat';
    } else {
        echo 'Automat';
    }
"
Tell me please, should I prepare such data in controller? And if it is possible, can you advice me, please, how it doing.

A:

I think in this simple case there is not much to do, but you could prepare it in your controller like this:
Controller:
  if ($model->gearbox == 1) { 
     $gearbox = 'Manual'; 
  } elseif($model->gearbox == 2) { 
     $gearbox = 'Manual-Automat'; 
  } else { 
     $gearbox = 'Automat'; 
  } 

$this->render('view',array('gearbox'=>$gearbox))

View:
echo $gearbox;

