Hi,
I’m stuck. I want to change my labels defined in attributeLabels() in my model, depending on what is currently being processed by CListView loop.
My controller triggers actionIndex:
public function actionIndex() {
$dataProvider = new CActiveDataProvider('TestRun');
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
My index triggers CListView:
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
));
View accesses my Model on every iteration for data:
<?php echo GxHtml::encode($data->getAttributeLabel('id')); ?>:
<?php echo GxHtml::encode($data->getAttributeLabel('name')); ?>:
<?php echo GxHtml::encode($data->name); ?>
<br />
<?php echo GxHtml::encode($data->getAttributeLabel('test_id')); ?>:
<?php echo GxHtml::encode(GxHtml::valueEx($data->test)); ?>
<br>
<?php echo GxHtml::encode($data->getAttributeLabel('result_1')); ?>:
<?php echo GxHtml::encode($data->result_1); ?>
So how can I access data being processed by CListView on every iteration in my Model ? Because depending on what is being processed, I want to change labels.
I tried:
Yii::app()->controller->id
but it only gives me name of current model