You need to get the value not from the array $data
($data->inactivo
) but directly from a variable $inactivo
. But in any case, at each iteration, the value of these variables will again be equal to 1
. In this case, you can use the following approach:
Before widget declaration:
Yii::app()->params['activos_flag']=1;
Yii::app()->params['inactivos_flag']=1;
and in parial view:
if ( Yii::app()->params['activos_flag'] == 1 ){
echo ('<label class="incidencias">ACTIVOS</label>');
Yii::app()->params['activos_flag'] = 0;
}
if ( Yii::app()->params['inactivos_flag'] == 1 ){
echo ('<label class="incidencias">INACTIVOS</label>');
Yii::app()->params['inactivos_flag'] = 0;
}