So guys here comes that line that you read all the time:
I’m new with yii and i need help please
So that said this is my case:
I have a table User and a table Survey in the same database. The user create surveys and when it happens the user saves his id in the table survey. Untill there everything fine. The trouble appears when i try to show the surveys with the crud list surveys. I will see all the surveys of the data base and not only the surveys that the user created.
i*ve been trying with something like this code but i get errors all the time.
if (Yii::app()->user->id == Yii::app()->survey->id){
… Show list
}
I was thinking as well to go trough the data provider searching for the data that has the id of the user (Yii::app()->user->id) save that in an extra array and then send it to the CListView. I’m understanding wrong how the ClistView works or i’m just totally lost on what i said?
$this->widget(‘zii.widgets.CListView’, array(‘dataProvider’=>$dataProvider, //here is the problem, i need an array with the surveys of the user that is logged in
‘itemView’=>’_view’,
‘sortableAttributes’=>array(
'title',
'start_date',
'end_date',
),
Any advice?