Checkboxlist Using Other Methods

I have a checklist

yyy




'category' => array(

   'type' => 'checkboxlist',

   'items' => CHtml::listData($model1, 'id', 'name'),



and how results:

id(value) name(text visible)

1 red

2 green

3 blue

how can have same results not using in the ‘items’ the code CHtml::listData($model1, ‘id’, ‘name’),

XXX

but this (simplified):




foreach($model1 as $var)

{

$items[] = array(

'id' => $var->id,

'name' => $var->name,

);

}



this is the context where will be used




return array(

  'action' => url('/area/selectfilter'),


  'elements' => array

  (

  'areas' => array(

   'type' => 'dropdownlist', 

   'items' => $model0

   ),


  'sections' => array

  (

  'type' => 'checkboxlist',

  'items' => CHtml::listData($model1, 'id', 'name'),

  ..

  ),

),



I think solutions are two:

  1. rewrite the checkboxlist ‘sections’ using directly XXX code, but how ?

or insert into ‘items’ a code that use the XXX results

I need XXX because more flexible; I need count the id end write a name with the counts, while in yyy cannot; above I post a simplified version